jyggen / bnet Goto Github PK
View Code? Open in Web Editor NEWBattle.net API Client - A PHP 7.1+ library for working with the Battle.net APIs.
License: MIT License
Battle.net API Client - A PHP 7.1+ library for working with the Battle.net APIs.
License: MIT License
In GuildEntity.php the member-to-character conversion uses full member record (with character and rank properties) instead of character property, leading to invalid character entity (for example, $character->character['name'] instead of $character->name).
Fix should be something like this:
In line 25 of GuildEntity.php:
$this->attributes['members'][$key]['character'] = new CharacterEntity($member);
should be changed to:
$this->attributes['members'][$key]['character'] = new CharacterEntity($member['character']);
Blizzard have moved to a new API platform, and with that some breaking changes have been introduced (intended and unintended).
fetch-api-docs
to support develop.battle.net.generate-metadata
to support the new API definition files.generate-classes
in case changes to the metadata format is needed.Hello Jyggen
should we make some function to help the developer to convert for instance: blizzard's classes and races for wow from their integer representations to their string representations.
And I would love to immpliment /wow/mount endpoint but where do that go under?
Is this library still being developed?
Hello :)
I have tried to loop through a guilds individual inside the GuildEntity class of course members array using the member field in the querystring
my idea is to return the CharacterEntity for the array instead of the normal array, so that it stays consistent in responses.
But i just cannot find out how to do that:
if(array_key_exists('members', $this->attributes)) {
foreach($this->attributes['members'] as $key => $value) {
$value['character'] = new CharacterEntity($value['character']);
}
}
This is what i have tried (i have of course made an test to back it up)
And here is a sample of what i'm trying to do:
"members": [{
"character": {
"name": "Tiando",
"realm": "Zenedar",
"battlegroup": "Cruelty / Crueldad",
"class": 3,
"race": 10,
"gender": 0,
"level": 94,
"achievementPoints": 11900,
"thumbnail": "internal-record-3657/67/95364163-avatar.jpg",
"spec": {
"name": "Marksmanship",
"role": "DPS",
"backgroundImage": "bg-hunter-marksman",
"icon": "ability_hunter_focusedaim",
"description": "A master archer or sharpshooter who excels in bringing down enemies from afar.",
"order": 1
},
"guild": "Vita Nova",
"guildRealm": "Frostwhisper",
"lastModified": 0
},
"rank": 3
}]
As you can see with the members field option you will get a character array back but i want that array to be a Character Entity class.
I know it's possible but how.
The problem is that it does not set the character key so my test for it is failing:
public function testFindCharacters()
{
$request = new GuildRequest(new TestClient('wow'));
$request->on('Auchindoun');
$response = $request->find('Dyslectic Defnenders', ['members']);
$this->assertInstanceOf('\Pwnraid\Bnet\Warcraft\Guilds\GuildEntity' ,$response);
$this->assertInstanceOf('\Pwnraid\Bnet\Warcraft\Characters\CharacterEntity', $response->members[0]['character']);
}
This is my test for it (fixture is also updated for it)
Hello
I love this package, but how can i set my configuration keys for OAuth?
Thoughts on getting this to work in CodeIgniter? By default, Codeigniter doesn't utilize any namespaces...
As of 6.0.2 (Warlords of Dreanor), the API has been updated with Item changes e.g. Item Contexts
As an example try to get the item with an ID of 113978 that will return a base site with all available contexts, but no data for that item, also new to the items while we are here, is the bl query string which indicates bonuses on the item.
Take a look at this link for the changes.
Is it possible that these changes to the API can be implemented to the package @jyggen?
Hey again @jyggen
One more question, is this package compatible with the framework laravel for instance?
Sense it is using some symfony dependencies and i know laravel is also using them ๐
Hello @jyggen
I'm trying to make an adapter from Laravel cache facilities to the psr 6 interfaces. It's going great at the moment.
My question is this: Should this package not include some kind of concrete implementation of these interfaces as per default? like you did beforehand usingtedivm/stash?
Thoughts? It would allow us to use all the lovely new features. The minimum version should at least be bumped to 5.6 since 5.5 goes EOL in 4 days.
I noticed some of my scripts appeared to be locked up, so I set about investigating.
My steps:
Retrieved the processId of my script
Then ran "strace -p " which showed it stuck on "fd 10"
"lsof -p " shows all fds for my process, and 10 is a TCP connection from my server to an IP address owned by Blizzard Paris (which I am assuming is me downloading auction data from an EU server).
The API wrapper function call that is hanging is:
$this->apiClient->auctions()->download($auctionIndex);
This is called with an appropriately verified $auctionIndex, since I compare it to a stored index in my DB to check if new data is available from Blizzard.
This happens extremely rarely, but when it does it manages to hard-lock my script for some reason.
Any ideas?
Thanks and keep up the amazing work!
Have been enjoying the elegance of your code. While doing some edge testing I found an issue:
...
$factory = new \Pwnraid\Bnet\ClientFactory('xyz');
$client = $factory->warcraft(new \Pwnraid\Bnet\Region(\Pwnraid\Bnet\Region::US));
$realms = $client->realms()->all();
Results in:
Fatal error: Call to undefined method GuzzleHttp\Psr7\Response::json() in pwnraid\bnet\src\Core\AbstractClient.php on line 201
Hello Pwnraid
I just wanted to make a heads up on this project, because Oauth client library has finally released a 1.x version :)
And the tests are failing :P
So you might want to revisit this package :)
@jyggen I have noticed that not every request on blizzards end currently returns a Last-Modified status like for instance the data endpoints for wow.
What would be your preferred way of handling this?
Could it be as simple as caching the request for x number of days or hours at a time?
What is your thoughts on this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.