UNPKG

1.96 kBTypeScriptView Raw
1import type { MetaSysProps, DefaultElements, MakeRequest } from '../common-types';
2export type PersonalAccessTokenProps = {
3 sys: MetaSysProps & {
4 expiresAt?: string;
5 };
6 name: string;
7 scopes: 'content_management_manage'[];
8 revokedAt: null | string;
9 token?: string;
10};
11/**
12 * @deprecated Use `PersonalAccessTokenProps` instead.
13 */
14export type PersonalAccessTokenProp = PersonalAccessTokenProps;
15export type CreatePersonalAccessTokenProps = Pick<PersonalAccessToken, 'name' | 'scopes'> & {
16 expiresIn?: number;
17};
18export interface PersonalAccessToken extends PersonalAccessTokenProps, DefaultElements<PersonalAccessTokenProps> {
19 /**
20 * Revokes a personal access token
21 * @return Object the revoked personal access token
22 * @example ```javascript
23 * const contentful = require('contentful-management')
24 *
25 * const client = contentful.createClient({
26 * accessToken: <content_management_api_key>
27 * })
28 *
29 * client.getPersonalAccessToken('<token-id>')
30 * .then((personalAccessToken) => {
31 * return personalAccessToken.revoke()
32 * })
33 * .catch(console.error)
34 * ```
35 */
36 revoke(): Promise<PersonalAccessToken>;
37}
38/**
39 * @private
40 * @param makeRequest - function to make requests via an adapter
41 * @param data - Raw personal access token data
42 * @return Wrapped personal access token
43 */
44export declare function wrapPersonalAccessToken(makeRequest: MakeRequest, data: PersonalAccessTokenProps): PersonalAccessToken;
45/**
46 * @private
47 * @param makeRequest - function to make requests via an adapter
48 * @param data - Raw personal access collection data
49 * @return Wrapped personal access token collection data
50 */
51export declare const wrapPersonalAccessTokenCollection: (makeRequest: MakeRequest, data: import("../common-types").CollectionProp<PersonalAccessTokenProps>) => import("../common-types").Collection<PersonalAccessToken, PersonalAccessTokenProps>;