11# Beeper Desktop Go API Library  
22
3- <a  href =" https://pkg.go.dev/github.com/beeper/ desktop-api-go " ><img  src =" https://pkg.go.dev/badge/github.com/beeper/ desktop-api-go.svg "  alt =" Go Reference " ></a >
3+ <a  href =" https://pkg.go.dev/github.com/stainless-sdks/beeper- desktop-api-go " ><img  src =" https://pkg.go.dev/badge/github.com/stainless-sdks/beeper- desktop-api-go.svg "  alt =" Go Reference " ></a >
44
5- The Beeper Desktop Go library provides convenient access to the [ Beeper Desktop REST API] ( https://www .beeper.com/desktop-api ) 
5+ The Beeper Desktop Go library provides convenient access to the [ Beeper Desktop REST API] ( https://developers .beeper.com/desktop-api/  ) 
66from applications written in Go.
77
88## Installation  
99
10- <!--  x-release-please-start-version --> 
11- 
1210``` go 
1311import  (
14- 	" github.com/beeper/ desktop-api-go"   //  imported as githubcombeeperdesktopapigo 
12+ 	" github.com/stainless-sdks/beeper- desktop-api-go"   //  imported as beeperdesktopapi 
1513)
1614``` 
1715
18- <!--  x-release-please-end --> 
19- 
2016Or to pin the version:
2117
22- <!--  x-release-please-start-version --> 
23- 
2418``` sh 
25- go get -u 
' github.com/beeper/ [email protected] ' 19+ go get -u 
' github.com/stainless-sdks/beeper- [email protected] ' 2620``` 
2721
28- <!--  x-release-please-end --> 
29- 
3022## Requirements  
3123
3224This library requires Go 1.18+.
@@ -42,17 +34,18 @@ import (
4234	" context" 
4335	" fmt" 
4436
45- 	" github.com/beeper/ desktop-api-go" 
46- 	" github.com/beeper/ desktop-api-go/option" 
37+ 	" github.com/stainless-sdks/beeper- desktop-api-go" 
38+ 	" github.com/stainless-sdks/beeper- desktop-api-go/option" 
4739)
4840
4941func  main () {
50- 	client  :=  githubcombeeperdesktopapigo .NewClient (
42+ 	client  :=  beeperdesktopapi .NewClient (
5143		option.WithAccessToken (" My Access Token"  ), //  defaults to os.LookupEnv("BEEPER_ACCESS_TOKEN")
5244	)
53- 	page , err  :=  client.Chats .Search (context.TODO (), githubcombeeperdesktopapigo.ChatSearchParams {
54- 		Limit: githubcombeeperdesktopapigo.Int (10 ),
55- 		Type:  githubcombeeperdesktopapigo.ChatSearchParamsTypeSingle ,
45+ 	page , err  :=  client.Chats .Search (context.TODO (), beeperdesktopapi.ChatSearchParams {
46+ 		IncludeMuted: beeperdesktopapi.Bool (true ),
47+ 		Limit:        beeperdesktopapi.Int (3 ),
48+ 		Type:         beeperdesktopapi.ChatSearchParamsTypeSingle ,
5649	})
5750	if  err != nil  {
5851		panic (err.Error ())
@@ -64,31 +57,31 @@ func main() {
6457
6558### Request fields  
6659
67- The githubcombeeperdesktopapigo  library uses the [ ` omitzero ` ] ( https://tip.golang.org/doc/go1.24#encodingjsonpkgencodingjson ) 
60+ The beeperdesktopapi  library uses the [ ` omitzero ` ] ( https://tip.golang.org/doc/go1.24#encodingjsonpkgencodingjson ) 
6861semantics from the Go 1.24+ ` encoding/json `  release for request fields.
6962
7063Required primitive fields (` int64 ` , ` string ` , etc.) feature the tag <code >\` json:"...,required"\` </code >. These
7164fields are always serialized, even their zero values.
7265
73- Optional primitive types are wrapped in a ` param.Opt[T] ` . These fields can be set with the provided constructors, ` githubcombeeperdesktopapigo .String(string)` , ` githubcombeeperdesktopapigo .Int(int64)` , etc.
66+ Optional primitive types are wrapped in a ` param.Opt[T] ` . These fields can be set with the provided constructors, ` beeperdesktopapi .String(string)` , ` beeperdesktopapi .Int(int64)` , etc.
7467
7568Any ` param.Opt[T] ` , map, slice, struct or string enum uses the
7669tag <code >\` json:"...,omitzero"\` </code >. Its zero value is considered omitted.
7770
7871The ` param.IsOmitted(any) `  function can confirm the presence of any ` omitzero `  field.
7972
8073``` go 
81- p  :=  githubcombeeperdesktopapigo .ExampleParams {
82- 	ID :   " id_xxx"  ,                                   //  required property
83- 	Name : githubcombeeperdesktopapigo .String (" ..."  ), //  optional property
74+ p  :=  beeperdesktopapi .ExampleParams {
75+ 	ID :   " id_xxx"  ,                       //  required property
76+ 	Name : beeperdesktopapi .String (" ..."  ), //  optional property
8477
85- 	Point : githubcombeeperdesktopapigo .Point {
86- 		X: 0 ,                                   //  required field will serialize as 0
87- 		Y: githubcombeeperdesktopapigo .Int (1 ), //  optional field will serialize as 1
78+ 	Point : beeperdesktopapi .Point {
79+ 		X: 0 ,                       //  required field will serialize as 0
80+ 		Y: beeperdesktopapi .Int (1 ), //  optional field will serialize as 1
8881		//  ... omitted non-required fields will not be serialized
8982	},
9083
91- 	Origin : githubcombeeperdesktopapigo .Origin {}, //  the zero value of [Origin] is considered omitted
84+ 	Origin : beeperdesktopapi .Origin {}, //  the zero value of [Origin] is considered omitted
9285}
9386``` 
9487
@@ -117,7 +110,7 @@ p.SetExtraFields(map[string]any{
117110})
118111
119112//  Send a number instead of an object
120- custom  :=  param.Override [githubcombeeperdesktopapigo .FooParams ](12 )
113+ custom  :=  param.Override [beeperdesktopapi .FooParams ](12 )
121114``` 
122115
123116### Request unions  
@@ -258,7 +251,7 @@ This library uses the functional options pattern. Functions defined in the
258251requests. For example:
259252
260253``` go 
261- client  :=  githubcombeeperdesktopapigo .NewClient (
254+ client  :=  beeperdesktopapi .NewClient (
262255	//  Adds a header to every request made by the client
263256	option.WithHeader (" X-Some-Header"  , " custom_header_info"  ),
264257)
@@ -273,7 +266,7 @@ client.Accounts.List(context.TODO(), ...,
273266
274267The request option ` option.WithDebugLog(nil) `  may be helpful while debugging.
275268
276- See the [ full list of request options] ( https://pkg.go.dev/github.com/beeper/ desktop-api-go/option ) .
269+ See the [ full list of request options] ( https://pkg.go.dev/github.com/stainless-sdks/beeper- desktop-api-go/option ) .
277270
278271### Pagination  
279272
@@ -282,9 +275,10 @@ This library provides some conveniences for working with paginated list endpoint
282275You can use ` .ListAutoPaging() `  methods to iterate through items across all pages:
283276
284277``` go 
285- iter  :=  client.Messages .SearchAutoPaging (context.TODO (), githubcombeeperdesktopapigo.MessageSearchParams {
286- 	Limit : githubcombeeperdesktopapigo.Int (20 ),
287- 	Query : githubcombeeperdesktopapigo.String (" meeting"  ),
278+ iter  :=  client.Messages .SearchAutoPaging (context.TODO (), beeperdesktopapi.MessageSearchParams {
279+ 	AccountIDs : []string {" local-telegram_ba_QFrb5lrLPhO3OT5MFBeTWv0x4BI"  },
280+ 	Limit :      beeperdesktopapi.Int (10 ),
281+ 	Query :      beeperdesktopapi.String (" deployment"  ),
288282})
289283//  Automatically fetches more pages as needed.
290284for  iter.Next () {
@@ -300,12 +294,13 @@ Or you can use simple `.List()` methods to fetch a single page and receive a sta
300294with additional helper methods like ` .GetNextPage() ` , e.g.:
301295
302296``` go 
303- page , err  :=  client.Messages .Search (context.TODO (), githubcombeeperdesktopapigo.MessageSearchParams {
304- 	Limit : githubcombeeperdesktopapigo.Int (20 ),
305- 	Query : githubcombeeperdesktopapigo.String (" meeting"  ),
297+ page , err  :=  client.Messages .Search (context.TODO (), beeperdesktopapi.MessageSearchParams {
298+ 	AccountIDs : []string {" local-telegram_ba_QFrb5lrLPhO3OT5MFBeTWv0x4BI"  },
299+ 	Limit :      beeperdesktopapi.Int (10 ),
300+ 	Query :      beeperdesktopapi.String (" deployment"  ),
306301})
307302for  page != nil  {
308- 	for  _ , message  :=  range  page.Data  {
303+ 	for  _ , message  :=  range  page.Items  {
309304		fmt.Printf (" %+v \n "  , message)
310305	}
311306	page, err = page.GetNextPage ()
@@ -318,19 +313,19 @@ if err != nil {
318313### Errors  
319314
320315When the API returns a non-success status code, we return an error with type
321- ` *githubcombeeperdesktopapigo .Error ` . This contains the ` StatusCode ` , ` *http.Request ` , and
316+ ` *beeperdesktopapi .Error ` . This contains the ` StatusCode ` , ` *http.Request ` , and
322317` *http.Response `  values of the request, as well as the JSON of the error body
323318(much like other response objects in the SDK).
324319
325320To handle errors, we recommend that you use the ` errors.As `  pattern:
326321
327322``` go 
328- _ , err  :=  client.Messages .Send (context.TODO (), githubcombeeperdesktopapigo .MessageSendParams {
329- 	ChatID : " !invalid-chat-id "  ,
330- 	Text :   githubcombeeperdesktopapigo .String (" Test message "  ),
323+ _ , err  :=  client.Messages .Send (context.TODO (), beeperdesktopapi .MessageSendParams {
324+ 	ChatID : " 1229391 "  ,
325+ 	Text :   beeperdesktopapi .String (" Hello! Just checking in on the project status. "  ),
331326})
332327if  err != nil  {
333- 	var  apierr  *githubcombeeperdesktopapigo .Error 
328+ 	var  apierr  *beeperdesktopapi .Error 
334329	if  errors.As (err, &apierr) {
335330		println (string (apierr.DumpRequest (true )))  //  Prints the serialized HTTP request
336331		println (string (apierr.DumpResponse (true ))) //  Prints the serialized HTTP response
@@ -370,20 +365,20 @@ The file name and content-type can be customized by implementing `Name() string`
370365string`  on the run-time type of  ` io.Reader` . Note that  ` os.File`  implements  ` Name() string`, so a
371366file returned by ` os.Open `  will be sent with the file name on disk.
372367
373- We also provide a helper ` githubcombeeperdesktopapigo .File(reader io.Reader, filename string, contentType string)` 
368+ We also provide a helper ` beeperdesktopapi .File(reader io.Reader, filename string, contentType string)` 
374369which can be used to wrap any ` io.Reader `  with the appropriate file name and content type.
375370
376371### Retries  
377372
378- Certain errors will be automatically retried 3  times by default, with a short exponential backoff.
373+ Certain errors will be automatically retried 2  times by default, with a short exponential backoff.
379374We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit,
380375and >=500 Internal errors.
381376
382377You can use the ` WithMaxRetries `  option to configure or disable this:
383378
384379``` go 
385380//  Configure the default for all requests:
386- client  :=  githubcombeeperdesktopapigo .NewClient (
381+ client  :=  beeperdesktopapi .NewClient (
387382	option.WithMaxRetries (0 ), //  default is 2
388383)
389384
@@ -399,11 +394,11 @@ you need to examine response headers, status codes, or other details.
399394``` go 
400395//  Create a variable to store the HTTP response
401396var  response  *http.Response 
402- getAccountsResponse , err  :=  client.Accounts .List (context.TODO (), option.WithResponseInto (&response))
397+ accounts , err  :=  client.Accounts .List (context.TODO (), option.WithResponseInto (&response))
403398if  err != nil  {
404399	//  handle error
405400}
406- fmt.Printf (" %+v \n "  , getAccountsResponse )
401+ fmt.Printf (" %+v \n "  , accounts )
407402
408403fmt.Printf (" Status Code: %d \n "  , response.StatusCode )
409404fmt.Printf (" Headers: %+#v \n "  , response.Header )
@@ -444,7 +439,7 @@ or the `option.WithJSONSet()` methods.
444439params  :=  FooNewParams {
445440    ID :   " id_xxxx"  ,
446441    Data : FooNewParamsData {
447-         FirstName: githubcombeeperdesktopapigo .String (" John"  ),
442+         FirstName: beeperdesktopapi .String (" John"  ),
448443    },
449444}
450445client.Foo .New (context.Background (), params, option.WithJSONSet (" data.last_name"  , " Doe"  ))
@@ -479,7 +474,7 @@ func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response,
479474    return  res, err
480475}
481476
482- client  :=  githubcombeeperdesktopapigo .NewClient (
477+ client  :=  beeperdesktopapi .NewClient (
483478	option.WithMiddleware (Logger),
484479)
485480``` 
@@ -504,7 +499,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con
504499
505500We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
506501
507- We are keen for your feedback; please open an [ issue] ( https://www.github.com/beeper/ desktop-api-go/issues )  with questions, bugs, or suggestions.
502+ We are keen for your feedback; please open an [ issue] ( https://www.github.com/stainless-sdks/beeper- desktop-api-go/issues )  with questions, bugs, or suggestions.
508503
509504## Contributing  
510505
0 commit comments