Skip to content

Commit

Permalink
feat(api): put/patch methods swap (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Jan 14, 2025
1 parent 131ba06 commit f0f654d
Show file tree
Hide file tree
Showing 13 changed files with 533 additions and 533 deletions.
16 changes: 8 additions & 8 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ Types:
Methods:

- <code title="post /agents">client.agents.<a href="./src/resources/agents/agents.ts">create</a>({ ...params }) -> ResourceCreated</code>
- <code title="put /agents/{agent_id}">client.agents.<a href="./src/resources/agents/agents.ts">update</a>(agentId, { ...params }) -> ResourceUpdated</code>
- <code title="patch /agents/{agent_id}">client.agents.<a href="./src/resources/agents/agents.ts">update</a>(agentId, { ...params }) -> ResourceUpdated</code>
- <code title="get /agents">client.agents.<a href="./src/resources/agents/agents.ts">list</a>({ ...params }) -> AgentsOffsetPagination</code>
- <code title="delete /agents/{agent_id}">client.agents.<a href="./src/resources/agents/agents.ts">delete</a>(agentId) -> ResourceDeleted</code>
- <code title="post /agents/{agent_id}">client.agents.<a href="./src/resources/agents/agents.ts">createOrUpdate</a>(agentId, { ...params }) -> ResourceCreated</code>
- <code title="get /agents/{agent_id}">client.agents.<a href="./src/resources/agents/agents.ts">get</a>(agentId) -> Agent</code>
- <code title="patch /agents/{agent_id}">client.agents.<a href="./src/resources/agents/agents.ts">patch</a>(agentId, { ...params }) -> ResourceUpdated</code>
- <code title="put /agents/{agent_id}">client.agents.<a href="./src/resources/agents/agents.ts">reset</a>(agentId, { ...params }) -> ResourceUpdated</code>

## Tools

Expand All @@ -31,10 +31,10 @@ Types:
Methods:

- <code title="post /agents/{agent_id}/tools">client.agents.tools.<a href="./src/resources/agents/tools.ts">create</a>(agentId, { ...params }) -> ResourceCreated</code>
- <code title="put /agents/{agent_id}/tools/{tool_id}">client.agents.tools.<a href="./src/resources/agents/tools.ts">update</a>(agentId, toolId, { ...params }) -> ResourceUpdated</code>
- <code title="patch /agents/{agent_id}/tools/{tool_id}">client.agents.tools.<a href="./src/resources/agents/tools.ts">update</a>(agentId, toolId, { ...params }) -> ResourceUpdated</code>
- <code title="get /agents/{agent_id}/tools">client.agents.tools.<a href="./src/resources/agents/tools.ts">list</a>(agentId, { ...params }) -> ToolListResponsesOffsetPagination</code>
- <code title="delete /agents/{agent_id}/tools/{tool_id}">client.agents.tools.<a href="./src/resources/agents/tools.ts">delete</a>(agentId, toolId) -> ResourceDeleted</code>
- <code title="patch /agents/{agent_id}/tools/{tool_id}">client.agents.tools.<a href="./src/resources/agents/tools.ts">patch</a>(agentId, toolId, { ...params }) -> ResourceUpdated</code>
- <code title="put /agents/{agent_id}/tools/{tool_id}">client.agents.tools.<a href="./src/resources/agents/tools.ts">reset</a>(agentId, toolId, { ...params }) -> ResourceUpdated</code>

## Docs

Expand Down Expand Up @@ -77,14 +77,14 @@ Types:
Methods:

- <code title="post /sessions">client.sessions.<a href="./src/resources/sessions.ts">create</a>({ ...params }) -> ResourceCreated</code>
- <code title="put /sessions/{session_id}">client.sessions.<a href="./src/resources/sessions.ts">update</a>(sessionId, { ...params }) -> ResourceUpdated</code>
- <code title="patch /sessions/{session_id}">client.sessions.<a href="./src/resources/sessions.ts">update</a>(sessionId, { ...params }) -> ResourceUpdated</code>
- <code title="get /sessions">client.sessions.<a href="./src/resources/sessions.ts">list</a>({ ...params }) -> SessionsOffsetPagination</code>
- <code title="delete /sessions/{session_id}">client.sessions.<a href="./src/resources/sessions.ts">delete</a>(sessionId) -> ResourceDeleted</code>
- <code title="post /sessions/{session_id}/chat">client.sessions.<a href="./src/resources/sessions.ts">chat</a>(sessionId, { ...params }) -> SessionChatResponse</code>
- <code title="post /sessions/{session_id}">client.sessions.<a href="./src/resources/sessions.ts">createOrUpdate</a>(sessionId, { ...params }) -> ResourceUpdated</code>
- <code title="get /sessions/{session_id}">client.sessions.<a href="./src/resources/sessions.ts">get</a>(sessionId) -> Session</code>
- <code title="get /sessions/{session_id}/history">client.sessions.<a href="./src/resources/sessions.ts">history</a>(sessionId) -> History</code>
- <code title="patch /sessions/{session_id}">client.sessions.<a href="./src/resources/sessions.ts">patch</a>(sessionId, { ...params }) -> ResourceUpdated</code>
- <code title="put /sessions/{session_id}">client.sessions.<a href="./src/resources/sessions.ts">reset</a>(sessionId, { ...params }) -> ResourceUpdated</code>

# Users

Expand All @@ -95,12 +95,12 @@ Types:
Methods:

- <code title="post /users">client.users.<a href="./src/resources/users/users.ts">create</a>({ ...params }) -> ResourceCreated</code>
- <code title="put /users/{user_id}">client.users.<a href="./src/resources/users/users.ts">update</a>(userId, { ...params }) -> ResourceUpdated</code>
- <code title="patch /users/{user_id}">client.users.<a href="./src/resources/users/users.ts">update</a>(userId, { ...params }) -> ResourceUpdated</code>
- <code title="get /users">client.users.<a href="./src/resources/users/users.ts">list</a>({ ...params }) -> UsersOffsetPagination</code>
- <code title="delete /users/{user_id}">client.users.<a href="./src/resources/users/users.ts">delete</a>(userId) -> ResourceDeleted</code>
- <code title="post /users/{user_id}">client.users.<a href="./src/resources/users/users.ts">createOrUpdate</a>(userId, { ...params }) -> ResourceCreated</code>
- <code title="get /users/{user_id}">client.users.<a href="./src/resources/users/users.ts">get</a>(userId) -> User</code>
- <code title="patch /users/{user_id}">client.users.<a href="./src/resources/users/users.ts">patch</a>(userId, { ...params }) -> ResourceUpdated</code>
- <code title="put /users/{user_id}">client.users.<a href="./src/resources/users/users.ts">reset</a>(userId, { ...params }) -> ResourceUpdated</code>

## Docs

Expand Down
12 changes: 6 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
SessionCreateOrUpdateParams,
SessionCreateParams,
SessionListParams,
SessionPatchParams,
SessionResetParams,
SessionUpdateParams,
Sessions,
SessionsOffsetPagination,
Expand All @@ -42,7 +42,7 @@ import {
AgentCreateOrUpdateParams,
AgentCreateParams,
AgentListParams,
AgentPatchParams,
AgentResetParams,
AgentUpdateParams,
Agents,
AgentsOffsetPagination,
Expand All @@ -62,7 +62,7 @@ import {
UserCreateOrUpdateParams,
UserCreateParams,
UserListParams,
UserPatchParams,
UserResetParams,
UserUpdateParams,
Users,
UsersOffsetPagination,
Expand Down Expand Up @@ -287,7 +287,7 @@ export declare namespace Julep {
type AgentUpdateParams as AgentUpdateParams,
type AgentListParams as AgentListParams,
type AgentCreateOrUpdateParams as AgentCreateOrUpdateParams,
type AgentPatchParams as AgentPatchParams,
type AgentResetParams as AgentResetParams,
};

export { Files as Files, type File as File, type FileCreateParams as FileCreateParams };
Expand All @@ -308,7 +308,7 @@ export declare namespace Julep {
type SessionListParams as SessionListParams,
type SessionChatParams as SessionChatParams,
type SessionCreateOrUpdateParams as SessionCreateOrUpdateParams,
type SessionPatchParams as SessionPatchParams,
type SessionResetParams as SessionResetParams,
};

export {
Expand All @@ -319,7 +319,7 @@ export declare namespace Julep {
type UserUpdateParams as UserUpdateParams,
type UserListParams as UserListParams,
type UserCreateOrUpdateParams as UserCreateOrUpdateParams,
type UserPatchParams as UserPatchParams,
type UserResetParams as UserResetParams,
};

export { Jobs as Jobs, type JobStatus as JobStatus };
Expand Down
32 changes: 16 additions & 16 deletions src/resources/agents/agents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
ToolListParams,
ToolListResponse,
ToolListResponsesOffsetPagination,
ToolPatchParams,
ToolResetParams,
ToolUpdateParams,
Tools,
} from './tools';
Expand All @@ -30,14 +30,14 @@ export class Agents extends APIResource {
}

/**
* Update Agent
* Patch Agent
*/
update(
agentId: string,
body: AgentUpdateParams,
options?: Core.RequestOptions,
): Core.APIPromise<Shared.ResourceUpdated> {
return this._client.put(`/agents/${agentId}`, { body, ...options });
return this._client.patch(`/agents/${agentId}`, { body, ...options });
}

/**
Expand Down Expand Up @@ -84,14 +84,14 @@ export class Agents extends APIResource {
}

/**
* Patch Agent
* Update Agent
*/
patch(
reset(
agentId: string,
body: AgentPatchParams,
body: AgentResetParams,
options?: Core.RequestOptions,
): Core.APIPromise<Shared.ResourceUpdated> {
return this._client.patch(`/agents/${agentId}`, { body, ...options });
return this._client.put(`/agents/${agentId}`, { body, ...options });
}
}

Expand Down Expand Up @@ -184,8 +184,6 @@ export namespace AgentCreateParams {
}

export interface AgentUpdateParams {
name: string;

about?: string;

canonical_name?: string | null;
Expand All @@ -200,6 +198,8 @@ export interface AgentUpdateParams {
metadata?: unknown | null;

model?: string;

name?: string | null;
}

export namespace AgentUpdateParams {
Expand Down Expand Up @@ -271,26 +271,26 @@ export namespace AgentCreateOrUpdateParams {
}
}

export interface AgentPatchParams {
export interface AgentResetParams {
name: string;

about?: string;

canonical_name?: string | null;

/**
* Default settings for the chat session (also used by the agent)
*/
default_settings?: AgentPatchParams.DefaultSettings | null;
default_settings?: AgentResetParams.DefaultSettings | null;

instructions?: string | Array<string>;

metadata?: unknown | null;

model?: string;

name?: string | null;
}

export namespace AgentPatchParams {
export namespace AgentResetParams {
/**
* Default settings for the chat session (also used by the agent)
*/
Expand Down Expand Up @@ -324,7 +324,7 @@ export declare namespace Agents {
type AgentUpdateParams as AgentUpdateParams,
type AgentListParams as AgentListParams,
type AgentCreateOrUpdateParams as AgentCreateOrUpdateParams,
type AgentPatchParams as AgentPatchParams,
type AgentResetParams as AgentResetParams,
};

export {
Expand All @@ -334,7 +334,7 @@ export declare namespace Agents {
type ToolCreateParams as ToolCreateParams,
type ToolUpdateParams as ToolUpdateParams,
type ToolListParams as ToolListParams,
type ToolPatchParams as ToolPatchParams,
type ToolResetParams as ToolResetParams,
};

export {
Expand Down
4 changes: 2 additions & 2 deletions src/resources/agents/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export {
type AgentUpdateParams,
type AgentListParams,
type AgentCreateOrUpdateParams,
type AgentPatchParams,
type AgentResetParams,
} from './agents';
export {
Docs,
Expand All @@ -24,5 +24,5 @@ export {
type ToolCreateParams,
type ToolUpdateParams,
type ToolListParams,
type ToolPatchParams,
type ToolResetParams,
} from './tools';
Loading

0 comments on commit f0f654d

Please sign in to comment.