@instructure/athena-api-client 2.3.4 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -73,6 +73,7 @@ All URIs are relative to *http://localhost:3000*
73
73
  *ChatsApi* | [**getChat**](docs/ChatsApi.md#getchat) | **GET** /api/v1/chats/{chatId} | Get a chat
74
74
  *ChatsApi* | [**listChats**](docs/ChatsApi.md#listchats) | **GET** /api/v1/chats | List chats
75
75
  *ChatsApi* | [**markChatAsViewed**](docs/ChatsApi.md#markchatasviewed) | **PATCH** /api/v1/chats/{chatId}/viewed | Mark chat as viewed
76
+ *ChatsApi* | [**resumeChatStream**](docs/ChatsApi.md#resumechatstream) | **GET** /api/v1/chat/{chatId}/stream | Resume a chat stream
76
77
  *ChatsApi* | [**sendChatMessage**](docs/ChatsApi.md#sendchatmessage) | **POST** /api/v1/chat | Send a message to a chat
77
78
  *ChatsApi* | [**updateChat**](docs/ChatsApi.md#updatechatoperation) | **PATCH** /api/v1/chats/{chatId} | Update a chat
78
79
  *DailyQuizApi* | [**createDailyQuiz**](docs/DailyQuizApi.md#createdailyquiz) | **POST** /api/v1/daily-quiz | Get or create today\'s daily quiz
@@ -33,6 +33,10 @@ export interface MarkChatAsViewedRequest {
33
33
  chatId: string;
34
34
  xUserId: string;
35
35
  }
36
+ export interface ResumeChatStreamRequest {
37
+ chatId: string;
38
+ xUserId: string;
39
+ }
36
40
  export interface SendChatMessageRequest {
37
41
  xUserId: string;
38
42
  chatRequest: ChatRequest;
@@ -99,6 +103,16 @@ export declare class ChatsApi extends runtime.BaseAPI {
99
103
  * Mark chat as viewed
100
104
  */
101
105
  markChatAsViewed(requestParameters: MarkChatAsViewedRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Chat>;
106
+ /**
107
+ * Reconnects to an active or recently completed chat stream. Returns 200 with an SSE body if a stream is available, or 204 No Content if no stream exists.
108
+ * Resume a chat stream
109
+ */
110
+ resumeChatStreamRaw(requestParameters: ResumeChatStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<string>>;
111
+ /**
112
+ * Reconnects to an active or recently completed chat stream. Returns 200 with an SSE body if a stream is available, or 204 No Content if no stream exists.
113
+ * Resume a chat stream
114
+ */
115
+ resumeChatStream(requestParameters: ResumeChatStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<string | null | undefined>;
102
116
  /**
103
117
  * Sends a message to a chat conversation with an AI assistant. The client must provide a chatId (UUID v4). If the chatId doesn\'t exist, a new chat will be created with that ID. If it exists and belongs to the user, the conversation continues. The response is streamed in real-time. An optional externalFileUrl (url + mediaType) can be included to have the model read a file as part of its response.
104
118
  * Send a message to a chat
@@ -239,6 +239,59 @@ class ChatsApi extends runtime.BaseAPI {
239
239
  return yield response.value();
240
240
  });
241
241
  }
242
+ /**
243
+ * Reconnects to an active or recently completed chat stream. Returns 200 with an SSE body if a stream is available, or 204 No Content if no stream exists.
244
+ * Resume a chat stream
245
+ */
246
+ resumeChatStreamRaw(requestParameters, initOverrides) {
247
+ return __awaiter(this, void 0, void 0, function* () {
248
+ if (requestParameters['chatId'] == null) {
249
+ throw new runtime.RequiredError('chatId', 'Required parameter "chatId" was null or undefined when calling resumeChatStream().');
250
+ }
251
+ if (requestParameters['xUserId'] == null) {
252
+ throw new runtime.RequiredError('xUserId', 'Required parameter "xUserId" was null or undefined when calling resumeChatStream().');
253
+ }
254
+ const queryParameters = {};
255
+ const headerParameters = {};
256
+ if (requestParameters['xUserId'] != null) {
257
+ headerParameters['X-User-Id'] = String(requestParameters['xUserId']);
258
+ }
259
+ if (this.configuration && this.configuration.apiKey) {
260
+ headerParameters["X-Auth-Token"] = yield this.configuration.apiKey("X-Auth-Token"); // AuthToken authentication
261
+ }
262
+ let urlPath = `/api/v1/chat/{chatId}/stream`;
263
+ urlPath = urlPath.replace(`{${"chatId"}}`, encodeURIComponent(String(requestParameters['chatId'])));
264
+ const response = yield this.request({
265
+ path: urlPath,
266
+ method: 'GET',
267
+ headers: headerParameters,
268
+ query: queryParameters,
269
+ }, initOverrides);
270
+ if (this.isJsonMime(response.headers.get('content-type'))) {
271
+ return new runtime.JSONApiResponse(response);
272
+ }
273
+ else {
274
+ return new runtime.TextApiResponse(response);
275
+ }
276
+ });
277
+ }
278
+ /**
279
+ * Reconnects to an active or recently completed chat stream. Returns 200 with an SSE body if a stream is available, or 204 No Content if no stream exists.
280
+ * Resume a chat stream
281
+ */
282
+ resumeChatStream(requestParameters, initOverrides) {
283
+ return __awaiter(this, void 0, void 0, function* () {
284
+ const response = yield this.resumeChatStreamRaw(requestParameters, initOverrides);
285
+ switch (response.raw.status) {
286
+ case 200:
287
+ return yield response.value();
288
+ case 204:
289
+ return null;
290
+ default:
291
+ return yield response.value();
292
+ }
293
+ });
294
+ }
242
295
  /**
243
296
  * Sends a message to a chat conversation with an AI assistant. The client must provide a chatId (UUID v4). If the chatId doesn\'t exist, a new chat will be created with that ID. If it exists and belongs to the user, the conversation continues. The response is streamed in real-time. An optional externalFileUrl (url + mediaType) can be included to have the model read a file as part of its response.
244
297
  * Send a message to a chat
@@ -33,6 +33,10 @@ export interface MarkChatAsViewedRequest {
33
33
  chatId: string;
34
34
  xUserId: string;
35
35
  }
36
+ export interface ResumeChatStreamRequest {
37
+ chatId: string;
38
+ xUserId: string;
39
+ }
36
40
  export interface SendChatMessageRequest {
37
41
  xUserId: string;
38
42
  chatRequest: ChatRequest;
@@ -99,6 +103,16 @@ export declare class ChatsApi extends runtime.BaseAPI {
99
103
  * Mark chat as viewed
100
104
  */
101
105
  markChatAsViewed(requestParameters: MarkChatAsViewedRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Chat>;
106
+ /**
107
+ * Reconnects to an active or recently completed chat stream. Returns 200 with an SSE body if a stream is available, or 204 No Content if no stream exists.
108
+ * Resume a chat stream
109
+ */
110
+ resumeChatStreamRaw(requestParameters: ResumeChatStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<string>>;
111
+ /**
112
+ * Reconnects to an active or recently completed chat stream. Returns 200 with an SSE body if a stream is available, or 204 No Content if no stream exists.
113
+ * Resume a chat stream
114
+ */
115
+ resumeChatStream(requestParameters: ResumeChatStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<string | null | undefined>;
102
116
  /**
103
117
  * Sends a message to a chat conversation with an AI assistant. The client must provide a chatId (UUID v4). If the chatId doesn\'t exist, a new chat will be created with that ID. If it exists and belongs to the user, the conversation continues. The response is streamed in real-time. An optional externalFileUrl (url + mediaType) can be included to have the model read a file as part of its response.
104
118
  * Send a message to a chat
@@ -236,6 +236,59 @@ export class ChatsApi extends runtime.BaseAPI {
236
236
  return yield response.value();
237
237
  });
238
238
  }
239
+ /**
240
+ * Reconnects to an active or recently completed chat stream. Returns 200 with an SSE body if a stream is available, or 204 No Content if no stream exists.
241
+ * Resume a chat stream
242
+ */
243
+ resumeChatStreamRaw(requestParameters, initOverrides) {
244
+ return __awaiter(this, void 0, void 0, function* () {
245
+ if (requestParameters['chatId'] == null) {
246
+ throw new runtime.RequiredError('chatId', 'Required parameter "chatId" was null or undefined when calling resumeChatStream().');
247
+ }
248
+ if (requestParameters['xUserId'] == null) {
249
+ throw new runtime.RequiredError('xUserId', 'Required parameter "xUserId" was null or undefined when calling resumeChatStream().');
250
+ }
251
+ const queryParameters = {};
252
+ const headerParameters = {};
253
+ if (requestParameters['xUserId'] != null) {
254
+ headerParameters['X-User-Id'] = String(requestParameters['xUserId']);
255
+ }
256
+ if (this.configuration && this.configuration.apiKey) {
257
+ headerParameters["X-Auth-Token"] = yield this.configuration.apiKey("X-Auth-Token"); // AuthToken authentication
258
+ }
259
+ let urlPath = `/api/v1/chat/{chatId}/stream`;
260
+ urlPath = urlPath.replace(`{${"chatId"}}`, encodeURIComponent(String(requestParameters['chatId'])));
261
+ const response = yield this.request({
262
+ path: urlPath,
263
+ method: 'GET',
264
+ headers: headerParameters,
265
+ query: queryParameters,
266
+ }, initOverrides);
267
+ if (this.isJsonMime(response.headers.get('content-type'))) {
268
+ return new runtime.JSONApiResponse(response);
269
+ }
270
+ else {
271
+ return new runtime.TextApiResponse(response);
272
+ }
273
+ });
274
+ }
275
+ /**
276
+ * Reconnects to an active or recently completed chat stream. Returns 200 with an SSE body if a stream is available, or 204 No Content if no stream exists.
277
+ * Resume a chat stream
278
+ */
279
+ resumeChatStream(requestParameters, initOverrides) {
280
+ return __awaiter(this, void 0, void 0, function* () {
281
+ const response = yield this.resumeChatStreamRaw(requestParameters, initOverrides);
282
+ switch (response.raw.status) {
283
+ case 200:
284
+ return yield response.value();
285
+ case 204:
286
+ return null;
287
+ default:
288
+ return yield response.value();
289
+ }
290
+ });
291
+ }
239
292
  /**
240
293
  * Sends a message to a chat conversation with an AI assistant. The client must provide a chatId (UUID v4). If the chatId doesn\'t exist, a new chat will be created with that ID. If it exists and belongs to the user, the conversation continues. The response is streamed in real-time. An optional externalFileUrl (url + mediaType) can be included to have the model read a file as part of its response.
241
294
  * Send a message to a chat
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@instructure/athena-api-client",
3
3
  "private": false,
4
- "version": "2.3.4",
4
+ "version": "2.4.0",
5
5
  "description": "OpenAPI client for the Athena API",
6
6
  "author": "Instructure",
7
7
  "repository": {