99 "fmt"
1010 "net/http"
1111 "net/url"
12+ "slices"
1213 "time"
1314
1415 "github.com/beeper/desktop-api-go/internal/apijson"
@@ -48,15 +49,15 @@ func NewChatService(opts ...option.RequestOption) (r ChatService) {
4849// Create a single or group chat on a specific account using participant IDs and
4950// optional title.
5051func (r * ChatService ) New (ctx context.Context , body ChatNewParams , opts ... option.RequestOption ) (res * ChatNewResponse , err error ) {
51- opts = append (r .Options [:] , opts ... )
52+ opts = slices . Concat (r .Options , opts )
5253 path := "v1/chats"
5354 err = requestconfig .ExecuteNewRequest (ctx , http .MethodPost , path , body , & res , opts ... )
5455 return
5556}
5657
5758// Retrieve chat details including metadata, participants, and latest message
5859func (r * ChatService ) Get (ctx context.Context , chatID string , query ChatGetParams , opts ... option.RequestOption ) (res * Chat , err error ) {
59- opts = append (r .Options [:] , opts ... )
60+ opts = slices . Concat (r .Options , opts )
6061 if chatID == "" {
6162 err = errors .New ("missing required chatID parameter" )
6263 return
@@ -70,7 +71,7 @@ func (r *ChatService) Get(ctx context.Context, chatID string, query ChatGetParam
7071// accounts into a single paginated list.
7172func (r * ChatService ) List (ctx context.Context , query ChatListParams , opts ... option.RequestOption ) (res * pagination.CursorList [ChatListResponse ], err error ) {
7273 var raw * http.Response
73- opts = append (r .Options [:] , opts ... )
74+ opts = slices . Concat (r .Options , opts )
7475 opts = append ([]option.RequestOption {option .WithResponseInto (& raw )}, opts ... )
7576 path := "v1/chats"
7677 cfg , err := requestconfig .NewRequestConfig (ctx , http .MethodGet , path , query , & res , opts ... )
@@ -94,7 +95,7 @@ func (r *ChatService) ListAutoPaging(ctx context.Context, query ChatListParams,
9495// Archive or unarchive a chat. Set archived=true to move to archive,
9596// archived=false to move back to inbox
9697func (r * ChatService ) Archive (ctx context.Context , chatID string , body ChatArchiveParams , opts ... option.RequestOption ) (res * shared.BaseResponse , err error ) {
97- opts = append (r .Options [:] , opts ... )
98+ opts = slices . Concat (r .Options , opts )
9899 if chatID == "" {
99100 err = errors .New ("missing required chatID parameter" )
100101 return
@@ -108,7 +109,7 @@ func (r *ChatService) Archive(ctx context.Context, chatID string, body ChatArchi
108109// algorithm.
109110func (r * ChatService ) Search (ctx context.Context , query ChatSearchParams , opts ... option.RequestOption ) (res * pagination.CursorSearch [Chat ], err error ) {
110111 var raw * http.Response
111- opts = append (r .Options [:] , opts ... )
112+ opts = slices . Concat (r .Options , opts )
112113 opts = append ([]option.RequestOption {option .WithResponseInto (& raw )}, opts ... )
113114 path := "v1/chats/search"
114115 cfg , err := requestconfig .NewRequestConfig (ctx , http .MethodGet , path , query , & res , opts ... )
0 commit comments