Skip to content

Commit b8ab363

Browse files
P-5606: Added replyToThread (#87)
* Added replyToThread * New changeset * Update .changeset/flat-chairs-bathe.md Co-authored-by: Mathias Vagni <mattvagni@users.noreply.github.com> --------- Co-authored-by: Mathias Vagni <mattvagni@users.noreply.github.com>
1 parent dce1336 commit b8ab363

File tree

5 files changed

+100
-1
lines changed

5 files changed

+100
-1
lines changed

.changeset/flat-chairs-bathe.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': patch
3+
---
4+
5+
Added `replyToThread` support. This lets you quickly reply to any thread when, for example, building an autoresponder.

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ Every mutation error will contain:
7777
- **fields**: an array containing all the fields that errored. Each field:
7878
- **field**: the name of the input field the error is for
7979
- **message**: an English technical description of the error. This error is usually meant to be read by a developer and not an end user.
80-
type: one of `VALIDATION`, `REQUIRED`, `NOT_FOUND`. See [MutationFieldErrorType](https://docs.plain.com/core-api/reference/enums/mutation-field-error-type) for a description of each value.
80+
type: one of `VALIDATION`, `REQUIRED`, `NOT_FOUND`. See [Error codes
81+
](https://www.plain.com/docs/graphql/error-codes) in our docs for a description of each value.
8182

8283
### BadRequestError
8384

src/client.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import {
3636
RemoveCustomerFromCustomerGroupsDocument,
3737
RemoveLabelsDocument,
3838
ReplyToEmailDocument,
39+
ReplyToThreadDocument,
3940
SendNewEmailDocument,
4041
SnoozeThreadDocument,
4142
ThreadDocument,
@@ -285,6 +286,17 @@ export class PlainClient {
285286
});
286287
}
287288

289+
async replyToThread(input: VariablesOf<typeof ReplyToThreadDocument>['input']): SDKResult<null> {
290+
const res = await request(this.#ctx, {
291+
query: ReplyToThreadDocument,
292+
variables: {
293+
input,
294+
},
295+
});
296+
297+
return unwrapData(res, () => null);
298+
}
299+
288300
async createAttachmentUploadUrl(
289301
input: VariablesOf<typeof CreateAttachmentUploadUrlDocument>['input']
290302
): SDKResult<AttachmentUploadUrlPartsFragment> {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
mutation replyToThread($input: ReplyToThreadInput!) {
2+
replyToThread(input: $input) {
3+
error {
4+
...MutationErrorParts
5+
}
6+
}
7+
}

0 commit comments

Comments
 (0)