@gleanwork/api-client 0.1.0-beta.2 → 0.1.0-beta.4

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.
Files changed (110) hide show
  1. package/README.md +34 -28
  2. package/dist/commonjs/__tests__/chat.test.js +233 -414
  3. package/dist/commonjs/__tests__/chat.test.js.map +1 -1
  4. package/dist/commonjs/funcs/chatChatStream.d.ts +16 -0
  5. package/dist/commonjs/funcs/chatChatStream.d.ts.map +1 -0
  6. package/dist/commonjs/funcs/chatChatStream.js +121 -0
  7. package/dist/commonjs/funcs/chatChatStream.js.map +1 -0
  8. package/dist/commonjs/funcs/clientChatStart.d.ts +1 -1
  9. package/dist/commonjs/funcs/clientChatStart.d.ts.map +1 -1
  10. package/dist/commonjs/funcs/clientChatStart.js +3 -3
  11. package/dist/commonjs/funcs/clientChatStart.js.map +1 -1
  12. package/dist/commonjs/lib/config.d.ts +3 -3
  13. package/dist/commonjs/lib/config.js +3 -3
  14. package/dist/commonjs/models/operations/chatstream.d.ts +38 -0
  15. package/dist/commonjs/models/operations/chatstream.d.ts.map +1 -0
  16. package/dist/commonjs/models/operations/chatstream.js +81 -0
  17. package/dist/commonjs/models/operations/chatstream.js.map +1 -0
  18. package/dist/commonjs/models/operations/index.d.ts +1 -0
  19. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  20. package/dist/commonjs/models/operations/index.js +1 -0
  21. package/dist/commonjs/models/operations/index.js.map +1 -1
  22. package/dist/commonjs/react-query/chatChatStream.d.ts +24 -0
  23. package/dist/commonjs/react-query/chatChatStream.d.ts.map +1 -0
  24. package/dist/commonjs/react-query/chatChatStream.js +47 -0
  25. package/dist/commonjs/react-query/chatChatStream.js.map +1 -0
  26. package/dist/commonjs/react-query/clientChatStart.d.ts +1 -1
  27. package/dist/commonjs/react-query/clientChatStart.d.ts.map +1 -1
  28. package/dist/commonjs/react-query/index.d.ts +1 -0
  29. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  30. package/dist/commonjs/react-query/index.js +1 -0
  31. package/dist/commonjs/react-query/index.js.map +1 -1
  32. package/dist/commonjs/sdk/chat.d.ts +1 -57
  33. package/dist/commonjs/sdk/chat.d.ts.map +1 -1
  34. package/dist/commonjs/sdk/chat.js +3 -83
  35. package/dist/commonjs/sdk/chat.js.map +1 -1
  36. package/dist/commonjs/sdk/client.d.ts +2 -2
  37. package/dist/commonjs/sdk/client.d.ts.map +1 -1
  38. package/dist/commonjs/sdk/client.js +2 -2
  39. package/dist/commonjs/sdk/client.js.map +1 -1
  40. package/dist/commonjs/sdk/clientchat.d.ts +68 -0
  41. package/dist/commonjs/sdk/clientchat.d.ts.map +1 -0
  42. package/dist/commonjs/sdk/clientchat.js +102 -0
  43. package/dist/commonjs/sdk/clientchat.js.map +1 -0
  44. package/dist/commonjs/sdk/sdk.d.ts +3 -0
  45. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  46. package/dist/commonjs/sdk/sdk.js +4 -0
  47. package/dist/commonjs/sdk/sdk.js.map +1 -1
  48. package/dist/esm/__tests__/chat.test.js +234 -415
  49. package/dist/esm/__tests__/chat.test.js.map +1 -1
  50. package/dist/esm/funcs/chatChatStream.d.ts +16 -0
  51. package/dist/esm/funcs/chatChatStream.d.ts.map +1 -0
  52. package/dist/esm/funcs/chatChatStream.js +85 -0
  53. package/dist/esm/funcs/chatChatStream.js.map +1 -0
  54. package/dist/esm/funcs/clientChatStart.d.ts +1 -1
  55. package/dist/esm/funcs/clientChatStart.d.ts.map +1 -1
  56. package/dist/esm/funcs/clientChatStart.js +3 -3
  57. package/dist/esm/funcs/clientChatStart.js.map +1 -1
  58. package/dist/esm/lib/config.d.ts +3 -3
  59. package/dist/esm/lib/config.js +3 -3
  60. package/dist/esm/models/operations/chatstream.d.ts +38 -0
  61. package/dist/esm/models/operations/chatstream.d.ts.map +1 -0
  62. package/dist/esm/models/operations/chatstream.js +43 -0
  63. package/dist/esm/models/operations/chatstream.js.map +1 -0
  64. package/dist/esm/models/operations/index.d.ts +1 -0
  65. package/dist/esm/models/operations/index.d.ts.map +1 -1
  66. package/dist/esm/models/operations/index.js +1 -0
  67. package/dist/esm/models/operations/index.js.map +1 -1
  68. package/dist/esm/react-query/chatChatStream.d.ts +24 -0
  69. package/dist/esm/react-query/chatChatStream.d.ts.map +1 -0
  70. package/dist/esm/react-query/chatChatStream.js +42 -0
  71. package/dist/esm/react-query/chatChatStream.js.map +1 -0
  72. package/dist/esm/react-query/clientChatStart.d.ts +1 -1
  73. package/dist/esm/react-query/clientChatStart.d.ts.map +1 -1
  74. package/dist/esm/react-query/index.d.ts +1 -0
  75. package/dist/esm/react-query/index.d.ts.map +1 -1
  76. package/dist/esm/react-query/index.js +1 -0
  77. package/dist/esm/react-query/index.js.map +1 -1
  78. package/dist/esm/sdk/chat.d.ts +1 -57
  79. package/dist/esm/sdk/chat.d.ts.map +1 -1
  80. package/dist/esm/sdk/chat.js +3 -83
  81. package/dist/esm/sdk/chat.js.map +1 -1
  82. package/dist/esm/sdk/client.d.ts +2 -2
  83. package/dist/esm/sdk/client.d.ts.map +1 -1
  84. package/dist/esm/sdk/client.js +2 -2
  85. package/dist/esm/sdk/client.js.map +1 -1
  86. package/dist/esm/sdk/clientchat.d.ts +68 -0
  87. package/dist/esm/sdk/clientchat.d.ts.map +1 -0
  88. package/dist/esm/sdk/clientchat.js +98 -0
  89. package/dist/esm/sdk/clientchat.js.map +1 -0
  90. package/dist/esm/sdk/sdk.d.ts +3 -0
  91. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  92. package/dist/esm/sdk/sdk.js +4 -0
  93. package/dist/esm/sdk/sdk.js.map +1 -1
  94. package/docs/sdks/chat/README.md +8 -768
  95. package/docs/sdks/clientchat/README.md +878 -0
  96. package/jsr.json +1 -1
  97. package/package.json +1 -1
  98. package/src/__tests__/chat.test.ts +292 -457
  99. package/src/funcs/chatChatStream.ts +169 -0
  100. package/src/funcs/clientChatStart.ts +5 -6
  101. package/src/lib/config.ts +3 -3
  102. package/src/models/operations/chatstream.ts +86 -0
  103. package/src/models/operations/index.ts +1 -0
  104. package/src/react-query/chatChatStream.ts +91 -0
  105. package/src/react-query/clientChatStart.ts +1 -1
  106. package/src/react-query/index.ts +1 -0
  107. package/src/sdk/chat.ts +3 -159
  108. package/src/sdk/client.ts +4 -4
  109. package/src/sdk/clientchat.ts +185 -0
  110. package/src/sdk/sdk.ts +6 -0
