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

ShopifyClient::build_rest_urlprivateWC 1.0

Build the REST API URL.

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

Хуков нет.

Возвращает

Строку. The complete API URL.

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

// private - только в коде основоного (родительского) класса
$result = $this->build_rest_url( $domain, $path, $query_params ): string;
$domain(строка) (обязательный)
The Shopify domain.
$path(строка) (обязательный)
The API path.
$query_params(массив) (обязательный)
Query parameters.

Код ShopifyClient::build_rest_url() WC 10.7.0

private function build_rest_url( string $domain, string $path, array $query_params ): string {
	// Ensure the domain has the protocol.
	if ( ! preg_match( '~^https?://~i', $domain ) ) {
		$domain = 'https://' . $domain;
	}

	$shop_url = untrailingslashit( $domain );
	// Use the latest stable API version.
	$api_version   = '2025-04';
	$rest_endpoint = "{$shop_url}/admin/api/{$api_version}{$path}";

	if ( ! empty( $query_params ) ) {
		$rest_endpoint = add_query_arg( $query_params, $rest_endpoint );
	}

	return $rest_endpoint;
}