UNPKG

contentful-management

Version:
30 lines (29 loc) 873 B
import copy from 'fast-copy'; import { toPlainObject } from 'contentful-sdk-core'; import enhanceWithMethods from '../enhance-with-methods'; function createSigningSecretApi(makeRequest) { const getParams = data => ({ organizationId: data.sys.organization.sys.id, appDefinitionId: data.sys.appDefinition.sys.id }); return { delete: function del() { const self = this; return makeRequest({ entityType: 'AppSigningSecret', action: 'delete', params: getParams(self) }); } }; } /** * @private * @param http - HTTP client instance * @param data - Raw AppSigningSecret data * @return Wrapped AppSigningSecret data */ export function wrapAppSigningSecret(makeRequest, data) { const signingSecret = toPlainObject(copy(data)); return enhanceWithMethods(signingSecret, createSigningSecretApi(makeRequest)); }