@shopify/cli-kit
Version:
A set of utilities, interfaces, and models that are common across all the platform features
47 lines (46 loc) • 2.11 kB
TypeScript
import { CacheOptions, GraphQLResponse, UnauthorizedHandler } from './graphql.js';
import { RequestModeInput } from '../http.js';
import { TypedDocumentNode } from '@graphql-typed-document-node/core';
import { Variables } from 'graphql-request';
export declare const appManagementHeaders: (token: string) => {
[key: string]: string;
};
export declare const appManagementAppLogsUrl: (organizationId: string, cursor?: string, filters?: {
status?: string;
source?: string;
}) => Promise<string>;
export interface RequestOptions {
requestMode: RequestModeInput;
}
/**
* @param orgId - The organization ID.
* @param query - GraphQL query to execute.
* @param token - Partners 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.
* @param requestOptions - Preferred behaviour for the request.
* @param unauthorizedHandler - Optional handler for unauthorized requests.
*/
export interface AppManagementRequestOptions<TResult, TVariables extends Variables> {
organizationId: string;
query: TypedDocumentNode<TResult, TVariables>;
token: string;
variables?: TVariables;
cacheOptions?: CacheOptions;
requestOptions?: RequestOptions;
unauthorizedHandler: UnauthorizedHandler;
}
/**
* Executes an org-scoped GraphQL query against the App Management API. Uses typed documents.
*
* @param options - The options for the request.
* @returns The response of the query of generic type <T>.
*/
export declare function appManagementRequestDoc<TResult, TVariables extends Variables>(options: AppManagementRequestOptions<TResult, TVariables>): Promise<TResult>;
/**
* Sets the next deprecation date from [GraphQL response extensions](https://www.apollographql.com/docs/resources/graphql-glossary/#extensions)
* if `response.extensions.deprecations` objects contain a `supportedUntilDate` (ISO 8601-formatted string).
*
* @param response - The response of the query.
*/
export declare function handleDeprecations<T>(response: GraphQLResponse<T>): void;