1 | import type { GetAppInstallationParams } from '../../common-types';
|
2 | import type { AppAccessTokenProps, CreateAppAccessTokenProps } from '../../entities/app-access-token';
|
3 | import type { OptionalDefaults } from '../wrappers/wrap';
|
4 | export type AppAccessTokenPlainClientAPI = {
|
5 | /**
|
6 | * Issue a token for an app installation in a space environment
|
7 | * @param params space, environment, and app definition IDs
|
8 | * @param payload the JWT to be used to issue the token
|
9 | * @returns the issued token, which can be cached until it expires
|
10 | * @throws if the request fails
|
11 | * @example
|
12 | * ```javascript
|
13 | * import { sign } from 'jsonwebtoken'
|
14 | *
|
15 | * const signOptions = { algorithm: 'RS256', issuer: '<app_definition_id>', expiresIn: '10m' }
|
16 | *
|
17 | * const { token } = await client.appAccessToken.create(
|
18 | * {
|
19 | * spaceId: '<space_id>',
|
20 | * environmentId: '<environment_id>',
|
21 | * appDefinitionId: '<app_definition_id>',
|
22 | * }, {
|
23 | * jwt: sign({}, '<private_key>', signOptions)
|
24 | * }
|
25 | * );
|
26 | * ```
|
27 | */
|
28 | create(params: OptionalDefaults<GetAppInstallationParams>, payload: CreateAppAccessTokenProps): Promise<AppAccessTokenProps>;
|
29 | };
|