Skip to content

Commit 310166b

Browse files
chore: configure new SDK language
1 parent 3878477 commit 310166b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1156
-1090
lines changed

.release-please-manifest.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 11
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper%2Fbeeper-desktop-api-7383c39da6288b468edac97cf9dabcf863cabfc238a80d963af419fb00547434.yml
3-
openapi_spec_hash: dfb41653806c34c18d81a43d7b0b1f9e
4-
config_hash: f3453a122776b2f792a72b84e5174cb8
1+
configured_endpoints: 14
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper%2Fbeeper-desktop-api-8c712fe19f280b0b89ecc8a3ce61e9f6b165cee97ce33f66c66a7a5db339c755.yml
3+
openapi_spec_hash: 1ea71129cc1a1ccc3dc8a99566082311
4+
config_hash: e12f3eced24cb0cf28852a474562f307

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ To use a local version of this library from source in another project, edit the
4141
directive. This can be done through the CLI with the following:
4242

4343
```sh
44-
$ go mod edit -replace github.com/beeper/desktop-api-go=/path/to/desktop-api-go
44+
$ go mod edit -replace github.com/stainless-sdks/beeper-desktop-api-go=/path/to/beeper-desktop-api-go
4545
```
4646

4747
## Running tests

README.md

Lines changed: 45 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,24 @@
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/)
66
from applications written in Go.
77

88
## Installation
99

10-
<!-- x-release-please-start-version -->
11-
1210
```go
1311
import (
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-
2016
Or 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

3224
This 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

4941
func 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)
6861
semantics from the Go 1.24+ `encoding/json` release for request fields.
6962

7063
Required primitive fields (`int64`, `string`, etc.) feature the tag <code>\`json:"...,required"\`</code>. These
7164
fields 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

7568
Any `param.Opt[T]`, map, slice, struct or string enum uses the
7669
tag <code>\`json:"...,omitzero"\`</code>. Its zero value is considered omitted.
7770

7871
The `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
258251
requests. 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

274267
The 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
282275
You 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.
290284
for iter.Next() {
@@ -300,12 +294,13 @@ Or you can use simple `.List()` methods to fetch a single page and receive a sta
300294
with 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
})
307302
for 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

320315
When 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

325320
To 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
})
332327
if 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`
370365
string` on the run-time type of `io.Reader`. Note that `os.File` implements `Name() string`, so a
371366
file 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)`
374369
which 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.
379374
We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit,
380375
and >=500 Internal errors.
381376

382377
You 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
401396
var 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))
403398
if err != nil {
404399
// handle error
405400
}
406-
fmt.Printf("%+v\n", getAccountsResponse)
401+
fmt.Printf("%+v\n", accounts)
407402

408403
fmt.Printf("Status Code: %d\n", response.StatusCode)
409404
fmt.Printf("Headers: %+#v\n", response.Header)
@@ -444,7 +439,7 @@ or the `option.WithJSONSet()` methods.
444439
params := FooNewParams{
445440
ID: "id_xxxx",
446441
Data: FooNewParamsData{
447-
FirstName: githubcombeeperdesktopapigo.String("John"),
442+
FirstName: beeperdesktopapi.String("John"),
448443
},
449444
}
450445
client.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

505500
We 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

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ or products provided by Beeper Desktop, please follow the respective company's s
2020

2121
### Beeper Desktop Terms and Policies
2222

23-
Please contact help@beeper.com for any questions or concerns regarding the security of our services.
23+
Please contact security@beeper.com for any questions or concerns regarding the security of our services.
2424

2525
---
2626

account.go

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
package githubcombeeperdesktopapigo
3+
package beeperdesktopapi
44

55
import (
66
"context"
77
"net/http"
88

9-
"github.com/beeper/desktop-api-go/internal/requestconfig"
10-
"github.com/beeper/desktop-api-go/option"
9+
"github.com/stainless-sdks/beeper-desktop-api-go/internal/apijson"
10+
"github.com/stainless-sdks/beeper-desktop-api-go/internal/requestconfig"
11+
"github.com/stainless-sdks/beeper-desktop-api-go/option"
12+
"github.com/stainless-sdks/beeper-desktop-api-go/packages/respjson"
13+
"github.com/stainless-sdks/beeper-desktop-api-go/shared"
1114
)
1215

1316
// Accounts operations
@@ -32,9 +35,35 @@ func NewAccountService(opts ...option.RequestOption) (r AccountService) {
3235
}
3336

3437
// List connected Beeper accounts available on this device
35-
func (r *AccountService) List(ctx context.Context, opts ...option.RequestOption) (res *GetAccountsResponse, err error) {
38+
func (r *AccountService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Account, err error) {
3639
opts = append(r.Options[:], opts...)
3740
path := "v0/get-accounts"
3841
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
3942
return
4043
}
44+
45+
// A chat account added to Beeper
46+
type Account struct {
47+
// Chat account added to Beeper. Use this to route account-scoped actions.
48+
AccountID string `json:"accountID,required"`
49+
// Display-only human-readable network name (e.g., 'WhatsApp', 'Messenger'). You
50+
// MUST use 'accountID' to perform actions.
51+
Network string `json:"network,required"`
52+
// A person on or reachable through Beeper. Values are best-effort and can vary by
53+
// network.
54+
User shared.User `json:"user,required"`
55+
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
56+
JSON struct {
57+
AccountID respjson.Field
58+
Network respjson.Field
59+
User respjson.Field
60+
ExtraFields map[string]respjson.Field
61+
raw string
62+
} `json:"-"`
63+
}
64+
65+
// Returns the unmodified JSON received from the API
66+
func (r Account) RawJSON() string { return r.JSON.raw }
67+
func (r *Account) UnmarshalJSON(data []byte) error {
68+
return apijson.UnmarshalRoot(data, r)
69+
}

account_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
package githubcombeeperdesktopapigo_test
3+
package beeperdesktopapi_test
44

55
import (
66
"context"
77
"errors"
88
"os"
99
"testing"
1010

11-
"github.com/beeper/desktop-api-go"
12-
"github.com/beeper/desktop-api-go/internal/testutil"
13-
"github.com/beeper/desktop-api-go/option"
11+
"github.com/stainless-sdks/beeper-desktop-api-go"
12+
"github.com/stainless-sdks/beeper-desktop-api-go/internal/testutil"
13+
"github.com/stainless-sdks/beeper-desktop-api-go/option"
1414
)
1515

1616
func TestAccountList(t *testing.T) {
@@ -21,13 +21,13 @@ func TestAccountList(t *testing.T) {
2121
if !testutil.CheckTestServer(t, baseURL) {
2222
return
2323
}
24-
client := githubcombeeperdesktopapigo.NewClient(
24+
client := beeperdesktopapi.NewClient(
2525
option.WithBaseURL(baseURL),
2626
option.WithAccessToken("My Access Token"),
2727
)
2828
_, err := client.Accounts.List(context.TODO())
2929
if err != nil {
30-
var apierr *githubcombeeperdesktopapigo.Error
30+
var apierr *beeperdesktopapi.Error
3131
if errors.As(err, &apierr) {
3232
t.Log(string(apierr.DumpRequest(true)))
3333
}

0 commit comments

Comments
 (0)