@@ -52,14 +52,11 @@ func main() {
5252 client := githubcombeeperdesktopapigo.NewClient (
5353 option.WithAccessToken (" My Access Token" ), // defaults to os.LookupEnv("BEEPER_ACCESS_TOKEN")
5454 )
55- page , err := client.V0 .FindChats (context.TODO (), githubcombeeperdesktopapigo.V0FindChatsParams {
56- Limit: githubcombeeperdesktopapigo.Int (10 ),
57- Type: githubcombeeperdesktopapigo.V0FindChatsParamsTypeSingle ,
58- })
55+ accounts , err := client.Accounts .List (context.TODO ())
5956 if err != nil {
6057 panic (err.Error ())
6158 }
62- fmt.Printf (" %+v \n " , page )
59+ fmt.Printf (" %+v \n " , accounts. Accounts )
6360}
6461
6562```
@@ -265,7 +262,7 @@ client := githubcombeeperdesktopapigo.NewClient(
265262 option.WithHeader (" X-Some-Header" , " custom_header_info" ),
266263)
267264
268- client.V0 . GetAccounts (context.TODO (), ...,
265+ client.Accounts . List (context.TODO (), ...,
269266 // Override the header
270267 option.WithHeader (" X-Some-Header" , " some_other_custom_header_info" ),
271268 // Add an undocumented field to the request body, using sjson syntax
@@ -284,7 +281,7 @@ This library provides some conveniences for working with paginated list endpoint
284281You can use ` .ListAutoPaging() ` methods to iterate through items across all pages:
285282
286283``` go
287- iter := client.V0 . SearchMessagesAutoPaging (context.TODO (), githubcombeeperdesktopapigo.V0SearchMessagesParams {
284+ iter := client.Messages . SearchAutoPaging (context.TODO (), githubcombeeperdesktopapigo.MessageSearchParams {
288285 Limit : githubcombeeperdesktopapigo.Int (20 ),
289286 Query : githubcombeeperdesktopapigo.String (" meeting" ),
290287})
@@ -302,13 +299,13 @@ Or you can use simple `.List()` methods to fetch a single page and receive a sta
302299with additional helper methods like ` .GetNextPage() ` , e.g.:
303300
304301``` go
305- page , err := client.V0 . SearchMessages (context.TODO (), githubcombeeperdesktopapigo.V0SearchMessagesParams {
302+ page , err := client.Messages . Search (context.TODO (), githubcombeeperdesktopapigo.MessageSearchParams {
306303 Limit : githubcombeeperdesktopapigo.Int (20 ),
307304 Query : githubcombeeperdesktopapigo.String (" meeting" ),
308305})
309306for page != nil {
310- for _ , v0 := range page.Data {
311- fmt.Printf (" %+v \n " , v0 )
307+ for _ , message := range page.Data {
308+ fmt.Printf (" %+v \n " , message )
312309 }
313310 page, err = page.GetNextPage ()
314311}
@@ -327,7 +324,7 @@ When the API returns a non-success status code, we return an error with type
327324To handle errors, we recommend that you use the ` errors.As ` pattern:
328325
329326``` go
330- _ , err := client.V0 . SendMessage (context.TODO (), githubcombeeperdesktopapigo.V0SendMessageParams {
327+ _ , err := client.Messages . Send (context.TODO (), githubcombeeperdesktopapigo.MessageSendParams {
331328 ChatID : " !invalid-chat-id" ,
332329 Text : githubcombeeperdesktopapigo.String (" Test message" ),
333330})
@@ -355,7 +352,7 @@ To set a per-retry timeout, use `option.WithRequestTimeout()`.
355352// This sets the timeout for the request, including all the retries.
356353ctx , cancel := context.WithTimeout (context.Background (), 5 *time.Minute )
357354defer cancel ()
358- client.V0 . GetAccounts (
355+ client.Accounts . List (
359356 ctx,
360357 // This sets the per-retry timeout
361358 option.WithRequestTimeout (20 *time.Second ),
@@ -390,7 +387,7 @@ client := githubcombeeperdesktopapigo.NewClient(
390387)
391388
392389// Override per-request:
393- client.V0 . GetAccounts (context.TODO (), option.WithMaxRetries (5 ))
390+ client.Accounts . List (context.TODO (), option.WithMaxRetries (5 ))
394391```
395392
396393### Accessing raw response data (e.g. response headers)
@@ -401,11 +398,11 @@ you need to examine response headers, status codes, or other details.
401398``` go
402399// Create a variable to store the HTTP response
403400var response *http.Response
404- accountsResponse , err := client.V0 . GetAccounts (context.TODO (), option.WithResponseInto (&response))
401+ accounts , err := client.Accounts . List (context.TODO (), option.WithResponseInto (&response))
405402if err != nil {
406403 // handle error
407404}
408- fmt.Printf (" %+v \n " , accountsResponse )
405+ fmt.Printf (" %+v \n " , accounts )
409406
410407fmt.Printf (" Status Code: %d \n " , response.StatusCode )
411408fmt.Printf (" Headers: %+#v \n " , response.Header )
0 commit comments