agsamantha/node_modules/openai/resources/beta/threads/messages.mjs

61 lines
2 KiB
JavaScript
Raw Normal View History

2024-10-02 15:15:21 -05:00
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../resource.mjs";
import { isRequestOptions } from "../../../core.mjs";
import * as MessagesAPI from "./messages.mjs";
import { CursorPage } from "../../../pagination.mjs";
export class Messages extends APIResource {
/**
* Create a message.
*/
create(threadId, body, options) {
return this._client.post(`/threads/${threadId}/messages`, {
body,
...options,
headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
});
}
/**
* Retrieve a message.
*/
retrieve(threadId, messageId, options) {
return this._client.get(`/threads/${threadId}/messages/${messageId}`, {
...options,
headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
});
}
/**
* Modifies a message.
*/
update(threadId, messageId, body, options) {
return this._client.post(`/threads/${threadId}/messages/${messageId}`, {
body,
...options,
headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
});
}
list(threadId, query = {}, options) {
if (isRequestOptions(query)) {
return this.list(threadId, {}, query);
}
return this._client.getAPIList(`/threads/${threadId}/messages`, MessagesPage, {
query,
...options,
headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
});
}
/**
* Deletes a message.
*/
del(threadId, messageId, options) {
return this._client.delete(`/threads/${threadId}/messages/${messageId}`, {
...options,
headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
});
}
}
export class MessagesPage extends CursorPage {
}
(function (Messages) {
Messages.MessagesPage = MessagesAPI.MessagesPage;
})(Messages || (Messages = {}));
//# sourceMappingURL=messages.mjs.map