trieve-ts-sdk
Advanced tools
Comparing version 0.0.30 to 0.0.31
@@ -41,2 +41,3 @@ declare const _default: { | ||
getAllMessagesForTopic(this: import("..").TrieveSDK, data: Omit<import("..").GetAllTopicMessagesData, "trDataset">, signal?: AbortSignal): Promise<import("..").Message[]>; | ||
getMessageById(this: import("..").TrieveSDK, data: Omit<import("..").GetMessageByIdData, "trDataset">, signal?: AbortSignal): Promise<import("..").Message>; | ||
createTopic(this: import("..").TrieveSDK, data: import("..").CreateTopicReqPayload, signal?: AbortSignal): Promise<import("..").Topic>; | ||
@@ -43,0 +44,0 @@ cloneTopic(this: import("..").TrieveSDK, data: import("..").CloneTopicReqPayload, signal?: AbortSignal): Promise<import("..").Topic>; |
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
import { CreateMessageReqPayload, EditMessageReqPayload, GetAllTopicMessagesData, RegenerateMessageReqPayload } from "../../fetch-client"; | ||
import { CreateMessageReqPayload, EditMessageReqPayload, GetAllTopicMessagesData, GetMessageByIdData, RegenerateMessageReqPayload } from "../../fetch-client"; | ||
import { TrieveSDK } from "../../sdk"; | ||
@@ -157,2 +157,15 @@ /** | ||
this: TrieveSDK, data: Omit<GetAllTopicMessagesData, "trDataset">, signal?: AbortSignal): Promise<import("../../types.gen").Message[]>; | ||
/** | ||
* Quickly get the full object for a given message. From the message, you can get the topic and all messages which exist on that topic. | ||
* | ||
* Example: | ||
* ```js | ||
*const data = await trieve.getMessageById({ | ||
messageId: "3c90c3cc-1d76-27198-8888-8dd25736052a", | ||
}); | ||
* ``` | ||
*/ | ||
export declare function getMessageById( | ||
/** @hidden */ | ||
this: TrieveSDK, data: Omit<GetMessageByIdData, "trDataset">, signal?: AbortSignal): Promise<import("../../types.gen").Message>; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -0,1 +1,6 @@ | ||
/** | ||
* This includes all the functions you can use to communicate with our user endpoint | ||
* | ||
* @module User Methods | ||
*/ | ||
import { TrieveSDK } from "../../sdk"; | ||
@@ -2,0 +7,0 @@ import { CreateApiKeyReqPayload, CreateApiKeyResponse, UpdateUserOrgRoleReqPayload } from "../../types.gen"; |
@@ -78,3 +78,9 @@ var __defProp = Object.defineProperty; | ||
if (!response.ok) { | ||
throw new Error(`HTTP error! status: ${await response.text()}`); | ||
throw new Error( | ||
`HTTP error! status: ${await response.text()} | ||
Payload ${JSON.stringify( | ||
requestBody | ||
)} | ||
route: ${method} ${this.baseUrl + updatedPath}` | ||
); | ||
} | ||
@@ -742,2 +748,3 @@ let responseObject; | ||
getAllMessagesForTopic: () => getAllMessagesForTopic, | ||
getMessageById: () => getMessageById, | ||
regenerateMessage: () => regenerateMessage, | ||
@@ -905,2 +912,13 @@ regenerateMessageReader: () => regenerateMessageReader, | ||
} | ||
async function getMessageById(data, signal) { | ||
return await this.trieve.fetch( | ||
"/api/message/{message_id}", | ||
"get", | ||
{ | ||
...data, | ||
datasetId: this.datasetId | ||
}, | ||
signal | ||
); | ||
} | ||
@@ -907,0 +925,0 @@ // src/functions/file/index.ts |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "0.0.30", | ||
"version": "0.0.31", | ||
"license": "MIT", | ||
@@ -12,0 +12,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
492737
8120