/** * The Scopes API enables embedded apps and extensions to request merchant consent for access scopes. */ export interface Scopes { /** * Queries Shopify for the scopes for this app on this shop */ query: () => Promise; /** * Requests the merchant to grant the provided scopes for this app on this shop */ request: (scopes: Scope[]) => Promise; /** * Revokes the provided scopes from this app on this shop */ revoke: (scopes: Scope[]) => Promise; } /** * `Scope` represents an [access scope](https://shopify.dev/docs/api/usage/access-scopes) handle, like "`write_products`" or "`read_orders`" */ export type Scope = string; /** * `UserResult` represents the results of a user responding to a scopes request, i.e. a merchant user’s action taken when presented with a grant modal. */ export type UserResult = 'granted-all' | 'declined-all'; export interface ScopesDetail { /** * The scopes that have been granted on the shop for this app */ granted: Scope[]; /** * The required scopes that the app has declared in its configuration */ required: Scope[]; /** * The optional scopes that the app has declared in its configuration */ optional: Scope[]; } export interface ScopesRequestResponse { result: UserResult; detail: ScopesDetail; } export interface ScopesRevokeResponse { detail: ScopesDetail; }