Automattic\WooCommerce\Internal\CLI\Migrator\Platforms\Shopify

ShopifyClient::build_graphql_request_argsprivateWC 1.0

Build the request arguments for GraphQL requests.

Метод класса: ShopifyClient{}

Хуков нет.

Возвращает

Массив. Request arguments for wp_remote_request.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->build_graphql_request_args( $access_token, $query, $variables ): array;
$access_token(строка) (обязательный)
The Shopify access token.
$query(строка) (обязательный)
The GraphQL query.
$variables(массив) (обязательный)
The GraphQL variables.

Код ShopifyClient::build_graphql_request_args() WC 10.7.0

private function build_graphql_request_args( string $access_token, string $query, array $variables ): array {
	$request_body = compact( 'query', 'variables' );

	return array(
		'method'  => 'POST',
		'headers' => array(
			'Content-Type'           => 'application/json',
			'X-Shopify-Access-Token' => $access_token,
		),
		'body'    => wp_json_encode( $request_body ),
		'timeout' => 60,
	);
}