contentful-management 11.42.0 → 11.43.0-beta.2

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.
Files changed (31) hide show
  1. package/dist/contentful-management.browser.js +564 -132
  2. package/dist/contentful-management.browser.js.map +1 -1
  3. package/dist/contentful-management.browser.min.js +1 -1
  4. package/dist/contentful-management.node.js +548 -132
  5. package/dist/contentful-management.node.js.map +1 -1
  6. package/dist/contentful-management.node.min.js +1 -1
  7. package/dist/es-modules/adapters/REST/endpoints/function-log.js +21 -0
  8. package/dist/es-modules/adapters/REST/endpoints/function.js +16 -0
  9. package/dist/es-modules/adapters/REST/endpoints/index.js +4 -0
  10. package/dist/es-modules/contentful-management.js +1 -1
  11. package/dist/es-modules/create-function-api.js +115 -0
  12. package/dist/es-modules/create-function-log-api.js +94 -0
  13. package/dist/es-modules/entities/function-log.js +24 -0
  14. package/dist/es-modules/entities/function.js +24 -1
  15. package/dist/es-modules/entities/index.js +4 -0
  16. package/dist/es-modules/plain/entities/function-log.js +1 -0
  17. package/dist/es-modules/plain/entities/function.js +1 -0
  18. package/dist/es-modules/plain/plain-client.js +7 -1
  19. package/dist/typings/adapters/REST/endpoints/function-log.d.ts +3 -0
  20. package/dist/typings/adapters/REST/endpoints/function.d.ts +4 -0
  21. package/dist/typings/adapters/REST/endpoints/index.d.ts +4 -0
  22. package/dist/typings/common-types.d.ts +45 -6
  23. package/dist/typings/create-function-api.d.ts +78 -0
  24. package/dist/typings/create-function-log-api.d.ts +63 -0
  25. package/dist/typings/entities/function-log.d.ts +50 -0
  26. package/dist/typings/entities/function.d.ts +23 -1
  27. package/dist/typings/entities/index.d.ts +4 -0
  28. package/dist/typings/plain/common-types.d.ts +5 -5
  29. package/dist/typings/plain/entities/function-log.d.ts +38 -0
  30. package/dist/typings/plain/entities/function.d.ts +49 -0
  31. package/package.json +1 -1
@@ -0,0 +1,21 @@
1
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
+ import * as raw from './raw';
7
+ const FunctionLogAlphaHeaders = {
8
+ 'x-contentful-enable-alpha-feature': 'function-logs'
9
+ };
10
+ const baseURL = params => `/spaces/${params.spaceId}/environments/${params.environmentId}/app_installations/${params.appInstallationId}/functions/${params.functionId}/logs`;
11
+ const getURL = params => `/spaces/${params.spaceId}/environments/${params.environmentId}/app_installations/${params.appInstallationId}/functions/${params.functionId}/logs/${params.logId}`;
12
+ export const get = (http, params) => {
13
+ return raw.get(http, getURL(params), {
14
+ headers: _objectSpread({}, FunctionLogAlphaHeaders)
15
+ });
16
+ };
17
+ export const getAll = (http, params) => {
18
+ return raw.get(http, baseURL(params), {
19
+ headers: _objectSpread({}, FunctionLogAlphaHeaders)
20
+ });
21
+ };
@@ -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,8 @@ 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';
30
+ import * as FunctionLog from './function-log';
29
31
  import * as Http from './http';
30
32
  import * as Locale from './locale';
31
33
  import * as Organization from './organization';
