Skip to content

Commit c17a038

Browse files
feat(api): update via SDK Studio (#6)
1 parent 5a079e7 commit c17a038

File tree

7 files changed

+80
-2
lines changed

7 files changed

+80
-2
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 6
1+
configured_endpoints: 7
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lightswitch%2Flightswitch-6dc2430da32f769677553172dba258ce0d23e8a260f803a5667d344159e8f57a.yml

api.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ Methods:
2222
- <code title="post /tasks">client.tasks.<a href="./src/resources/tasks.ts">create</a>({ ...params }) -> void</code>
2323
- <code title="get /tasks">client.tasks.<a href="./src/resources/tasks.ts">list</a>() -> TaskListResponse</code>
2424

25+
# TasksTaskID
26+
27+
Types:
28+
29+
- <code><a href="./src/resources/tasks-task-id.ts">Task</a></code>
30+
31+
Methods:
32+
33+
- <code title="put /tasks/{task_id}">client.tasksTaskID.<a href="./src/resources/tasks-task-id.ts">update</a>(taskID, { ...params }) -> Task</code>
34+
2535
# Users
2636

2737
Types:

src/client.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
2020
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
2121
import { Project, ProjectCreateParams, ProjectListResponse, Projects } from './resources/projects';
2222
import { Task, TaskCreateParams, TaskListResponse, Tasks } from './resources/tasks';
23+
import { Task as TasksTaskIdapiTask, TasksTaskID, TasksTaskIDUpdateParams } from './resources/tasks-task-id';
2324
import { User, UserCreateParams, UserListResponse, Users } from './resources/users';
2425
import { readEnv } from './internal/utils/env';
2526
import { logger } from './internal/utils/log';
@@ -612,10 +613,12 @@ export class Lightswitch {
612613

613614
projects: API.Projects = new API.Projects(this);
614615
tasks: API.Tasks = new API.Tasks(this);
616+
tasksTaskID: API.TasksTaskID = new API.TasksTaskID(this);
615617
users: API.Users = new API.Users(this);
616618
}
617619
Lightswitch.Projects = Projects;
618620
Lightswitch.Tasks = Tasks;
621+
Lightswitch.TasksTaskID = TasksTaskID;
619622
Lightswitch.Users = Users;
620623
export declare namespace Lightswitch {
621624
export type RequestOptions = Opts.RequestOptions;
@@ -634,6 +637,12 @@ export declare namespace Lightswitch {
634637
type TaskCreateParams as TaskCreateParams,
635638
};
636639

640+
export {
641+
TasksTaskID as TasksTaskID,
642+
type TasksTaskIdapiTask as Task,
643+
type TasksTaskIDUpdateParams as TasksTaskIDUpdateParams,
644+
};
645+
637646
export {
638647
Users as Users,
639648
type User as User,

src/resources/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
export { Projects, type Project, type ProjectListResponse, type ProjectCreateParams } from './projects';
44
export { Tasks, type Task, type TaskListResponse, type TaskCreateParams } from './tasks';
5+
export { TasksTaskID, type Task, type TasksTaskIDUpdateParams } from './tasks-task-id';
56
export { Users, type User, type UserListResponse, type UserCreateParams } from './users';

src/resources/tasks-task-id.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
import { APIResource } from '../resource';
4+
import { APIPromise } from '../api-promise';
5+
import { RequestOptions } from '../internal/request-options';
6+
7+
export class TasksTaskID extends APIResource {
8+
/**
9+
* Update a task
10+
*/
11+
update(taskID: number, body: TasksTaskIDUpdateParams, options?: RequestOptions): APIPromise<Task> {
12+
return this._client.put(`/tasks/${taskID}`, { body, ...options });
13+
}
14+
}
15+
16+
export interface Task {
17+
id?: number;
18+
19+
projectId?: number;
20+
21+
status?: string;
22+
23+
title?: string;
24+
}
25+
26+
export interface TasksTaskIDUpdateParams {
27+
id?: number;
28+
29+
projectId?: number;
30+
31+
status?: string;
32+
33+
title?: string;
34+
}
35+
36+
export declare namespace TasksTaskID {
37+
export { type Task as Task, type TasksTaskIDUpdateParams as TasksTaskIDUpdateParams };
38+
}

src/resources/tasks.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
import { APIResource } from '../resource';
4+
import * as TasksTaskIDAPI from './tasks-task-id';
45
import { APIPromise } from '../api-promise';
56
import { buildHeaders } from '../internal/headers';
67
import { RequestOptions } from '../internal/request-options';
@@ -35,7 +36,7 @@ export interface Task {
3536
title?: string;
3637
}
3738

38-
export type TaskListResponse = Array<Task>;
39+
export type TaskListResponse = Array<TasksTaskIDAPI.Task>;
3940

4041
export interface TaskCreateParams {
4142
id?: number;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
import Lightswitch from 'lightswitch-api';
4+
5+
const client = new Lightswitch({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' });
6+
7+
describe('resource tasksTaskID', () => {
8+
// skipped: tests are disabled for the time being
9+
test.skip('update', async () => {
10+
const responsePromise = client.tasksTaskID.update(0, {});
11+
const rawResponse = await responsePromise.asResponse();
12+
expect(rawResponse).toBeInstanceOf(Response);
13+
const response = await responsePromise;
14+
expect(response).not.toBeInstanceOf(Response);
15+
const dataAndResponse = await responsePromise.withResponse();
16+
expect(dataAndResponse.data).toBe(response);
17+
expect(dataAndResponse.response).toBe(rawResponse);
18+
});
19+
});

0 commit comments

Comments
 (0)