permissions.d.ts 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. import { APIResource } from "../../../resource.js";
  2. import * as Core from "../../../core.js";
  3. import { Page } from "../../../pagination.js";
  4. export declare class Permissions extends APIResource {
  5. /**
  6. * **NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys).
  7. *
  8. * This enables organization owners to share fine-tuned models with other projects
  9. * in their organization.
  10. *
  11. * @example
  12. * ```ts
  13. * // Automatically fetches more pages as needed.
  14. * for await (const permissionCreateResponse of client.fineTuning.checkpoints.permissions.create(
  15. * 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd',
  16. * { project_ids: ['string'] },
  17. * )) {
  18. * // ...
  19. * }
  20. * ```
  21. */
  22. create(fineTunedModelCheckpoint: string, body: PermissionCreateParams, options?: Core.RequestOptions): Core.PagePromise<PermissionCreateResponsesPage, PermissionCreateResponse>;
  23. /**
  24. * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
  25. *
  26. * Organization owners can use this endpoint to view all permissions for a
  27. * fine-tuned model checkpoint.
  28. *
  29. * @example
  30. * ```ts
  31. * const permission =
  32. * await client.fineTuning.checkpoints.permissions.retrieve(
  33. * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F',
  34. * );
  35. * ```
  36. */
  37. retrieve(fineTunedModelCheckpoint: string, query?: PermissionRetrieveParams, options?: Core.RequestOptions): Core.APIPromise<PermissionRetrieveResponse>;
  38. retrieve(fineTunedModelCheckpoint: string, options?: Core.RequestOptions): Core.APIPromise<PermissionRetrieveResponse>;
  39. /**
  40. * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
  41. *
  42. * Organization owners can use this endpoint to delete a permission for a
  43. * fine-tuned model checkpoint.
  44. *
  45. * @example
  46. * ```ts
  47. * const permission =
  48. * await client.fineTuning.checkpoints.permissions.del(
  49. * 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd',
  50. * 'cp_zc4Q7MP6XxulcVzj4MZdwsAB',
  51. * );
  52. * ```
  53. */
  54. del(fineTunedModelCheckpoint: string, permissionId: string, options?: Core.RequestOptions): Core.APIPromise<PermissionDeleteResponse>;
  55. }
  56. /**
  57. * Note: no pagination actually occurs yet, this is for forwards-compatibility.
  58. */
  59. export declare class PermissionCreateResponsesPage extends Page<PermissionCreateResponse> {
  60. }
  61. /**
  62. * The `checkpoint.permission` object represents a permission for a fine-tuned
  63. * model checkpoint.
  64. */
  65. export interface PermissionCreateResponse {
  66. /**
  67. * The permission identifier, which can be referenced in the API endpoints.
  68. */
  69. id: string;
  70. /**
  71. * The Unix timestamp (in seconds) for when the permission was created.
  72. */
  73. created_at: number;
  74. /**
  75. * The object type, which is always "checkpoint.permission".
  76. */
  77. object: 'checkpoint.permission';
  78. /**
  79. * The project identifier that the permission is for.
  80. */
  81. project_id: string;
  82. }
  83. export interface PermissionRetrieveResponse {
  84. data: Array<PermissionRetrieveResponse.Data>;
  85. has_more: boolean;
  86. object: 'list';
  87. first_id?: string | null;
  88. last_id?: string | null;
  89. }
  90. export declare namespace PermissionRetrieveResponse {
  91. /**
  92. * The `checkpoint.permission` object represents a permission for a fine-tuned
  93. * model checkpoint.
  94. */
  95. interface Data {
  96. /**
  97. * The permission identifier, which can be referenced in the API endpoints.
  98. */
  99. id: string;
  100. /**
  101. * The Unix timestamp (in seconds) for when the permission was created.
  102. */
  103. created_at: number;
  104. /**
  105. * The object type, which is always "checkpoint.permission".
  106. */
  107. object: 'checkpoint.permission';
  108. /**
  109. * The project identifier that the permission is for.
  110. */
  111. project_id: string;
  112. }
  113. }
  114. export interface PermissionDeleteResponse {
  115. /**
  116. * The ID of the fine-tuned model checkpoint permission that was deleted.
  117. */
  118. id: string;
  119. /**
  120. * Whether the fine-tuned model checkpoint permission was successfully deleted.
  121. */
  122. deleted: boolean;
  123. /**
  124. * The object type, which is always "checkpoint.permission".
  125. */
  126. object: 'checkpoint.permission';
  127. }
  128. export interface PermissionCreateParams {
  129. /**
  130. * The project identifiers to grant access to.
  131. */
  132. project_ids: Array<string>;
  133. }
  134. export interface PermissionRetrieveParams {
  135. /**
  136. * Identifier for the last permission ID from the previous pagination request.
  137. */
  138. after?: string;
  139. /**
  140. * Number of permissions to retrieve.
  141. */
  142. limit?: number;
  143. /**
  144. * The order in which to retrieve permissions.
  145. */
  146. order?: 'ascending' | 'descending';
  147. /**
  148. * The ID of the project to get permissions for.
  149. */
  150. project_id?: string;
  151. }
  152. export declare namespace Permissions {
  153. export { type PermissionCreateResponse as PermissionCreateResponse, type PermissionRetrieveResponse as PermissionRetrieveResponse, type PermissionDeleteResponse as PermissionDeleteResponse, PermissionCreateResponsesPage as PermissionCreateResponsesPage, type PermissionCreateParams as PermissionCreateParams, type PermissionRetrieveParams as PermissionRetrieveParams, };
  154. }
  155. //# sourceMappingURL=permissions.d.ts.map