// 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 { buildHeaders } from '../../internal/headers'; import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; export class Share extends APIResource { /** * Creates or returns a share token for a run. Child runs share their trace root. * * Self-hosted deployments require LangSmith `v0.16` or later. * * @example * ```ts * const share = await client.runs.share.create( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * ); * ``` */ create(runID: string, body: ShareCreateParams, options?: RequestOptions): APIPromise { return this._client.post(path`/api/v2/runs/${runID}/share`, { body, ...options }); } /** * Deletes the share token for the trace identified by trace_id and session_id. * Idempotent: returns 204 whether or not a share token existed. * * Self-hosted deployments require LangSmith `v0.16` or later. * * @example * ```ts * await client.runs.share.delete( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * ); * ``` */ delete(traceID: string, body: ShareDeleteParams, options?: RequestOptions): APIPromise { return this._client.delete(path`/api/v2/runs/${traceID}/share`, { body, ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } } export interface ShareCreateResponse { share_token?: string; } export interface ShareCreateParams { /** * session_id is the tracing project UUID containing the trace. */ session_id?: string; /** * trace_id is the root trace UUID to share. */ trace_id?: string; } export interface ShareDeleteParams { /** * session_id is the tracing project UUID containing the trace. */ session_id?: string; } export declare namespace Share { export { type ShareCreateResponse as ShareCreateResponse, type ShareCreateParams as ShareCreateParams, type ShareDeleteParams as ShareDeleteParams, }; }