@shopify/cli-kit
Version:
A set of utilities, interfaces, and models that are common across all the platform features
58 lines (57 loc) • 2.84 kB
TypeScript
import { CacheOptions, GraphQLVariables, UnauthorizedHandler } from './graphql.js';
import { TypedDocumentNode } from '@graphql-typed-document-node/core';
import { Variables } from 'graphql-request';
/**
* Executes a GraphQL query against the Business Platform Destinations API.
*
* @param query - GraphQL query to execute.
* @param token - Business Platform token.
* @param variables - GraphQL variables to pass to the query.
* @param cacheOptions - Cache options for the request. If not present, the request will not be cached.
* @returns The response of the query of generic type <T>.
*/
export declare function businessPlatformRequest<T>(query: string, token: string, variables?: GraphQLVariables, cacheOptions?: CacheOptions): Promise<T>;
/**
* @param query - GraphQL query to execute.
* @param token - Business Platform token.
* @param variables - GraphQL variables to pass to the query.
* @param cacheOptions - Cache options for the request. If not present, the request will not be cached.
*/
export interface BusinessPlatformRequestOptions<TResult, TVariables extends Variables> {
query: TypedDocumentNode<TResult, TVariables>;
token: string;
variables?: TVariables;
cacheOptions?: CacheOptions;
unauthorizedHandler: UnauthorizedHandler;
}
/**
* Executes a GraphQL query against the Business Platform Destinations API. Uses typed documents.
*
* @param options - The options for the request.
* @returns The response of the query of generic type <TResult>.
*/
export declare function businessPlatformRequestDoc<TResult, TVariables extends Variables>(options: BusinessPlatformRequestOptions<TResult, TVariables>): Promise<TResult>;
export interface BusinessPlatformOrganizationsRequestNonTypedOptions {
query: string;
token: string;
organizationId: string;
unauthorizedHandler: UnauthorizedHandler;
variables?: GraphQLVariables;
}
/**
* Executes a GraphQL query against the Business Platform Organizations API.
*
* @param options - The options for the request.
* @returns The response of the query of generic type <T>.
*/
export declare function businessPlatformOrganizationsRequest<T>(options: BusinessPlatformOrganizationsRequestNonTypedOptions): Promise<T>;
export interface BusinessPlatformOrganizationsRequestOptions<TResult, TVariables extends Variables> extends BusinessPlatformRequestOptions<TResult, TVariables> {
organizationId: string;
}
/**
* Executes a GraphQL query against the Business Platform Organizations API. Uses typed documents.
*
* @param options - The options for the request.
* @returns The response of the query of generic type <T>.
*/
export declare function businessPlatformOrganizationsRequestDoc<TResult, TVariables extends Variables>(options: BusinessPlatformOrganizationsRequestOptions<TResult, TVariables>): Promise<TResult>;