@@ -45,35 +45,11 @@ export class Files extends APIResource {
4545 *
4646 * @example
4747 * ```ts
48- * const file = await client.files.update('fileId', {
49- * customCoordinates: '10,10,100,100',
50- * customMetadata: { brand: 'Nike', color: 'red' },
51- * extensions: [
52- * { name: 'remove-bg', options: { add_shadow: true } },
53- * {
54- * name: 'google-auto-tagging',
55- * minConfidence: 80,
56- * maxTags: 10,
57- * },
58- * {
59- * name: 'aws-auto-tagging',
60- * minConfidence: 80,
61- * maxTags: 10,
62- * },
63- * { name: 'ai-auto-description' },
64- * ],
65- * removeAITags: ['car', 'vehicle', 'motorsports'],
66- * tags: ['tag1', 'tag2'],
67- * webhookUrl:
68- * 'https://webhook.site/0d6b6c7a-8e5a-4b3a-8b7c-0d6b6c7a8e5a',
69- * });
48+ * const file = await client.files.update('fileId');
7049 * ```
7150 */
72- update (
73- fileID : string ,
74- body : FileUpdateParams | null | undefined = { } ,
75- options ?: RequestOptions ,
76- ) : APIPromise < FileUpdateResponse > {
51+ update ( fileID : string , params : FileUpdateParams , options ?: RequestOptions ) : APIPromise < FileUpdateResponse > {
52+ const body = 'body' in params ? params . body : params ;
7753 return this . _client . patch ( path `/v1/files/${ fileID } /details` , { body, ...options } ) ;
7854 }
7955
@@ -632,11 +608,12 @@ export namespace Metadata {
632608 }
633609}
634610
635- export type UpdateFileDetailsRequest =
636- | UpdateFileDetailsRequest . UpdateFileDetails
637- | UpdateFileDetailsRequest . ChangePublicationStatus ;
611+ /**
612+ * Schema for update file update request.
613+ */
614+ export type UpdateFileRequest = UpdateFileRequest . UpdateFileDetails | unknown ;
638615
639- export namespace UpdateFileDetailsRequest {
616+ export namespace UpdateFileRequest {
640617 export interface UpdateFileDetails {
641618 /**
642619 * Define an important area in the image in the format `x,y,width,height` e.g.
@@ -688,31 +665,6 @@ export namespace UpdateFileDetailsRequest {
688665 */
689666 webhookUrl ?: string ;
690667 }
691-
692- export interface ChangePublicationStatus {
693- /**
694- * Configure the publication status of a file and its versions.
695- */
696- publish ?: ChangePublicationStatus . Publish ;
697- }
698-
699- export namespace ChangePublicationStatus {
700- /**
701- * Configure the publication status of a file and its versions.
702- */
703- export interface Publish {
704- /**
705- * Set to `true` to publish the file. Set to `false` to unpublish the file.
706- */
707- isPublished : boolean ;
708-
709- /**
710- * Set to `true` to publish/unpublish all versions of the file. Set to `false` to
711- * publish/unpublish only the current version of the file.
712- */
713- includeFileVersions ?: boolean ;
714- }
715- }
716668}
717669
718670/**
@@ -1011,28 +963,7 @@ export declare namespace FileUpdateParams {
1011963 }
1012964
1013965 export interface ChangePublicationStatus {
1014- /**
1015- * Configure the publication status of a file and its versions.
1016- */
1017- publish ?: ChangePublicationStatus . Publish ;
1018- }
1019-
1020- export namespace ChangePublicationStatus {
1021- /**
1022- * Configure the publication status of a file and its versions.
1023- */
1024- export interface Publish {
1025- /**
1026- * Set to `true` to publish the file. Set to `false` to unpublish the file.
1027- */
1028- isPublished : boolean ;
1029-
1030- /**
1031- * Set to `true` to publish/unpublish all versions of the file. Set to `false` to
1032- * publish/unpublish only the current version of the file.
1033- */
1034- includeFileVersions ?: boolean ;
1035- }
966+ body : unknown ;
1036967 }
1037968}
1038969
@@ -1414,7 +1345,7 @@ export declare namespace Files {
14141345 type File as File ,
14151346 type Folder as Folder ,
14161347 type Metadata as Metadata ,
1417- type UpdateFileDetailsRequest as UpdateFileDetailsRequest ,
1348+ type UpdateFileRequest as UpdateFileRequest ,
14181349 type FileUpdateResponse as FileUpdateResponse ,
14191350 type FileCopyResponse as FileCopyResponse ,
14201351 type FileMoveResponse as FileMoveResponse ,
0 commit comments