@@ -57,9 +57,9 @@ class Shopify
57
57
58
58
protected ?PendingRequest $ httpClient = null ;
59
59
60
- public function __construct (string $ apiKey , string $ password , string $ domain , string $ apiVersion )
60
+ public function __construct (string $ accessToken , string $ domain , string $ apiVersion )
61
61
{
62
- $ this ->withCredentials ($ apiKey , $ password , $ domain , $ apiVersion );
62
+ $ this ->withCredentials ($ accessToken , $ domain , $ apiVersion );
63
63
}
64
64
65
65
public function cursor (Collection $ results ): Cursor
@@ -70,13 +70,13 @@ public function cursor(Collection $results): Cursor
70
70
public function getHttpClient (): PendingRequest
71
71
{
72
72
return $ this ->httpClient ??= Http::baseUrl ($ this ->getBaseUrl ())
73
- ->withBasicAuth ( $ this -> apiKey , $ this ->password );
73
+ ->withHeaders ([ ' X-Shopify-Access-Token ' => $ this ->accessToken ] );
74
74
}
75
75
76
76
public function graphQl (): PendingRequest
77
77
{
78
78
return Http::baseUrl ("https:// {$ this ->domain }/admin/api/graphql.json " )
79
- ->withHeaders (['X-Shopify-Access-Token ' => $ this ->password ]);
79
+ ->withHeaders (['X-Shopify-Access-Token ' => $ this ->accessToken ]);
80
80
}
81
81
82
82
public function getBaseUrl (): string
@@ -91,10 +91,9 @@ public function tap(callable $callback): self
91
91
return $ this ;
92
92
}
93
93
94
- public function withCredentials (string $ apiKey , string $ password , string $ domain , string $ apiVersion ): self
94
+ public function withCredentials (string $ accessToken , string $ domain , string $ apiVersion ): self
95
95
{
96
- $ this ->apiKey = $ apiKey ;
97
- $ this ->password = $ password ;
96
+ $ this ->accessToken = $ accessToken ;
98
97
$ this ->domain = $ domain ;
99
98
$ this ->apiVersion = $ apiVersion ;
100
99
0 commit comments