// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../core/resource'; import { APIPromise } from '../../core/api-promise'; import { PageCursorURL, PagePromise } from '../../core/pagination'; import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; /** * Agents defined by the company */ export class SourceRevisions extends APIResource { /** * A list of source revisions for an agent. * * @example HTTP * Representative request and response shapes. * ``` * GET /agents/{agent_id}/source-revisions/?limit=1&cursor=cursor HTTP/1.1 * Host: rest.ripplingapis.com * Accept: application/json * Rippling-Api-Version: 2024-08-01 * * HTTP/1.1 200 OK * Content-Type: application/json * * { * "results": [ * { * "id": "string", * "created_at": "string", * "updated_at": "string", * "version": 0, * "source_digest": "string" * } * ], * "next_link": "string" * } * ``` */ list( agentID: string, query: SourceRevisionListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { return this._client.getAPIList( path`/agents/${agentID}/source-revisions/`, PageCursorURL, { query, ...options }, ); } /** * Create a source revision for an agent. * * @example HTTP * Representative request and response shapes. * ``` * POST /agents/{agent_id}/source-revisions/ HTTP/1.1 * Host: rest.ripplingapis.com * Content-Type: application/json * Accept: application/json * Rippling-Api-Version: 2024-08-01 * * { * "entrypoint": "entrypoint", * "files": [ * { * "content": "content", * "kind": "kind", * "path": "path" * } * ] * } * * HTTP/1.1 200 OK * Content-Type: application/json * * { * "id": "string", * "created_at": "string", * "updated_at": "string", * "version": 0, * "files": [ * { * "path": "string", * "content": "string", * "kind": "string" * } * ], * "entrypoint": "string", * "source_digest": "string" * } * ``` */ create( agentID: string, body: SourceRevisionCreateParams, options?: RequestOptions, ): APIPromise { return this._client.post(path`/agents/${agentID}/source-revisions/`, { body, ...options }); } /** * Retrieve a source revision for an agent. * * @example HTTP * Representative request and response shapes. * ``` * GET /agents/{agent_id}/source-revisions/{source_revision_id}/ HTTP/1.1 * Host: rest.ripplingapis.com * Accept: application/json * Rippling-Api-Version: 2024-08-01 * * HTTP/1.1 200 OK * Content-Type: application/json * * { * "id": "string", * "created_at": "string", * "updated_at": "string", * "version": 0, * "files": [ * { * "path": "string", * "content": "string", * "kind": "string" * } * ], * "entrypoint": "string", * "source_digest": "string" * } * ``` */ retrieve( agentID: string, sourceRevisionID: string, options?: RequestOptions, ): APIPromise { return this._client.get(path`/agents/${agentID}/source-revisions/${sourceRevisionID}/`, options); } } export type SourceRevisionListResponsesPageCursorURL = PageCursorURL; /** * List representation of an agent source revision without source contents. */ export interface SourceRevisionListResponse { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * Record update date */ updated_at: string; /** * The digest of the source revision */ source_digest?: string; /** * The version number of the source revision */ version?: number; } export interface SourceRevisionCreateResponse { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * The entrypoint file */ entrypoint: string; /** * The files in the source revision */ files: Array; /** * Record update date */ updated_at: string; /** * The digest of the source revision */ source_digest?: string; /** * The version number of the source revision */ version?: number; } export namespace SourceRevisionCreateResponse { export interface File { /** * The contents of the source file */ content: string; /** * The source file language or format */ kind: string; /** * The path of the source file */ path: string; } } export interface SourceRevisionRetrieveResponse { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * The entrypoint file */ entrypoint: string; /** * The files in the source revision */ files: Array; /** * Record update date */ updated_at: string; /** * The digest of the source revision */ source_digest?: string; /** * The version number of the source revision */ version?: number; } export namespace SourceRevisionRetrieveResponse { export interface File { /** * The contents of the source file */ content: string; /** * The source file language or format */ kind: string; /** * The path of the source file */ path: string; } } export interface SourceRevisionListParams { /** * The cursor from a previous next_link. */ cursor?: string; /** * The maximum number of results to return. */ limit?: number; } export interface SourceRevisionCreateParams { /** * The entrypoint file */ entrypoint: string; /** * The files in the source revision */ files: Array; } export namespace SourceRevisionCreateParams { export interface File { /** * The contents of the source file */ content: string; /** * The source file language or format */ kind: string; /** * The path of the source file */ path: string; } } export declare namespace SourceRevisions { export { type SourceRevisionListResponse as SourceRevisionListResponse, type SourceRevisionCreateResponse as SourceRevisionCreateResponse, type SourceRevisionRetrieveResponse as SourceRevisionRetrieveResponse, type SourceRevisionListResponsesPageCursorURL as SourceRevisionListResponsesPageCursorURL, type SourceRevisionListParams as SourceRevisionListParams, type SourceRevisionCreateParams as SourceRevisionCreateParams, }; }