@@ -0,0 +1,185 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { clientChatDelete } from "../funcs/clientChatDelete.js";
6
+ import { clientChatDeleteAll } from "../funcs/clientChatDeleteAll.js";
7
+ import { clientChatDeleteFiles } from "../funcs/clientChatDeleteFiles.js";
8
+ import { clientChatGet } from "../funcs/clientChatGet.js";
9
+ import { clientChatGetApplication } from "../funcs/clientChatGetApplication.js";
10
+ import { clientChatGetFiles } from "../funcs/clientChatGetFiles.js";
11
+ import { clientChatList } from "../funcs/clientChatList.js";
12
+ import { clientChatStart } from "../funcs/clientChatStart.js";
13
+ import { clientChatUploadFiles } from "../funcs/clientChatUploadFiles.js";
14
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
15
+ import * as components from "../models/components/index.js";
16
+ import { unwrapAsync } from "../types/fp.js";
17
+
18
+ export class ClientChat extends ClientSDK {
19
+ /**
20
+ * Chat
21
+ *
22
+ * @remarks
23
+ * Have a conversation with Glean AI.
24
+ */
25
+ async start(
26
+ chatRequest: components.ChatRequest,
27
+ timezoneOffset?: number | undefined,
28
+ options?: RequestOptions,
29
+ ): Promise<components.ChatResponse> {
30
+ return unwrapAsync(clientChatStart(
31
+ this,
32
+ chatRequest,
33
+ timezoneOffset,
34
+ options,
35
+ ));
36
+ }
37
+
38
+ /**
39
+ * Deletes all saved Chats owned by a user
40
+ *
41
+ * @remarks
42
+ * Deletes all saved Chats a user has had and all their contained conversational content.
43
+ */
44
+ async deleteAll(
45
+ timezoneOffset?: number | undefined,
46
+ options?: RequestOptions,
47
+ ): Promise<void> {
48
+ return unwrapAsync(clientChatDeleteAll(
49
+ this,
50
+ timezoneOffset,
51
+ options,
52
+ ));
53
+ }
54
+
55
+ /**
56
+ * Deletes saved Chats
57
+ *
58
+ * @remarks
59
+ * Deletes saved Chats and all their contained conversational content.
60
+ */
61
+ async delete(
62
+ deleteChatsRequest: components.DeleteChatsRequest,
63
+ timezoneOffset?: number | undefined,
64
+ options?: RequestOptions,
65
+ ): Promise<void> {
66
+ return unwrapAsync(clientChatDelete(
67
+ this,
68
+ deleteChatsRequest,
69
+ timezoneOffset,
70
+ options,
71
+ ));
72
+ }
73
+
74
+ /**
75
+ * Retrieves a Chat
76
+ *
77
+ * @remarks
78
+ * Retrieves the chat history between Glean Assistant and the user for a given Chat.
79
+ */
80
+ async get(
81
+ getChatRequest: components.GetChatRequest,
82
+ timezoneOffset?: number | undefined,
83
+ options?: RequestOptions,
84
+ ): Promise<components.GetChatResponse> {
85
+ return unwrapAsync(clientChatGet(
86
+ this,
87
+ getChatRequest,
88
+ timezoneOffset,
89
+ options,
90
+ ));
91
+ }
92
+
93
+ /**
94
+ * Retrieves all saved Chats
95
+ *
96
+ * @remarks
97
+ * Retrieves all the saved Chats between Glean Assistant and the user. The returned Chats contain only metadata and no conversational content.
98
+ */
99
+ async list(
100
+ timezoneOffset?: number | undefined,
101
+ options?: RequestOptions,
102
+ ): Promise<components.ListChatsResponse> {
103
+ return unwrapAsync(clientChatList(
104
+ this,
105
+ timezoneOffset,
106
+ options,
107
+ ));
108
+ }
109
+
110
+ /**
111
+ * Gets the metadata for a custom Chat application
112
+ *
113
+ * @remarks
114
+ * Gets the Chat application details for the specified application ID.
115
+ */
116
+ async getApplication(
117
+ getChatApplicationRequest: components.GetChatApplicationRequest,
118
+ timezoneOffset?: number | undefined,
119
+ options?: RequestOptions,
120
+ ): Promise<components.GetChatApplicationResponse> {
121
+ return unwrapAsync(clientChatGetApplication(
122
+ this,
123
+ getChatApplicationRequest,
124
+ timezoneOffset,
125
+ options,
126
+ ));
127
+ }
128
+
129
+ /**
130
+ * Upload files for Chat.
131
+ *
132
+ * @remarks
133
+ * Upload files for Chat.
134
+ */
135
+ async uploadFiles(
136
+ uploadChatFilesRequest: components.UploadChatFilesRequest,
137
+ timezoneOffset?: number | undefined,
138
+ options?: RequestOptions,
139
+ ): Promise<components.UploadChatFilesResponse> {
140
+ return unwrapAsync(clientChatUploadFiles(
141
+ this,
142
+ uploadChatFilesRequest,
143
+ timezoneOffset,
144
+ options,
145
+ ));
146
+ }
147
+
148
+ /**
149
+ * Get files uploaded by a user for Chat.
150
+ *
151
+ * @remarks
152
+ * Get files uploaded by a user for Chat.
153
+ */
154
+ async getFiles(
155
+ getChatFilesRequest: components.GetChatFilesRequest,
156
+ timezoneOffset?: number | undefined,
157
+ options?: RequestOptions,
158
+ ): Promise<components.GetChatFilesResponse> {
159
+ return unwrapAsync(clientChatGetFiles(
160
+ this,
161
+ getChatFilesRequest,
162
+ timezoneOffset,
163
+ options,
164
+ ));
165
+ }
166
+
167
+ /**
168
+ * Delete files uploaded by a user for chat.
169
+ *
170
+ * @remarks
171
+ * Delete files uploaded by a user for Chat.
172
+ */
173
+ async deleteFiles(
174
+ deleteChatFilesRequest: components.DeleteChatFilesRequest,
175
+ timezoneOffset?: number | undefined,
176
+ options?: RequestOptions,
177
+ ): Promise<void> {
178
+ return unwrapAsync(clientChatDeleteFiles(
179
+ this,
180
+ deleteChatFilesRequest,
181
+ timezoneOffset,
182
+ options,
183
+ ));
184
+ }
185
+ }
package/src/sdk/sdk.ts CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { ClientSDK } from "../lib/sdks.js";
6
6
  import { Agents } from "./agents.js";
7
+ import { Chat } from "./chat.js";
7
8
  import { Client } from "./client.js";
8
9
  import { Indexing } from "./indexing.js";
9
10
 
@@ -22,4 +23,9 @@ export class Glean extends ClientSDK {
22
23
  get indexing(): Indexing {
23
24
  return (this._indexing ??= new Indexing(this._options));
24
25
  }
26
+
27
+ private _chat?: Chat;
28
+ get chat(): Chat {
29
+ return (this._chat ??= new Chat(this._options));
30
+ }
25
31
  }