Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 9
configured_endpoints: 10
12 changes: 12 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,15 @@ Types:
Methods:

- <code title="get /inference-pipelines/{inferencePipelineId}/results">client.inferencePipelines.testResults.<a href="./src/resources/inference-pipelines/test-results.ts">list</a>(inferencePipelineId, { ...params }) -> TestResultListResponse</code>

# Storage

## PresignedURL

Types:

- <code><a href="./src/resources/storage/presigned-url.ts">PresignedURLCreateResponse</a></code>

Methods:

- <code title="post /storage/presigned-url">client.storage.presignedURL.<a href="./src/resources/storage/presigned-url.ts">create</a>({ ...params }) -> PresignedURLCreateResponse</code>
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export class Openlayer extends Core.APIClient {
projects: API.Projects = new API.Projects(this);
commits: API.Commits = new API.Commits(this);
inferencePipelines: API.InferencePipelines = new API.InferencePipelines(this);
storage: API.Storage = new API.Storage(this);

protected override defaultQuery(): Core.DefaultQuery | undefined {
return this._options.defaultQuery;
Expand Down Expand Up @@ -199,6 +200,8 @@ export namespace Openlayer {
export import Commits = API.Commits;

export import InferencePipelines = API.InferencePipelines;

export import Storage = API.Storage;
}

export default Openlayer;
1 change: 1 addition & 0 deletions src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ export {
ProjectListParams,
Projects,
} from './projects/projects';
export { Storage } from './storage/storage';
4 changes: 4 additions & 0 deletions src/resources/storage/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export { PresignedURLCreateResponse, PresignedURLCreateParams, PresignedURL } from './presigned-url';
export { Storage } from './storage';
47 changes: 47 additions & 0 deletions src/resources/storage/presigned-url.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { APIResource } from '../../resource';
import * as Core from '../../core';
import * as PresignedURLAPI from './presigned-url';

export class PresignedURL extends APIResource {
/**
* Retrieve a presigned url to post storage artifacts.
*/
create(
params: PresignedURLCreateParams,
options?: Core.RequestOptions,
): Core.APIPromise<PresignedURLCreateResponse> {
const { objectName } = params;
return this._client.post('/storage/presigned-url', { query: { objectName }, ...options });
}
}

export interface PresignedURLCreateResponse {
/**
* The storage URI to send back to the backend after the upload was completed.
*/
storageUri: string;

/**
* The presigned url.
*/
url: string;

/**
* Fields to include in the body of the upload. Only needed by s3.
*/
fields?: unknown;
}

export interface PresignedURLCreateParams {
/**
* The name of the object.
*/
objectName: string;
}

export namespace PresignedURL {
export import PresignedURLCreateResponse = PresignedURLAPI.PresignedURLCreateResponse;
export import PresignedURLCreateParams = PresignedURLAPI.PresignedURLCreateParams;
}
14 changes: 14 additions & 0 deletions src/resources/storage/storage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { APIResource } from '../../resource';
import * as PresignedURLAPI from './presigned-url';

export class Storage extends APIResource {
presignedURL: PresignedURLAPI.PresignedURL = new PresignedURLAPI.PresignedURL(this._client);
}

export namespace Storage {
export import PresignedURL = PresignedURLAPI.PresignedURL;
export import PresignedURLCreateResponse = PresignedURLAPI.PresignedURLCreateResponse;
export import PresignedURLCreateParams = PresignedURLAPI.PresignedURLCreateParams;
}
26 changes: 26 additions & 0 deletions tests/api-resources/storage/presigned-url.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// 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 presignedURL', () => {
test('create: only required params', async () => {
const responsePromise = openlayer.storage.presignedURL.create({ objectName: 'objectName' });
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.storage.presignedURL.create({ objectName: 'objectName' });
});
});