UNPKG

1.74 kBTypeScriptView Raw
1import type { Except } from 'type-fest';
2import type { BasicMetaSysProps, DefaultElements, MakeRequest, SysLink } from '../common-types';
3type AppEventSubscriptionSys = Except<BasicMetaSysProps, 'version' | 'id'> & {
4 appDefinition: SysLink;
5 organization: SysLink;
6};
7export type AppEventSubscriptionProps = {
8 /**
9 * System metadata
10 */
11 sys: AppEventSubscriptionSys;
12 /** Subscription url that will receive events */
13 targetUrl: string;
14 /** List of topics to subscribe to */
15 topics: string[];
16};
17export type CreateAppEventSubscriptionProps = Except<AppEventSubscriptionProps, 'sys'>;
18export interface AppEventSubscription extends AppEventSubscriptionProps, DefaultElements<AppEventSubscriptionProps> {
19 /**
20 * Deletes this object on the server.
21 * @return Promise for the deletion. It contains no data, but the Promise error case should be handled.
22 * @example ```javascript
23 * const contentful = require('contentful-management')
24 *
25 * const client = contentful.createClient({
26 * accessToken: '<content_management_api_key>'
27 * })
28 * client.getOrganization('<organization_id>')
29 * .then((organization) => organization.getAppEventSubscription(<app-definition-id>))
30 * .then((eventSubscription) => eventSubscription.delete())
31 * .then(() => console.log('eventSubscription deleted'))
32 * .catch(console.error)
33 * ```
34 */
35 delete(): Promise<void>;
36}
37/**
38 * @private
39 * @param http - HTTP client instance
40 * @param data - Raw AppEventSubscription data
41 * @return Wrapped AppEventSubscription data
42 */
43export declare function wrapAppEventSubscription(makeRequest: MakeRequest, data: AppEventSubscriptionProps): AppEventSubscription;
44export {};