Skip to content

Commit

Permalink
feat: set chat status
Browse files Browse the repository at this point in the history
  • Loading branch information
Belkross committed Feb 14, 2024
1 parent 8e17051 commit 2235201
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/resources/messaging.resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
GetAllMessagesFromAttendeeInput,
GetAllChatsFromAttendeeInput,
PostNewChatInput,
PerformActionInput,
} from '../index.js';
import { FormData } from 'formdata-node';
import { Blob } from 'node-fetch';
Expand Down Expand Up @@ -236,4 +237,24 @@ export class MessagingResource {
validator: untypedYetValidator,
});
}

async setChatStatus(input: PerformActionInput, options?: RequestOptions): Promise<Response.UntypedYet> {
const { chat_id, action, value } = input;

const body = {
action,
value,
};

return await this.client.request.send({
path: ['chats', chat_id],
method: 'PATCH',
body,
headers: {
'Content-Type': 'application/json',
},
options,
validator: untypedYetValidator,
});
}
}
6 changes: 6 additions & 0 deletions src/types/input/input-messaging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,9 @@ export type GetAllAttendeesInput = {
limit?: number;
account_id?: string;
};

export type PerformActionInput = {
chat_id: string;
action: 'setReadStatus';
value: boolean;
};

0 comments on commit 2235201

Please sign in to comment.