Skip to content

Commit 47bf5e4

Browse files
committed
add createKnowledgeSource mutation
1 parent e370dc7 commit 47bf5e4

File tree

8 files changed

+5085
-4267
lines changed

8 files changed

+5085
-4267
lines changed

pnpm-lock.yaml

Lines changed: 4099 additions & 4182 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/client.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
CreateAttachmentUploadUrlDocument,
1919
CreateCustomerCardConfigDocument,
2020
CreateCustomerEventDocument,
21+
CreateKnowledgeSourceDocument,
2122
CreateLabelTypeDocument,
2223
CreateNoteDocument,
2324
CreateThreadDocument,
@@ -44,6 +45,7 @@ import {
4445
type EmailPartsFragment,
4546
IndexDocumentDocument,
4647
type IndexedDocumentPartsFragment,
48+
type KnowledgeSourcePartsFragment,
4749
type LabelPartsFragment,
4850
LabelTypeDocument,
4951
type LabelTypePartsFragment,
@@ -1216,4 +1218,15 @@ export class PlainClient {
12161218

12171219
return unwrapData(res, (q) => nonNullable(q.sendCustomerChat.chat));
12181220
}
1221+
1222+
async createKnowledgeSource(
1223+
input: VariablesOf<typeof CreateKnowledgeSourceDocument>['input']
1224+
): SDKResult<KnowledgeSourcePartsFragment> {
1225+
const res = await request(this.#ctx, {
1226+
query: CreateKnowledgeSourceDocument,
1227+
variables: { input },
1228+
});
1229+
1230+
return unwrapData(res, (q) => nonNullable(q.createKnowledgeSource.knowledgeSource));
1231+
}
12191232
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
fragment IndexingStatusParts on IndexingStatus {
2+
... on IndexingStatusPending {
3+
startedAt {
4+
...DateTimeParts
5+
}
6+
}
7+
... on IndexingStatusFailed {
8+
failedAt {
9+
...DateTimeParts
10+
}
11+
reason
12+
}
13+
... on IndexingStatusIndexed {
14+
indexedAt {
15+
...DateTimeParts
16+
}
17+
}
18+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
fragment KnowledgeSourceParts on KnowledgeSource {
2+
... on KnowledgeSourceSitemap {
3+
id
4+
url
5+
type
6+
labelTypes {
7+
...LabelTypeParts
8+
}
9+
status {
10+
...IndexingStatusParts
11+
}
12+
createdAt {
13+
...DateTimeParts
14+
}
15+
createdBy {
16+
...ActorParts
17+
}
18+
updatedAt {
19+
...DateTimeParts
20+
}
21+
updatedBy {
22+
...ActorParts
23+
}
24+
}
25+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
mutation createKnowledgeSource($input: CreateKnowledgeSourceInput!) {
2+
createKnowledgeSource(input: $input) {
3+
knowledgeSource {
4+
...KnowledgeSourceParts
5+
}
6+
error {
7+
type
8+
code
9+
message
10+
fields {
11+
type
12+
field
13+
message
14+
}
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)