UNPKG

contentful-management

Version:
45 lines (44 loc) 1.74 kB
import type { Except } from 'type-fest'; import type { BasicMetaSysProps, DefaultElements, MakeRequest, SysLink } from '../common-types'; type AppEventSubscriptionSys = Except<BasicMetaSysProps, 'version' | 'id'> & { appDefinition: SysLink; organization: SysLink; }; export type AppEventSubscriptionProps = { /** * System metadata */ sys: AppEventSubscriptionSys; /** Subscription url that will receive events */ targetUrl: string; /** List of topics to subscribe to */ topics: string[]; }; export type CreateAppEventSubscriptionProps = Except<AppEventSubscriptionProps, 'sys'>; export interface AppEventSubscription extends AppEventSubscriptionProps, DefaultElements<AppEventSubscriptionProps> { /** * Deletes this object on the server. * @return Promise for the deletion. It contains no data, but the Promise error case should be handled. * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '<content_management_api_key>' * }) * client.getOrganization('<organization_id>') * .then((organization) => organization.getAppEventSubscription(<app-definition-id>)) * .then((eventSubscription) => eventSubscription.delete()) * .then(() => console.log('eventSubscription deleted')) * .catch(console.error) * ``` */ delete(): Promise<void>; } /** * @private * @param http - HTTP client instance * @param data - Raw AppEventSubscription data * @return Wrapped AppEventSubscription data */ export declare function wrapAppEventSubscription(makeRequest: MakeRequest, data: AppEventSubscriptionProps): AppEventSubscription; export {};