// 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 { RequestOptions } from '../internal/request-options'; import { path } from '../internal/utils/path'; /** * Author, publish, and install Unity Packages V2 packages */ export class PackageVersionComponentUpdates extends APIResource { /** * Start an asynchronous package version component update or preview for a draft * version. Returns a tracker immediately (202). Poll GET * /package-version-component-updates/{id}/ until status is COMPLETE or FAILED. * When is_preview_mode is true, the version is not saved; extraction_result is the * would-change diff. When false, the version is persisted and extraction_result is * the did-change diff. * * @example HTTP * Representative request and response shapes. * ``` * POST /package-version-component-updates/ HTTP/1.1 * Host: rest.ripplingapis.com * Content-Type: application/json * Accept: application/json * Rippling-Api-Version: 2024-08-01 * * { * "action": "ADD", * "version_id": "version_id" * } * * HTTP/1.1 202 Accepted * Content-Type: application/json * * { * "id": "string", * "created_at": "string", * "updated_at": "string", * "package_version_id": "string", * "status": "string", * "error_message": "string", * "extraction_result": {} * } * ``` */ create( body: PackageVersionComponentUpdateCreateParams, options?: RequestOptions, ): APIPromise { return this._client.post('/package-version-component-updates/', { body, ...options }); } /** * Poll a package version component update or preview tracker. On COMPLETE, * extraction_result contains added_nodes, removed_nodes, updated_nodes, and * package_version_id. On FAILED, status is FAILED and error_message is set. Same * response shape for preview and apply. * * @example HTTP * Representative request and response shapes. * ``` * GET /package-version-component-updates/{tracker_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", * "package_version_id": "string", * "status": "string", * "error_message": "string", * "extraction_result": {} * } * ``` */ retrieve( trackerID: string, options?: RequestOptions, ): APIPromise { return this._client.get(path`/package-version-component-updates/${trackerID}/`, options); } } /** * Async package version component-update tracker for publisher companies. */ export interface PackageVersionComponentUpdateCreateResponse { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * Record update date */ updated_at: string; /** * Error message when the update failed */ error_message?: string; /** * Diff of added, removed, and updated nodes when status is COMPLETE. In preview * mode this is what would change; in apply mode this is what did change. Null * while the update is in progress. */ extraction_result?: unknown; /** * The package version being updated */ package_version_id?: string; /** * Update status (IN_PROGRESS, COMPLETE, or FAILED) */ status?: string; } /** * Async package version component-update tracker for publisher companies. */ export interface PackageVersionComponentUpdateRetrieveResponse { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * Record update date */ updated_at: string; /** * Error message when the update failed */ error_message?: string; /** * Diff of added, removed, and updated nodes when status is COMPLETE. In preview * mode this is what would change; in apply mode this is what did change. Null * while the update is in progress. */ extraction_result?: unknown; /** * The package version being updated */ package_version_id?: string; /** * Update status (IN_PROGRESS, COMPLETE, or FAILED) */ status?: string; } export interface PackageVersionComponentUpdateCreateParams { /** * The update action to perform. */ action: 'ADD' | 'REMOVE' | 'REFRESH'; /** * The draft package version to update. */ version_id: string; /** * When true, compute the component diff without persisting the version. When * false, apply and save the changes. Same tracker contract in both modes. */ is_preview_mode?: boolean; /** * Component identifiers required for ADD and REMOVE. */ nodes?: Array; } export declare namespace PackageVersionComponentUpdates { export { type PackageVersionComponentUpdateCreateResponse as PackageVersionComponentUpdateCreateResponse, type PackageVersionComponentUpdateRetrieveResponse as PackageVersionComponentUpdateRetrieveResponse, type PackageVersionComponentUpdateCreateParams as PackageVersionComponentUpdateCreateParams, }; }