files.d.mts 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. import { APIResource } from "../../../core/resource.mjs";
  2. import * as ContentAPI from "./content.mjs";
  3. import { Content, ContentRetrieveParams } from "./content.mjs";
  4. import { APIPromise } from "../../../core/api-promise.mjs";
  5. import { CursorPage, type CursorPageParams, PagePromise } from "../../../core/pagination.mjs";
  6. import { type Uploadable } from "../../../core/uploads.mjs";
  7. import { RequestOptions } from "../../../internal/request-options.mjs";
  8. export declare class Files extends APIResource {
  9. content: ContentAPI.Content;
  10. /**
  11. * Create a Container File
  12. *
  13. * You can send either a multipart/form-data request with the raw file content, or
  14. * a JSON request with a file ID.
  15. */
  16. create(containerID: string, body: FileCreateParams, options?: RequestOptions): APIPromise<FileCreateResponse>;
  17. /**
  18. * Retrieve Container File
  19. */
  20. retrieve(fileID: string, params: FileRetrieveParams, options?: RequestOptions): APIPromise<FileRetrieveResponse>;
  21. /**
  22. * List Container files
  23. */
  24. list(containerID: string, query?: FileListParams | null | undefined, options?: RequestOptions): PagePromise<FileListResponsesPage, FileListResponse>;
  25. /**
  26. * Delete Container File
  27. */
  28. delete(fileID: string, params: FileDeleteParams, options?: RequestOptions): APIPromise<void>;
  29. }
  30. export type FileListResponsesPage = CursorPage<FileListResponse>;
  31. export interface FileCreateResponse {
  32. /**
  33. * Unique identifier for the file.
  34. */
  35. id: string;
  36. /**
  37. * Size of the file in bytes.
  38. */
  39. bytes: number;
  40. /**
  41. * The container this file belongs to.
  42. */
  43. container_id: string;
  44. /**
  45. * Unix timestamp (in seconds) when the file was created.
  46. */
  47. created_at: number;
  48. /**
  49. * The type of this object (`container.file`).
  50. */
  51. object: 'container.file';
  52. /**
  53. * Path of the file in the container.
  54. */
  55. path: string;
  56. /**
  57. * Source of the file (e.g., `user`, `assistant`).
  58. */
  59. source: string;
  60. }
  61. export interface FileRetrieveResponse {
  62. /**
  63. * Unique identifier for the file.
  64. */
  65. id: string;
  66. /**
  67. * Size of the file in bytes.
  68. */
  69. bytes: number;
  70. /**
  71. * The container this file belongs to.
  72. */
  73. container_id: string;
  74. /**
  75. * Unix timestamp (in seconds) when the file was created.
  76. */
  77. created_at: number;
  78. /**
  79. * The type of this object (`container.file`).
  80. */
  81. object: 'container.file';
  82. /**
  83. * Path of the file in the container.
  84. */
  85. path: string;
  86. /**
  87. * Source of the file (e.g., `user`, `assistant`).
  88. */
  89. source: string;
  90. }
  91. export interface FileListResponse {
  92. /**
  93. * Unique identifier for the file.
  94. */
  95. id: string;
  96. /**
  97. * Size of the file in bytes.
  98. */
  99. bytes: number;
  100. /**
  101. * The container this file belongs to.
  102. */
  103. container_id: string;
  104. /**
  105. * Unix timestamp (in seconds) when the file was created.
  106. */
  107. created_at: number;
  108. /**
  109. * The type of this object (`container.file`).
  110. */
  111. object: 'container.file';
  112. /**
  113. * Path of the file in the container.
  114. */
  115. path: string;
  116. /**
  117. * Source of the file (e.g., `user`, `assistant`).
  118. */
  119. source: string;
  120. }
  121. export interface FileCreateParams {
  122. /**
  123. * The File object (not file name) to be uploaded.
  124. */
  125. file?: Uploadable;
  126. /**
  127. * Name of the file to create.
  128. */
  129. file_id?: string;
  130. }
  131. export interface FileRetrieveParams {
  132. container_id: string;
  133. }
  134. export interface FileListParams extends CursorPageParams {
  135. /**
  136. * Sort order by the `created_at` timestamp of the objects. `asc` for ascending
  137. * order and `desc` for descending order.
  138. */
  139. order?: 'asc' | 'desc';
  140. }
  141. export interface FileDeleteParams {
  142. container_id: string;
  143. }
  144. export declare namespace Files {
  145. export { type FileCreateResponse as FileCreateResponse, type FileRetrieveResponse as FileRetrieveResponse, type FileListResponse as FileListResponse, type FileListResponsesPage as FileListResponsesPage, type FileCreateParams as FileCreateParams, type FileRetrieveParams as FileRetrieveParams, type FileListParams as FileListParams, type FileDeleteParams as FileDeleteParams, };
  146. export { Content as Content, type ContentRetrieveParams as ContentRetrieveParams };
  147. }
  148. //# sourceMappingURL=files.d.mts.map