Skip to content

Commit

Permalink
Expose addressId from the Conversation contract (#1104)
Browse files Browse the repository at this point in the history
* Expose  from the Conversation contract

* include the changeset
  • Loading branch information
iAmmar7 authored Aug 6, 2024
1 parent b17e444 commit d257907
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/rude-ravens-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@signalwire/js': patch
---

CF SDK: Expose the `addressId` from the Conversation contract
16 changes: 10 additions & 6 deletions packages/js/src/fabric/ConversationAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,31 @@ import {
export class ConversationAPI implements ConversationContract {
constructor(
private conversation: Conversation,
private data: ConversationResponse
private payload: ConversationResponse
) {}

get id() {
return this.data.id
return this.payload.id
}

get addressId() {
return this.payload.address_id
}

get createdAt() {
return this.data.created_at
return this.payload.created_at
}

get lastMessageAt() {
return this.data.last_message_at
return this.payload.last_message_at
}

get metadata() {
return this.data.metadata
return this.payload.metadata
}

get name() {
return this.data.name
return this.payload.name
}

sendMessage(params: ConversationAPISendMessageParams) {
Expand Down
4 changes: 3 additions & 1 deletion packages/js/src/fabric/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,9 @@ export type GetAddressesResult = PaginatedResult<GetAddressResponse>
* Conversations
*/
export interface ConversationContract {
readonly id: string
readonly addressId: string
readonly createdAt: number
readonly id: string
readonly lastMessageAt: number
readonly metadata: Record<string, any>
readonly name: string
Expand Down Expand Up @@ -231,6 +232,7 @@ export interface GetConversationsParams {
}

export interface ConversationResponse {
address_id: string
created_at: number
id: string
last_message_at: number
Expand Down

0 comments on commit d257907

Please sign in to comment.