UNPKG

contentful-management

Version:
27 lines (24 loc) 935 B
import { get as get$1 } from './raw.mjs'; const getMany = (http, params) => { return get$1(http, `/organizations`, { params: params?.query, }); }; const get = (http, params) => { return getMany(http, { query: { limit: 100 } }).then((data) => { const org = data.items.find((org) => org.sys.id === params.organizationId); if (!org) { const error = new Error(`No organization was found with the ID ${params.organizationId} instead got ${JSON.stringify(data)}`); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore error.status = 404; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore error.statusText = 'Not Found'; return Promise.reject(error); } return org; }); }; export { get, getMany }; //# sourceMappingURL=organization.mjs.map