-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Operation "trends.byWoeid" was added
Type "Trends_Response" was added Type "Trend" was added
- Loading branch information
SDKgen-Bot
committed
Apr 24, 2024
1 parent
08840d7
commit b4240e6
Showing
11 changed files
with
172 additions
and
1 deletion.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
/** | ||
* Trend automatically generated by SDKgen please do not edit this file manually | ||
* @see https://sdkgen.app | ||
*/ | ||
|
||
namespace SdkFabric\Twitter; | ||
|
||
use PSX\Schema\Attribute\Description; | ||
use PSX\Schema\Attribute\Key; | ||
|
||
#[Description('')] | ||
class Trend implements \JsonSerializable, \PSX\Record\RecordableInterface | ||
{ | ||
#[Key('trend_name')] | ||
#[Description('')] | ||
protected ?string $trendName = null; | ||
#[Key('tweet_count')] | ||
#[Description('')] | ||
protected ?int $tweetCount = null; | ||
public function setTrendName(?string $trendName) : void | ||
{ | ||
$this->trendName = $trendName; | ||
} | ||
public function getTrendName() : ?string | ||
{ | ||
return $this->trendName; | ||
} | ||
public function setTweetCount(?int $tweetCount) : void | ||
{ | ||
$this->tweetCount = $tweetCount; | ||
} | ||
public function getTweetCount() : ?int | ||
{ | ||
return $this->tweetCount; | ||
} | ||
public function toRecord() : \PSX\Record\RecordInterface | ||
{ | ||
/** @var \PSX\Record\Record<mixed> $record */ | ||
$record = new \PSX\Record\Record(); | ||
$record->put('trend_name', $this->trendName); | ||
$record->put('tweet_count', $this->tweetCount); | ||
return $record; | ||
} | ||
public function jsonSerialize() : object | ||
{ | ||
return (object) $this->toRecord()->getAll(); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
/** | ||
* TrendsResponse automatically generated by SDKgen please do not edit this file manually | ||
* @see https://sdkgen.app | ||
*/ | ||
|
||
namespace SdkFabric\Twitter; | ||
|
||
use PSX\Schema\Attribute\Description; | ||
|
||
#[Description('')] | ||
class TrendsResponse implements \JsonSerializable, \PSX\Record\RecordableInterface | ||
{ | ||
/** | ||
* @var array<Trend>|null | ||
*/ | ||
#[Description('')] | ||
protected ?array $data = null; | ||
/** | ||
* @param array<Trend>|null $data | ||
*/ | ||
public function setData(?array $data) : void | ||
{ | ||
$this->data = $data; | ||
} | ||
/** | ||
* @return array<Trend>|null | ||
*/ | ||
public function getData() : ?array | ||
{ | ||
return $this->data; | ||
} | ||
public function toRecord() : \PSX\Record\RecordInterface | ||
{ | ||
/** @var \PSX\Record\Record<mixed> $record */ | ||
$record = new \PSX\Record\Record(); | ||
$record->put('data', $this->data); | ||
return $record; | ||
} | ||
public function jsonSerialize() : object | ||
{ | ||
return (object) $this->toRecord()->getAll(); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/** | ||
* TrendsTag automatically generated by SDKgen please do not edit this file manually | ||
* @see https://sdkgen.app | ||
*/ | ||
|
||
namespace SdkFabric\Twitter; | ||
|
||
use GuzzleHttp\Exception\BadResponseException; | ||
use Sdkgen\Client\Exception\ClientException; | ||
use Sdkgen\Client\Exception\UnknownStatusCodeException; | ||
use Sdkgen\Client\TagAbstract; | ||
|
||
class TrendsTag extends TagAbstract | ||
{ | ||
/** | ||
* The Trends lookup endpoint allow developers to get the Trends for a location, specified using the where-on-earth id (WOEID). | ||
* | ||
* @param string $woeid | ||
* @return TrendsResponse | ||
* @throws ClientException | ||
*/ | ||
public function byWoeid(string $woeid): TrendsResponse | ||
{ | ||
$url = $this->parser->url('/2/trends/by/woeid/:woeid', [ | ||
'woeid' => $woeid, | ||
]); | ||
|
||
$options = [ | ||
'query' => $this->parser->query([ | ||
], [ | ||
]), | ||
]; | ||
|
||
try { | ||
$response = $this->httpClient->request('GET', $url, $options); | ||
$data = (string) $response->getBody(); | ||
|
||
return $this->parser->parse($data, TrendsResponse::class); | ||
} catch (ClientException $e) { | ||
throw $e; | ||
} catch (BadResponseException $e) { | ||
$data = (string) $e->getResponse()->getBody(); | ||
|
||
switch ($e->getResponse()->getStatusCode()) { | ||
default: | ||
throw new UnknownStatusCodeException('The server returned an unknown status code'); | ||
} | ||
} catch (\Throwable $e) { | ||
throw new ClientException('An unknown error occurred: ' . $e->getMessage()); | ||
} | ||
} | ||
|
||
|
||
} |
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
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
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