GithubHelp home page GithubHelp logo

Comments (6)

mririgoyen avatar mririgoyen commented on June 10, 2024 1

Sure thing! Let us know if you have any other questions. Limiting the use of the API is not only a benefit for you and your users, but for us as well. Running servers on ad-only income is a tough balancing act. 😄

from pictogrammers.com.

SmileyJoe avatar SmileyJoe commented on June 10, 2024

Closing as I found the documentation under contributing:

https://pictogrammers.com/docs/contribute/api/

from pictogrammers.com.

mririgoyen avatar mririgoyen commented on June 10, 2024

You shouldn't be using the API for this use case.

There are two ways you could do this:

  • Install @mdi/svg and reference the meta.json file for each icon's metadata. Read the svg/{ICON_NAME}.svg to get the SVG and extract the d attribute from the path.

  • Install @mdi/js. You can directly get the path data this way.

    import { mdiAccount } from '@mdi/js';
    
    console.log(mdiAccount); // M12,...14Z
    

from pictogrammers.com.

SmileyJoe avatar SmileyJoe commented on June 10, 2024

Thanks for the reply @mririgoyen , I'm not sure if I'm missing something but I don't see how that fits into a java based library for android?

The idea of the lib is to load icons as needed based on the name of the icon, this can come from an api or be set in code, and then store the icon locally, is that the same thing you had in mind?

from pictogrammers.com.

mririgoyen avatar mririgoyen commented on June 10, 2024

Yes, that would be ideal for a number of reasons. You would bring all assets down locally, avoiding network requests. This will be much quicker for your users and prevent unneeded network traffic to the site. You also avoid things breaking if the site goes down for some reason.

Please note that the article you found on our API documentation explicitly states:

Please do not use these endpoints to scrape the site or to build third party applications. All data is provided in the meta.json on the CDN or in the GitHub repo after every release.

So, in your case, the two options available to you would be:

  • Use @mdi/svg, either from NPM or from cloning the GitHub repo. Read the meta.json file and then the svg/{ICON_NAME.svg} files to get the information you need.

  • Continue using the CDN to get the meta.json file, but instead of using the API to get the icon, just use the CDN again.

    https://cdn.jsdelivr.net/npm/@mdi/[email protected]/svg/account.svg

The first option bring all icons local and removes the need for network requests, which would be the ideal path IMO. The second option slightly alters what you are currently doing to avoid using the API.

from pictogrammers.com.

SmileyJoe avatar SmileyJoe commented on June 10, 2024

Ah, I see, ok cool, I must have missed that api note on the old documentation. Thanks, let me make some updates.

from pictogrammers.com.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.