Skip to content

Commit 25c15f5

Browse files
authored
chore: fix types & docs for upload credentials [] (#2466)
1 parent 3d0fca0 commit 25c15f5

File tree

2 files changed

+70
-63
lines changed

2 files changed

+70
-63
lines changed

lib/entities/upload-credential.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,27 @@ export interface UploadCredential
1414
extends UploadCredentialProps,
1515
DefaultElements<UploadCredentialProps> {
1616
/**
17-
* Deletes this object on the server.
18-
* @return Promise for the deletion. It contains no data, but the Promise error case should be handled.
17+
* creates the upload credentials.
18+
* @return upload credentials for file uploads
1919
* @example
2020
* const contentful = require('contentful-management')
2121
*
2222
* const client = contentful.createClient({
2323
* accessToken: '<content_management_api_key>'
2424
* })
2525
*
26-
* client.getSpace('<space_id>')
27-
* .then((space) => space.getEnvironment('<environment_id>'))
28-
* .then((environment) => environment.getUpload('<upload_id>'))
29-
* .then((upload) => upload.delete())
30-
* .then((upload) => console.log(`upload ${upload.sys.id} updated.`))
31-
* .catch(console.error)
26+
* try {
27+
* const space = await client.getSpace('<space_id>')
28+
* const environment = await space.getEnvironment('<environment_id>')
29+
*
30+
* const upload = await client.uploadCredential.create({
31+
* spaceId: space.sys.id,
32+
* environmentId: environment.sys.id
33+
* })
34+
* } catch (error) {
35+
* console.error(error)
36+
* }
37+
*
3238
*/
3339
create(): Promise<UploadCredentialProps>
3440
}

lib/export-types.ts

Lines changed: 56 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
export * from './common-types'
2-
export * from './plain/common-types'
2+
export type {
3+
AccessToken,
4+
AccessTokenProps as AccessTokenProp,
5+
CreatePersonalAccessTokenProps as CreatePATProps,
6+
} from './entities/access-token'
37
export type { ApiKey, ApiKeyProps, CreateApiKeyProps } from './entities/api-key'
8+
export type {
9+
AppAccessToken,
10+
AppAccessTokenProps,
11+
CreateAppAccessTokenProps,
12+
} from './entities/app-access-token'
413
export type {
514
AppAction,
615
AppActionCategoryProps,
@@ -38,11 +47,17 @@ export type {
3847
CreateAppDetailsProps,
3948
IconType,
4049
} from './entities/app-details'
50+
export type {
51+
AppEventSubscription,
52+
AppEventSubscriptionProps,
53+
CreateAppEventSubscriptionProps,
54+
} from './entities/app-event-subscription'
4155
export type {
4256
AppInstallation,
4357
AppInstallationProps,
4458
CreateAppInstallationProps,
4559
} from './entities/app-installation'
60+
export type { AppKey, AppKeyProps, CreateAppKeyProps } from './entities/app-key'
4661
export type {
4762
AppSignedRequest,
4863
AppSignedRequestProps,
@@ -53,17 +68,6 @@ export type {
5368
AppSigningSecretProps,
5469
CreateAppSigningSecretProps,
5570
} from './entities/app-signing-secret'
56-
export type {
57-
AppEventSubscription,
58-
AppEventSubscriptionProps,
59-
CreateAppEventSubscriptionProps,
60-
} from './entities/app-event-subscription'
61-
export type { AppKey, AppKeyProps, CreateAppKeyProps } from './entities/app-key'
62-
export type {
63-
AppAccessToken,
64-
AppAccessTokenProps,
65-
CreateAppAccessTokenProps,
66-
} from './entities/app-access-token'
6771
export type { AppUpload, AppUploadProps } from './entities/app-upload'
6872
export type { Asset, AssetFileProp, AssetProps, CreateAssetProps } from './entities/asset'
6973
export type { AssetKey, AssetKeyProps, CreateAssetKeyProps } from './entities/asset-key'
@@ -78,15 +82,15 @@ export type {
7882
BulkActionValidatePayload,
7983
} from './entities/bulk-action'
8084
export type {
81-
RichTextCommentDocument,
82-
RichTextCommentProps,
8385
Comment,
8486
CommentProps,
8587
CreateCommentProps,
86-
UpdateCommentProps,
8788
DeleteCommentParams,
8889
GetCommentParentEntityParams,
8990
GetManyCommentsParams,
91+
RichTextCommentDocument,
92+
RichTextCommentProps,
93+
UpdateCommentProps,
9094
} from './entities/comment'
9195
export type {
9296
AnnotationAssignment,
@@ -112,7 +116,6 @@ export type {
112116
GroupControl,
113117
SidebarItem,
114118
} from './entities/editor-interface'
115-
export type { FunctionProps } from './entities/function'
116119
export type { CreateEntryProps, Entry, EntryProps, WithResourceName } from './entities/entry'
117120
export type { CreateEnvironmentProps, Environment, EnvironmentProps } from './entities/environment'
118121
export type {
@@ -143,6 +146,7 @@ export type {
143146
ExtensionProps as UIExtensionProps,
144147
} from './entities/extension'
145148
export type { FieldType } from './entities/field-type'
149+
export type { FunctionProps } from './entities/function'
146150
export type { CreateLocaleProps, Locale, LocaleProps } from './entities/locale'
147151
export type { Organization, OrganizationProp, OrganizationProps } from './entities/organization'
148152
export type {
@@ -160,21 +164,16 @@ export type {
160164
PersonalAccessTokenProp,
161165
PersonalAccessTokenProps,
162166
} from './entities/personal-access-token'
163-
export type {
164-
CreatePersonalAccessTokenProps as CreatePATProps,
165-
AccessToken,
166-
AccessTokenProps as AccessTokenProp,
167-
} from './entities/access-token'
168167
export type { PreviewApiKey, PreviewApiKeyProps } from './entities/preview-api-key'
169168
export type {
170169
Release,
170+
ReleaseMetadata,
171171
ReleasePayload,
172172
ReleaseProps,
173173
ReleaseQueryOptions,
174+
ReleaseReferenceFilters,
174175
ReleaseSysProps,
175176
ReleaseValidateOptions,
176-
ReleaseMetadata,
177-
ReleaseReferenceFilters,
178177
} from './entities/release'
179178
export type {
180179
ReleaseAction,
@@ -212,66 +211,82 @@ export type {
212211
} from './entities/team-space-membership'
213212
export type { UIConfig, UIConfigProps } from './entities/ui-config'
214213
export type { Upload, UploadProps } from './entities/upload'
214+
export type { UploadCredential, UploadCredentialProps } from './entities/upload-credential'
215215
export type { Usage, UsageProps } from './entities/usage'
216216
export type { User, UserProps } from './entities/user'
217217
export type { UserUIConfig, UserUIConfigProps } from './entities/user-ui-config'
218218
export type {
219219
CreateWebhooksProps,
220220
UpdateWebhookProps,
221+
UpsertWebhookSigningSecretPayload,
222+
WebHooks,
221223
WebhookCallRequest,
222224
WebhookFilter,
223225
WebhookProps,
224-
WebHooks,
225-
WebhookTransformation,
226-
UpsertWebhookSigningSecretPayload,
227226
WebhookSigningSecretProps,
227+
WebhookTransformation,
228228
} from './entities/webhook'
229229
export type {
230-
// General typings (props, params, options)
231-
WorkflowDefinition,
232-
WorkflowDefinitionSysProps,
233-
WorkflowDefinitionProps,
234-
CreateWorkflowDefinitionProps,
235-
UpdateWorkflowDefinitionProps,
236230
CreateWorkflowDefinitionParams,
237-
UpdateWorkflowDefinitionParams,
231+
CreateWorkflowDefinitionProps,
232+
CreateWorkflowStepProps,
238233
DeleteWorkflowDefinitionParams,
239-
WorkflowStepProps,
234+
UpdateWorkflowDefinitionParams,
235+
UpdateWorkflowDefinitionProps,
240236
UpdateWorkflowStepProps,
241-
CreateWorkflowStepProps,
237+
// General typings (props, params, options)
238+
WorkflowDefinition,
239+
WorkflowDefinitionProps,
242240
WorkflowDefinitionQueryOptions,
241+
WorkflowDefinitionSysProps,
243242
// Property: appliesTo
244243
WorkflowDefinitionValidationLink,
245244
// Property: step.actions
246245
WorkflowStepAction,
247246
WorkflowStepActionType,
247+
WorkflowStepAppAction,
248+
WorkflowStepEmailAction,
249+
WorkflowStepEmailActionRecipient,
248250
// Property: step.permissions
249251
WorkflowStepPermission,
250252
WorkflowStepPermissionActors,
251-
WorkflowStepEmailActionRecipient,
252-
WorkflowStepEmailAction,
253+
WorkflowStepProps,
253254
WorkflowStepTaskAction,
254-
WorkflowStepAppAction,
255255
} from './entities/workflow-definition'
256+
export * from './plain/common-types'
256257

257258
export {
258-
WorkflowStepPermissionType,
259259
WorkflowStepPermissionAction,
260260
WorkflowStepPermissionEffect,
261+
WorkflowStepPermissionType,
261262
} from './entities/workflow-definition'
262263

264+
export type { ConceptProps, CreateConceptProps } from './entities/concept'
265+
export type { ConceptSchemeProps, CreateConceptSchemeProps } from './entities/concept-scheme'
266+
export type { ResourceProps, ResourceQueryOptions } from './entities/resource'
267+
export type {
268+
ResourceProvider,
269+
ResourceProviderProps,
270+
UpsertResourceProviderProps,
271+
} from './entities/resource-provider'
272+
export type {
273+
ResourceType,
274+
ResourceTypeProps,
275+
SpaceEnvResourceTypeProps,
276+
UpsertResourceTypeProps,
277+
} from './entities/resource-type'
263278
export type {
264279
DefinedParameters,
265280
FreeFormParameters,
281+
InstallationParameterType,
266282
ParameterDefinition,
267283
ParameterOption,
268284
ParameterType,
269-
InstallationParameterType,
270285
} from './entities/widget-parameters'
271286
export type {
272287
CreateWorkflowProps,
273-
UpdateWorkflowProps,
274288
DeleteWorkflowParams,
289+
UpdateWorkflowProps,
275290
Workflow,
276291
WorkflowProps,
277292
WorkflowQueryOptions,
@@ -281,17 +296,3 @@ export type {
281296
WorkflowsChangelogEntryProps,
282297
WorkflowsChangelogQueryOptions,
283298
} from './entities/workflows-changelog-entry'
284-
export type { ConceptProps, CreateConceptProps } from './entities/concept'
285-
export type { ConceptSchemeProps, CreateConceptSchemeProps } from './entities/concept-scheme'
286-
export type {
287-
ResourceProvider,
288-
ResourceProviderProps,
289-
UpsertResourceProviderProps,
290-
} from './entities/resource-provider'
291-
export type {
292-
ResourceType,
293-
ResourceTypeProps,
294-
SpaceEnvResourceTypeProps,
295-
UpsertResourceTypeProps,
296-
} from './entities/resource-type'
297-
export type { ResourceProps, ResourceQueryOptions } from './entities/resource'

0 commit comments

Comments
 (0)