sofwar / trade-opskins-api
A Trade Opskins API client for PHP.
Requires
- php: >=7.1.0
- ext-json: *
- guzzlehttp/guzzle: ~6.0
This package is auto-updated.
Last update: 2024-10-24 00:49:01 UTC
README
This is the unofficial client library for the Opskins Trade API. We provide an intuitive, stable interface to integrate Opskins Trade API into your PHP project.
Installation
Install the library using Composer. Please read the Composer Documentation if you are unfamiliar with Composer or dependency managers in general.
composer require sofwar/trade-opskins-api
require __DIR__.'/../vendor/autoload.php';
$opskins = new \SofWar\Opskins\Opskins();
Access Token
You can use both a user access token and api key
ACCESS_TOKEN = XXXXXXXABH5IABYKNAAAABlcY8Lgurj5K+LRRA3UYeg2e3OQaXWLZC3OKXXrxjxCFof5YHQ=
ACCESS_TOKEN = xxxxb65b683xxde1553892d3b1xxx
Initialization
$opskins = new Opskins();
Also you can initialize Opskins with the default access token
$opskins = new Opskins('ACCESS_TOKEN');
OR
$opskins = new Opskins('); $opskins->setAccessToken('ACCESS_TOKEN');
Authorization
The library provides the authorization flows for user based on OAuth 2.0 protocol implementation in Opskins API. Please read the full documentation before you start.
Authorization Code Flow
For getting user access key use following command:
$client_id = 'XXXXX'; $client_secret = 'XXXXXXXXXXXX'; $oauth = new \SofWar\Opskins\OpskinsOAuth($client_id, $client_secret); $state = 'secret_state_code'; $browser_url = $oauth->getAuthorizeUrl($state, ['identity_basic', 'items']);
After successful authorization user's browser will be redirected to the specified redirect_uri. Meanwhile the code will be sent as a GET parameter to the specified address:
https://example.com?code=CODE&state=STATE
Then use this method to get the access token:
$client_id = 'XXXXX'; $client_secret = 'XXXXXXXXXXXX'; $oauth = new \SofWar\Opskins\OpskinsOAuth($client_id, $client_secret); $response = $oauth->getAccessToken($_GET['code']); $access_token = $response['access_token'];
API Request
You can find the full list of Opskins Trade API methods here.
Examples
All examples can be found here
TODO
- ICase
- GetCaseSchema
- GetCaseOdds
- GetMinimumOpenVolume
- OpenWithKeys
- ICaseSite
- GetKeyCount
- GetTradeStatus
- SendKeyRequest
- UpdateCommissionSettings
- IEthereum
- GetContractAddress
- IItem
- GetAllItems
- GetItemsById
- WithdrawToOpskins
- GetItemDefinitions
- GetRarityStats
- InstantSellRecentItems
- ITest
- Test
- TestAuthed
- TestBody
- ITrade
- AcceptOffer
- CancelOffer
- GetApps
- GetOffer
- GetOffers
- GetTradeURL
- GetUserInventory
- GetUserInventoryFromSteamId
- RegenerateTradeUrl
- SendOffer
- SendOfferToSteamId
- IUser
- CreateVCaseUser
- GetInventory
- GetProfile
- UpdateProfile
- UserReports