Skip to content

Commit 6d1f1bd

Browse files
committed
initial connector
1 parent 07a70bd commit 6d1f1bd

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

composer.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@
1717
],
1818
"require": {
1919
"php": "^8.3",
20-
"spatie/laravel-package-tools": "^1.16",
21-
"illuminate/contracts": "^10.0||^11.0||^12.0"
20+
"illuminate/contracts": "^10.0||^11.0||^12.0",
21+
"saloonphp/laravel-plugin": "^3.0",
22+
"saloonphp/saloon": "^3.0",
23+
"spatie/laravel-package-tools": "^1.16"
2224
},
2325
"require-dev": {
26+
"jonpurvis/lawman": "^4.0",
27+
"larastan/larastan": "^2.9||^3.0",
2428
"laravel/pint": "^1.14",
2529
"nunomaduro/collision": "^8.1.1||^7.10.0",
26-
"larastan/larastan": "^2.9||^3.0",
2730
"orchestra/testbench": "^10.0.0||^9.0.0||^8.22.0",
2831
"pestphp/pest": "^3.0",
2932
"pestphp/pest-plugin-arch": "^3.0",

src/LaravelGetResponse.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,25 @@
44

55
namespace Ziming\LaravelGetResponse;
66

7-
class LaravelGetResponse {}
7+
use Saloon\Contracts\Authenticator;
8+
use Saloon\Http\Auth\HeaderAuthenticator;
9+
use Saloon\Http\Auth\TokenAuthenticator;
10+
use Saloon\Http\Connector;
11+
12+
/*
13+
* Add Oauth authenticator in the future
14+
*/
15+
class LaravelGetResponse extends Connector
16+
{
17+
public function __construct(protected readonly string $token){}
18+
19+
protected function defaultAuth(): HeaderAuthenticator
20+
{
21+
return new HeaderAuthenticator($this->token, 'X-AUTH-TOKEN');
22+
}
23+
24+
public function resolveBaseUrl(): string
25+
{
26+
return 'https://api.getresponse.com/v3/';
27+
}
28+
}

0 commit comments

Comments
 (0)