πͺBuilding SDKs
Example SDK
Getting Started
Example SDK Connector
<?php
namespace Pokeapi;
use Generator;
use Saloon\Http\Connector;
use Saloon\Contracts\Request;
use Pokeapi\Responses\PokeapiResponse;
class Pokeapi extends Connector
{
/**
* Resolve the base URL of the service.
*
* @return string
*/
public function resolveBaseUrl(): string
{
return 'https://pokeapi.co/api/v2';
}
/**
* Define default headers
*
* @return string[]
*/
protected function defaultHeaders(): array
{
return [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
];
}
/**
* Constructor
*
* @return void
*/
public function __construct(string $token)
{
$this->withTokenAuth($token);
}
}Using the SDK connector
Sending Requests
Getting started
Use your request
Sending Requests With Methods
Request Resources
Creating the base resource class
Creating a resource
Defining a resource on your connector
Using the resource
Custom Responses
Additional Features
Testing
Last updated