Skip to content

Commit 4b49f04

Browse files
authored
Add createThread threadFields documentation (#49)
* Add createThread threadFields documentation * add example * de-lint
1 parent c444388 commit 4b49f04

File tree

3 files changed

+54
-2
lines changed

3 files changed

+54
-2
lines changed

_snippets/graphql/create-thread.mdx

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ mutation createThread($input: CreateThreadInput!) {
1515
title
1616
previewText
1717
priority
18+
threadFields {
19+
id
20+
key
21+
type
22+
stringValue
23+
booleanValue
24+
}
1825
}
1926
error {
2027
message
@@ -44,7 +51,26 @@ mutation createThread($input: CreateThreadInput!) {
4451
}
4552
}
4653
],
47-
"labelTypeIds": ["lt_01HB924PME9C0YWKW1N4AK3BZA"]
54+
"labelTypeIds": ["lt_01HB924PME9C0YWKW1N4AK3BZA"],
55+
"threadFields": [
56+
{
57+
"key": "my_string_field",
58+
"type": "STRING",
59+
"stringValue": "any value"
60+
}
61+
]
62+
// You can also set other thread field types like boolean or enum.
63+
// "threadFields": [{
64+
// "key": "my_enum_field",
65+
// "type": "ENUM",
66+
// "stringValue": "any specified value",
67+
// }],
68+
//
69+
// "threadFields": [{
70+
// "key": "my_bool_field",
71+
// "type": "BOOL",
72+
// "booleanValue": true,
73+
// }],
4874
}
4975
}
5076
```

_snippets/typescript-sdk/create-thread.mdx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
```ts
2-
import { PlainClient } from '@team-plain/typescript-sdk';
2+
import { PlainClient, ThreadFieldSchemaType } from '@team-plain/typescript-sdk';
33

44
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });
55

@@ -25,6 +25,29 @@ const res = await client.createThread({
2525
// Label types are created in settings where you can also copy
2626
// their ID.
2727
labelTypeIds: ['lt_01HB924PME9C0YWKW1N4AK3BZA'],
28+
29+
// Thread fields are created in settings where you can also copy
30+
// their key.
31+
threadFields: [
32+
{
33+
key: 'my_string_field',
34+
type: ThreadFieldSchemaType.String,
35+
stringValue: 'any value',
36+
},
37+
],
38+
39+
// You can also set other thread field types like boolean or enum.
40+
// threadFields: [{
41+
// key: 'my_enum_field',
42+
// type: ThreadFieldSchemaType.Enum,
43+
// stringValue: 'any specified value',
44+
// }]
45+
//
46+
// threadFields: [{
47+
// key: 'my_bool_field',
48+
// type: ThreadFieldSchemaType.Bool,
49+
// booleanValue: true,
50+
// }],
2851
});
2952

3053
if (res.error) {

api-reference/graphql/threads/create.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ To create a thread you need a `customerId`. You can get a customer id by [creati
2323
- `thread:create`
2424
- `thread:edit`
2525
- `thread:read`
26+
- `threadField:create`
27+
- `threadField:update`
28+
- `threadField:read`
2629

2730
<Snippet file="typescript-sdk/create-thread.mdx" />
2831

0 commit comments

Comments
 (0)