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
41 changes: 0 additions & 41 deletions .github/workflows/create-releases.yml

This file was deleted.

8 changes: 6 additions & 2 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# workflow for re-running publishing to NPM in case it fails for some reason
# you can run this workflow by navigating to https://www.github.com/openlayer-ai/openlayer-ts/actions/workflows/publish-npm.yml
# This workflow is triggered when a GitHub release is created.
# It can also be run manually to re-publish to NPM in case it failed for some reason.
# You can run this workflow by navigating to https://www.github.com/openlayer-ai/openlayer-ts/actions/workflows/publish-npm.yml
name: Publish NPM
on:
workflow_dispatch:

release:
types: [published]

jobs:
publish:
name: publish
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ jobs:
run: |
bash ./bin/check-release-environment
env:
STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }}
NPM_TOKEN: ${{ secrets.OPENLAYER_NPM_TOKEN || secrets.NPM_TOKEN }}

2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 14
configured_endpoints: 15
8 changes: 8 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ Methods:

# Commits

Types:

- <code><a href="./src/resources/commits/commits.ts">CommitRetrieveResponse</a></code>

Methods:

- <code title="get /versions/{projectVersionId}">client.commits.<a href="./src/resources/commits/commits.ts">retrieve</a>(projectVersionId) -> CommitRetrieveResponse</code>

## TestResults

Types:
Expand Down
4 changes: 0 additions & 4 deletions bin/check-release-environment
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

errors=()

if [ -z "${STAINLESS_API_KEY}" ]; then
errors+=("The STAINLESS_API_KEY secret has not been set. Please contact Stainless for an API key & set it in your organization secrets on GitHub.")
fi

if [ -z "${NPM_TOKEN}" ]; then
errors+=("The OPENLAYER_NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets")
fi
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as Core from './core';
import * as Errors from './error';
import * as Uploads from './uploads';
import * as API from './resources/index';
import { Commits } from './resources/commits/commits';
import { CommitRetrieveResponse, Commits } from './resources/commits/commits';
import {
InferencePipelineRetrieveParams,
InferencePipelineRetrieveResponse,
Expand Down Expand Up @@ -206,7 +206,7 @@ export declare namespace Openlayer {
type ProjectListParams as ProjectListParams,
};

export { Commits as Commits };
export { Commits as Commits, type CommitRetrieveResponse as CommitRetrieveResponse };

export {
InferencePipelines as InferencePipelines,
Expand Down
161 changes: 161 additions & 0 deletions src/resources/commits/commits.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,177 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { APIResource } from '../../resource';
import * as Core from '../../core';
import * as TestResultsAPI from './test-results';
import { TestResultListParams, TestResultListResponse, TestResults } from './test-results';

export class Commits extends APIResource {
testResults: TestResultsAPI.TestResults = new TestResultsAPI.TestResults(this._client);

/**
* Retrieve a project version (commit) by its id.
*/
retrieve(projectVersionId: string, options?: Core.RequestOptions): Core.APIPromise<CommitRetrieveResponse> {
return this._client.get(`/versions/${projectVersionId}`, options);
}
}

export interface CommitRetrieveResponse {
/**
* The project version (commit) id.
*/
id: string;

/**
* The details of a commit (project version).
*/
commit: CommitRetrieveResponse.Commit;

/**
* The commit archive date.
*/
dateArchived: string | null;

/**
* The project version (commit) creation date.
*/
dateCreated: string;

/**
* The number of tests that are failing for the commit.
*/
failingGoalCount: number;

/**
* The model id.
*/
mlModelId: string | null;

/**
* The number of tests that are passing for the commit.
*/
passingGoalCount: number;

/**
* The project id.
*/
projectId: string;

/**
* The commit status. Initially, the commit is `queued`, then, it switches to
* `running`. Finally, it can be `paused`, `failed`, or `completed`.
*/
status: 'queued' | 'running' | 'paused' | 'failed' | 'completed' | 'unknown';

/**
* The commit status message.
*/
statusMessage: string | null;

/**
* The total number of tests for the commit.
*/
totalGoalCount: number;

/**
* The training dataset id.
*/
trainingDatasetId: string | null;

/**
* The validation dataset id.
*/
validationDatasetId: string | null;

/**
* Whether the commit is archived.
*/
archived?: boolean | null;

/**
* The deployment status associated with the commit's model.
*/
deploymentStatus?: string;

links?: CommitRetrieveResponse.Links;
}

export namespace CommitRetrieveResponse {
/**
* The details of a commit (project version).
*/
export interface Commit {
/**
* The commit id.
*/
id: string;

/**
* The author id of the commit.
*/
authorId: string;

/**
* The size of the commit bundle in bytes.
*/
fileSize: number | null;

/**
* The commit message.
*/
message: string;

/**
* The model id.
*/
mlModelId: string | null;

/**
* The storage URI where the commit bundle is stored.
*/
storageUri: string;

/**
* The training dataset id.
*/
trainingDatasetId: string | null;

/**
* The validation dataset id.
*/
validationDatasetId: string | null;

/**
* The commit creation date.
*/
dateCreated?: string;

/**
* The ref of the corresponding git commit.
*/
gitCommitRef?: string;

/**
* The SHA of the corresponding git commit.
*/
gitCommitSha?: number;

/**
* The URL of the corresponding git commit.
*/
gitCommitUrl?: string;
}

export interface Links {
app: string;
}
}

Commits.TestResults = TestResults;

export declare namespace Commits {
export { type CommitRetrieveResponse as CommitRetrieveResponse };

export {
TestResults as TestResults,
type TestResultListResponse as TestResultListResponse,
Expand Down
2 changes: 1 addition & 1 deletion src/resources/commits/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export { Commits } from './commits';
export { Commits, type CommitRetrieveResponse } from './commits';
export { TestResults, type TestResultListResponse, type TestResultListParams } from './test-results';
2 changes: 1 addition & 1 deletion src/resources/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export { Commits } from './commits/commits';
export { Commits, type CommitRetrieveResponse } from './commits/commits';
export {
InferencePipelines,
type InferencePipelineRetrieveResponse,
Expand Down
29 changes: 29 additions & 0 deletions tests/api-resources/commits/commits.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import Openlayer from 'openlayer';
import { Response } from 'node-fetch';

const client = new Openlayer({
apiKey: 'My API Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});

describe('resource commits', () => {
test('retrieve', async () => {
const responsePromise = client.commits.retrieve('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('retrieve: 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(
client.commits.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { path: '/_stainless_unknown_path' }),
).rejects.toThrow(Openlayer.NotFoundError);
});
});