From b283f6f123067b864841df1eb21e5f1d6da51c93 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 3 Nov 2025 18:49:34 +0000 Subject: [PATCH 1/2] feat(api): include indexing jobs --- .stats.yml | 8 +- api.md | 48 ++ src/client.ts | 29 ++ src/resources/agents/agents.ts | 76 ++- .../evaluation-metrics/evaluation-metrics.ts | 20 + .../agents/evaluation-metrics/index.ts | 7 + .../evaluation-metrics/scheduled-indexing.ts | 292 +++++++++++ src/resources/index.ts | 13 + src/resources/knowledge-bases/data-sources.ts | 22 + src/resources/knowledge-bases/index.ts | 2 + .../knowledge-bases/indexing-jobs.ts | 55 ++- .../knowledge-bases/knowledge-bases.ts | 63 +++ src/resources/nfs.ts | 3 + src/resources/nfs/index.ts | 22 + src/resources/nfs/nfs.ts | 456 ++++++++++++++++++ src/resources/nfs/snapshots.ts | 216 +++++++++ tests/api-resources/agents/agents.test.ts | 4 + .../scheduled-indexing.test.ts | 61 +++ .../knowledge-bases/data-sources.test.ts | 1 + .../knowledge-bases/indexing-jobs.test.ts | 14 + .../knowledge-bases/knowledge-bases.test.ts | 17 + tests/api-resources/nfs/nfs.test.ts | 112 +++++ tests/api-resources/nfs/snapshots.test.ts | 69 +++ 23 files changed, 1602 insertions(+), 8 deletions(-) create mode 100644 src/resources/agents/evaluation-metrics/scheduled-indexing.ts create mode 100644 src/resources/nfs.ts create mode 100644 src/resources/nfs/index.ts create mode 100644 src/resources/nfs/nfs.ts create mode 100644 src/resources/nfs/snapshots.ts create mode 100644 tests/api-resources/agents/evaluation-metrics/scheduled-indexing.test.ts create mode 100644 tests/api-resources/nfs/nfs.test.ts create mode 100644 tests/api-resources/nfs/snapshots.test.ts diff --git a/.stats.yml b/.stats.yml index af483f0..425463f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 175 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/digitalocean%2Fgradient-cb3bf9b21459cad24410206c27a32fd31ef6cf86711700597549dbbd0d634002.yml -openapi_spec_hash: 6a9149a81ba15e7c5c5c1f4d77daad92 -config_hash: bad49c3bf949d5168ec3896bedff253a +configured_endpoints: 188 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/digitalocean%2Fgradient-f07d74847e620dfa26d8df40ea4680814af9bba381b3a57a7b6ed76ad49d85f8.yml +openapi_spec_hash: e3553dc2abf2afd4368b736bcc32a289 +config_hash: b712366a70c9d33e22d40eb601ca972f diff --git a/api.md b/api.md index 2b12888..1fe66b9 100644 --- a/api.md +++ b/api.md @@ -211,6 +211,20 @@ Methods: - client.agents.evaluationMetrics.oauth2.dropbox.createTokens({ ...params }) -> DropboxCreateTokensResponse +### ScheduledIndexing + +Types: + +- ScheduledIndexingCreateResponse +- ScheduledIndexingRetrieveResponse +- ScheduledIndexingDeleteResponse + +Methods: + +- client.agents.evaluationMetrics.scheduledIndexing.create({ ...params }) -> ScheduledIndexingCreateResponse +- client.agents.evaluationMetrics.scheduledIndexing.retrieve(knowledgeBaseUuid) -> ScheduledIndexingRetrieveResponse +- client.agents.evaluationMetrics.scheduledIndexing.delete(uuid) -> ScheduledIndexingDeleteResponse + ## EvaluationRuns Types: @@ -700,6 +714,7 @@ Types: - KnowledgeBaseUpdateResponse - KnowledgeBaseListResponse - KnowledgeBaseDeleteResponse +- KnowledgeBaseListIndexingJobsResponse Methods: @@ -708,6 +723,7 @@ Methods: - client.knowledgeBases.update(pathUuid, { ...params }) -> KnowledgeBaseUpdateResponse - client.knowledgeBases.list({ ...params }) -> KnowledgeBaseListResponse - client.knowledgeBases.delete(uuid) -> KnowledgeBaseDeleteResponse +- client.knowledgeBases.listIndexingJobs(knowledgeBaseUuid) -> KnowledgeBaseListIndexingJobsResponse ## DataSources @@ -740,6 +756,7 @@ Types: - IndexingJobRetrieveResponse - IndexingJobListResponse - IndexingJobRetrieveDataSourcesResponse +- IndexingJobRetrieveSignedURLResponse - IndexingJobUpdateCancelResponse Methods: @@ -748,6 +765,7 @@ Methods: - client.knowledgeBases.indexingJobs.retrieve(uuid) -> IndexingJobRetrieveResponse - client.knowledgeBases.indexingJobs.list({ ...params }) -> IndexingJobListResponse - client.knowledgeBases.indexingJobs.retrieveDataSources(indexingJobUuid) -> IndexingJobRetrieveDataSourcesResponse +- client.knowledgeBases.indexingJobs.retrieveSignedURL(indexingJobUuid) -> IndexingJobRetrieveSignedURLResponse - client.knowledgeBases.indexingJobs.updateCancel(pathUuid, { ...params }) -> IndexingJobUpdateCancelResponse - client.knowledgeBases.indexingJobs.waitForCompletion(uuid, { ...options }) -> IndexingJobRetrieveResponse @@ -835,3 +853,33 @@ Methods: - client.databases.schemaRegistry.config.update(databaseClusterUuid, { ...params }) -> ConfigUpdateResponse - client.databases.schemaRegistry.config.retrieveSubject(subjectName, { ...params }) -> ConfigRetrieveSubjectResponse - client.databases.schemaRegistry.config.updateSubject(subjectName, { ...params }) -> ConfigUpdateSubjectResponse + +# Nfs + +Types: + +- NfCreateResponse +- NfRetrieveResponse +- NfListResponse +- NfInitiateActionResponse + +Methods: + +- client.nfs.create({ ...params }) -> NfCreateResponse +- client.nfs.retrieve(nfsID, { ...params }) -> NfRetrieveResponse +- client.nfs.list({ ...params }) -> NfListResponse +- client.nfs.delete(nfsID, { ...params }) -> void +- client.nfs.initiateAction(nfsID, { ...params }) -> NfInitiateActionResponse + +## Snapshots + +Types: + +- SnapshotRetrieveResponse +- SnapshotListResponse + +Methods: + +- client.nfs.snapshots.retrieve(nfsSnapshotID, { ...params }) -> SnapshotRetrieveResponse +- client.nfs.snapshots.list({ ...params }) -> SnapshotListResponse +- client.nfs.snapshots.delete(nfsSnapshotID, { ...params }) -> void diff --git a/src/client.ts b/src/client.ts index 98aa8dd..c70a3ea 100644 --- a/src/client.ts +++ b/src/client.ts @@ -73,6 +73,7 @@ import { KnowledgeBaseCreateParams, KnowledgeBaseCreateResponse, KnowledgeBaseDeleteResponse, + KnowledgeBaseListIndexingJobsResponse, KnowledgeBaseListParams, KnowledgeBaseListResponse, KnowledgeBaseRetrieveResponse, @@ -88,6 +89,18 @@ import { ModelListResponse, Models, } from './resources/models/models'; +import { + NfCreateParams, + NfCreateResponse, + NfDeleteParams, + NfInitiateActionParams, + NfInitiateActionResponse, + NfListParams, + NfListResponse, + NfRetrieveParams, + NfRetrieveResponse, + Nfs, +} from './resources/nfs/nfs'; import { type Fetch } from './internal/builtin-types'; import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers'; import { FinalRequestOptions, RequestOptions } from './internal/request-options'; @@ -871,6 +884,7 @@ export class Gradient { models: API.Models = new API.Models(this); regions: API.Regions = new API.Regions(this); databases: API.Databases = new API.Databases(this); + nfs: API.Nfs = new API.Nfs(this); } Gradient.Agents = Agents; @@ -882,6 +896,7 @@ Gradient.KnowledgeBases = KnowledgeBases; Gradient.Models = Models; Gradient.Regions = Regions; Gradient.Databases = Databases; +Gradient.Nfs = Nfs; export declare namespace Gradient { export type RequestOptions = Opts.RequestOptions; @@ -948,6 +963,7 @@ export declare namespace Gradient { type KnowledgeBaseUpdateResponse as KnowledgeBaseUpdateResponse, type KnowledgeBaseListResponse as KnowledgeBaseListResponse, type KnowledgeBaseDeleteResponse as KnowledgeBaseDeleteResponse, + type KnowledgeBaseListIndexingJobsResponse as KnowledgeBaseListIndexingJobsResponse, type KnowledgeBaseCreateParams as KnowledgeBaseCreateParams, type KnowledgeBaseUpdateParams as KnowledgeBaseUpdateParams, type KnowledgeBaseListParams as KnowledgeBaseListParams, @@ -970,6 +986,19 @@ export declare namespace Gradient { export { Databases as Databases }; + export { + Nfs as Nfs, + type NfCreateResponse as NfCreateResponse, + type NfRetrieveResponse as NfRetrieveResponse, + type NfListResponse as NfListResponse, + type NfInitiateActionResponse as NfInitiateActionResponse, + type NfCreateParams as NfCreateParams, + type NfRetrieveParams as NfRetrieveParams, + type NfListParams as NfListParams, + type NfDeleteParams as NfDeleteParams, + type NfInitiateActionParams as NfInitiateActionParams, + }; + export type Action = API.Action; export type ActionLink = API.ActionLink; export type APILinks = API.APILinks; diff --git a/src/resources/agents/agents.ts b/src/resources/agents/agents.ts index ba6d606..4e1b4c6 100644 --- a/src/resources/agents/agents.ts +++ b/src/resources/agents/agents.ts @@ -432,6 +432,8 @@ export interface APIAgent { */ model?: APIAgentModel; + model_provider_key?: APIAgent.ModelProviderKey; + /** * Agent name */ @@ -521,6 +523,13 @@ export interface APIAgent { */ version_hash?: string; + /** + * VPC Egress IPs + */ + vpc_egress_ips?: Array; + + vpc_uuid?: string; + workspace?: APIWorkspace; } @@ -539,6 +548,8 @@ export namespace APIAgent { * A Chatbot */ export interface Chatbot { + allowed_domains?: Array; + button_background_color?: string; logo?: string; @@ -588,7 +599,8 @@ export namespace APIAgent { | 'STATUS_WAITING_FOR_UNDEPLOYMENT' | 'STATUS_UNDEPLOYING' | 'STATUS_UNDEPLOYMENT_FAILED' - | 'STATUS_DELETED'; + | 'STATUS_DELETED' + | 'STATUS_BUILDING'; /** * Last modified @@ -738,6 +750,45 @@ export namespace APIAgent { log_stream_name?: string; } + export interface ModelProviderKey { + /** + * API key ID + */ + api_key_uuid?: string; + + /** + * Key creation date + */ + created_at?: string; + + /** + * Created by user id from DO + */ + created_by?: string; + + /** + * Key deleted date + */ + deleted_at?: string; + + /** + * Models supported by the openAI api key + */ + models?: Array; + + /** + * Name of the key + */ + name?: string; + + provider?: 'MODEL_PROVIDER_DIGITALOCEAN' | 'MODEL_PROVIDER_ANTHROPIC' | 'MODEL_PROVIDER_OPENAI'; + + /** + * Key last updated date + */ + updated_at?: string; + } + /** * Represents an AgentTemplate entity */ @@ -1348,6 +1399,8 @@ export namespace AgentListResponse { * A Chatbot */ export interface Chatbot { + allowed_domains?: Array; + button_background_color?: string; logo?: string; @@ -1397,7 +1450,8 @@ export namespace AgentListResponse { | 'STATUS_WAITING_FOR_UNDEPLOYMENT' | 'STATUS_UNDEPLOYING' | 'STATUS_UNDEPLOYMENT_FAILED' - | 'STATUS_DELETED'; + | 'STATUS_DELETED' + | 'STATUS_BUILDING'; /** * Last modified @@ -1648,6 +1702,8 @@ export interface AgentCreateParams { */ knowledge_base_uuid?: Array; + model_provider_key_uuid?: string; + /** * Identifier for the foundation model. */ @@ -1677,11 +1733,22 @@ export interface AgentCreateParams { * Agent tag to organize related resources */ tags?: Array; + + /** + * Identifier for the workspace + */ + workspace_uuid?: string; } export interface AgentUpdateParams { agent_log_insights_enabled?: boolean; + /** + * Optional list of allowed domains for the chatbot - Must use fully qualified + * domain name (FQDN) such as https://example.com + */ + allowed_domains?: Array; + /** * Optional anthropic key uuid for use with anthropic models */ @@ -1717,6 +1784,11 @@ export interface AgentUpdateParams { */ max_tokens?: number; + /** + * Optional Model Provider uuid for use with provider models + */ + model_provider_key_uuid?: string; + /** * Identifier for the foundation model. */ diff --git a/src/resources/agents/evaluation-metrics/evaluation-metrics.ts b/src/resources/agents/evaluation-metrics/evaluation-metrics.ts index 690033e..d9d6a62 100644 --- a/src/resources/agents/evaluation-metrics/evaluation-metrics.ts +++ b/src/resources/agents/evaluation-metrics/evaluation-metrics.ts @@ -4,6 +4,14 @@ import { APIResource } from '../../../core/resource'; import * as EvaluationRunsAPI from '../evaluation-runs'; import * as ModelsAPI from './models'; import { ModelListParams, ModelListResponse, Models } from './models'; +import * as ScheduledIndexingAPI from './scheduled-indexing'; +import { + ScheduledIndexing, + ScheduledIndexingCreateParams, + ScheduledIndexingCreateResponse, + ScheduledIndexingDeleteResponse, + ScheduledIndexingRetrieveResponse, +} from './scheduled-indexing'; import * as AnthropicAPI from './anthropic/anthropic'; import { Anthropic } from './anthropic/anthropic'; import * as Oauth2API from './oauth2/oauth2'; @@ -31,6 +39,9 @@ export class EvaluationMetrics extends APIResource { anthropic: AnthropicAPI.Anthropic = new AnthropicAPI.Anthropic(this._client); openai: OpenAIAPI.OpenAI = new OpenAIAPI.OpenAI(this._client); oauth2: Oauth2API.Oauth2 = new Oauth2API.Oauth2(this._client); + scheduledIndexing: ScheduledIndexingAPI.ScheduledIndexing = new ScheduledIndexingAPI.ScheduledIndexing( + this._client, + ); /** * To list all evaluation metrics, send a GET request to @@ -133,6 +144,7 @@ EvaluationMetrics.Models = Models; EvaluationMetrics.Anthropic = Anthropic; EvaluationMetrics.OpenAI = OpenAI; EvaluationMetrics.Oauth2 = Oauth2; +EvaluationMetrics.ScheduledIndexing = ScheduledIndexing; export declare namespace EvaluationMetrics { export { @@ -168,4 +180,12 @@ export declare namespace EvaluationMetrics { type Oauth2GenerateURLResponse as Oauth2GenerateURLResponse, type Oauth2GenerateURLParams as Oauth2GenerateURLParams, }; + + export { + ScheduledIndexing as ScheduledIndexing, + type ScheduledIndexingCreateResponse as ScheduledIndexingCreateResponse, + type ScheduledIndexingRetrieveResponse as ScheduledIndexingRetrieveResponse, + type ScheduledIndexingDeleteResponse as ScheduledIndexingDeleteResponse, + type ScheduledIndexingCreateParams as ScheduledIndexingCreateParams, + }; } diff --git a/src/resources/agents/evaluation-metrics/index.ts b/src/resources/agents/evaluation-metrics/index.ts index 7941c92..cffc6f4 100644 --- a/src/resources/agents/evaluation-metrics/index.ts +++ b/src/resources/agents/evaluation-metrics/index.ts @@ -10,6 +10,13 @@ export { export { Models, type ModelListResponse, type ModelListParams } from './models'; export { Oauth2, type Oauth2GenerateURLResponse, type Oauth2GenerateURLParams } from './oauth2/index'; export { OpenAI } from './openai/index'; +export { + ScheduledIndexing, + type ScheduledIndexingCreateResponse, + type ScheduledIndexingRetrieveResponse, + type ScheduledIndexingDeleteResponse, + type ScheduledIndexingCreateParams, +} from './scheduled-indexing'; export { Workspaces, type WorkspaceCreateResponse, diff --git a/src/resources/agents/evaluation-metrics/scheduled-indexing.ts b/src/resources/agents/evaluation-metrics/scheduled-indexing.ts new file mode 100644 index 0000000..83238dd --- /dev/null +++ b/src/resources/agents/evaluation-metrics/scheduled-indexing.ts @@ -0,0 +1,292 @@ +// 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'; + +export class ScheduledIndexing extends APIResource { + /** + * To create scheduled indexing for a knowledge base, send a POST request to + * `/v2/gen-ai/scheduled-indexing`. + * + * @example + * ```ts + * const scheduledIndexing = + * await client.agents.evaluationMetrics.scheduledIndexing.create(); + * ``` + */ + create( + body: ScheduledIndexingCreateParams | null | undefined = {}, + options?: RequestOptions, + ): APIPromise { + return this._client.post('/v2/gen-ai/scheduled-indexing', { + body, + defaultBaseURL: 'https://api.digitalocean.com', + ...options, + }); + } + + /** + * Get Scheduled Indexing for knowledge base using knoweldge base uuid, send a GET + * request to `/v2/gen-ai/scheduled-indexing/knowledge-base/{knowledge_base_uuid}`. + * + * @example + * ```ts + * const scheduledIndexing = + * await client.agents.evaluationMetrics.scheduledIndexing.retrieve( + * '"123e4567-e89b-12d3-a456-426614174000"', + * ); + * ``` + */ + retrieve( + knowledgeBaseUuid: string, + options?: RequestOptions, + ): APIPromise { + return this._client.get(path`/v2/gen-ai/scheduled-indexing/knowledge-base/${knowledgeBaseUuid}`, { + defaultBaseURL: 'https://api.digitalocean.com', + ...options, + }); + } + + /** + * Delete Scheduled Indexing for knowledge base, send a DELETE request to + * `/v2/gen-ai/scheduled-indexing/{uuid}`. + * + * @example + * ```ts + * const scheduledIndexing = + * await client.agents.evaluationMetrics.scheduledIndexing.delete( + * '"123e4567-e89b-12d3-a456-426614174000"', + * ); + * ``` + */ + delete(uuid: string, options?: RequestOptions): APIPromise { + return this._client.delete(path`/v2/gen-ai/scheduled-indexing/${uuid}`, { + defaultBaseURL: 'https://api.digitalocean.com', + ...options, + }); + } +} + +export interface ScheduledIndexingCreateResponse { + /** + * Metadata for scheduled indexing entries + */ + indexing_info?: ScheduledIndexingCreateResponse.IndexingInfo; +} + +export namespace ScheduledIndexingCreateResponse { + /** + * Metadata for scheduled indexing entries + */ + export interface IndexingInfo { + /** + * Created at timestamp + */ + created_at?: string; + + /** + * Days for execution (day is represented same as in a cron expression, e.g. Monday + * begins with 1 ) + */ + days?: Array; + + /** + * Deleted at timestamp (if soft deleted) + */ + deleted_at?: string; + + /** + * Whether the schedule is currently active + */ + is_active?: boolean; + + /** + * Knowledge base uuid associated with this schedule + */ + knowledge_base_uuid?: string; + + /** + * Last time the schedule was executed + */ + last_ran_at?: string; + + /** + * Next scheduled run + */ + next_run_at?: string; + + /** + * Scheduled time of execution (HH:MM:SS format) + */ + time?: string; + + /** + * Updated at timestamp + */ + updated_at?: string; + + /** + * Unique identifier for the scheduled indexing entry + */ + uuid?: string; + } +} + +export interface ScheduledIndexingRetrieveResponse { + /** + * Metadata for scheduled indexing entries + */ + indexing_info?: ScheduledIndexingRetrieveResponse.IndexingInfo; +} + +export namespace ScheduledIndexingRetrieveResponse { + /** + * Metadata for scheduled indexing entries + */ + export interface IndexingInfo { + /** + * Created at timestamp + */ + created_at?: string; + + /** + * Days for execution (day is represented same as in a cron expression, e.g. Monday + * begins with 1 ) + */ + days?: Array; + + /** + * Deleted at timestamp (if soft deleted) + */ + deleted_at?: string; + + /** + * Whether the schedule is currently active + */ + is_active?: boolean; + + /** + * Knowledge base uuid associated with this schedule + */ + knowledge_base_uuid?: string; + + /** + * Last time the schedule was executed + */ + last_ran_at?: string; + + /** + * Next scheduled run + */ + next_run_at?: string; + + /** + * Scheduled time of execution (HH:MM:SS format) + */ + time?: string; + + /** + * Updated at timestamp + */ + updated_at?: string; + + /** + * Unique identifier for the scheduled indexing entry + */ + uuid?: string; + } +} + +export interface ScheduledIndexingDeleteResponse { + /** + * Metadata for scheduled indexing entries + */ + indexing_info?: ScheduledIndexingDeleteResponse.IndexingInfo; +} + +export namespace ScheduledIndexingDeleteResponse { + /** + * Metadata for scheduled indexing entries + */ + export interface IndexingInfo { + /** + * Created at timestamp + */ + created_at?: string; + + /** + * Days for execution (day is represented same as in a cron expression, e.g. Monday + * begins with 1 ) + */ + days?: Array; + + /** + * Deleted at timestamp (if soft deleted) + */ + deleted_at?: string; + + /** + * Whether the schedule is currently active + */ + is_active?: boolean; + + /** + * Knowledge base uuid associated with this schedule + */ + knowledge_base_uuid?: string; + + /** + * Last time the schedule was executed + */ + last_ran_at?: string; + + /** + * Next scheduled run + */ + next_run_at?: string; + + /** + * Scheduled time of execution (HH:MM:SS format) + */ + time?: string; + + /** + * Updated at timestamp + */ + updated_at?: string; + + /** + * Unique identifier for the scheduled indexing entry + */ + uuid?: string; + } +} + +export interface ScheduledIndexingCreateParams { + /** + * Days for execution (day is represented same as in a cron expression, e.g. Monday + * begins with 1 ) + */ + days?: Array; + + /** + * Knowledge base uuid for which the schedule is created + */ + knowledge_base_uuid?: string; + + /** + * Time of execution (HH:MM) UTC + */ + time?: string; +} + +export declare namespace ScheduledIndexing { + export { + type ScheduledIndexingCreateResponse as ScheduledIndexingCreateResponse, + type ScheduledIndexingRetrieveResponse as ScheduledIndexingRetrieveResponse, + type ScheduledIndexingDeleteResponse as ScheduledIndexingDeleteResponse, + type ScheduledIndexingCreateParams as ScheduledIndexingCreateParams, + }; +} diff --git a/src/resources/index.ts b/src/resources/index.ts index bb622ec..bf14de5 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -59,6 +59,7 @@ export { type KnowledgeBaseUpdateResponse, type KnowledgeBaseListResponse, type KnowledgeBaseDeleteResponse, + type KnowledgeBaseListIndexingJobsResponse, type KnowledgeBaseCreateParams, type KnowledgeBaseUpdateParams, type KnowledgeBaseListParams, @@ -71,4 +72,16 @@ export { type ModelListResponse, type ModelListParams, } from './models/models'; +export { + Nfs, + type NfCreateResponse, + type NfRetrieveResponse, + type NfListResponse, + type NfInitiateActionResponse, + type NfCreateParams, + type NfRetrieveParams, + type NfListParams, + type NfDeleteParams, + type NfInitiateActionParams, +} from './nfs/nfs'; export { Regions, type RegionListResponse, type RegionListParams } from './regions'; diff --git a/src/resources/knowledge-bases/data-sources.ts b/src/resources/knowledge-bases/data-sources.ts index 73271de..205d2b2 100644 --- a/src/resources/knowledge-bases/data-sources.ts +++ b/src/resources/knowledge-bases/data-sources.ts @@ -155,6 +155,11 @@ export interface APIKnowledgeBaseDataSource { */ file_upload_data_source?: APIFileUploadDataSource; + /** + * Google Drive Data Source for Display + */ + google_drive_data_source?: APIKnowledgeBaseDataSource.GoogleDriveDataSource; + /** * Path of folder or object in bucket - Deprecated, moved to data_source_details */ @@ -217,6 +222,18 @@ export namespace APIKnowledgeBaseDataSource { export interface DropboxDataSource { folder?: string; } + + /** + * Google Drive Data Source for Display + */ + export interface GoogleDriveDataSource { + folder_id?: string; + + /** + * Name of the selected folder if available + */ + folder_name?: string; + } } /** @@ -260,6 +277,11 @@ export interface APIWebCrawlerDataSource { * Whether to ingest and index media (images, etc.) on web pages. */ embed_media?: boolean; + + /** + * Declaring which tags to exclude in web pages while webcrawling + */ + exclude_tags?: Array; } /** diff --git a/src/resources/knowledge-bases/index.ts b/src/resources/knowledge-bases/index.ts index f64b0d2..251910f 100644 --- a/src/resources/knowledge-bases/index.ts +++ b/src/resources/knowledge-bases/index.ts @@ -24,6 +24,7 @@ export { type IndexingJobRetrieveResponse, type IndexingJobListResponse, type IndexingJobRetrieveDataSourcesResponse, + type IndexingJobRetrieveSignedURLResponse, type IndexingJobUpdateCancelResponse, type IndexingJobCreateParams, type IndexingJobListParams, @@ -37,6 +38,7 @@ export { type KnowledgeBaseUpdateResponse, type KnowledgeBaseListResponse, type KnowledgeBaseDeleteResponse, + type KnowledgeBaseListIndexingJobsResponse, type KnowledgeBaseCreateParams, type KnowledgeBaseUpdateParams, type KnowledgeBaseListParams, diff --git a/src/resources/knowledge-bases/indexing-jobs.ts b/src/resources/knowledge-bases/indexing-jobs.ts index 657f7d8..ac84a53 100644 --- a/src/resources/knowledge-bases/indexing-jobs.ts +++ b/src/resources/knowledge-bases/indexing-jobs.ts @@ -149,6 +149,28 @@ export class IndexingJobs extends APIResource { }); } + /** + * To get a signed URL for indexing job details, send a GET request to + * `/v2/gen-ai/indexing_jobs/{uuid}/details_signed_url`. + * + * @example + * ```ts + * const response = + * await client.knowledgeBases.indexingJobs.retrieveSignedURL( + * '"123e4567-e89b-12d3-a456-426614174000"', + * ); + * ``` + */ + retrieveSignedURL( + indexingJobUuid: string, + options?: RequestOptions, + ): APIPromise { + return this._client.get(path`/v2/gen-ai/indexing_jobs/${indexingJobUuid}/details_signed_url`, { + defaultBaseURL: 'https://api.digitalocean.com', + ...options, + }); + } + /** * To cancel an indexing job for a knowledge base, send a PUT request to * `/v2/gen-ai/indexing_jobs/{uuid}/cancel`. @@ -355,7 +377,8 @@ export interface APIIndexedDataSource { | 'DATA_SOURCE_STATUS_UPDATED' | 'DATA_SOURCE_STATUS_PARTIALLY_UPDATED' | 'DATA_SOURCE_STATUS_NOT_UPDATED' - | 'DATA_SOURCE_STATUS_FAILED'; + | 'DATA_SOURCE_STATUS_FAILED' + | 'DATA_SOURCE_STATUS_CANCELLED'; /** * Total size of files in data source in bytes @@ -387,10 +410,20 @@ export interface APIIndexingJob { */ created_at?: string; + /** + * Details on Data Sources included in the Indexing Job + */ + data_source_jobs?: Array; + data_source_uuids?: Array; finished_at?: string; + /** + * Boolean value to determine if the indexing job details are available + */ + is_report_available?: boolean; + /** * Knowledge base id */ @@ -417,7 +450,7 @@ export interface APIIndexingJob { | 'INDEX_JOB_STATUS_PENDING'; /** - * Number of tokens + * Number of tokens [This field is deprecated] */ tokens?: number; @@ -436,11 +469,21 @@ export interface APIIndexingJob { */ total_items_indexed?: string; + /** + * Total Items Removed + */ + total_items_removed?: string; + /** * Total Items Skipped */ total_items_skipped?: string; + /** + * Total Tokens Consumed By the Indexing Job + */ + total_tokens?: string; + /** * Last modified */ @@ -496,6 +539,13 @@ export interface IndexingJobRetrieveDataSourcesResponse { indexed_data_sources?: Array; } +export interface IndexingJobRetrieveSignedURLResponse { + /** + * The signed url for downloading the indexing job details + */ + signed_url?: string; +} + /** * CancelKnowledgeBaseIndexingJobOutput description */ @@ -546,6 +596,7 @@ export declare namespace IndexingJobs { type IndexingJobRetrieveResponse as IndexingJobRetrieveResponse, type IndexingJobListResponse as IndexingJobListResponse, type IndexingJobRetrieveDataSourcesResponse as IndexingJobRetrieveDataSourcesResponse, + type IndexingJobRetrieveSignedURLResponse as IndexingJobRetrieveSignedURLResponse, type IndexingJobUpdateCancelResponse as IndexingJobUpdateCancelResponse, type IndexingJobCreateParams as IndexingJobCreateParams, type IndexingJobListParams as IndexingJobListParams, diff --git a/src/resources/knowledge-bases/knowledge-bases.ts b/src/resources/knowledge-bases/knowledge-bases.ts index f5f1d5c..a01488c 100644 --- a/src/resources/knowledge-bases/knowledge-bases.ts +++ b/src/resources/knowledge-bases/knowledge-bases.ts @@ -29,6 +29,7 @@ import { IndexingJobListResponse, IndexingJobRetrieveDataSourcesResponse, IndexingJobRetrieveResponse, + IndexingJobRetrieveSignedURLResponse, IndexingJobUpdateCancelParams, IndexingJobUpdateCancelResponse, IndexingJobs, @@ -334,6 +335,28 @@ export class KnowledgeBases extends APIResource { } } } + + /** + * To list latest 15 indexing jobs for a knowledge base, send a GET request to + * `/v2/gen-ai/knowledge_bases/{knowledge_base_uuid}/indexing_jobs`. + * + * @example + * ```ts + * const response = + * await client.knowledgeBases.listIndexingJobs( + * '"123e4567-e89b-12d3-a456-426614174000"', + * ); + * ``` + */ + listIndexingJobs( + knowledgeBaseUuid: string, + options?: RequestOptions, + ): APIPromise { + return this._client.get(path`/v2/gen-ai/knowledge_bases/${knowledgeBaseUuid}/indexing_jobs`, { + defaultBaseURL: 'https://api.digitalocean.com', + ...options, + }); + } } /** @@ -471,6 +494,26 @@ export interface KnowledgeBaseDeleteResponse { uuid?: string; } +/** + * Indexing jobs + */ +export interface KnowledgeBaseListIndexingJobsResponse { + /** + * The indexing jobs + */ + jobs?: Array; + + /** + * Links to other pages + */ + links?: Shared.APILinks; + + /** + * Meta information about the data set + */ + meta?: Shared.APIMeta; +} + export interface KnowledgeBaseCreateParams { /** * Identifier of the DigitalOcean OpenSearch database this knowledge base will use, @@ -545,6 +588,11 @@ export namespace KnowledgeBaseCreateParams { */ file_upload_data_source?: DataSourcesAPI.APIFileUploadDataSource; + /** + * Google Drive Data Source + */ + google_drive_data_source?: Datasource.GoogleDriveDataSource; + item_path?: string; /** @@ -571,6 +619,19 @@ export namespace KnowledgeBaseCreateParams { */ refresh_token?: string; } + + /** + * Google Drive Data Source + */ + export interface GoogleDriveDataSource { + folder_id?: string; + + /** + * Refresh token. you can obrain a refresh token by following the oauth2 flow. see + * /v2/gen-ai/oauth2/google/tokens for reference. + */ + refresh_token?: string; + } } } @@ -629,6 +690,7 @@ export declare namespace KnowledgeBases { type KnowledgeBaseUpdateResponse as KnowledgeBaseUpdateResponse, type KnowledgeBaseListResponse as KnowledgeBaseListResponse, type KnowledgeBaseDeleteResponse as KnowledgeBaseDeleteResponse, + type KnowledgeBaseListIndexingJobsResponse as KnowledgeBaseListIndexingJobsResponse, type KnowledgeBaseCreateParams as KnowledgeBaseCreateParams, type KnowledgeBaseUpdateParams as KnowledgeBaseUpdateParams, type KnowledgeBaseListParams as KnowledgeBaseListParams, @@ -659,6 +721,7 @@ export declare namespace KnowledgeBases { type IndexingJobRetrieveResponse as IndexingJobRetrieveResponse, type IndexingJobListResponse as IndexingJobListResponse, type IndexingJobRetrieveDataSourcesResponse as IndexingJobRetrieveDataSourcesResponse, + type IndexingJobRetrieveSignedURLResponse as IndexingJobRetrieveSignedURLResponse, type IndexingJobUpdateCancelResponse as IndexingJobUpdateCancelResponse, type IndexingJobCreateParams as IndexingJobCreateParams, type IndexingJobListParams as IndexingJobListParams, diff --git a/src/resources/nfs.ts b/src/resources/nfs.ts new file mode 100644 index 0000000..f45540d --- /dev/null +++ b/src/resources/nfs.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './nfs/index'; diff --git a/src/resources/nfs/index.ts b/src/resources/nfs/index.ts new file mode 100644 index 0000000..3277c57 --- /dev/null +++ b/src/resources/nfs/index.ts @@ -0,0 +1,22 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + Nfs, + type NfCreateResponse, + type NfRetrieveResponse, + type NfListResponse, + type NfInitiateActionResponse, + type NfCreateParams, + type NfRetrieveParams, + type NfListParams, + type NfDeleteParams, + type NfInitiateActionParams, +} from './nfs'; +export { + Snapshots, + type SnapshotRetrieveResponse, + type SnapshotListResponse, + type SnapshotRetrieveParams, + type SnapshotListParams, + type SnapshotDeleteParams, +} from './snapshots'; diff --git a/src/resources/nfs/nfs.ts b/src/resources/nfs/nfs.ts new file mode 100644 index 0000000..8514a94 --- /dev/null +++ b/src/resources/nfs/nfs.ts @@ -0,0 +1,456 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../core/resource'; +import * as SnapshotsAPI from './snapshots'; +import { + SnapshotDeleteParams, + SnapshotListParams, + SnapshotListResponse, + SnapshotRetrieveParams, + SnapshotRetrieveResponse, + Snapshots, +} from './snapshots'; +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 Nfs extends APIResource { + snapshots: SnapshotsAPI.Snapshots = new SnapshotsAPI.Snapshots(this._client); + + /** + * To create a new NFS share, send a POST request to `/v2/nfs`. + * + * @example + * ```ts + * const nf = await client.nfs.create({ + * name: 'sammy-share-drive', + * region: 'atl1', + * size_gib: 1024, + * vpc_ids: ['796c6fe3-2a1d-4da2-9f3e-38239827dc91'], + * }); + * ``` + */ + create(body: NfCreateParams, options?: RequestOptions): APIPromise { + return this._client.post('/v2/nfs', { body, defaultBaseURL: 'https://api.digitalocean.com', ...options }); + } + + /** + * To get an NFS share, send a GET request to `/v2/nfs/{nfs_id}?region=${region}`. + * + * A successful request will return the NFS share. + * + * @example + * ```ts + * const nf = await client.nfs.retrieve( + * '0a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d', + * { region: 'region' }, + * ); + * ``` + */ + retrieve(nfsID: string, query: NfRetrieveParams, options?: RequestOptions): APIPromise { + return this._client.get(path`/v2/nfs/${nfsID}`, { + query, + defaultBaseURL: 'https://api.digitalocean.com', + ...options, + }); + } + + /** + * To list NFS shares, send a GET request to `/v2/nfs?region=${region}`. + * + * A successful request will return all NFS shares belonging to the authenticated + * user. + * + * @example + * ```ts + * const nfs = await client.nfs.list({ region: 'region' }); + * ``` + */ + list(query: NfListParams, options?: RequestOptions): APIPromise { + return this._client.get('/v2/nfs', { query, defaultBaseURL: 'https://api.digitalocean.com', ...options }); + } + + /** + * To delete an NFS share, send a DELETE request to + * `/v2/nfs/{nfs_id}?region=${region}`. + * + * A successful request will return a `204 No Content` status code. + * + * @example + * ```ts + * await client.nfs.delete( + * '0a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d', + * { region: 'region' }, + * ); + * ``` + */ + delete(nfsID: string, params: NfDeleteParams, options?: RequestOptions): APIPromise { + const { region } = params; + return this._client.delete(path`/v2/nfs/${nfsID}`, { + query: { region }, + defaultBaseURL: 'https://api.digitalocean.com', + ...options, + headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), + }); + } + + /** + * To execute an action (such as resize) on a specified NFS share, send a POST + * request to `/v2/nfs/{nfs_id}/actions`. In the JSON body to the request, set the + * `type` attribute to on of the supported action types: + * + * | Action | Details | + * | ----------------------- | -------------------------------------------------------------------------- | + * | `resize` | Resizes an NFS share. Set the size_gib attribute to a desired value in GiB | + * | `snapshot` | Takes a snapshot of an NFS share | + * + * @example + * ```ts + * const response = await client.nfs.initiateAction( + * '0a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d', + * { region: 'atl1', type: 'resize' }, + * ); + * ``` + */ + initiateAction( + nfsID: string, + body: NfInitiateActionParams, + options?: RequestOptions, + ): APIPromise { + return this._client.post(path`/v2/nfs/${nfsID}/actions`, { + body, + defaultBaseURL: 'https://api.digitalocean.com', + ...options, + }); + } +} + +export interface NfCreateResponse { + share?: NfCreateResponse.Share; +} + +export namespace NfCreateResponse { + export interface Share { + /** + * The unique identifier of the NFS share. + */ + id: string; + + /** + * Timestamp for when the NFS share was created. + */ + created_at: string; + + /** + * The human-readable name of the share. + */ + name: string; + + /** + * The DigitalOcean region slug (e.g., nyc2, atl1) where the NFS share resides. + */ + region: string; + + /** + * The desired/provisioned size of the share in GiB (Gibibytes). Must be >= 50. + */ + size_gib: number; + + /** + * The current status of the share. + */ + status: 'CREATING' | 'ACTIVE' | 'FAILED' | 'DELETED'; + + /** + * The host IP of the NFS server that will be accessible from the associated VPC + */ + host?: string; + + /** + * Path at which the share will be available, to be mounted at a target of the + * user's choice within the client + */ + mount_path?: string; + + /** + * List of VPC IDs that should be able to access the share. + */ + vpc_ids?: Array; + } +} + +export interface NfRetrieveResponse { + share?: NfRetrieveResponse.Share; +} + +export namespace NfRetrieveResponse { + export interface Share { + /** + * The unique identifier of the NFS share. + */ + id: string; + + /** + * Timestamp for when the NFS share was created. + */ + created_at: string; + + /** + * The human-readable name of the share. + */ + name: string; + + /** + * The DigitalOcean region slug (e.g., nyc2, atl1) where the NFS share resides. + */ + region: string; + + /** + * The desired/provisioned size of the share in GiB (Gibibytes). Must be >= 50. + */ + size_gib: number; + + /** + * The current status of the share. + */ + status: 'CREATING' | 'ACTIVE' | 'FAILED' | 'DELETED'; + + /** + * The host IP of the NFS server that will be accessible from the associated VPC + */ + host?: string; + + /** + * Path at which the share will be available, to be mounted at a target of the + * user's choice within the client + */ + mount_path?: string; + + /** + * List of VPC IDs that should be able to access the share. + */ + vpc_ids?: Array; + } +} + +export interface NfListResponse { + shares?: Array; +} + +export namespace NfListResponse { + export interface Share { + /** + * The unique identifier of the NFS share. + */ + id: string; + + /** + * Timestamp for when the NFS share was created. + */ + created_at: string; + + /** + * The human-readable name of the share. + */ + name: string; + + /** + * The DigitalOcean region slug (e.g., nyc2, atl1) where the NFS share resides. + */ + region: string; + + /** + * The desired/provisioned size of the share in GiB (Gibibytes). Must be >= 50. + */ + size_gib: number; + + /** + * The current status of the share. + */ + status: 'CREATING' | 'ACTIVE' | 'FAILED' | 'DELETED'; + + /** + * The host IP of the NFS server that will be accessible from the associated VPC + */ + host?: string; + + /** + * Path at which the share will be available, to be mounted at a target of the + * user's choice within the client + */ + mount_path?: string; + + /** + * List of VPC IDs that should be able to access the share. + */ + vpc_ids?: Array; + } +} + +/** + * Action response of an NFS share. + */ +export interface NfInitiateActionResponse { + /** + * The action that was submitted. + */ + action: NfInitiateActionResponse.Action; +} + +export namespace NfInitiateActionResponse { + /** + * The action that was submitted. + */ + export interface Action { + /** + * The DigitalOcean region slug where the resource is located. + */ + region_slug: string; + + /** + * The unique identifier of the resource on which the action is being performed. + */ + resource_id: string; + + /** + * The type of resource on which the action is being performed. + */ + resource_type: 'network_file_share' | 'network_file_share_snapshot'; + + /** + * The timestamp when the action was started. + */ + started_at: string; + + /** + * The current status of the action. + */ + status: 'in-progress' | 'completed' | 'errored'; + + /** + * The type of action being performed. + */ + type: string; + } +} + +export interface NfCreateParams { + /** + * The human-readable name of the share. + */ + name: string; + + /** + * The DigitalOcean region slug (e.g., nyc2, atl1) where the NFS share resides. + */ + region: string; + + /** + * The desired/provisioned size of the share in GiB (Gibibytes). Must be >= 50. + */ + size_gib: number; + + /** + * List of VPC IDs that should be able to access the share. + */ + vpc_ids: Array; +} + +export interface NfRetrieveParams { + /** + * The DigitalOcean region slug (e.g., nyc2, atl1) where the NFS share resides. + */ + region: string; +} + +export interface NfListParams { + /** + * The DigitalOcean region slug (e.g., nyc2, atl1) where the NFS share resides. + */ + region: string; +} + +export interface NfDeleteParams { + /** + * The DigitalOcean region slug (e.g., nyc2, atl1) where the NFS share resides. + */ + region: string; +} + +export type NfInitiateActionParams = + | NfInitiateActionParams.NfsActionResize + | NfInitiateActionParams.NfsActionSnapshot; + +export declare namespace NfInitiateActionParams { + export interface NfsActionResize { + /** + * The DigitalOcean region slug (e.g. atl1, nyc2) where the NFS snapshot resides. + */ + region: string; + + /** + * The type of action to initiate for the NFS share (such as resize or snapshot). + */ + type: 'resize' | 'snapshot'; + + params?: NfsActionResize.Params; + } + + export namespace NfsActionResize { + export interface Params { + /** + * The new size for the NFS share. + */ + size_gib: number; + } + } + + export interface NfsActionSnapshot { + /** + * The DigitalOcean region slug (e.g. atl1, nyc2) where the NFS snapshot resides. + */ + region: string; + + /** + * The type of action to initiate for the NFS share (such as resize or snapshot). + */ + type: 'resize' | 'snapshot'; + + params?: NfsActionSnapshot.Params; + } + + export namespace NfsActionSnapshot { + export interface Params { + /** + * Snapshot name of the NFS share + */ + name: string; + } + } +} + +Nfs.Snapshots = Snapshots; + +export declare namespace Nfs { + export { + type NfCreateResponse as NfCreateResponse, + type NfRetrieveResponse as NfRetrieveResponse, + type NfListResponse as NfListResponse, + type NfInitiateActionResponse as NfInitiateActionResponse, + type NfCreateParams as NfCreateParams, + type NfRetrieveParams as NfRetrieveParams, + type NfListParams as NfListParams, + type NfDeleteParams as NfDeleteParams, + type NfInitiateActionParams as NfInitiateActionParams, + }; + + export { + Snapshots as Snapshots, + type SnapshotRetrieveResponse as SnapshotRetrieveResponse, + type SnapshotListResponse as SnapshotListResponse, + type SnapshotRetrieveParams as SnapshotRetrieveParams, + type SnapshotListParams as SnapshotListParams, + type SnapshotDeleteParams as SnapshotDeleteParams, + }; +} diff --git a/src/resources/nfs/snapshots.ts b/src/resources/nfs/snapshots.ts new file mode 100644 index 0000000..04f34b6 --- /dev/null +++ b/src/resources/nfs/snapshots.ts @@ -0,0 +1,216 @@ +// 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 Snapshots extends APIResource { + /** + * To get an NFS snapshot, send a GET request to + * `/v2/nfs/snapshots/{nfs_snapshot_id}?region=${region}`. + * + * A successful request will return the NFS snapshot. + * + * @example + * ```ts + * const snapshot = await client.nfs.snapshots.retrieve( + * '0a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d', + * { region: 'region' }, + * ); + * ``` + */ + retrieve( + nfsSnapshotID: string, + query: SnapshotRetrieveParams, + options?: RequestOptions, + ): APIPromise { + return this._client.get(path`/v2/nfs/snapshots/${nfsSnapshotID}`, { + query, + defaultBaseURL: 'https://api.digitalocean.com', + ...options, + }); + } + + /** + * To list all NFS snapshots, send a GET request to + * `/v2/nfs/snapshots?region=${region}&share_id={share_id}`. + * + * A successful request will return all NFS snapshots belonging to the + * authenticated user in the specified region. + * + * Optionally, you can filter snapshots by a specific NFS share by including the + * `share_id` query parameter. + * + * @example + * ```ts + * const snapshots = await client.nfs.snapshots.list({ + * region: 'region', + * }); + * ``` + */ + list(query: SnapshotListParams, options?: RequestOptions): APIPromise { + return this._client.get('/v2/nfs/snapshots', { + query, + defaultBaseURL: 'https://api.digitalocean.com', + ...options, + }); + } + + /** + * To delete an NFS snapshot, send a DELETE request to + * `/v2/nfs/snapshots/{nfs_snapshot_id}?region=${region}`. + * + * A successful request will return a `204 No Content` status code. + * + * @example + * ```ts + * await client.nfs.snapshots.delete( + * '0a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d', + * { region: 'region' }, + * ); + * ``` + */ + delete(nfsSnapshotID: string, params: SnapshotDeleteParams, options?: RequestOptions): APIPromise { + const { region } = params; + return this._client.delete(path`/v2/nfs/snapshots/${nfsSnapshotID}`, { + query: { region }, + defaultBaseURL: 'https://api.digitalocean.com', + ...options, + headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), + }); + } +} + +export interface SnapshotRetrieveResponse { + /** + * Represents an NFS snapshot. + */ + snapshot?: SnapshotRetrieveResponse.Snapshot; +} + +export namespace SnapshotRetrieveResponse { + /** + * Represents an NFS snapshot. + */ + export interface Snapshot { + /** + * The unique identifier of the snapshot. + */ + id: string; + + /** + * The timestamp when the snapshot was created. + */ + created_at: string; + + /** + * The human-readable name of the snapshot. + */ + name: string; + + /** + * The DigitalOcean region slug where the snapshot is located. + */ + region: string; + + /** + * The unique identifier of the share from which this snapshot was created. + */ + share_id: string; + + /** + * The size of the snapshot in GiB. + */ + size_gib: number; + + /** + * The current status of the snapshot. + */ + status: 'UNKNOWN' | 'CREATING' | 'ACTIVE' | 'FAILED' | 'DELETED'; + } +} + +export interface SnapshotListResponse { + snapshots?: Array; +} + +export namespace SnapshotListResponse { + /** + * Represents an NFS snapshot. + */ + export interface Snapshot { + /** + * The unique identifier of the snapshot. + */ + id: string; + + /** + * The timestamp when the snapshot was created. + */ + created_at: string; + + /** + * The human-readable name of the snapshot. + */ + name: string; + + /** + * The DigitalOcean region slug where the snapshot is located. + */ + region: string; + + /** + * The unique identifier of the share from which this snapshot was created. + */ + share_id: string; + + /** + * The size of the snapshot in GiB. + */ + size_gib: number; + + /** + * The current status of the snapshot. + */ + status: 'UNKNOWN' | 'CREATING' | 'ACTIVE' | 'FAILED' | 'DELETED'; + } +} + +export interface SnapshotRetrieveParams { + /** + * The DigitalOcean region slug (e.g., nyc2, atl1) where the NFS share resides. + */ + region: string; +} + +export interface SnapshotListParams { + /** + * The DigitalOcean region slug (e.g., nyc2, atl1) where the NFS share resides. + */ + region: string; + + /** + * The unique ID of an NFS share. If provided, only snapshots of this specific + * share will be returned. + */ + share_id?: string; +} + +export interface SnapshotDeleteParams { + /** + * The DigitalOcean region slug (e.g., nyc2, atl1) where the NFS share resides. + */ + region: string; +} + +export declare namespace Snapshots { + export { + type SnapshotRetrieveResponse as SnapshotRetrieveResponse, + type SnapshotListResponse as SnapshotListResponse, + type SnapshotRetrieveParams as SnapshotRetrieveParams, + type SnapshotListParams as SnapshotListParams, + type SnapshotDeleteParams as SnapshotDeleteParams, + }; +} diff --git a/tests/api-resources/agents/agents.test.ts b/tests/api-resources/agents/agents.test.ts index f299460..619d49f 100644 --- a/tests/api-resources/agents/agents.test.ts +++ b/tests/api-resources/agents/agents.test.ts @@ -30,12 +30,14 @@ describe('resource agents', () => { description: '"My Agent Description"', instruction: '"You are an agent who thinks deeply about the world"', knowledge_base_uuid: ['example string'], + model_provider_key_uuid: '"12345678-1234-1234-1234-123456789012"', model_uuid: '"12345678-1234-1234-1234-123456789012"', name: '"My Agent"', open_ai_key_uuid: '"12345678-1234-1234-1234-123456789012"', project_id: '"12345678-1234-1234-1234-123456789012"', region: '"tor1"', tags: ['example string'], + workspace_uuid: '123e4567-e89b-12d3-a456-426614174000', }, { path: '/_stainless_unknown_path' }, ), @@ -74,12 +76,14 @@ describe('resource agents', () => { '"123e4567-e89b-12d3-a456-426614174000"', { agent_log_insights_enabled: true, + allowed_domains: ['example string'], anthropic_key_uuid: '"12345678-1234-1234-1234-123456789012"', conversation_logs_enabled: true, description: '"My Agent Description"', instruction: '"You are an agent who thinks deeply about the world"', k: 5, max_tokens: 100, + model_provider_key_uuid: '"12345678-1234-1234-1234-123456789012"', model_uuid: '"12345678-1234-1234-1234-123456789012"', name: '"My New Agent Name"', open_ai_key_uuid: '"12345678-1234-1234-1234-123456789012"', diff --git a/tests/api-resources/agents/evaluation-metrics/scheduled-indexing.test.ts b/tests/api-resources/agents/evaluation-metrics/scheduled-indexing.test.ts new file mode 100644 index 0000000..ee0c14c --- /dev/null +++ b/tests/api-resources/agents/evaluation-metrics/scheduled-indexing.test.ts @@ -0,0 +1,61 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Gradient from '@digitalocean/gradient'; + +const client = new Gradient({ + accessToken: 'My Access Token', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource scheduledIndexing', () => { + // Prism tests are disabled + test.skip('create', async () => { + const responsePromise = client.agents.evaluationMetrics.scheduledIndexing.create(); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('create: request options and params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + client.agents.evaluationMetrics.scheduledIndexing.create( + { days: [123], knowledge_base_uuid: '123e4567-e89b-12d3-a456-426614174000', time: 'example string' }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(Gradient.NotFoundError); + }); + + // Prism tests are disabled + test.skip('retrieve', async () => { + const responsePromise = client.agents.evaluationMetrics.scheduledIndexing.retrieve( + '"123e4567-e89b-12d3-a456-426614174000"', + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('delete', async () => { + const responsePromise = client.agents.evaluationMetrics.scheduledIndexing.delete( + '"123e4567-e89b-12d3-a456-426614174000"', + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); +}); diff --git a/tests/api-resources/knowledge-bases/data-sources.test.ts b/tests/api-resources/knowledge-bases/data-sources.test.ts index e5c7517..53bcf93 100644 --- a/tests/api-resources/knowledge-bases/data-sources.test.ts +++ b/tests/api-resources/knowledge-bases/data-sources.test.ts @@ -46,6 +46,7 @@ describe('resource dataSources', () => { base_url: 'example string', crawling_option: 'UNKNOWN', embed_media: true, + exclude_tags: ['example string'], }, }, { path: '/_stainless_unknown_path' }, diff --git a/tests/api-resources/knowledge-bases/indexing-jobs.test.ts b/tests/api-resources/knowledge-bases/indexing-jobs.test.ts index fc19fd5..6241d90 100644 --- a/tests/api-resources/knowledge-bases/indexing-jobs.test.ts +++ b/tests/api-resources/knowledge-bases/indexing-jobs.test.ts @@ -82,6 +82,20 @@ describe('resource indexingJobs', () => { expect(dataAndResponse.response).toBe(rawResponse); }); + // Prism tests are disabled + test.skip('retrieveSignedURL', async () => { + const responsePromise = client.knowledgeBases.indexingJobs.retrieveSignedURL( + '"123e4567-e89b-12d3-a456-426614174000"', + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + // Prism tests are disabled test.skip('updateCancel', async () => { const responsePromise = client.knowledgeBases.indexingJobs.updateCancel( diff --git a/tests/api-resources/knowledge-bases/knowledge-bases.test.ts b/tests/api-resources/knowledge-bases/knowledge-bases.test.ts index 2735566..4a8d8dc 100644 --- a/tests/api-resources/knowledge-bases/knowledge-bases.test.ts +++ b/tests/api-resources/knowledge-bases/knowledge-bases.test.ts @@ -44,6 +44,10 @@ describe('resource knowledgeBases', () => { size_in_bytes: '12345', stored_object_key: 'example string', }, + google_drive_data_source: { + folder_id: '123e4567-e89b-12d3-a456-426614174000', + refresh_token: 'example string', + }, item_path: 'example string', spaces_data_source: { bucket_name: 'example name', @@ -54,6 +58,7 @@ describe('resource knowledgeBases', () => { base_url: 'example string', crawling_option: 'UNKNOWN', embed_media: true, + exclude_tags: ['example string'], }, }, ], @@ -143,4 +148,16 @@ describe('resource knowledgeBases', () => { expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); }); + + // Prism tests are disabled + test.skip('listIndexingJobs', async () => { + const responsePromise = client.knowledgeBases.listIndexingJobs('"123e4567-e89b-12d3-a456-426614174000"'); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); }); diff --git a/tests/api-resources/nfs/nfs.test.ts b/tests/api-resources/nfs/nfs.test.ts new file mode 100644 index 0000000..54d7668 --- /dev/null +++ b/tests/api-resources/nfs/nfs.test.ts @@ -0,0 +1,112 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Gradient from '@digitalocean/gradient'; + +const client = new Gradient({ + accessToken: 'My Access Token', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource nfs', () => { + // Prism tests are disabled + test.skip('create: only required params', async () => { + const responsePromise = client.nfs.create({ + name: 'sammy-share-drive', + region: 'atl1', + size_gib: 1024, + vpc_ids: ['796c6fe3-2a1d-4da2-9f3e-38239827dc91'], + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('create: required and optional params', async () => { + const response = await client.nfs.create({ + name: 'sammy-share-drive', + region: 'atl1', + size_gib: 1024, + vpc_ids: ['796c6fe3-2a1d-4da2-9f3e-38239827dc91'], + }); + }); + + // Prism tests are disabled + test.skip('retrieve: only required params', async () => { + const responsePromise = client.nfs.retrieve('0a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d', { region: 'region' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('retrieve: required and optional params', async () => { + const response = await client.nfs.retrieve('0a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d', { region: 'region' }); + }); + + // Prism tests are disabled + test.skip('list: only required params', async () => { + const responsePromise = client.nfs.list({ region: 'region' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('list: required and optional params', async () => { + const response = await client.nfs.list({ region: 'region' }); + }); + + // Prism tests are disabled + test.skip('delete: only required params', async () => { + const responsePromise = client.nfs.delete('0a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d', { region: 'region' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('delete: required and optional params', async () => { + const response = await client.nfs.delete('0a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d', { region: 'region' }); + }); + + // Prism tests are disabled + test.skip('initiateAction: only required params', async () => { + const responsePromise = client.nfs.initiateAction('0a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d', { + region: 'atl1', + type: 'resize', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('initiateAction: required and optional params', async () => { + const response = await client.nfs.initiateAction('0a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d', { + region: 'atl1', + type: 'resize', + params: { size_gib: 2048 }, + }); + }); +}); diff --git a/tests/api-resources/nfs/snapshots.test.ts b/tests/api-resources/nfs/snapshots.test.ts new file mode 100644 index 0000000..2013c38 --- /dev/null +++ b/tests/api-resources/nfs/snapshots.test.ts @@ -0,0 +1,69 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Gradient from '@digitalocean/gradient'; + +const client = new Gradient({ + accessToken: 'My Access Token', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource snapshots', () => { + // Prism tests are disabled + test.skip('retrieve: only required params', async () => { + const responsePromise = client.nfs.snapshots.retrieve('0a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d', { + region: 'region', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('retrieve: required and optional params', async () => { + const response = await client.nfs.snapshots.retrieve('0a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d', { + region: 'region', + }); + }); + + // Prism tests are disabled + test.skip('list: only required params', async () => { + const responsePromise = client.nfs.snapshots.list({ region: 'region' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('list: required and optional params', async () => { + const response = await client.nfs.snapshots.list({ region: 'region', share_id: 'share_id' }); + }); + + // Prism tests are disabled + test.skip('delete: only required params', async () => { + const responsePromise = client.nfs.snapshots.delete('0a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d', { + region: 'region', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('delete: required and optional params', async () => { + const response = await client.nfs.snapshots.delete('0a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d', { + region: 'region', + }); + }); +}); From 3821374f3a63fb7362bb457a0a88985e75f18845 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 3 Nov 2025 18:49:52 +0000 Subject: [PATCH 2/2] release: 0.1.0-alpha.3 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 21 +++++++++++++++++++++ package.json | 2 +- src/version.ts | 2 +- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c5e8a3e..17473a2 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.2" + ".": "0.1.0-alpha.3" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 2178147..fe9b53f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## 0.1.0-alpha.3 (2025-11-03) + +Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/digitalocean/gradient-typescript/compare/v0.1.0-alpha.2...v0.1.0-alpha.3) + +### Features + +* add waitForAgentReady helper for agent deployment polling ([#9](https://github.com/digitalocean/gradient-typescript/issues/9)) ([48a9366](https://github.com/digitalocean/gradient-typescript/commit/48a9366dbb8879bb6a4be7b59a6bba26840d50d9)) +* **api:** include indexing jobs ([b283f6f](https://github.com/digitalocean/gradient-typescript/commit/b283f6f123067b864841df1eb21e5f1d6da51c93)) +* knowledge base indexing poller ([#14](https://github.com/digitalocean/gradient-typescript/issues/14)) ([04e35f0](https://github.com/digitalocean/gradient-typescript/commit/04e35f0553c622fe33b422f611bb7f1592346510)) +* **knowledge-bases:** add waitForDatabase polling helper ([#8](https://github.com/digitalocean/gradient-typescript/issues/8)) ([12d1af3](https://github.com/digitalocean/gradient-typescript/commit/12d1af3c82962f420eef7160b8ac043aa96087f7)) + + +### Chores + +* formatting fixes ([b2388ec](https://github.com/digitalocean/gradient-typescript/commit/b2388ec757d21bdb00365969af5b083ae1e574b0)) + + +### Refactors + +* normalize wait-for implementations ([#20](https://github.com/digitalocean/gradient-typescript/issues/20)) ([30419d1](https://github.com/digitalocean/gradient-typescript/commit/30419d1f1b238a5d2fcb4720c9599c66daa78ce9)) + ## 0.1.0-alpha.2 (2025-10-16) Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/digitalocean/gradient-typescript/compare/v0.1.0-alpha.1...v0.1.0-alpha.2) diff --git a/package.json b/package.json index 14c6dd7..91f3d97 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@digitalocean/gradient", - "version": "0.1.0-alpha.2", + "version": "0.1.0-alpha.3", "description": "The official TypeScript library for the Gradient API", "author": "DigitalOcean, LLC ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index a528f63..a64b06c 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.1.0-alpha.2'; // x-release-please-version +export const VERSION = '0.1.0-alpha.3'; // x-release-please-version