From ab8c1a7831e52f8a1d94f75155f9a5a1f30c150e Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Fri, 5 Jul 2024 19:55:18 +0000 Subject: [PATCH] feat(api): update via SDK Studio --- .stats.yml | 2 +- api.md | 10 - src/resources/projects/index.ts | 8 +- src/resources/projects/inference-pipelines.ts | 282 +----------------- src/resources/projects/projects.ts | 4 - .../projects/inference-pipelines.test.ts | 70 ----- 6 files changed, 3 insertions(+), 373 deletions(-) delete mode 100644 tests/api-resources/projects/inference-pipelines.test.ts diff --git a/.stats.yml b/.stats.yml index 699660ea..2b7dbf39 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 8 +configured_endpoints: 6 diff --git a/api.md b/api.md index 8e1c3f52..09b11592 100644 --- a/api.md +++ b/api.md @@ -22,16 +22,6 @@ Methods: ## InferencePipelines -Types: - -- InferencePipelineCreateResponse -- InferencePipelineListResponse - -Methods: - -- client.projects.inferencePipelines.create(id, { ...params }) -> InferencePipelineCreateResponse -- client.projects.inferencePipelines.list(id, { ...params }) -> InferencePipelineListResponse - # Commits ## TestResults diff --git a/src/resources/projects/index.ts b/src/resources/projects/index.ts index 62a84c5a..4c3989e0 100644 --- a/src/resources/projects/index.ts +++ b/src/resources/projects/index.ts @@ -1,13 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { CommitListResponse, CommitListParams, Commits } from './commits'; -export { - InferencePipelineCreateResponse, - InferencePipelineListResponse, - InferencePipelineCreateParams, - InferencePipelineListParams, - InferencePipelines, -} from './inference-pipelines'; +export { InferencePipelines } from './inference-pipelines'; export { ProjectCreateResponse, ProjectListResponse, diff --git a/src/resources/projects/inference-pipelines.ts b/src/resources/projects/inference-pipelines.ts index 28c51863..31b150cd 100644 --- a/src/resources/projects/inference-pipelines.ts +++ b/src/resources/projects/inference-pipelines.ts @@ -1,285 +1,5 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import { isRequestOptions } from '../../core'; -import * as Core from '../../core'; -import * as InferencePipelinesAPI from './inference-pipelines'; -export class InferencePipelines extends APIResource { - /** - * Create an inference pipeline under a project. - */ - create( - id: string, - body: InferencePipelineCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post(`/projects/${id}/inference-pipelines`, { body, ...options }); - } - - /** - * List the inference pipelines in a project. - */ - list( - id: string, - query?: InferencePipelineListParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - list(id: string, options?: Core.RequestOptions): Core.APIPromise; - list( - id: string, - query: InferencePipelineListParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(query)) { - return this.list(id, {}, query); - } - return this._client.get(`/projects/${id}/inference-pipelines`, { query, ...options }); - } -} - -export interface InferencePipelineCreateResponse { - /** - * The inference pipeline id. - */ - id: string; - - /** - * The creation date. - */ - dateCreated: string; - - /** - * The last test evaluation date. - */ - dateLastEvaluated: string | null; - - /** - * The last data sample received date. - */ - dateLastSampleReceived: string | null; - - /** - * The next test evaluation date. - */ - dateOfNextEvaluation: string | null; - - /** - * The last updated date. - */ - dateUpdated: string; - - /** - * The inference pipeline description. - */ - description: string | null; - - /** - * The number of tests failing. - */ - failingGoalCount: number; - - links: InferencePipelineCreateResponse.Links; - - /** - * The inference pipeline name. - */ - name: string; - - /** - * The number of tests passing. - */ - passingGoalCount: number; - - /** - * The project id. - */ - projectId: string; - - /** - * The status of test evaluation for the inference pipeline. - */ - status: 'queued' | 'running' | 'paused' | 'failed' | 'completed' | 'unknown'; - - /** - * The status message of test evaluation for the inference pipeline. - */ - statusMessage: string | null; - - /** - * The total number of tests. - */ - totalGoalCount: number; - - /** - * The storage type. - */ - storageType?: 'local' | 's3' | 'gcs' | 'azure'; -} - -export namespace InferencePipelineCreateResponse { - export interface Links { - app: string; - } -} - -export interface InferencePipelineListResponse { - _meta: InferencePipelineListResponse._Meta; - - items: Array; -} - -export namespace InferencePipelineListResponse { - export interface _Meta { - /** - * The current page. - */ - page: number; - - /** - * The number of items per page. - */ - perPage: number; - - /** - * The total number of items. - */ - totalItems: number; - - /** - * The total number of pages. - */ - totalPages: number; - } - - export interface Item { - /** - * The inference pipeline id. - */ - id: string; - - /** - * The creation date. - */ - dateCreated: string; - - /** - * The last test evaluation date. - */ - dateLastEvaluated: string | null; - - /** - * The last data sample received date. - */ - dateLastSampleReceived: string | null; - - /** - * The next test evaluation date. - */ - dateOfNextEvaluation: string | null; - - /** - * The last updated date. - */ - dateUpdated: string; - - /** - * The inference pipeline description. - */ - description: string | null; - - /** - * The number of tests failing. - */ - failingGoalCount: number; - - links: Item.Links; - - /** - * The inference pipeline name. - */ - name: string; - - /** - * The number of tests passing. - */ - passingGoalCount: number; - - /** - * The project id. - */ - projectId: string; - - /** - * The status of test evaluation for the inference pipeline. - */ - status: 'queued' | 'running' | 'paused' | 'failed' | 'completed' | 'unknown'; - - /** - * The status message of test evaluation for the inference pipeline. - */ - statusMessage: string | null; - - /** - * The total number of tests. - */ - totalGoalCount: number; - - /** - * The storage type. - */ - storageType?: 'local' | 's3' | 'gcs' | 'azure'; - } - - export namespace Item { - export interface Links { - app: string; - } - } -} - -export interface InferencePipelineCreateParams { - /** - * The inference pipeline description. - */ - description: string | null; - - /** - * The inference pipeline name. - */ - name: string; - - /** - * The reference dataset URI. - */ - referenceDatasetUri?: string | null; - - /** - * The storage type. - */ - storageType?: 'local' | 's3' | 'gcs' | 'azure'; -} - -export interface InferencePipelineListParams { - /** - * Filter list of items by name. - */ - name?: string; - - /** - * The page to return in a paginated query. - */ - page?: number; - - /** - * Maximum number of items to return per page. - */ - perPage?: number; -} - -export namespace InferencePipelines { - export import InferencePipelineCreateResponse = InferencePipelinesAPI.InferencePipelineCreateResponse; - export import InferencePipelineListResponse = InferencePipelinesAPI.InferencePipelineListResponse; - export import InferencePipelineCreateParams = InferencePipelinesAPI.InferencePipelineCreateParams; - export import InferencePipelineListParams = InferencePipelinesAPI.InferencePipelineListParams; -} +export class InferencePipelines extends APIResource {} diff --git a/src/resources/projects/projects.ts b/src/resources/projects/projects.ts index 3a6ad577..6691b80a 100644 --- a/src/resources/projects/projects.ts +++ b/src/resources/projects/projects.ts @@ -421,8 +421,4 @@ export namespace Projects { export import CommitListResponse = CommitsAPI.CommitListResponse; export import CommitListParams = CommitsAPI.CommitListParams; export import InferencePipelines = InferencePipelinesAPI.InferencePipelines; - export import InferencePipelineCreateResponse = InferencePipelinesAPI.InferencePipelineCreateResponse; - export import InferencePipelineListResponse = InferencePipelinesAPI.InferencePipelineListResponse; - export import InferencePipelineCreateParams = InferencePipelinesAPI.InferencePipelineCreateParams; - export import InferencePipelineListParams = InferencePipelinesAPI.InferencePipelineListParams; } diff --git a/tests/api-resources/projects/inference-pipelines.test.ts b/tests/api-resources/projects/inference-pipelines.test.ts deleted file mode 100644 index 2b030a28..00000000 --- a/tests/api-resources/projects/inference-pipelines.test.ts +++ /dev/null @@ -1,70 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import Openlayer from 'openlayer'; -import { Response } from 'node-fetch'; - -const openlayer = new Openlayer({ - apiKey: 'My API Key', - baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', -}); - -describe('resource inferencePipelines', () => { - test('create: only required params', async () => { - const responsePromise = openlayer.projects.inferencePipelines.create( - '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - { description: 'This pipeline is used for production.', name: 'production' }, - ); - 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); - }); - - test('create: required and optional params', async () => { - const response = await openlayer.projects.inferencePipelines.create( - '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - { - description: 'This pipeline is used for production.', - name: 'production', - referenceDatasetUri: 's3://...', - storageType: 's3', - }, - ); - }); - - test('list', async () => { - const responsePromise = openlayer.projects.inferencePipelines.list( - '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - ); - 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); - }); - - test('list: request options instead of 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( - openlayer.projects.inferencePipelines.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { - path: '/_stainless_unknown_path', - }), - ).rejects.toThrow(Openlayer.NotFoundError); - }); - - test('list: 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( - openlayer.projects.inferencePipelines.list( - '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - { name: 'string', page: 1, perPage: 1 }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Openlayer.NotFoundError); - }); -});