@@ -34,7 +34,7 @@ public function __construct(
3434 *
3535 * @param string|array $data Query to be posted to endpoint
3636 * @param array $query Parameters on a query to be added to the URL
37- * @param array & $extraHeaders Any extra headers to send along with the request
37+ * @param array $extraHeaders Any extra headers to send along with the request
3838 * @param int|null $tries How many times to attempt the request
3939 *
4040 * @return HttpResponse
@@ -44,7 +44,7 @@ public function __construct(
4444 public function query (
4545 string | array $ data ,
4646 array $ query = [],
47- array & $ extraHeaders = [],
47+ array $ extraHeaders = [],
4848 ?int $ tries = null
4949 ): HttpResponse {
5050 if (empty ($ data )) {
@@ -71,6 +71,40 @@ public function query(
7171 );
7272 }
7373
74+ /**
75+ * Proxy string query to this client's domain.
76+ *
77+ * @param string $data Query to be posted to endpoint
78+ * @param array $extraHeaders Any extra headers to send along with the request
79+ * @param int|null $tries How many times to attempt the request
80+ *
81+ * @return \Shopify\Clients\HttpResponse
82+ * @throws \Psr\Http\Client\ClientExceptionInterface
83+ * @throws \Shopify\Exception\MissingArgumentException
84+ * @throws \Shopify\Exception\UninitializedContextException
85+ */
86+ public function proxy (
87+ string $ data ,
88+ array $ extraHeaders = [],
89+ ?int $ tries = null
90+ ): HttpResponse {
91+ if (empty ($ data )) {
92+ throw new MissingArgumentException ('Query missing ' );
93+ }
94+
95+ list ($ accessTokenHeader , $ accessToken ) = $ this ->getAccessTokenHeader ();
96+ $ extraHeaders [$ accessTokenHeader ] = $ accessToken ;
97+
98+ return $ this ->client ->post (
99+ path: $ this ->getApiPath (),
100+ body: $ data ,
101+ dataType: Http::DATA_TYPE_JSON ,
102+ headers: $ extraHeaders ,
103+ tries: $ tries ,
104+ query: [],
105+ );
106+ }
107+
74108 /**
75109 * Fetches the URL path to be used for API requests.
76110 *
0 commit comments