Skip to content

Commit

Permalink
Add docs for thread fields (#40)
Browse files Browse the repository at this point in the history
* add docs for thread fields

* fix formatting

* make formatting consistent

* fix import

* lint

* Update thread-fields.mdx

Co-authored-by: Preslav Mihaylov <[email protected]>

* Update thread-fields.mdx

Co-authored-by: Preslav Mihaylov <[email protected]>

* review feedback

---------

Co-authored-by: Preslav Mihaylov <[email protected]>
  • Loading branch information
mattvagni and preslavmihaylov authored Apr 23, 2024
1 parent 7f3a5f8 commit c76af82
Show file tree
Hide file tree
Showing 53 changed files with 288 additions and 101 deletions.
24 changes: 24 additions & 0 deletions _snippets/graphql/delete-thread-field.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
```graphql Mutation
mutation deleteThreadField($input: DeleteThreadFieldInput!) {
deleteThreadField(input: $input) {
error {
message
type
code
fields {
field
message
type
}
}
}
}
```

```json Variables
{
"input": {
"threadFieldId": "tf_01HVTN2VTNYP91P5XGDQ57M2ZX"
}
}
```
45 changes: 45 additions & 0 deletions _snippets/graphql/upsert-thread-field.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
```graphql Mutation
mutation upsertThreadField($input: UpsertThreadFieldInput!) {
upsertThreadField(input: $input) {
result
threadField {
id
key
type
threadId
stringValue
booleanValue
isAiGenerated
createdAt {
iso8601
}
updatedAt {
iso8601
}
}
error {
message
type
code
fields {
field
message
type
}
}
}
}
```

```json Variables
{
"input": {
"identifier": {
"threadId": "th_01HVNWFJS395XVPPBJNE6A8BHP",
"key": "product_area"
},
"type": "STRING",
"stringValue": "security"
}
}
```
2 changes: 1 addition & 1 deletion _snippets/typescript-sdk/add-customer-to-group.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```tsx
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });
Expand Down
6 changes: 5 additions & 1 deletion _snippets/typescript-sdk/add-customer-to-tenants.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
```tsx
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

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

const res = await client.addCustomerToTenants({
customerIdentifier: {
// You can use the customer email
Expand Down
2 changes: 1 addition & 1 deletion _snippets/typescript-sdk/add-labels.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```tsx
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });
Expand Down
6 changes: 5 additions & 1 deletion _snippets/typescript-sdk/add-members-to-tier.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
```tsx
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

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

const res = await client.addMembersToTier({
memberIdentifiers: [
{
Expand Down
6 changes: 2 additions & 4 deletions _snippets/typescript-sdk/assign-thread.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
```tsx
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

const client = new PlainClient({
apiKey: 'XXX',
});
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });

const res = await client.assignThread({
threadId: 'th_01H8H46YPB2S4MAJM382FG9423',
Expand Down
4 changes: 2 additions & 2 deletions _snippets/typescript-sdk/create-attachment-url.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```tsx
```ts
import { AttachmentType, PlainClient } from '@team-plain/typescript-sdk';

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

const res = await client.createAttachmentUploadUrl({
customerId: 'c_XXXXXXXXXXXXXXXXXXXXXXXXXX',
Expand Down
7 changes: 2 additions & 5 deletions _snippets/typescript-sdk/create-customer-event.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
```tsx
```ts
import { PlainClient, uiComponent } from '@team-plain/typescript-sdk';

const client = new PlainClient({
apiKey: 'XXX',
debug: true,
});
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });

const res = await client.createCustomerEvent({
title: 'API key generated',
Expand Down
7 changes: 2 additions & 5 deletions _snippets/typescript-sdk/create-thread-event.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
```tsx
```ts
import { PlainClient, uiComponent } from '@team-plain/typescript-sdk';

const client = new PlainClient({
apiKey: 'XXX',
debug: true,
});
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });

const res = await client.createThreadEvent({
title: 'API key generated',
Expand Down
6 changes: 2 additions & 4 deletions _snippets/typescript-sdk/create-thread.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
```tsx
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

const client = new PlainClient({
apiKey: 'XXX',
});
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });

const res = await client.createThread({
title: 'Bug Report',
Expand Down
6 changes: 2 additions & 4 deletions _snippets/typescript-sdk/delete-customer.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
```tsx
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

const client = new PlainClient({
apiKey: 'XXX',
});
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });

const res = await client.deleteCustomer({
customerId: 'c_01H1P4TE62AS5KZ4CZFC0578ED',
Expand Down
15 changes: 15 additions & 0 deletions _snippets/typescript-sdk/delete-thread-field.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

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

const res = await client.deleteThreadField({
threadFieldId: 'tf_01HVTN2VTNYP91P5XGDQ57M2ZX',
});

if (res.error) {
console.error(res.error);
} else {
console.log(res.data);
}
```
2 changes: 1 addition & 1 deletion _snippets/typescript-sdk/error-handling.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```tsx {21}
```ts {21}
import { PlainClient } from '@team-plain/typescript-sdk';

export async function createCustomer() {
Expand Down
2 changes: 1 addition & 1 deletion _snippets/typescript-sdk/first-api-call.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const apiKey = 'XXX';
const email = 'XXX';

const client = new PlainClient({
apiKey: apiKey,
apiKey,
});

client.getCustomerByEmail({ email: email }).then((result) => {
Expand Down
6 changes: 5 additions & 1 deletion _snippets/typescript-sdk/get-companies.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
```tsx
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

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

const res = await client.getCompanies({
first: 25,
});
Expand Down
8 changes: 4 additions & 4 deletions _snippets/typescript-sdk/get-customer-by-email.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```tsx
const client = new PlainClient({
apiKey: 'XXX',
});
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

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

const res = await client.getCustomerByEmail({ email: '[email protected]' });

Expand Down
8 changes: 4 additions & 4 deletions _snippets/typescript-sdk/get-customer-by-id.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```tsx
const client = new PlainClient({
apiKey: 'XXX',
});
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

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

const res = await client.getCustomerById({
customerId: 'c_01H14DFQ4PDYBH398J1E99TWSS',
Expand Down
8 changes: 4 additions & 4 deletions _snippets/typescript-sdk/get-customers.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```tsx
const client = new PlainClient({
apiKey: 'XXX',
});
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

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

const res = await client.getCustomers({
first: 50,
Expand Down
6 changes: 5 additions & 1 deletion _snippets/typescript-sdk/get-tenant-by-id.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
```tsx
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

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

const res = await client.getTenantById({
tenantId: 'te_123',
});
Expand Down
6 changes: 5 additions & 1 deletion _snippets/typescript-sdk/get-tenants.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
```tsx
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

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

const res = await client.getTenants({
first: 25,
});
Expand Down
6 changes: 5 additions & 1 deletion _snippets/typescript-sdk/get-tier-by-id.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
```tsx
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

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

const res = await client.getTierById({
tierId: 'tier_123',
});
Expand Down
6 changes: 5 additions & 1 deletion _snippets/typescript-sdk/get-tiers.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
```tsx
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

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

const res = await client.getTiers({
first: 25,
});
Expand Down
6 changes: 2 additions & 4 deletions _snippets/typescript-sdk/mark-thread-as-done.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
```tsx
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

const client = new PlainClient({
apiKey: 'XXX',
});
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });

const res = await client.markThreadAsDone({
threadId: 'th_01HB924RWAW8H3Q8KZDFWYBJHZ',
Expand Down
6 changes: 2 additions & 4 deletions _snippets/typescript-sdk/mark-thread-as-todo.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
```tsx
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

const client = new PlainClient({
apiKey: 'XXX',
});
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });

const res = await client.markThreadAsTodo({
threadId: 'th_01HB924RWAW8H3Q8KZDFWYBJHZ',
Expand Down
6 changes: 2 additions & 4 deletions _snippets/typescript-sdk/page-info-after.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
```tsx
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

const client = new PlainClient({
apiKey: 'XXX',
});
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });

const firstPage = client.getCustomers({});

Expand Down
6 changes: 2 additions & 4 deletions _snippets/typescript-sdk/remove-customer-from-groups.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
```tsx
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

const client = new PlainClient({
apiKey: 'plainApiKey_rO6tIKWU2w0gD_ek9HwjsHMiq1MHsgAn7mhVrcC7MGw',
});
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });

const res = await client.removeCustomerFromCustomerGroups({
customerId: 'c_01H1P4TE62AS5KZ4CZFC0578ED',
Expand Down
2 changes: 1 addition & 1 deletion _snippets/typescript-sdk/remove-customer-from-tenants.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```tsx
```ts
const res = await client.removeCustomerFromTenants({
customerIdentifier: {
// You can use the customer email
Expand Down
2 changes: 1 addition & 1 deletion _snippets/typescript-sdk/remove-labels.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```tsx
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });
Expand Down
6 changes: 5 additions & 1 deletion _snippets/typescript-sdk/remove-members-from-tier.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
```tsx
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

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

const res = await client.removeMembersFromTier({
memberIdentifiers: [
{
Expand Down
2 changes: 1 addition & 1 deletion _snippets/typescript-sdk/reply-email.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```tsx
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });
Expand Down
2 changes: 1 addition & 1 deletion _snippets/typescript-sdk/reply-to-response.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```tsx
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });
Expand Down
2 changes: 1 addition & 1 deletion _snippets/typescript-sdk/reply-to-thread.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```tsx
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });
Expand Down
2 changes: 1 addition & 1 deletion _snippets/typescript-sdk/send-email.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```tsx
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });
Expand Down
6 changes: 5 additions & 1 deletion _snippets/typescript-sdk/set-customer-tenants.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
```tsx
```ts
import { PlainClient } from '@team-plain/typescript-sdk';

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

const res = await client.setCustomerTenants({
customerIdentifier: {
// You can use the customer email
Expand Down
Loading

0 comments on commit c76af82

Please sign in to comment.