Unit_AI/node_modules/openai/resources/beta/threads/messages/messages.mjs
2024-06-01 16:24:36 -04:00

59 lines
No EOL
2 KiB
JavaScript

// File generated from our OpenAPI spec by Stainless.
import { APIResource } from 'openai/resource';
import { isRequestOptions } from 'openai/core';
import * as MessagesAPI from 'openai/resources/beta/threads/messages/messages';
import * as FilesAPI from 'openai/resources/beta/threads/messages/files';
import { CursorPage } from 'openai/pagination';
export class Messages extends APIResource {
constructor() {
super(...arguments);
this.files = new FilesAPI.Files(this._client);
}
/**
* Create a message.
*/
create(threadId, body, options) {
return this._client.post(`/threads/${threadId}/messages`, {
body,
...options,
headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
});
}
/**
* Retrieve a message.
*/
retrieve(threadId, messageId, options) {
return this._client.get(`/threads/${threadId}/messages/${messageId}`, {
...options,
headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
});
}
/**
* Modifies a message.
*/
update(threadId, messageId, body, options) {
return this._client.post(`/threads/${threadId}/messages/${messageId}`, {
body,
...options,
headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
});
}
list(threadId, query = {}, options) {
if (isRequestOptions(query)) {
return this.list(threadId, {}, query);
}
return this._client.getAPIList(`/threads/${threadId}/messages`, ThreadMessagesPage, {
query,
...options,
headers: { 'OpenAI-Beta': 'assistants=v1', ...options?.headers },
});
}
}
export class ThreadMessagesPage extends CursorPage {
}
(function (Messages) {
Messages.ThreadMessagesPage = MessagesAPI.ThreadMessagesPage;
Messages.Files = FilesAPI.Files;
Messages.MessageFilesPage = FilesAPI.MessageFilesPage;
})(Messages || (Messages = {}));
//# sourceMappingURL=messages.mjs.map