mirror of
https://github.com/kevin-DL/scraps.git
synced 2026-01-12 02:05:14 +00:00
Create spoonacular integration
- Find recipes by ingredients
This commit is contained in:
49
app/Http/Integrations/Spoonacular/SpoonacularConnector.php
Normal file
49
app/Http/Integrations/Spoonacular/SpoonacularConnector.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Integrations\Spoonacular;
|
||||
|
||||
use Saloon\Http\Auth\QueryAuthenticator;
|
||||
use Saloon\Http\Connector;
|
||||
use Saloon\Traits\Plugins\AcceptsJson;
|
||||
|
||||
class SpoonacularConnector extends Connector
|
||||
{
|
||||
use AcceptsJson;
|
||||
|
||||
/**
|
||||
* The Base URL of the API
|
||||
*/
|
||||
public function resolveBaseUrl(): string
|
||||
{
|
||||
return config('services.spoonacular.api_url');
|
||||
}
|
||||
|
||||
/**
|
||||
* Default headers for every request
|
||||
*/
|
||||
protected function defaultHeaders(): array
|
||||
{
|
||||
return [
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Default HTTP client options
|
||||
*/
|
||||
protected function defaultConfig(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
protected function defaultQuery(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
protected function defaultAuth(): QueryAuthenticator
|
||||
{
|
||||
return new QueryAuthenticator('apiKey', config('services.spoonacular.api_key'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user