files.d.ts 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. import { APIResource } from "../../../resource.js";
  2. import * as Core from "../../../core.js";
  3. import * as ContentAPI from "./content.js";
  4. import { Content } from "./content.js";
  5. import { CursorPage, type CursorPageParams } from "../../../pagination.js";
  6. export declare class Files extends APIResource {
  7. content: ContentAPI.Content;
  8. /**
  9. * Create a Container File
  10. *
  11. * You can send either a multipart/form-data request with the raw file content, or
  12. * a JSON request with a file ID.
  13. */
  14. create(containerId: string, body: FileCreateParams, options?: Core.RequestOptions): Core.APIPromise<FileCreateResponse>;
  15. /**
  16. * Retrieve Container File
  17. */
  18. retrieve(containerId: string, fileId: string, options?: Core.RequestOptions): Core.APIPromise<FileRetrieveResponse>;
  19. /**
  20. * List Container files
  21. */
  22. list(containerId: string, query?: FileListParams, options?: Core.RequestOptions): Core.PagePromise<FileListResponsesPage, FileListResponse>;
  23. list(containerId: string, options?: Core.RequestOptions): Core.PagePromise<FileListResponsesPage, FileListResponse>;
  24. /**
  25. * Delete Container File
  26. */
  27. del(containerId: string, fileId: string, options?: Core.RequestOptions): Core.APIPromise<void>;
  28. }
  29. export declare class FileListResponsesPage extends CursorPage<FileListResponse> {
  30. }
  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?: Core.Uploadable;
  126. /**
  127. * Name of the file to create.
  128. */
  129. file_id?: string;
  130. }
  131. export interface FileListParams extends CursorPageParams {
  132. /**
  133. * Sort order by the `created_at` timestamp of the objects. `asc` for ascending
  134. * order and `desc` for descending order.
  135. */
  136. order?: 'asc' | 'desc';
  137. }
  138. export declare namespace Files {
  139. export { type FileCreateResponse as FileCreateResponse, type FileRetrieveResponse as FileRetrieveResponse, type FileListResponse as FileListResponse, FileListResponsesPage as FileListResponsesPage, type FileCreateParams as FileCreateParams, type FileListParams as FileListParams, };
  140. export { Content as Content };
  141. }
  142. //# sourceMappingURL=files.d.ts.map