Git Product home page Git Product logo

Comments (7)

dolejska-daniel avatar dolejska-daniel commented on June 17, 2024 1

Hello @zaclummys,

it is not currently possible to retrieve only image URL, but it is possible to easily extract it from generated Html class instance. Heres how:

Source:

DataDragonAPI::initByCdn();
var_dump(DataDragonAPI::getChampionIcon('Orianna')->getAttribute('src'));

Output:

string(69) "http://ddragon.leagueoflegends.com/cdn/8.9.1/img/champion/Orianna.png"

I will add functions, that will only generate image URLs, also supporting SSL as soon as I get to it. Thank you for your question - if you've got any more questions, feel free to ask, otherwise, mark this issue as closed.

Daniel

from riot-api.

dolejska-daniel avatar dolejska-daniel commented on June 17, 2024 1

Hi there again,

you can now refer to v2.0.0-rc.4(299599c), it should contain what you've asked for 😺.

from riot-api.

dolejska-daniel avatar dolejska-daniel commented on June 17, 2024 1

Hi again @zaclummys,

I don't see a reason, why would that be useful. You can easily change current region with RiotAPI::setRegion(...) or change it only temporarily using RiotAPI::setTemporaryRegion(...) with ability to revert it to the previous region setting using RiotAPI::unsetTemporaryRegion().

Tell me when you would need to create completly new instance with only different region settings, even when you've got the ability to change it during its lifetime.

Daniel

from riot-api.

zaclummys avatar zaclummys commented on June 17, 2024 1

@dolejska-daniel,

You're right! I hadn't noticed RiotAPI::setTemporaryRegion(...).

That method solves my problem. Thank you!

from riot-api.

dolejska-daniel avatar dolejska-daniel commented on June 17, 2024 1

Hey, @zaclummys,

the idea behind is this great, but this type of change made to the function accessing /lol/static-data/v3/champions/{id} endpoint would result in endpoint being completly inaccessible by the library - it would instead of that endpoint use data from different endpoint.

Because if the functionality of the port would eventually change in the future or if someone would really want to actually use the endpoint, they would not be able to.

People are not dummies, so when using StaticData, they will implement this on their side (eventually 😆, when they notice the low limit on StaticData endpoints). Anyhow, this approach is used in StaticData linking feature, so whatever for would someone want to use the mentioned endpoint, they don't actually really need to, when they can use StaticData linking with any request made to the API.

Also, next time, please make sure to create new issue, this idea is not really related to the current issue topic and since we've solved this, I'll mark it as closed 😺.

Daniel

from riot-api.

zaclummys avatar zaclummys commented on June 17, 2024

@dolejska-daniel, I have an suggestion.

Create a new method called RiotAPI::region to create a new instance with same settings but different region setting.

class RiotAPI {
    // ...
    public static region (RiotAPI $instance, Region $region) {
        $settings = clone $instance->settings; // clone all settings

        $settings[
            RiotAPI::SET_REGION => $region, // change region setting
        ];

        return new RiotAPI(settings); // return a new instance
    }
}

$RiotAPINorthAmerica = new RiotAPI([
    RiotAPI::SET_KEY => '',
    RiotAPI::SET_REGION => Region::NORTH_AMERICA,
]);

$RiotAPIBrazil = RiotAPI::region($RiotAPINorthAmerica, Region::BRAZIL);

// or

$RiotAPI = new RiotAPI([
    RiotAPI::SET_KEY => '',
]);

$RiotAPIBrazil = RiotAPI::region($RiotAPI, Region::BRAZIL);

from riot-api.

zaclummys avatar zaclummys commented on June 17, 2024

@dolejska-daniel,

I tested some endpoints and got another suggestion.

/lol/static-data/v3/champions/{id} can only be requested 10 times a hour (10:3600). It's not feasible to use it that way.

Some rioters recommend requesting the entire list and caching it instead of requesting items individually. (https://discussion.developer.riotgames.com/questions/3204/why-am-i-getting-statusmessagerate-limit-exceededs.html)

I think a many-to-one caching system can solves that.

/lol/static-data/v3/champions/1 +----+
                                     |----+ /lol/static-data/v3/champions
/lol/static-data/v3/champions/2 +----+

What do you think about it? Have you already created a way to solve this?

from riot-api.

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.