-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from nstack-io/develop
Fixed some naming
- Loading branch information
Showing
11 changed files
with
233 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
|
||
namespace NStack\Clients; | ||
|
||
use NStack\Exceptions\FailedToParseException; | ||
use NStack\Models\Language; | ||
use NStack\Models\Resource; | ||
|
||
/** | ||
|
@@ -56,4 +58,42 @@ public function showResource($url): array | |
|
||
return $data; | ||
} | ||
|
||
/** | ||
* indexLanguage | ||
* | ||
* @param string $platform | ||
* @return array | ||
* @throws \NStack\Exceptions\FailedToParseException | ||
* @author Casper Rasmussen <[email protected]> | ||
*/ | ||
public function indexLanguage(string $platform): array | ||
{ | ||
$response = $this->client->get($this->buildPath($this->path . '/' . $platform . '/languages')); | ||
$contents = $response->getBody()->getContents(); | ||
$data = json_decode($contents, true); | ||
|
||
$array = []; | ||
foreach ($data['data'] as $object) { | ||
$array[] = new Language($object); | ||
} | ||
|
||
return $array; | ||
} | ||
|
||
/** | ||
* bestFitLanguage | ||
* | ||
* @param string $platform | ||
* @return Language | ||
* @throws FailedToParseException | ||
*/ | ||
public function bestFitLanguage(string $platform): Language | ||
{ | ||
$response = $this->client->get($this->buildPath($this->path . '/' . $platform . '/languages/best_fit')); | ||
$contents = $response->getBody()->getContents(); | ||
$data = json_decode($contents, true); | ||
|
||
return new Language($data['data']); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,12 @@ | |
namespace NStack\Clients; | ||
|
||
/** | ||
* Class UgcClient | ||
* Class PushLogClient | ||
* | ||
* @package NStack\Clients | ||
* @author Tiago Araujo <[email protected]> | ||
*/ | ||
class UgcClient extends NStackClient | ||
class PushLogClient extends NStackClient | ||
{ | ||
/** @var string */ | ||
protected $path = 'ugc'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,12 +7,12 @@ | |
use NStack\Models\VersionControlUpdate; | ||
|
||
/** | ||
* Class NotifyClient | ||
* Class VersionControlClient | ||
* | ||
* @package NStack\Clients | ||
* @author Tiago Araujo <[email protected]> | ||
*/ | ||
class NotifyClient extends NStackClient | ||
class VersionControlClient extends NStackClient | ||
{ | ||
/** @var string */ | ||
protected $path = 'notify/updates'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,18 @@ | |
|
||
namespace NStack; | ||
|
||
use NStack\Clients\CollectionsClient; | ||
use NStack\Clients\ContinentsClient; | ||
use NStack\Clients\CountriesClient; | ||
use NStack\Clients\FilesClient; | ||
use NStack\Clients\IpAddressesClient; | ||
use NStack\Clients\LanguagesClient; | ||
use NStack\Clients\LocalizeClient; | ||
use NStack\Clients\ProposalsClient; | ||
use NStack\Clients\PushLogClient; | ||
use NStack\Clients\TimezoneClient; | ||
use NStack\Clients\ValidatorsClient; | ||
use NStack\Clients\VersionControlClient; | ||
use NStack\Exceptions\MissingMasterKeyException; | ||
|
||
/** | ||
|
@@ -17,12 +27,42 @@ class NStack | |
/** @var \NStack\Config */ | ||
protected $config; | ||
|
||
/** @var \NStack\Clients\ContinentsClient */ | ||
/** @var CollectionsClient */ | ||
protected $collectionClient; | ||
|
||
/** @var ContinentsClient */ | ||
protected $continentsClient; | ||
|
||
/** @var \NStack\Clients\CountriesClient */ | ||
/** @var CountriesClient */ | ||
protected $countriesClient; | ||
|
||
/** @var FilesClient */ | ||
protected $filesClient; | ||
|
||
/** @var IpAddressesClient */ | ||
protected $ipAddressClient; | ||
|
||
/** @var LanguagesClient */ | ||
protected $languageClient; | ||
|
||
/** @var LocalizeClient */ | ||
protected $localizeClient; | ||
|
||
/** @var VersionControlClient */ | ||
protected $versionControlClient; | ||
|
||
/** @var ProposalsClient */ | ||
protected $proposalClient; | ||
|
||
/** @var TimezoneClient */ | ||
protected $timezoneClient; | ||
|
||
/** @var PushLogClient */ | ||
protected $pushLogClient; | ||
|
||
/** @var ValidatorsClient */ | ||
protected $validatorClient; | ||
|
||
/** | ||
* NStack constructor. | ||
* | ||
|
@@ -34,6 +74,16 @@ public function __construct(Config $config) | |
$this->config = $config; | ||
$this->continentsClient = new ContinentsClient($config); | ||
$this->countriesClient = new CountriesClient($config); | ||
$this->collectionClient = new CollectionsClient($config); | ||
$this->filesClient = new FilesClient($config); | ||
$this->ipAddressClient = new IpAddressesClient($config); | ||
$this->languageClient = new LanguagesClient($config); | ||
$this->localizeClient = new LocalizeClient($config); | ||
$this->versionControlClient = new VersionControlClient($config); | ||
$this->proposalClient = new ProposalsClient($config); | ||
$this->timezoneClient = new TimezoneClient($config); | ||
$this->pushLogClient = new PushLogClient($config); | ||
$this->validatorClient = new ValidatorsClient($config); | ||
} | ||
|
||
/** | ||
|
@@ -48,7 +98,7 @@ public function getConfig(): Config | |
/** | ||
* getContinentsClient | ||
* | ||
* @return \NStack\Clients\ContinentsClient | ||
* @return ContinentsClient | ||
* @author Casper Rasmussen <[email protected]> | ||
*/ | ||
public function getContinentsClient(): ContinentsClient | ||
|
@@ -59,14 +109,104 @@ public function getContinentsClient(): ContinentsClient | |
/** | ||
* getCountriesClient | ||
* | ||
* @return \NStack\Clients\CountriesClient | ||
* @return CountriesClient | ||
* @author Casper Rasmussen <[email protected]> | ||
*/ | ||
public function getCountriesClient(): CountriesClient | ||
{ | ||
return $this->countriesClient; | ||
} | ||
|
||
/** | ||
* @return CollectionsClient | ||
* @author Casper Rasmussen <[email protected]> | ||
*/ | ||
public function getCollectionClient(): CollectionsClient | ||
{ | ||
return $this->collectionClient; | ||
} | ||
|
||
/** | ||
* @return FilesClient | ||
* @author Casper Rasmussen <[email protected]> | ||
*/ | ||
public function getFilesClient(): FilesClient | ||
{ | ||
return $this->filesClient; | ||
} | ||
|
||
/** | ||
* @return IpAddressesClient | ||
* @author Casper Rasmussen <[email protected]> | ||
*/ | ||
public function getIpAddressClient(): IpAddressesClient | ||
{ | ||
return $this->ipAddressClient; | ||
} | ||
|
||
/** | ||
* @return LanguagesClient | ||
* @author Casper Rasmussen <[email protected]> | ||
*/ | ||
public function getLanguageClient(): LanguagesClient | ||
{ | ||
return $this->languageClient; | ||
} | ||
|
||
/** | ||
* @return LocalizeClient | ||
* @author Casper Rasmussen <[email protected]> | ||
*/ | ||
public function getLocalizeClient(): LocalizeClient | ||
{ | ||
return $this->localizeClient; | ||
} | ||
|
||
/** | ||
* @return VersionControlClient | ||
* @author Casper Rasmussen <[email protected]> | ||
*/ | ||
public function getVersionControlClient(): VersionControlClient | ||
{ | ||
return $this->versionControlClient; | ||
} | ||
|
||
/** | ||
* @return ProposalsClient | ||
* @author Casper Rasmussen <[email protected]> | ||
*/ | ||
public function getProposalClient(): ProposalsClient | ||
{ | ||
return $this->proposalClient; | ||
} | ||
|
||
/** | ||
* @return TimezoneClient | ||
* @author Casper Rasmussen <[email protected]> | ||
*/ | ||
public function getTimezoneClient(): TimezoneClient | ||
{ | ||
return $this->timezoneClient; | ||
} | ||
|
||
/** | ||
* @return PushLogClient | ||
* @author Casper Rasmussen <[email protected]> | ||
*/ | ||
public function getPushLogClient(): PushLogClient | ||
{ | ||
return $this->pushLogClient; | ||
} | ||
|
||
/** | ||
* @return ValidatorsClient | ||
* @author Casper Rasmussen <[email protected]> | ||
*/ | ||
public function getValidatorClient(): ValidatorsClient | ||
{ | ||
return $this->validatorClient; | ||
} | ||
|
||
/** | ||
* getDeeplink | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.