// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../core/resource'; import * as BusinessPartnersAPI from '../business-partners'; import * as AvailableUpgradesAPI from './available-upgrades'; import { AvailableUpgradeRetrieveParams, AvailableUpgradeRetrieveResponse, AvailableUpgrades, } from './available-upgrades'; import * as NextVersionsAPI from './next-versions'; import { NextVersionCreateParams, NextVersionCreateResponse, NextVersions } from './next-versions'; import * as VersionsAPI from './versions'; import { VersionCreateParams, VersionCreateResponse, VersionListParams, VersionListResponse, VersionListResponsesPageCursorURL, Versions, } from './versions'; import { APIPromise } from '../../core/api-promise'; import { PageCursorURL, PagePromise } from '../../core/pagination'; import { buildHeaders } from '../../internal/headers'; import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; /** * Author, publish, and install Unity Packages V2 packages */ export class Packages extends APIResource { availableUpgrades: AvailableUpgradesAPI.AvailableUpgrades = new AvailableUpgradesAPI.AvailableUpgrades( this._client, ); versions: VersionsAPI.Versions = new VersionsAPI.Versions(this._client); nextVersions: NextVersionsAPI.NextVersions = new NextVersionsAPI.NextVersions(this._client); /** * A list of packages. * * - Requires: `Unity Packages V2 Platform API` * - Filterable fields: `package_key` * - Sortable fields: `id`, `created_at`, `updated_at` * * @example HTTP * Representative request and response shapes. * ``` * GET /packages/?filter=filter&order_by=order_by&limit=50&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 * * { * "__meta": { * "redacted_fields": [ * { * "name": "date_of_birth", * "reason": "Insufficient entitlements" * } * ] * }, * "results": [ * { * "id": "string", * "created_at": "string", * "updated_at": "string", * "package_key": "string", * "package_display_name": "string", * "description": "string", * "package_type": "MANAGED", * "latest_version_id": "string", * "latest_version_number": "string" * } * ], * "next_link": "string" * } * ``` */ list( query: PackageListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { return this._client.getAPIList('/packages/', PageCursorURL, { query, ...options }); } /** * Create a new package * * @example HTTP * Representative request and response shapes. * ``` * POST /packages/ HTTP/1.1 * Host: rest.ripplingapis.com * Content-Type: application/json * Accept: application/json * Rippling-Api-Version: 2024-08-01 * * { * "package_display_name": "package_display_name", * "package_key": "package_key", * "package_type": "MANAGED" * } * * HTTP/1.1 200 OK * Content-Type: application/json * * { * "id": "string", * "created_at": "string", * "updated_at": "string", * "package_key": "string", * "package_display_name": "string", * "description": "string", * "package_type": "MANAGED", * "latest_version_id": "string", * "latest_version_number": "string" * } * ``` */ create(body: PackageCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/packages/', { body, ...options }); } /** * Retrieve a specific package * * @example HTTP * Representative request and response shapes. * ``` * GET /packages/{package_key}/ 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 * * { * "__meta": { * "redacted_fields": [ * {} * ] * } * } * ``` */ retrieve(packageKey: string, options?: RequestOptions): APIPromise { return this._client.get(path`/packages/${packageKey}/`, options); } /** * Update a specific package. * * @example HTTP * Representative request and response shapes. * ``` * PATCH /packages/{package_key}/ HTTP/1.1 * Host: rest.ripplingapis.com * Content-Type: application/json * Accept: application/json * Rippling-Api-Version: 2024-08-01 * * { * "package_display_name": "package_display_name", * "package_key": "package_key", * "package_type": "MANAGED" * } * * HTTP/1.1 200 OK * Content-Type: application/json * * { * "id": "string", * "created_at": "string", * "updated_at": "string", * "package_key": "string", * "package_display_name": "string", * "description": "string", * "package_type": "MANAGED", * "latest_version_id": "string", * "latest_version_number": "string" * } * ``` */ update( packageKey: string, body: PackageUpdateParams, options?: RequestOptions, ): APIPromise { return this._client.patch(path`/packages/${packageKey}/`, { body, ...options }); } /** * Delete a package * * @example HTTP * Representative request and response shapes. * ``` * DELETE /packages/{package_key}/ HTTP/1.1 * Host: rest.ripplingapis.com * Rippling-Api-Version: 2024-08-01 * * HTTP/1.1 204 No Content * ``` */ delete(packageKey: string, options?: RequestOptions): APIPromise { return this._client.delete(path`/packages/${packageKey}/`, { ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } } export type PackageListResponsesPageCursorURL = PageCursorURL; export interface PackageListResponse { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * The display name of the package */ package_display_name: string; /** * The unique package key within the publisher company */ package_key: string; /** * The package type */ package_type: 'MANAGED' | 'UNMANAGED'; /** * Record update date */ updated_at: string; /** * The description of the package */ description?: string; /** * The ID of the latest package version, if any */ latest_version_id?: string; /** * The version number of the latest package version, if any */ latest_version_number?: string; } export interface PackageCreateResponse { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * The display name of the package */ package_display_name: string; /** * The unique package key within the publisher company */ package_key: string; /** * The package type */ package_type: 'MANAGED' | 'UNMANAGED'; /** * Record update date */ updated_at: string; /** * The description of the package */ description?: string; /** * The ID of the latest package version, if any */ latest_version_id?: string; /** * The version number of the latest package version, if any */ latest_version_number?: string; } /** * Meta information for the response. */ export interface PackageRetrieveResponse extends BusinessPartnersAPI.Meta { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * The display name of the package */ package_display_name: string; /** * The unique package key within the publisher company */ package_key: string; /** * The package type */ package_type: 'MANAGED' | 'UNMANAGED'; /** * Record update date */ updated_at: string; /** * The description of the package */ description?: string; /** * The ID of the latest package version, if any */ latest_version_id?: string; /** * The version number of the latest package version, if any */ latest_version_number?: string; } export interface PackageUpdateResponse { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * The display name of the package */ package_display_name: string; /** * The unique package key within the publisher company */ package_key: string; /** * The package type */ package_type: 'MANAGED' | 'UNMANAGED'; /** * Record update date */ updated_at: string; /** * The description of the package */ description?: string; /** * The ID of the latest package version, if any */ latest_version_id?: string; /** * The version number of the latest package version, if any */ latest_version_number?: string; } export interface PackageListParams { cursor?: string; filter?: string; /** * The maximum number of results to return. Defaults to 50. Maximum is 100. */ limit?: number; order_by?: string; } export interface PackageCreateParams { /** * The display name of the package */ package_display_name: string; /** * The unique package key within the publisher company */ package_key: string; /** * The package type */ package_type: 'MANAGED' | 'UNMANAGED'; /** * The description of the package */ description?: string; } export interface PackageUpdateParams { /** * The display name of the package */ package_display_name: string; /** * The unique package key within the publisher company */ package_key: string; /** * The package type */ package_type: 'MANAGED' | 'UNMANAGED'; /** * The description of the package */ description?: string; } Packages.AvailableUpgrades = AvailableUpgrades; Packages.Versions = Versions; Packages.NextVersions = NextVersions; export declare namespace Packages { export { type PackageListResponse as PackageListResponse, type PackageCreateResponse as PackageCreateResponse, type PackageRetrieveResponse as PackageRetrieveResponse, type PackageUpdateResponse as PackageUpdateResponse, type PackageListResponsesPageCursorURL as PackageListResponsesPageCursorURL, type PackageListParams as PackageListParams, type PackageCreateParams as PackageCreateParams, type PackageUpdateParams as PackageUpdateParams, }; export { AvailableUpgrades as AvailableUpgrades, type AvailableUpgradeRetrieveResponse as AvailableUpgradeRetrieveResponse, type AvailableUpgradeRetrieveParams as AvailableUpgradeRetrieveParams, }; export { Versions as Versions, type VersionListResponse as VersionListResponse, type VersionCreateResponse as VersionCreateResponse, type VersionListResponsesPageCursorURL as VersionListResponsesPageCursorURL, type VersionListParams as VersionListParams, type VersionCreateParams as VersionCreateParams, }; export { NextVersions as NextVersions, type NextVersionCreateResponse as NextVersionCreateResponse, type NextVersionCreateParams as NextVersionCreateParams, }; }