generated from spawnia/php-package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
sailor.php
42 lines (36 loc) · 1.2 KB
/
sailor.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php declare(strict_types=1);
use Spawnia\Sailor;
return [
'example' => new class() extends Sailor\EndpointConfig {
public function makeClient(): Sailor\Client
{
// You may use one of the built-in clients, such as Guzzle, or bring your own.
// This file is required when Sailor is first used in your application,
// so you can configure the client dynamically, e.g. use environment variables.
return new Sailor\Client\Guzzle(
'https://example.com/graphql',
[
'headers' => [
'Authorization' => 'Bearer foobarbaz',
],
]
);
}
public function namespace(): string
{
return 'Vendor\\ExampleApi';
}
public function targetPath(): string
{
return __DIR__ . '/generated/ExampleApi';
}
public function schemaPath(): string
{
return __DIR__ . '/example.graphql';
}
public function finder(): Sailor\Codegen\Finder
{
return new Sailor\Codegen\DirectoryFinder(__DIR__ . '/src');
}
},
];