Skip to content

Commit 9e5c278

Browse files
authored
Add support for creating label types (#157)
* Add support for creating label types * revert changes to webhooks * lint
1 parent e92b27e commit 9e5c278

File tree

4 files changed

+41
-3
lines changed

4 files changed

+41
-3
lines changed

.changeset/nice-phones-battle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@team-plain/typescript-sdk': minor
3+
---
4+
5+
add support for creating label types (createLabelType)

src/client.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
CreateAttachmentUploadUrlDocument,
1818
CreateCustomerCardConfigDocument,
1919
CreateCustomerEventDocument,
20+
CreateLabelTypeDocument,
2021
CreateNoteDocument,
2122
CreateThreadDocument,
2223
CreateThreadEventDocument,
@@ -294,9 +295,10 @@ export class PlainClient {
294295
/**
295296
* Get a paginated list of customer groups.
296297
*/
297-
async getCustomerGroups(
298-
variables: VariablesOf<typeof CustomerGroupsDocument>
299-
): SDKResult<{ customerGroups: CustomerGroupPartsFragment[]; pageInfo: PageInfo }> {
298+
async getCustomerGroups(variables: VariablesOf<typeof CustomerGroupsDocument>): SDKResult<{
299+
customerGroups: CustomerGroupPartsFragment[];
300+
pageInfo: PageInfo;
301+
}> {
300302
const res = await request(this.#ctx, {
301303
query: CustomerGroupsDocument,
302304
variables,
@@ -1122,4 +1124,17 @@ export class PlainClient {
11221124

11231125
return unwrapData(res, (q) => nonNullable(q.updateCompanyTier.companyTierMembership));
11241126
}
1127+
1128+
async createLabelType(
1129+
input: VariablesOf<typeof CreateLabelTypeDocument>['input']
1130+
): SDKResult<LabelTypePartsFragment> {
1131+
const res = await request(this.#ctx, {
1132+
query: CreateLabelTypeDocument,
1133+
variables: {
1134+
input,
1135+
},
1136+
});
1137+
1138+
return unwrapData(res, (q) => nonNullable(q.createLabelType.labelType));
1139+
}
11251140
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
mutation createLabelType($input: CreateLabelTypeInput!) {
2+
createLabelType(input: $input) {
3+
labelType {
4+
...LabelTypeParts
5+
}
6+
error {
7+
...MutationErrorParts
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)