UNPKG

1.43 kBTypeScriptView Raw
1import type { DefaultElements, MakeRequest, MetaSysProps, SysLink } from '../common-types';
2export type UploadCredentialProps = {
3 /**
4 * System metadata
5 */
6 sys: MetaSysProps & {
7 space: SysLink;
8 environment?: SysLink;
9 };
10};
11export interface UploadCredential extends UploadCredentialProps, DefaultElements<UploadCredentialProps> {
12 /**
13 * creates the upload credentials.
14 * @return upload credentials for file uploads
15 * @example
16 * const contentful = require('contentful-management')
17 *
18 * const client = contentful.createClient({
19 * accessToken: '<content_management_api_key>'
20 * })
21 *
22 * try {
23 * const space = await client.getSpace('<space_id>')
24 * const environment = await space.getEnvironment('<environment_id>')
25 *
26 * const upload = await client.uploadCredential.create({
27 * spaceId: space.sys.id,
28 * environmentId: environment.sys.id
29 * })
30 * } catch (error) {
31 * console.error(error)
32 * }
33 *
34 */
35 create(): Promise<UploadCredentialProps>;
36}
37/**
38 * @private
39 * @param {function} makeRequest - function to make requests via an adapter
40 * @param {object} data - Raw upload credential data
41 * @return {UploadCredential} Wrapped upload credential data
42 */
43export declare function wrapUploadCredential(makeRequest: MakeRequest, data: UploadCredentialProps): UploadCredential;