contentful-management 11.42.0 → 11.43.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contentful-management.browser.js +356 -132
- package/dist/contentful-management.browser.js.map +1 -1
- package/dist/contentful-management.browser.min.js +1 -1
- package/dist/contentful-management.node.js +347 -132
- package/dist/contentful-management.node.js.map +1 -1
- package/dist/contentful-management.node.min.js +1 -1
- package/dist/es-modules/adapters/REST/endpoints/function.js +16 -0
- package/dist/es-modules/adapters/REST/endpoints/index.js +2 -0
- package/dist/es-modules/contentful-management.js +1 -1
- package/dist/es-modules/create-function-api.js +115 -0
- package/dist/es-modules/entities/function.js +24 -1
- package/dist/es-modules/entities/index.js +2 -0
- package/dist/es-modules/plain/entities/function.js +1 -0
- package/dist/es-modules/plain/plain-client.js +3 -1
- package/dist/typings/adapters/REST/endpoints/function.d.ts +4 -0
- package/dist/typings/adapters/REST/endpoints/index.d.ts +2 -0
- package/dist/typings/common-types.d.ts +24 -6
- package/dist/typings/create-function-api.d.ts +78 -0
- package/dist/typings/entities/function.d.ts +23 -1
- package/dist/typings/entities/index.d.ts +2 -0
- package/dist/typings/plain/common-types.d.ts +3 -5
- package/dist/typings/plain/entities/function.d.ts +49 -0
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as raw from './raw';
|
|
2
|
+
// Base URL
|
|
3
|
+
const getManyUrl = params => `/organizations/${params.organizationId}/app_definitions/${params.appDefinitionId}/functions`;
|
|
4
|
+
const getFunctionUrl = params => `${getManyUrl(params)}/${params.functionId}`;
|
|
5
|
+
const getFunctionsEnvURL = params => {
|
|
6
|
+
return `/spaces/${params.spaceId}/environments/${params.environmentId}/app_installations/${params.appInstallationId}/functions`;
|
|
7
|
+
};
|
|
8
|
+
export const get = (http, params) => {
|
|
9
|
+
return raw.get(http, getFunctionUrl(params));
|
|
10
|
+
};
|
|
11
|
+
export const getMany = (http, params) => {
|
|
12
|
+
return raw.get(http, getManyUrl(params));
|
|
13
|
+
};
|
|
14
|
+
export const getManyForEnvironment = (http, params) => {
|
|
15
|
+
return raw.get(http, getFunctionsEnvURL(params));
|
|
16
|
+
};
|
|
@@ -26,6 +26,7 @@ import * as EnvironmentAlias from './environment-alias';
|
|
|
26
26
|
import * as EnvironmentTemplate from './environment-template';
|
|
27
27
|
import * as EnvironmentTemplateInstallation from './environment-template-installation';
|
|
28
28
|
import * as Extension from './extension';
|
|
29
|
+
import * as Function from './function';
|
|
29
30
|
import * as Http from './http';
|
|
30
31
|
import * as Locale from './locale';
|
|
31
32
|
import * as Organization from './organization';
|
|
@@ -87,6 +88,7 @@ export default {
|
|
|
87
88
|
EnvironmentTemplate,
|
|
88
89
|
EnvironmentTemplateInstallation,
|
|
89
90
|
Extension,
|
|
91
|
+
Function,
|
|
90
92
|
Http,
|
|
91
93
|
Locale,
|
|
92
94
|
Organization,
|
|
@@ -46,7 +46,7 @@ function createClient(params, opts = {}) {
|
|
|
46
46
|
const sdkMain = opts.type === 'plain' ? 'contentful-management-plain.js' : 'contentful-management.js';
|
|
47
47
|
const userAgent = getUserAgentHeader(
|
|
48
48
|
// @ts-expect-error
|
|
49
|
-
`${sdkMain}/${"11.
|
|
49
|
+
`${sdkMain}/${"11.43.0-beta.1"}`, params.application, params.integration, params.feature);
|
|
50
50
|
const adapter = createAdapter(_objectSpread(_objectSpread({}, params), {}, {
|
|
51
51
|
userAgent
|
|
52
52
|
}));
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import entities from './entities';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @private
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
10
|
+
export default function createFunctionApi(makeRequest) {
|
|
11
|
+
const {
|
|
12
|
+
wrapFunction,
|
|
13
|
+
wrapFunctionCollection
|
|
14
|
+
} = entities.func;
|
|
15
|
+
return {
|
|
16
|
+
/**
|
|
17
|
+
* Gets all Functions for an App Definition
|
|
18
|
+
* @Param organizationId - Organization ID
|
|
19
|
+
* @Param appDefinitionId - App Definition ID
|
|
20
|
+
* @returns a collection of Functions
|
|
21
|
+
* ```javascript
|
|
22
|
+
* const contentful = require('contentful-management')
|
|
23
|
+
*
|
|
24
|
+
* const client = contentful.createClient({
|
|
25
|
+
* accessToken: '<content_management_api_key>'
|
|
26
|
+
* })
|
|
27
|
+
*
|
|
28
|
+
* client.function.getMany({
|
|
29
|
+
* organizationId: <organizationId>,
|
|
30
|
+
* appDefinitionId: <appDefinitionId>
|
|
31
|
+
* })
|
|
32
|
+
* .then((response) => console.log(response.items))
|
|
33
|
+
* .catch(console.error)
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
getManyFunctions() {
|
|
37
|
+
const raw = this.toPlainObject();
|
|
38
|
+
return makeRequest({
|
|
39
|
+
entityType: 'Function',
|
|
40
|
+
action: 'getMany',
|
|
41
|
+
params: {
|
|
42
|
+
appDefinitionId: raw.sys.appDefinition.sys.id,
|
|
43
|
+
organizationId: raw.sys.organization.sys.id
|
|
44
|
+
}
|
|
45
|
+
}).then(data => wrapFunctionCollection(makeRequest, data));
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
* Gets a Function by ID
|
|
49
|
+
* @Param organizationId - Organization ID
|
|
50
|
+
* @Param appDefinitionId - App Definition ID
|
|
51
|
+
* @Param functionId - Function ID
|
|
52
|
+
* @returns a collection of Functions
|
|
53
|
+
* ```javascript
|
|
54
|
+
* const contentful = require('contentful-management')
|
|
55
|
+
*
|
|
56
|
+
* const client = contentful.createClient({
|
|
57
|
+
* accessToken: '<content_management_api_key>'
|
|
58
|
+
* })
|
|
59
|
+
*
|
|
60
|
+
* client.function.get({
|
|
61
|
+
* organizationId: <organizationId>,
|
|
62
|
+
* appDefinitionId: <appDefinitionId>,
|
|
63
|
+
* functionId: <functionId>
|
|
64
|
+
* })
|
|
65
|
+
* .then((response) => console.log(response.items))
|
|
66
|
+
* .catch(console.error)
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
getFunction(functionId) {
|
|
70
|
+
const raw = this.toPlainObject();
|
|
71
|
+
return makeRequest({
|
|
72
|
+
entityType: 'Function',
|
|
73
|
+
action: 'get',
|
|
74
|
+
params: {
|
|
75
|
+
appDefinitionId: raw.sys.appDefinition.sys.id,
|
|
76
|
+
organizationId: raw.sys.organization.sys.id,
|
|
77
|
+
functionId
|
|
78
|
+
}
|
|
79
|
+
}).then(data => wrapFunction(makeRequest, data));
|
|
80
|
+
},
|
|
81
|
+
/**
|
|
82
|
+
* Gets all Functions for an Environment
|
|
83
|
+
* @Param organizationId - Organization ID
|
|
84
|
+
* @Param appDefinitionId - App Definition ID
|
|
85
|
+
* @Param functionId - Function ID
|
|
86
|
+
* @returns a collection of Functions
|
|
87
|
+
* ```javascript
|
|
88
|
+
* const contentful = require('contentful-management')
|
|
89
|
+
*
|
|
90
|
+
* const client = contentful.createClient({
|
|
91
|
+
* accessToken: '<content_management_api_key>'
|
|
92
|
+
* })
|
|
93
|
+
*
|
|
94
|
+
* client.function.get({
|
|
95
|
+
* environmentId: <environmentId>,
|
|
96
|
+
* spaceId: <spaceId>,
|
|
97
|
+
* appInstallationId: <appInstallationId>
|
|
98
|
+
* })
|
|
99
|
+
* .then((response) => console.log(response.items))
|
|
100
|
+
* .catch(console.error)
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
getManyFunctionsForEnvironment(spaceId, environmentId, appInstallationId) {
|
|
104
|
+
return makeRequest({
|
|
105
|
+
entityType: 'Function',
|
|
106
|
+
action: 'getManyForEnvironment',
|
|
107
|
+
params: {
|
|
108
|
+
spaceId: spaceId,
|
|
109
|
+
environmentId: environmentId,
|
|
110
|
+
appInstallationId: appInstallationId
|
|
111
|
+
}
|
|
112
|
+
}).then(data => wrapFunctionCollection(makeRequest, data));
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}
|
|
@@ -1 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
import { freezeSys, toPlainObject } from 'contentful-sdk-core';
|
|
2
|
+
import copy from 'fast-copy';
|
|
3
|
+
import { wrapCollection } from '../common-utils';
|
|
4
|
+
import enhanceWithMethods from '../enhance-with-methods';
|
|
5
|
+
import createFunctionApi from '../create-function-api';
|
|
6
|
+
/**
|
|
7
|
+
* @private
|
|
8
|
+
* @param makeRequest - (real) function to make requests via an adapter
|
|
9
|
+
* @param data - raw contentful-Function data
|
|
10
|
+
* @return Wrapped Function data
|
|
11
|
+
*/
|
|
12
|
+
export function wrapFunction(makeRequest, data) {
|
|
13
|
+
const appAction = toPlainObject(copy(data));
|
|
14
|
+
const appActionWithMethods = enhanceWithMethods(appAction, createFunctionApi(makeRequest));
|
|
15
|
+
return freezeSys(appActionWithMethods);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @private
|
|
20
|
+
* @param makeRequest - real) function to make requests via an adapter
|
|
21
|
+
* @param data - raw contentful-function data
|
|
22
|
+
* @return Wrapped App Function collection data
|
|
23
|
+
*/
|
|
24
|
+
export const wrapFunctionCollection = wrapCollection(wrapFunction);
|
|
@@ -23,6 +23,7 @@ import * as environmentAlias from './environment-alias';
|
|
|
23
23
|
import * as environmentTemplate from './environment-template';
|
|
24
24
|
import * as environmentTemplateInstallation from './environment-template-installation';
|
|
25
25
|
import * as extension from './extension';
|
|
26
|
+
import * as func from './function';
|
|
26
27
|
import * as locale from './locale';
|
|
27
28
|
import * as organization from './organization';
|
|
28
29
|
import * as organizationInvitation from './organization-invitation';
|
|
@@ -84,6 +85,7 @@ export default {
|
|
|
84
85
|
environmentTemplate,
|
|
85
86
|
environmentTemplateInstallation,
|
|
86
87
|
extension,
|
|
88
|
+
func,
|
|
87
89
|
locale,
|
|
88
90
|
organization,
|
|
89
91
|
organizationInvitation,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -139,7 +139,9 @@ export const createPlainClient = (makeRequest, defaults) => {
|
|
|
139
139
|
updatePut: wrap(wrapParams, 'ConceptScheme', 'updatePut')
|
|
140
140
|
},
|
|
141
141
|
function: {
|
|
142
|
-
|
|
142
|
+
get: wrap(wrapParams, 'Function', 'get'),
|
|
143
|
+
getMany: wrap(wrapParams, 'Function', 'getMany'),
|
|
144
|
+
getManyForEnvironment: wrap(wrapParams, 'Function', 'getManyForEnvironment')
|
|
143
145
|
},
|
|
144
146
|
editorInterface: {
|
|
145
147
|
get: wrap(wrapParams, 'EditorInterface', 'get'),
|
|
@@ -26,6 +26,7 @@ import * as EnvironmentAlias from './environment-alias';
|
|
|
26
26
|
import * as EnvironmentTemplate from './environment-template';
|
|
27
27
|
import * as EnvironmentTemplateInstallation from './environment-template-installation';
|
|
28
28
|
import * as Extension from './extension';
|
|
29
|
+
import * as Function from './function';
|
|
29
30
|
import * as Http from './http';
|
|
30
31
|
import * as Locale from './locale';
|
|
31
32
|
import * as Organization from './organization';
|
|
@@ -87,6 +88,7 @@ declare const _default: {
|
|
|
87
88
|
EnvironmentTemplate: typeof EnvironmentTemplate;
|
|
88
89
|
EnvironmentTemplateInstallation: typeof EnvironmentTemplateInstallation;
|
|
89
90
|
Extension: typeof Extension;
|
|
91
|
+
Function: typeof Function;
|
|
90
92
|
Http: typeof Http;
|
|
91
93
|
Locale: typeof Locale;
|
|
92
94
|
Organization: typeof Organization;
|
|
@@ -360,6 +360,9 @@ type MRInternal<UA extends boolean> = {
|
|
|
360
360
|
(opts: MROpts<'Extension', 'createWithId', UA>): MRReturn<'Extension', 'createWithId'>;
|
|
361
361
|
(opts: MROpts<'Extension', 'update', UA>): MRReturn<'Extension', 'update'>;
|
|
362
362
|
(opts: MROpts<'Extension', 'delete', UA>): MRReturn<'Extension', 'delete'>;
|
|
363
|
+
(opts: MROpts<'Function', 'get', UA>): MRReturn<'Function', 'get'>;
|
|
364
|
+
(opts: MROpts<'Function', 'getMany', UA>): MRReturn<'Function', 'getMany'>;
|
|
365
|
+
(opts: MROpts<'Function', 'getManyForEnvironment', UA>): MRReturn<'Function', 'getManyForEnvironment'>;
|
|
363
366
|
(opts: MROpts<'Locale', 'get', UA>): MRReturn<'Locale', 'get'>;
|
|
364
367
|
(opts: MROpts<'Locale', 'getMany', UA>): MRReturn<'Locale', 'getMany'>;
|
|
365
368
|
(opts: MROpts<'Locale', 'delete', UA>): MRReturn<'Locale', 'delete'>;
|
|
@@ -1218,12 +1221,6 @@ export type MRActions = {
|
|
|
1218
1221
|
return: EditorInterfaceProps;
|
|
1219
1222
|
};
|
|
1220
1223
|
};
|
|
1221
|
-
Function: {
|
|
1222
|
-
getMany: {
|
|
1223
|
-
params: GetAppDefinitionParams & QueryParams;
|
|
1224
|
-
return: CollectionProp<FunctionProps>;
|
|
1225
|
-
};
|
|
1226
|
-
};
|
|
1227
1224
|
Environment: {
|
|
1228
1225
|
get: {
|
|
1229
1226
|
params: GetSpaceEnvironmentParams;
|
|
@@ -1486,6 +1483,20 @@ export type MRActions = {
|
|
|
1486
1483
|
return: any;
|
|
1487
1484
|
};
|
|
1488
1485
|
};
|
|
1486
|
+
Function: {
|
|
1487
|
+
get: {
|
|
1488
|
+
params: GetFunctionParams;
|
|
1489
|
+
return: FunctionProps;
|
|
1490
|
+
};
|
|
1491
|
+
getMany: {
|
|
1492
|
+
params: GetManyFunctionParams;
|
|
1493
|
+
return: CollectionProp<FunctionProps>;
|
|
1494
|
+
};
|
|
1495
|
+
getManyForEnvironment: {
|
|
1496
|
+
params: GetFunctionForEnvParams;
|
|
1497
|
+
return: CollectionProp<FunctionProps>;
|
|
1498
|
+
};
|
|
1499
|
+
};
|
|
1489
1500
|
Locale: {
|
|
1490
1501
|
get: {
|
|
1491
1502
|
params: GetSpaceEnvironmentParams & {
|
|
@@ -2367,6 +2378,13 @@ export type GetExtensionParams = GetSpaceEnvironmentParams & {
|
|
|
2367
2378
|
export type GetEnvironmentTemplateParams = GetOrganizationParams & {
|
|
2368
2379
|
environmentTemplateId: string;
|
|
2369
2380
|
};
|
|
2381
|
+
export type GetFunctionParams = GetAppDefinitionParams & {
|
|
2382
|
+
functionId: string;
|
|
2383
|
+
};
|
|
2384
|
+
export type GetManyFunctionParams = GetAppDefinitionParams;
|
|
2385
|
+
export type GetFunctionForEnvParams = GetSpaceEnvironmentParams & {
|
|
2386
|
+
appInstallationId: string;
|
|
2387
|
+
};
|
|
2370
2388
|
export type GetOrganizationParams = {
|
|
2371
2389
|
organizationId: string;
|
|
2372
2390
|
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { MakeRequest } from './common-types';
|
|
2
|
+
import type { FunctionProps } from './entities/function';
|
|
3
|
+
/**
|
|
4
|
+
* @private
|
|
5
|
+
*/
|
|
6
|
+
export type ContentfulFunctionApi = ReturnType<typeof createFunctionApi>;
|
|
7
|
+
/**
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
10
|
+
export default function createFunctionApi(makeRequest: MakeRequest): {
|
|
11
|
+
/**
|
|
12
|
+
* Gets all Functions for an App Definition
|
|
13
|
+
* @Param organizationId - Organization ID
|
|
14
|
+
* @Param appDefinitionId - App Definition ID
|
|
15
|
+
* @returns a collection of Functions
|
|
16
|
+
* ```javascript
|
|
17
|
+
* const contentful = require('contentful-management')
|
|
18
|
+
*
|
|
19
|
+
* const client = contentful.createClient({
|
|
20
|
+
* accessToken: '<content_management_api_key>'
|
|
21
|
+
* })
|
|
22
|
+
*
|
|
23
|
+
* client.function.getMany({
|
|
24
|
+
* organizationId: <organizationId>,
|
|
25
|
+
* appDefinitionId: <appDefinitionId>
|
|
26
|
+
* })
|
|
27
|
+
* .then((response) => console.log(response.items))
|
|
28
|
+
* .catch(console.error)
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
getManyFunctions(): Promise<import("./common-types").Collection<FunctionProps & any, FunctionProps>>;
|
|
32
|
+
/**
|
|
33
|
+
* Gets a Function by ID
|
|
34
|
+
* @Param organizationId - Organization ID
|
|
35
|
+
* @Param appDefinitionId - App Definition ID
|
|
36
|
+
* @Param functionId - Function ID
|
|
37
|
+
* @returns a collection of Functions
|
|
38
|
+
* ```javascript
|
|
39
|
+
* const contentful = require('contentful-management')
|
|
40
|
+
*
|
|
41
|
+
* const client = contentful.createClient({
|
|
42
|
+
* accessToken: '<content_management_api_key>'
|
|
43
|
+
* })
|
|
44
|
+
*
|
|
45
|
+
* client.function.get({
|
|
46
|
+
* organizationId: <organizationId>,
|
|
47
|
+
* appDefinitionId: <appDefinitionId>,
|
|
48
|
+
* functionId: <functionId>
|
|
49
|
+
* })
|
|
50
|
+
* .then((response) => console.log(response.items))
|
|
51
|
+
* .catch(console.error)
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
getFunction(functionId: string): Promise<FunctionProps & any>;
|
|
55
|
+
/**
|
|
56
|
+
* Gets all Functions for an Environment
|
|
57
|
+
* @Param organizationId - Organization ID
|
|
58
|
+
* @Param appDefinitionId - App Definition ID
|
|
59
|
+
* @Param functionId - Function ID
|
|
60
|
+
* @returns a collection of Functions
|
|
61
|
+
* ```javascript
|
|
62
|
+
* const contentful = require('contentful-management')
|
|
63
|
+
*
|
|
64
|
+
* const client = contentful.createClient({
|
|
65
|
+
* accessToken: '<content_management_api_key>'
|
|
66
|
+
* })
|
|
67
|
+
*
|
|
68
|
+
* client.function.get({
|
|
69
|
+
* environmentId: <environmentId>,
|
|
70
|
+
* spaceId: <spaceId>,
|
|
71
|
+
* appInstallationId: <appInstallationId>
|
|
72
|
+
* })
|
|
73
|
+
* .then((response) => console.log(response.items))
|
|
74
|
+
* .catch(console.error)
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
getManyFunctionsForEnvironment(spaceId: string, environmentId: string, appInstallationId: string): Promise<import("./common-types").Collection<FunctionProps & any, FunctionProps>>;
|
|
78
|
+
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type { Link } from '../common-types';
|
|
1
|
+
import type { Link, DefaultElements } from '../common-types';
|
|
2
|
+
import type { MakeRequest } from '../common-types';
|
|
3
|
+
import createFunctionApi from '../create-function-api';
|
|
2
4
|
export type FunctionProps = {
|
|
3
5
|
sys: {
|
|
4
6
|
id: string;
|
|
@@ -16,3 +18,23 @@ export type FunctionProps = {
|
|
|
16
18
|
accepts: string[];
|
|
17
19
|
allowNetworks?: string[];
|
|
18
20
|
};
|
|
21
|
+
export interface Function extends FunctionProps, DefaultElements<FunctionProps> {
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @private
|
|
25
|
+
* @param makeRequest - (real) function to make requests via an adapter
|
|
26
|
+
* @param data - raw contentful-Function data
|
|
27
|
+
* @return Wrapped Function data
|
|
28
|
+
*/
|
|
29
|
+
export declare function wrapFunction(makeRequest: MakeRequest, data: FunctionProps): FunctionProps & ReturnType<typeof createFunctionApi>;
|
|
30
|
+
/**
|
|
31
|
+
* @private
|
|
32
|
+
* @param makeRequest - real) function to make requests via an adapter
|
|
33
|
+
* @param data - raw contentful-function data
|
|
34
|
+
* @return Wrapped App Function collection data
|
|
35
|
+
*/
|
|
36
|
+
export declare const wrapFunctionCollection: (makeRequest: MakeRequest, data: import("../common-types").CollectionProp<FunctionProps>) => import("../common-types").Collection<FunctionProps & {
|
|
37
|
+
getManyFunctions(): Promise<import("../common-types").Collection<FunctionProps & any, FunctionProps>>;
|
|
38
|
+
getFunction(functionId: string): Promise<FunctionProps & any>;
|
|
39
|
+
getManyFunctionsForEnvironment(spaceId: string, environmentId: string, appInstallationId: string): Promise<import("../common-types").Collection<FunctionProps & any, FunctionProps>>;
|
|
40
|
+
}, FunctionProps>;
|
|
@@ -23,6 +23,7 @@ import * as environmentAlias from './environment-alias';
|
|
|
23
23
|
import * as environmentTemplate from './environment-template';
|
|
24
24
|
import * as environmentTemplateInstallation from './environment-template-installation';
|
|
25
25
|
import * as extension from './extension';
|
|
26
|
+
import * as func from './function';
|
|
26
27
|
import * as locale from './locale';
|
|
27
28
|
import * as organization from './organization';
|
|
28
29
|
import * as organizationInvitation from './organization-invitation';
|
|
@@ -84,6 +85,7 @@ declare const _default: {
|
|
|
84
85
|
environmentTemplate: typeof environmentTemplate;
|
|
85
86
|
environmentTemplateInstallation: typeof environmentTemplateInstallation;
|
|
86
87
|
extension: typeof extension;
|
|
88
|
+
func: typeof func;
|
|
87
89
|
locale: typeof locale;
|
|
88
90
|
organization: typeof organization;
|
|
89
91
|
organizationInvitation: typeof organizationInvitation;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RawAxiosRequestConfig, RawAxiosRequestHeaders } from 'axios';
|
|
2
2
|
import type { OpPatch } from 'json-patch';
|
|
3
|
-
import type { BasicCursorPaginationOptions, CollectionProp, CursorPaginatedCollectionProp, EnvironmentTemplateParams,
|
|
3
|
+
import type { BasicCursorPaginationOptions, CollectionProp, CursorPaginatedCollectionProp, EnvironmentTemplateParams, GetBulkActionParams, GetContentTypeParams, GetEnvironmentTemplateParams, GetOrganizationMembershipParams, GetOrganizationParams, GetReleaseParams, GetSnapshotForContentTypeParams, GetSnapshotForEntryParams, GetSpaceEnvironmentParams, GetSpaceParams, KeyValueMap, QueryParams } from '../common-types';
|
|
4
4
|
import type { AccessTokenProps, CreatePersonalAccessTokenProps as CreatePATProps } from '../entities/access-token';
|
|
5
5
|
import type { ApiKeyProps, CreateApiKeyProps } from '../entities/api-key';
|
|
6
6
|
import type { AssetFileProp, AssetProcessingForLocale, AssetProps, CreateAssetProps } from '../entities/asset';
|
|
@@ -10,7 +10,6 @@ import type { ContentTypeProps, CreateContentTypeProps } from '../entities/conte
|
|
|
10
10
|
import type { CreateEntryProps, EntryProps, EntryReferenceProps } from '../entities/entry';
|
|
11
11
|
import type { CreateEnvironmentTemplateProps, EnvironmentTemplateProps } from '../entities/environment-template';
|
|
12
12
|
import type { CreateEnvironmentTemplateInstallationProps, EnvironmentTemplateInstallationProps, EnvironmentTemplateValidationProps, ValidateEnvironmentTemplateInstallationProps } from '../entities/environment-template-installation';
|
|
13
|
-
import type { FunctionProps } from '../entities/function';
|
|
14
13
|
import type { CreateOrganizationInvitationProps, OrganizationInvitationProps } from '../entities/organization-invitation';
|
|
15
14
|
import type { OrganizationMembershipProps } from '../entities/organization-membership';
|
|
16
15
|
import type { CreatePersonalAccessTokenProps, PersonalAccessTokenProps } from '../entities/personal-access-token';
|
|
@@ -38,6 +37,7 @@ import type { EditorInterfacePlainClientAPI } from './entities/editor-interface'
|
|
|
38
37
|
import type { EnvironmentPlainClientAPI } from './entities/environment';
|
|
39
38
|
import type { EnvironmentAliasPlainClientAPI } from './entities/environment-alias';
|
|
40
39
|
import type { ExtensionPlainClientAPI } from './entities/extension';
|
|
40
|
+
import type { FunctionPlainClientAPI } from './entities/function';
|
|
41
41
|
import type { LocalePlainClientAPI } from './entities/locale';
|
|
42
42
|
import type { OrganizationPlainClientAPI } from './entities/organization';
|
|
43
43
|
import type { ResourcePlainAPI } from './entities/resource';
|
|
@@ -82,9 +82,7 @@ export type PlainClientAPI = {
|
|
|
82
82
|
appSignedRequest: AppSignedRequestPlainClientAPI;
|
|
83
83
|
appSigningSecret: AppSigningSecretPlainClientAPI;
|
|
84
84
|
appAccessToken: AppAccessTokenPlainClientAPI;
|
|
85
|
-
function:
|
|
86
|
-
getMany(params: OptionalDefaults<GetAppDefinitionParams & QueryParams>): Promise<CollectionProp<FunctionProps>>;
|
|
87
|
-
};
|
|
85
|
+
function: FunctionPlainClientAPI;
|
|
88
86
|
editorInterface: EditorInterfacePlainClientAPI;
|
|
89
87
|
space: SpacePlainClientAPI;
|
|
90
88
|
environment: EnvironmentPlainClientAPI;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { CollectionProp, GetFunctionParams, GetFunctionForEnvParams, GetManyFunctionParams } from '../../common-types';
|
|
2
|
+
import type { FunctionProps } from '../../entities/function';
|
|
3
|
+
import type { OptionalDefaults } from '../wrappers/wrap';
|
|
4
|
+
export type FunctionPlainClientAPI = {
|
|
5
|
+
/**
|
|
6
|
+
* Fetches the specified function
|
|
7
|
+
* @param params organization ID, app definition ID, entity ID to identify the function
|
|
8
|
+
* @returns the function
|
|
9
|
+
* @throws if the request fails, or the Function is not found
|
|
10
|
+
* @example
|
|
11
|
+
* ```javascript
|
|
12
|
+
* const func = await client.function.get({
|
|
13
|
+
* organizationId: "<org_id>",
|
|
14
|
+
* appDefinitionId: "<app_definition_id>",
|
|
15
|
+
* functionId: "<function_id>",
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
get(params: OptionalDefaults<GetFunctionParams>): Promise<FunctionProps>;
|
|
20
|
+
/**
|
|
21
|
+
* Fetches all functions for the given app
|
|
22
|
+
* @param params organization ID, app definition ID to identify the functions
|
|
23
|
+
* @returns an object containing an array of Functions
|
|
24
|
+
* @throws if the request fails, or the App is not found
|
|
25
|
+
* @example
|
|
26
|
+
* ```javascript
|
|
27
|
+
* const functions = await client.function.getMany({
|
|
28
|
+
* organizationId: "<org_id>",
|
|
29
|
+
* appDefinitionId: "<app_definition_id>",
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
getMany(params: OptionalDefaults<GetManyFunctionParams>): Promise<CollectionProp<FunctionProps>>;
|
|
34
|
+
/**
|
|
35
|
+
* Fetches all functions for the given environment
|
|
36
|
+
* @param params space ID, environment ID, app installation ID to identify the functions
|
|
37
|
+
* @returns an object containing an array of Functions
|
|
38
|
+
* @throws if the request fails, or the Environment is not found
|
|
39
|
+
* @example
|
|
40
|
+
* ```javascript
|
|
41
|
+
* const functions = await client.function.getManyForEnvironment({
|
|
42
|
+
* spaceId: "<space_id>",
|
|
43
|
+
* environmentId: "<environment_id>",
|
|
44
|
+
* appInstallationId: "<app_installation_id>",
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
getManyForEnvironment(params: OptionalDefaults<GetFunctionForEnvParams>): Promise<CollectionProp<FunctionProps>>;
|
|
49
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contentful-management",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.43.0-beta.1",
|
|
4
4
|
"description": "Client for Contentful's Content Management API",
|
|
5
5
|
"homepage": "https://www.contentful.com/developers/documentation/content-management-api/",
|
|
6
6
|
"main": "./dist/contentful-management.node.js",
|