// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../core/resource'; import * as ComponentsAPI from './components'; import { ComponentDeployParams, ComponentDeployResponse, ComponentValidateParams, ComponentValidateResponse, Components, } from './components'; import * as DeploymentRunsAPI from './deployment-runs'; import { DeploymentRunCreateParams, DeploymentRunCreateResponse, DeploymentRunGetResponse, DeploymentRuns, } from './deployment-runs'; import * as SchemaAPI from './schema'; import { Schema, SchemaGetParams, SchemaGetResponse } from './schema'; import * as TypesAPI from './types'; import { TypeListResponse, Types } from './types'; import * as ValidationRunsAPI from './validation-runs'; import { ValidationRunCreateParams, ValidationRunCreateResponse, ValidationRunGetResponse, ValidationRuns, } from './validation-runs'; import { APIPromise } from '../../core/api-promise'; import { RequestOptions } from '../../internal/request-options'; /** * Custom objects defined by the company */ export class Metadata extends APIResource { types: TypesAPI.Types = new TypesAPI.Types(this._client); schema: SchemaAPI.Schema = new SchemaAPI.Schema(this._client); components: ComponentsAPI.Components = new ComponentsAPI.Components(this._client); validationRuns: ValidationRunsAPI.ValidationRuns = new ValidationRunsAPI.ValidationRuns(this._client); deploymentRuns: DeploymentRunsAPI.DeploymentRuns = new DeploymentRunsAPI.DeploymentRuns(this._client); /** * Extract the company's selectable metadata components, optionally filtered by a * search query. Unreadable dependencies are omitted. * * Requires the Metadata entitlement. * * @example SDK usage * ```ts * const response = await client.metadata.extract(); * ``` * * @example HTTP * Representative request and response shapes. * ``` * GET /metadata/extract/?q=q&limit=1 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 * * { * "root_components": [ * { * "name": "string", * "identifier": {} * } * ], * "component_configs": [ * { * "type": "string" * } * ], * "install_order": [ * {} * ], * "dependency_graph": {}, * "external_managed_dependencies": [ * {} * ], * "context_complete": false, * "context_warnings": [ * "string" * ] * } * ``` */ extract( query: MetadataExtractParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.get('/metadata/extract/', { query, ...options }); } /** * Extract exact metadata components and their readable dependency closure. * Requested components that cannot be read return 403; unreadable dependencies are * omitted. * * Requires the Metadata entitlement. * * @example SDK usage * ```ts * const response = await client.metadata.extractByIdentifiers( * { identifiers: [{ foo: 'bar' }] }, * ); * ``` * * @example HTTP * Representative request and response shapes. * ``` * POST /metadata/extract/ HTTP/1.1 * Host: rest.ripplingapis.com * Content-Type: application/json * Accept: application/json * Rippling-Api-Version: 2024-08-01 * * { * "identifiers": [ * { * "foo": "bar" * } * ] * } * * HTTP/1.1 200 OK * Content-Type: application/json * * { * "component_configs": [ * { * "type": "string" * } * ], * "install_order": [ * {} * ], * "external_managed_dependencies": [ * {} * ] * } * ``` */ extractByIdentifiers( body: MetadataExtractByIdentifiersParams, options?: RequestOptions, ): APIPromise { return this._client.post('/metadata/extract/', { body, ...options }); } } export interface MetadataExtractResponse { /** * Readable component configs for the selected roots. Dependencies the caller * cannot read are omitted, so the result may not be deployable as-is. */ component_configs: Array; /** * Serialized dependency graph for the extracted package. */ dependency_graph: { [key: string]: unknown }; /** * Topological install order for the extracted package. */ install_order: Array<{ [key: string]: unknown }>; /** * Components selected as extraction roots. */ root_components: Array; /** * For search-backed extraction, whether contextual expansion completed without * warnings or unreadable components being omitted. */ context_complete?: boolean; /** * Warnings from search-backed contextual expansion. */ context_warnings?: Array; external_managed_dependencies?: Array<{ [key: string]: unknown }>; [k: string]: unknown; } export namespace MetadataExtractResponse { /** * A metadata component config. The `type` field selects the concrete component * schema. Fetch type-specific fields from GET /metadata/schema/?type=. */ export interface ComponentConfig { /** * Metadata component type, such as CUSTOM_OBJECT or CUSTOM_OBJECT_FIELD. */ type: string; [k: string]: unknown; } /** * Selectable package root returned by metadata extraction. */ export interface RootComponent { /** * Identifier for the selected component. */ identifier?: { [key: string]: unknown }; /** * Display name for the selectable component. */ name?: string; [k: string]: unknown; } } export interface MetadataExtractByIdentifiersResponse { /** * Readable component configs for the requested roots. Unreadable dependencies are * omitted, so the result may not be deployable as-is. */ component_configs: Array; external_managed_dependencies: Array<{ [key: string]: unknown }>; /** * Topological install order for the extracted package. */ install_order: Array<{ [key: string]: unknown }>; } export namespace MetadataExtractByIdentifiersResponse { /** * A metadata component config. The `type` field selects the concrete component * schema. Fetch type-specific fields from GET /metadata/schema/?type=. */ export interface ComponentConfig { /** * Metadata component type, such as CUSTOM_OBJECT or CUSTOM_OBJECT_FIELD. */ type: string; [k: string]: unknown; } } export interface MetadataExtractParams { /** * Maximum search results to return when q is provided. */ limit?: number; /** * Optional text search over selectable components. */ q?: string; } export interface MetadataExtractByIdentifiersParams { identifiers: Array<{ [key: string]: unknown }>; } Metadata.Types = Types; Metadata.Schema = Schema; Metadata.Components = Components; Metadata.ValidationRuns = ValidationRuns; Metadata.DeploymentRuns = DeploymentRuns; export declare namespace Metadata { export { type MetadataExtractResponse as MetadataExtractResponse, type MetadataExtractByIdentifiersResponse as MetadataExtractByIdentifiersResponse, type MetadataExtractParams as MetadataExtractParams, type MetadataExtractByIdentifiersParams as MetadataExtractByIdentifiersParams, }; export { Types as Types, type TypeListResponse as TypeListResponse }; export { Schema as Schema, type SchemaGetResponse as SchemaGetResponse, type SchemaGetParams as SchemaGetParams, }; export { Components as Components, type ComponentValidateResponse as ComponentValidateResponse, type ComponentDeployResponse as ComponentDeployResponse, type ComponentValidateParams as ComponentValidateParams, type ComponentDeployParams as ComponentDeployParams, }; export { ValidationRuns as ValidationRuns, type ValidationRunCreateResponse as ValidationRunCreateResponse, type ValidationRunGetResponse as ValidationRunGetResponse, type ValidationRunCreateParams as ValidationRunCreateParams, }; export { DeploymentRuns as DeploymentRuns, type DeploymentRunCreateResponse as DeploymentRunCreateResponse, type DeploymentRunGetResponse as DeploymentRunGetResponse, type DeploymentRunCreateParams as DeploymentRunCreateParams, }; }