@@ -87,6 +89,8 @@ export default {
87
89
  EnvironmentTemplate,
88
90
  EnvironmentTemplateInstallation,
89
91
  Extension,
92
+ Function,
93
+ FunctionLog,
90
94
  Http,
91
95
  Locale,
92
96
  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.42.0"}`, params.application, params.integration, params.feature);
49
+ `${sdkMain}/${"11.43.0-beta.2"}`, 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
+ }
@@ -0,0 +1,94 @@
1
+ import entities from './entities';
2
+ import { wrapFunctionLogCollection } from './entities/function-log';
3
+
4
+ /**
5
+ * @private
6
+ */
7
+
8
+ /**
9
+ * @private
10
+ */
11
+ export default function createFunctionLogApi(makeRequest) {
12
+ const {
13
+ wrapFunctionLog
14
+ } = entities.functionLog;
15
+ return {
16
+ /**
17
+ * Get a FunctionLog by it's log ID
18
+ * @Param spaceId - Space ID
19
+ * @Param environmentId - Environment ID
20
+ * @Param appInstallationId - App Installation ID
21
+ * @Param functionId - Function ID
22
+ * @Param logId - Log ID
23
+ * @returns a function log
24
+ * ```javascript
25
+ * const contentful = require('contentful-management')
26
+ *
27
+ * const client = contentful.createClient({
28
+ * accessToken: '<content_management_api_key>'
29
+ * })
30
+ *
31
+ * client.functionLog.get({
32
+ * spaceId: '<space_id>',
33
+ * environmentId: '<environment_id>',
34
+ * appInstallationId: '<app_installation_id>',
35
+ * functionId: '<function_id>',
36
+ * logId: '<log_id>'
37
+ * })
38
+ * .then((response) => console.log(response.items))
39
+ * .catch(console.error)
40
+ * ```
41
+ */
42
+ get(logId) {
43
+ const raw = this.toPlainObject();
44
+ return makeRequest({
45
+ entityType: 'FunctionLog',
46
+ action: 'get',
47
+ params: {
48
+ spaceId: raw.sys.space.sys.id,
49
+ environmentId: raw.sys.environment.sys.id,
50
+ appInstallationId: raw.sys.appDefinition.sys.id,
51
+ functionId: raw.sys.id,
52
+ logId: logId
53
+ }
54
+ }).then(data => wrapFunctionLog(makeRequest, data));
55
+ },
56
+ /**
57
+ * Get all FunctionLogs
58
+ * @Param spaceId - Space ID
59
+ * @Param environmentId - Environment ID
60
+ * @Param appInstallationId - App Installation ID
61
+ * @Param functionId - Function ID
62
+ * @returns a collection of FunctionLogs
63
+ * ```javascript
64
+ * const contentful = require('contentful-management')
65
+ *
66
+ * const client = contentful.createClient({
67
+ * accessToken: '<content_management_api_key>'
68
+ * })
69
+ *
70
+ * client.functionLog.getAll({
71
+ * spaceId: '<space_id>',
72
+ * environmentId: '<environment_id>',
73
+ * appInstallationId: '<app_installation_id>',
74
+ * functionId: '<function_id>'
75
+ * })
76
+ * .then((response) => console.log(response.items))
77
+ * .catch(console.error)
78
+ * ```
79
+ */
80
+ getAll() {
81
+ const raw = this.toPlainObject();
82
+ return makeRequest({
83
+ entityType: 'FunctionLog',
84
+ action: 'getAll',
85
+ params: {
86
+ spaceId: raw.sys.space.sys.id,
87
+ environmentId: raw.sys.environment.sys.id,
88
+ appInstallationId: raw.sys.appDefinition.sys.id,
89
+ functionId: raw.sys.id
90
+ }
91
+ }).then(data => wrapFunctionLogCollection(makeRequest, data));
92
+ }
93
+ };
94
+ }
@@ -0,0 +1,24 @@
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 createFunctionLogApi from '../create-function-log-api';
6
+ /**
7
+ * @private
8
+ * @param makeRequest - function to make requests via an adapter
9
+ * @param data - raw contentful-Function data
10
+ * @return Wrapped Function data
11
+ */
12
+ export function wrapFunctionLog(makeRequest, data) {
13
+ const appAction = toPlainObject(copy(data));
14
+ const appActionWithMethods = enhanceWithMethods(appAction, createFunctionLogApi(makeRequest));
15
+ return freezeSys(appActionWithMethods);
16
+ }
17
+
18
+ /**
19
+ * @private
20
+ * @param makeRequest - 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 wrapFunctionLogCollection = wrapCollection(wrapFunctionLog);
@@ -1 +1,24 @@
1
- export {};
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,8 @@ 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';
27
+ import * as functionLog from './function-log';
26
28
  import * as locale from './locale';
27
29
  import * as organization from './organization';
28
30
  import * as organizationInvitation from './organization-invitation';
@@ -84,6 +86,8 @@ export default {
84
86
  environmentTemplate,
85
87
  environmentTemplateInstallation,
86
88
  extension,
89
+ func,
90
+ functionLog,
87
91
  locale,
88
92
  organization,
89
93
  organizationInvitation,
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -139,7 +139,13 @@ export const createPlainClient = (makeRequest, defaults) => {
139
139
  updatePut: wrap(wrapParams, 'ConceptScheme', 'updatePut')
140
140
  },
141
141
  function: {
142
- getMany: wrap(wrapParams, 'Function', 'getMany')
142
+ get: wrap(wrapParams, 'Function', 'get'),
143
+ getMany: wrap(wrapParams, 'Function', 'getMany'),
144
+ getManyForEnvironment: wrap(wrapParams, 'Function', 'getManyForEnvironment')
145
+ },
146
+ functionLog: {
147
+ get: wrap(wrapParams, 'FunctionLog', 'get'),
148
+ getAll: wrap(wrapParams, 'FunctionLog', 'getAll')
143
149
  },
144
150
  editorInterface: {
145
151
  get: wrap(wrapParams, 'EditorInterface', 'get'),
@@ -0,0 +1,3 @@
1
+ import type { RestEndpoint } from '../types';
2
+ export declare const get: RestEndpoint<'FunctionLog', 'get'>;
3
+ export declare const getAll: RestEndpoint<'FunctionLog', 'getAll'>;
@@ -0,0 +1,4 @@
1
+ import type { RestEndpoint } from '../types';
2
+ export declare const get: RestEndpoint<'Function', 'get'>;
3
+ export declare const getMany: RestEndpoint<'Function', 'getMany'>;
4
+ export declare const getManyForEnvironment: RestEndpoint<'Function', 'getManyForEnvironment'>;
@@ -26,6 +26,8 @@ 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';
30
+ import * as FunctionLog from './function-log';
29
31
  import * as Http from './http';
30
32
  import * as Locale from './locale';
31
33
  import * as Organization from './organization';
@@ -87,6 +89,8 @@ declare const _default: {
87
89
  EnvironmentTemplate: typeof EnvironmentTemplate;
88
90
  EnvironmentTemplateInstallation: typeof EnvironmentTemplateInstallation;
89
91
  Extension: typeof Extension;
92
+ Function: typeof Function;
93
+ FunctionLog: typeof FunctionLog;
90
94
  Http: typeof Http;
91
95
  Locale: typeof Locale;
92
96
  Organization: typeof Organization;
@@ -60,6 +60,7 @@ import type { UserUIConfigProps } from './entities/user-ui-config';
60
60
  import type { CompleteWorkflowParams, CreateWorkflowParams, CreateWorkflowProps, DeleteWorkflowParams, WorkflowProps, WorkflowQueryOptions } from './entities/workflow';
61
61
  import type { CreateWorkflowDefinitionParams, CreateWorkflowDefinitionProps, DeleteWorkflowDefinitionParams, WorkflowDefinitionProps, WorkflowDefinitionQueryOptions } from './entities/workflow-definition';
62
62
  import type { WorkflowsChangelogEntryProps, WorkflowsChangelogQueryOptions } from './entities/workflows-changelog-entry';
63
+ import type { FunctionLogProps } from './entities/function-log';
63
64
  export interface DefaultElements<TPlainObject extends object = object> {
64
65
  toPlainObject(): TPlainObject;
65
66
  }
@@ -360,6 +361,11 @@ type MRInternal<UA extends boolean> = {
360
361
  (opts: MROpts<'Extension', 'createWithId', UA>): MRReturn<'Extension', 'createWithId'>;
361
362
  (opts: MROpts<'Extension', 'update', UA>): MRReturn<'Extension', 'update'>;
362
363
  (opts: MROpts<'Extension', 'delete', UA>): MRReturn<'Extension', 'delete'>;
364
+ (opts: MROpts<'Function', 'get', UA>): MRReturn<'Function', 'get'>;
365
+ (opts: MROpts<'Function', 'getMany', UA>): MRReturn<'Function', 'getMany'>;
366
+ (opts: MROpts<'Function', 'getManyForEnvironment', UA>): MRReturn<'Function', 'getManyForEnvironment'>;
367
+ (opts: MROpts<'FunctionLog', 'get', UA>): MRReturn<'FunctionLog', 'get'>;
368
+ (opts: MROpts<'FunctionLog', 'getAll', UA>): MRReturn<'FunctionLog', 'getAll'>;
363
369
  (opts: MROpts<'Locale', 'get', UA>): MRReturn<'Locale', 'get'>;
364
370
  (opts: MROpts<'Locale', 'getMany', UA>): MRReturn<'Locale', 'getMany'>;
365
371
  (opts: MROpts<'Locale', 'delete', UA>): MRReturn<'Locale', 'delete'>;
@@ -1218,12 +1224,6 @@ export type MRActions = {
1218
1224
  return: EditorInterfaceProps;
1219
1225
  };
1220
1226
  };
1221
- Function: {
1222
- getMany: {
1223
- params: GetAppDefinitionParams & QueryParams;
1224
- return: CollectionProp<FunctionProps>;
1225
- };
1226
- };
1227
1227
  Environment: {
1228
1228
  get: {
1229
1229
  params: GetSpaceEnvironmentParams;
@@ -1486,6 +1486,32 @@ export type MRActions = {
1486
1486
  return: any;
1487
1487
  };
1488
1488
  };
1489
+ Function: {
1490
+ get: {
1491
+ params: GetFunctionParams;
1492
+ return: FunctionProps;
1493
+ };
1494
+ getMany: {
1495
+ params: GetManyFunctionParams;
1496
+ return: CollectionProp<FunctionProps>;
1497
+ };
1498
+ getManyForEnvironment: {
1499
+ params: GetFunctionForEnvParams;
1500
+ return: CollectionProp<FunctionProps>;
1501
+ };
1502
+ };
1503
+ FunctionLog: {
1504
+ get: {
1505
+ params: GetFunctionLogParams;
1506
+ return: FunctionLogProps;
1507
+ headers?: RawAxiosRequestHeaders;
1508
+ };
1509
+ getAll: {
1510
+ params: GetAllFunctionLogParams;
1511
+ return: CollectionProp<FunctionLogProps>;
1512
+ headers?: RawAxiosRequestHeaders;
1513
+ };
1514
+ };
1489
1515
  Locale: {
1490
1516
  get: {
1491
1517
  params: GetSpaceEnvironmentParams & {
@@ -2367,6 +2393,19 @@ export type GetExtensionParams = GetSpaceEnvironmentParams & {
2367
2393
  export type GetEnvironmentTemplateParams = GetOrganizationParams & {
2368
2394
  environmentTemplateId: string;
2369
2395
  };
2396
+ export type GetFunctionParams = GetAppDefinitionParams & {
2397
+ functionId: string;
2398
+ };
2399
+ export type GetManyFunctionParams = GetAppDefinitionParams;
2400
+ export type GetFunctionForEnvParams = GetSpaceEnvironmentParams & {
2401
+ appInstallationId: string;
2402
+ };
2403
+ export type GetAllFunctionLogParams = GetFunctionForEnvParams & {
2404
+ functionId: string;
2405
+ };
2406
+ export type GetFunctionLogParams = GetAllFunctionLogParams & {
2407
+ logId: string;
2408
+ };
2370
2409
  export type GetOrganizationParams = {
2371
2410
  organizationId: string;
2372
2411
  };
@@ -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
+ };
@@ -0,0 +1,63 @@
1
+ import type { MakeRequest } from './common-types';
2
+ import type { FunctionLogProps } from './entities/function-log';
3
+ /**
4
+ * @private
5
+ */
6
+ export type ContentfulFunctionLogApi = ReturnType<typeof createFunctionLogApi>;
7
+ /**
8
+ * @private
9
+ */
10
+ export default function createFunctionLogApi(makeRequest: MakeRequest): {
11
+ /**
12
+ * Get a FunctionLog by it's log ID
13
+ * @Param spaceId - Space ID
14
+ * @Param environmentId - Environment ID
15
+ * @Param appInstallationId - App Installation ID
16
+ * @Param functionId - Function ID
17
+ * @Param logId - Log ID
18
+ * @returns a function log
19
+ * ```javascript
20
+ * const contentful = require('contentful-management')
21
+ *
22
+ * const client = contentful.createClient({
23
+ * accessToken: '<content_management_api_key>'
24
+ * })
25
+ *
26
+ * client.functionLog.get({
27
+ * spaceId: '<space_id>',
28
+ * environmentId: '<environment_id>',
29
+ * appInstallationId: '<app_installation_id>',
30
+ * functionId: '<function_id>',
31
+ * logId: '<log_id>'
32
+ * })
33
+ * .then((response) => console.log(response.items))
34
+ * .catch(console.error)
35
+ * ```
36
+ */
37
+ get(logId: string): Promise<FunctionLogProps & any>;
38
+ /**
39
+ * Get all FunctionLogs
40
+ * @Param spaceId - Space ID
41
+ * @Param environmentId - Environment ID
42
+ * @Param appInstallationId - App Installation ID
43
+ * @Param functionId - Function ID
44
+ * @returns a collection of FunctionLogs
45
+ * ```javascript
46
+ * const contentful = require('contentful-management')
47
+ *
48
+ * const client = contentful.createClient({
49
+ * accessToken: '<content_management_api_key>'
50
+ * })
51
+ *
52
+ * client.functionLog.getAll({
53
+ * spaceId: '<space_id>',
54
+ * environmentId: '<environment_id>',
55
+ * appInstallationId: '<app_installation_id>',
56
+ * functionId: '<function_id>'
57
+ * })
58
+ * .then((response) => console.log(response.items))
59
+ * .catch(console.error)
60
+ * ```
61
+ */
62
+ getAll(): Promise<import("./common-types").Collection<FunctionLogProps & any, FunctionLogProps>>;
63
+ };