Automattic\WooCommerce\Internal\CLI\Migrator\Platforms\Shopify
ShopifyClient::graphql_request
Makes a request to the Shopify GraphQL API.
Метод класса: ShopifyClient{}
Хуков нет.
Возвращает
Объект|\WP_Error. Decoded JSON response data or WP_Error on failure.
Использование
$ShopifyClient = new ShopifyClient(); $ShopifyClient->graphql_request( $query, $variables );
- $query(строка) (обязательный)
- The GraphQL query string.
- $variables(массив)
- The variables for the query.
По умолчанию:array()
Код ShopifyClient::graphql_request() ShopifyClient::graphql request WC 10.9.4
public function graphql_request( string $query, array $variables = array() ) {
$credentials = $this->get_credentials();
if ( is_wp_error( $credentials ) ) {
return $credentials;
}
$graphql_endpoint = $this->build_graphql_url( $credentials['domain'] );
$request_args = $this->build_graphql_request_args( $credentials['access_token'], $query, $variables );
$response = wp_remote_request( $graphql_endpoint, $request_args );
return $this->process_graphql_response( $response );
}