Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
9504a61
chore(internal): minor cleanup
stainless-app[bot] Mar 11, 2026
ce4f065
chore(internal): use explicit returns
stainless-app[bot] Mar 11, 2026
f102b8e
chore(internal): use explicit returns in more places
stainless-app[bot] Mar 11, 2026
962727a
codegen metadata
stainless-app[bot] Mar 12, 2026
26470e3
codegen metadata
stainless-app[bot] Mar 12, 2026
9fd07e4
feat(api): manual updates
stainless-app[bot] Mar 12, 2026
92a6968
codegen metadata
stainless-app[bot] Mar 13, 2026
b7458ce
chore(internal): tweak CI branches
stainless-app[bot] Mar 17, 2026
bd09ac3
refactor(tests): switch from prism to steady
stainless-app[bot] Mar 20, 2026
0260191
chore(tests): bump steady to v0.19.4
stainless-app[bot] Mar 21, 2026
bb2044f
chore(tests): bump steady to v0.19.5
stainless-app[bot] Mar 21, 2026
229284f
chore(internal): update gitignore
stainless-app[bot] Mar 24, 2026
30b897c
chore(tests): bump steady to v0.19.6
stainless-app[bot] Mar 24, 2026
2a83146
chore(ci): skip lint on metadata-only changes
stainless-app[bot] Mar 25, 2026
b64d423
chore(tests): bump steady to v0.19.7
stainless-app[bot] Mar 25, 2026
eaa5a1a
codegen metadata
stainless-app[bot] Mar 25, 2026
72229ec
codegen metadata
stainless-app[bot] Mar 25, 2026
7721cb4
codegen metadata
stainless-app[bot] Mar 25, 2026
3e39971
chore(internal): support default value struct tag
stainless-app[bot] Mar 26, 2026
029f5d6
chore(client): fix multipart serialisation of Default() fields
stainless-app[bot] Mar 26, 2026
8293eb7
fix: prevent duplicate ? in query params
stainless-app[bot] Mar 27, 2026
76dc981
chore: remove unnecessary error check for url parsing
stainless-app[bot] Mar 27, 2026
d4f7e8e
feat(internal): support comma format in multipart form encoding
stainless-app[bot] Mar 27, 2026
b4dec8f
chore(ci): support opting out of skipping builds on metadata-only com…
stainless-app[bot] Mar 28, 2026
350f111
chore: update docs for api:"required"
stainless-app[bot] Mar 28, 2026
8e7e3a6
chore(tests): bump steady to v0.20.1
stainless-app[bot] Apr 1, 2026
a5fbcc7
chore(tests): bump steady to v0.20.2
stainless-app[bot] Apr 1, 2026
5042271
feat(api): add network, bridge fields to accounts
stainless-app[bot] Apr 12, 2026
423bb69
chore(tests): bump steady to v0.22.1
stainless-app[bot] Apr 18, 2026
25b94e4
chore(internal): more robust bootstrap script
stainless-app[bot] Apr 23, 2026
7c34729
feat(go): add default http client with timeout
stainless-app[bot] Apr 25, 2026
d4fdbe1
feat: support setting headers via env
stainless-app[bot] Apr 28, 2026
bfbab41
Update Desktop API Stainless config and OpenAPI spec
stainless-app[bot] Apr 29, 2026
16eed65
Preserve asset serve SDK compatibility
stainless-app[bot] Apr 29, 2026
4297fcc
Document asset serve stream response
stainless-app[bot] Apr 29, 2026
6d4b2b1
codegen metadata
stainless-app[bot] Apr 30, 2026
3da8f58
codegen metadata
stainless-app[bot] May 1, 2026
6a8ff6a
chore: avoid embedding reflect.Type for dead code elimination
stainless-app[bot] May 1, 2026
d2d6223
feat(api): api update
stainless-app[bot] May 4, 2026
85ced8c
feat(api): api update
stainless-app[bot] May 4, 2026
4681bd6
feat(api): api update
stainless-app[bot] May 6, 2026
f23c602
release: 5.0.0
stainless-app[bot] May 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
name: CI
on:
push:
branches-ignore:
- 'generated'
- 'codegen/**'
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
branches:
- '**'
- '!integrated/**'
- '!stl-preview-head/**'
- '!stl-preview-base/**'
- '!generated'
- '!codegen/**'
- 'codegen/stl/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
Expand All @@ -22,7 +24,7 @@ jobs:
runs-on: ${{ github.repository == 'stainless-sdks/beeper-desktop-api-go' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: |-
github.repository == 'stainless-sdks/beeper-desktop-api-go' &&
(github.event_name == 'push' || github.event.pull_request.head.repo.fork)
(github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- uses: actions/checkout@v6

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.prism.log
.stdy.log
codegen.log
Brewfile.lock.json
.idea/
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.5.0"
".": "5.0.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 23
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper%2Fbeeper-desktop-api-5a8ac7b545c48dc892e5c680303e305254921554dabee848e40a808659dbcf1e.yml
openapi_spec_hash: 0103975601aac1445d3a4ef418c5d17a
config_hash: aa49273410d42fb96c5515dbce1f182f
configured_endpoints: 30
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper/beeper-desktop-api-c08c14bb754b4cb0e02b21fabb680469368286be339dec0aaa8c69d04a1f021a.yml
openapi_spec_hash: a10246aaf7cdc33b682fc245bd5f893b
config_hash: 72f9d43b9b51a5da912e9f3730e53ae2
49 changes: 49 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,54 @@
# Changelog

## 5.0.0 (2026-05-06)

Full Changelog: [v0.5.0...v5.0.0](https://github.com/beeper/desktop-api-go/compare/v0.5.0...v5.0.0)

### Features

* **api:** add network, bridge fields to accounts ([5042271](https://github.com/beeper/desktop-api-go/commit/50422719fe1149b4a0a33cac7a7605e499fac9e4))
* **api:** api update ([4681bd6](https://github.com/beeper/desktop-api-go/commit/4681bd6077032db3dfe8d8e6d4b4edaddcb7292c))
* **api:** api update ([85ced8c](https://github.com/beeper/desktop-api-go/commit/85ced8c13f1d373cd36f5fb2c74ae3aad2a99016))
* **api:** api update ([d2d6223](https://github.com/beeper/desktop-api-go/commit/d2d6223284dade370d2671176ff36811203d9981))
* **api:** manual updates ([9fd07e4](https://github.com/beeper/desktop-api-go/commit/9fd07e44e68014b1ba88891a8e89d2994540df19))
* **go:** add default http client with timeout ([7c34729](https://github.com/beeper/desktop-api-go/commit/7c347297b7df763e97e3554777ffebdecd37009c))
* **internal:** support comma format in multipart form encoding ([d4f7e8e](https://github.com/beeper/desktop-api-go/commit/d4f7e8ef134cb9a535fa05458ee7af93532c8c2b))
* support setting headers via env ([d4fdbe1](https://github.com/beeper/desktop-api-go/commit/d4fdbe157b2634c7e0c16be61583f9ebb99a8ed4))


### Bug Fixes

* prevent duplicate ? in query params ([8293eb7](https://github.com/beeper/desktop-api-go/commit/8293eb76584617003ec104770810028b3e4076b0))


### Chores

* avoid embedding reflect.Type for dead code elimination ([6a8ff6a](https://github.com/beeper/desktop-api-go/commit/6a8ff6a1189beb742794e0f7b11ce2aa5651c63e))
* **ci:** skip lint on metadata-only changes ([2a83146](https://github.com/beeper/desktop-api-go/commit/2a83146c4d9b2f29ddce45b6f8484f7533f98c58))
* **ci:** support opting out of skipping builds on metadata-only commits ([b4dec8f](https://github.com/beeper/desktop-api-go/commit/b4dec8f324d1c18699f81d6a060b33c1b0d4772a))
* **client:** fix multipart serialisation of Default() fields ([029f5d6](https://github.com/beeper/desktop-api-go/commit/029f5d67da0158cf1ed913fc3f6dfd213681d363))
* **internal:** minor cleanup ([9504a61](https://github.com/beeper/desktop-api-go/commit/9504a6100b1c23909976ac1473285cab5397aece))
* **internal:** more robust bootstrap script ([25b94e4](https://github.com/beeper/desktop-api-go/commit/25b94e4324b7c4b7f0c8decbaed4cd8ed979a3b4))
* **internal:** support default value struct tag ([3e39971](https://github.com/beeper/desktop-api-go/commit/3e39971ec0ee20accae2c2eae5e64004f6cfe810))
* **internal:** tweak CI branches ([b7458ce](https://github.com/beeper/desktop-api-go/commit/b7458ceb902a6e768e54adc05d5532f63147e3db))
* **internal:** update gitignore ([229284f](https://github.com/beeper/desktop-api-go/commit/229284fcf7e552241afaebbe24df184a5db693af))
* **internal:** use explicit returns ([ce4f065](https://github.com/beeper/desktop-api-go/commit/ce4f065cc711a045df715b8c0a7c4338f7d114db))
* **internal:** use explicit returns in more places ([f102b8e](https://github.com/beeper/desktop-api-go/commit/f102b8ecdfa469185a1ed3700f73952f7c3bfec5))
* remove unnecessary error check for url parsing ([76dc981](https://github.com/beeper/desktop-api-go/commit/76dc981c3f95e4b7935aaefd95f1de5e119d9298))
* **tests:** bump steady to v0.19.4 ([0260191](https://github.com/beeper/desktop-api-go/commit/026019176b91a6cc8a06f3e34cf6df2365f14e50))
* **tests:** bump steady to v0.19.5 ([bb2044f](https://github.com/beeper/desktop-api-go/commit/bb2044f9230e575f610398a5f28a43bd7b7e8cf2))
* **tests:** bump steady to v0.19.6 ([30b897c](https://github.com/beeper/desktop-api-go/commit/30b897ce73a2216204876ab5fb3132cf549228ee))
* **tests:** bump steady to v0.19.7 ([b64d423](https://github.com/beeper/desktop-api-go/commit/b64d42348319e02f4cad0107d9848f57743d04c7))
* **tests:** bump steady to v0.20.1 ([8e7e3a6](https://github.com/beeper/desktop-api-go/commit/8e7e3a6fcedaf7b4eaeb0f7e880e5347f5c2ac93))
* **tests:** bump steady to v0.20.2 ([a5fbcc7](https://github.com/beeper/desktop-api-go/commit/a5fbcc7e74ba585849c839bffb71ee1b42f6af2d))
* **tests:** bump steady to v0.22.1 ([423bb69](https://github.com/beeper/desktop-api-go/commit/423bb69d2de050be324c3389a759747693eb55ed))
* update docs for api:"required" ([350f111](https://github.com/beeper/desktop-api-go/commit/350f111de7c4045065804f2425729f72a65a1388))


### Refactors

* **tests:** switch from prism to steady ([bd09ac3](https://github.com/beeper/desktop-api-go/commit/bd09ac321d342e5f197f8ceac6abf4ee5e766822))

## 0.5.0 (2026-03-06)

Full Changelog: [v0.4.0...v0.5.0](https://github.com/beeper/desktop-api-go/compare/v0.4.0...v0.5.0)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ $ go mod edit -replace github.com/beeper/desktop-api-go=/path/to/desktop-api-go

## Running tests

Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
Most tests require you to [set up a mock server](https://github.com/dgellow/steady) against the OpenAPI spec to run the tests.

```sh
$ ./scripts/mock
Expand Down
28 changes: 16 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!-- x-release-please-start-version -->

<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>
<a href="https://pkg.go.dev/github.com/beeper/desktop-api-go/v5"><img src="https://pkg.go.dev/badge/github.com/beeper/desktop-api-go.svg" alt="Go Reference"></a>

<!-- x-release-please-end -->

Expand All @@ -13,8 +13,8 @@ from applications written in Go.

Use the Beeper Desktop MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.

[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40beeper%2Fdesktop-api-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBiZWVwZXIvZGVza3RvcC1hcGktbWNwIl0sImVudiI6eyJCRUVQRVJfQUNDRVNTX1RPS0VOIjoiTXkgQWNjZXNzIFRva2VuIn19)
[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40beeper%2Fdesktop-api-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40beeper%2Fdesktop-api-mcp%22%5D%2C%22env%22%3A%7B%22BEEPER_ACCESS_TOKEN%22%3A%22My%20Access%20Token%22%7D%7D)
[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40beeper%2Fdesktop-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBiZWVwZXIvZGVza3RvcC1tY3AiXSwiZW52Ijp7IkJFRVBFUl9BQ0NFU1NfVE9LRU4iOiJNeSBBY2Nlc3MgVG9rZW4ifX0)
[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40beeper%2Fdesktop-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40beeper%2Fdesktop-mcp%22%5D%2C%22env%22%3A%7B%22BEEPER_ACCESS_TOKEN%22%3A%22My%20Access%20Token%22%7D%7D)

> Note: You may need to set environment variables in your MCP client.

Expand All @@ -24,7 +24,7 @@ Use the Beeper Desktop MCP Server to enable AI assistants to interact with this

```go
import (
"github.com/beeper/desktop-api-go" // imported as beeperdesktopapi
"github.com/beeper/desktop-api-go/v5" // imported as beeperdesktopapi
)
```

Expand All @@ -35,7 +35,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/beeper/desktop-api-go@v0.5.0'
go get -u 'github.com/beeper/desktop-api-go@v5.0.0'
```

<!-- x-release-please-end -->
Expand All @@ -55,12 +55,16 @@ import (
"context"
"fmt"

"github.com/beeper/desktop-api-go"
"github.com/beeper/desktop-api-go/v5"
"github.com/beeper/desktop-api-go/v5/option"
)

func main() {
client := beeperdesktopapi.NewClient()
client := beeperdesktopapi.NewClient(
option.WithAccessToken("My Access Token"), // defaults to os.LookupEnv("BEEPER_ACCESS_TOKEN")
)
page, err := client.Chats.Search(context.TODO(), beeperdesktopapi.ChatSearchParams{
AccountIDs: []string{"matrix", "discordgo", "local-whatsapp_ba_EvYDBBsZbRQAy3UOSWqG0LuTVkc"},
IncludeMuted: beeperdesktopapi.Bool(true),
Limit: beeperdesktopapi.Int(3),
Type: beeperdesktopapi.ChatSearchParamsTypeSingle,
Expand All @@ -78,7 +82,7 @@ func main() {
The beeperdesktopapi library uses the [`omitzero`](https://tip.golang.org/doc/go1.24#encodingjsonpkgencodingjson)
semantics from the Go 1.24+ `encoding/json` release for request fields.

Required primitive fields (`int64`, `string`, etc.) feature the tag <code>\`json:"...,required"\`</code>. These
Required primitive fields (`int64`, `string`, etc.) feature the tag <code>\`api:"required"\`</code>. These
fields are always serialized, even their zero values.

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.
Expand Down Expand Up @@ -294,9 +298,9 @@ You can use `.ListAutoPaging()` methods to iterate through items across all page

```go
iter := client.Messages.SearchAutoPaging(context.TODO(), beeperdesktopapi.MessageSearchParams{
AccountIDs: []string{"local-telegram_ba_QFrb5lrLPhO3OT5MFBeTWv0x4BI"},
AccountIDs: []string{"discordgo", "local-whatsapp_ba_EvYDBBsZbRQAy3UOSWqG0LuTVkc"},
Limit: beeperdesktopapi.Int(10),
Query: beeperdesktopapi.String("deployment"),
Query: beeperdesktopapi.String("oauth"),
})
// Automatically fetches more pages as needed.
for iter.Next() {
Expand All @@ -313,9 +317,9 @@ with additional helper methods like `.GetNextPage()`, e.g.:

```go
page, err := client.Messages.Search(context.TODO(), beeperdesktopapi.MessageSearchParams{
AccountIDs: []string{"local-telegram_ba_QFrb5lrLPhO3OT5MFBeTWv0x4BI"},
AccountIDs: []string{"discordgo", "local-whatsapp_ba_EvYDBBsZbRQAy3UOSWqG0LuTVkc"},
Limit: beeperdesktopapi.Int(10),
Query: beeperdesktopapi.String("deployment"),
Query: beeperdesktopapi.String("oauth"),
})
for page != nil {
for _, message := range page.Items {
Expand Down
59 changes: 49 additions & 10 deletions account.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"net/http"
"slices"

"github.com/beeper/desktop-api-go/internal/apijson"
"github.com/beeper/desktop-api-go/internal/requestconfig"
"github.com/beeper/desktop-api-go/option"
"github.com/beeper/desktop-api-go/packages/respjson"
"github.com/beeper/desktop-api-go/shared"
"github.com/beeper/desktop-api-go/v5/internal/apijson"
"github.com/beeper/desktop-api-go/v5/internal/requestconfig"
"github.com/beeper/desktop-api-go/v5/option"
"github.com/beeper/desktop-api-go/v5/packages/respjson"
"github.com/beeper/desktop-api-go/v5/shared"
)

// Manage connected chat accounts
Expand All @@ -38,25 +38,35 @@ func NewAccountService(opts ...option.RequestOption) (r AccountService) {
return
}

// Lists chat accounts across networks (WhatsApp, Telegram, Twitter/X, etc.)
// actively connected to this Beeper Desktop instance
// List Chat Accounts connected to this Beeper Desktop instance, including bridge
// metadata and network identity.
func (r *AccountService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Account, err error) {
opts = slices.Concat(r.Options, opts)
path := "v1/accounts"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
return res, err
}

// A chat account added to Beeper
// A chat account added to Beeper.
type Account struct {
// Chat account added to Beeper. Use this to route account-scoped actions.
// Chat account added to Beeper. Use this to route account-scoped actions. Examples
// include matrix for Beeper/Matrix, discordgo for a cloud bridge,
// slackgo.TEAM-USER for workspace-scoped cloud bridges, and local-whatsapp*ba*...
// for local bridges.
AccountID string `json:"accountID" api:"required"`
// Bridge metadata for the account. Available in Beeper Desktop v4.2.785+.
Bridge AccountBridge `json:"bridge" api:"required"`
// User the account belongs to.
User shared.User `json:"user" api:"required"`
// Human-friendly network name for the account. Omitted when the network is
// unknown.
Network string `json:"network"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
AccountID respjson.Field
Bridge respjson.Field
User respjson.Field
Network respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
Expand All @@ -67,3 +77,32 @@ func (r Account) RawJSON() string { return r.JSON.raw }
func (r *Account) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}

// Bridge metadata for the account. Available in Beeper Desktop v4.2.785+.
type AccountBridge struct {
// Bridge instance identifier. Matrix and cloud bridges often use the bridge type
// (for example matrix or discordgo); local bridges use a local bridge ID (for
// example local-whatsapp). Available in Beeper Desktop v4.2.785+.
ID string `json:"id" api:"required"`
// Bridge provider for the account. Available in Beeper Desktop v4.2.785+.
//
// Any of "cloud", "self-hosted", "local", "platform-sdk".
Provider string `json:"provider" api:"required"`
// Bridge type, such as matrix, discordgo, slackgo, whatsapp, telegram, or twitter.
// Available in Beeper Desktop v4.2.785+.
Type string `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Provider respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}

// Returns the unmodified JSON received from the API
func (r AccountBridge) RawJSON() string { return r.JSON.raw }
func (r *AccountBridge) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
6 changes: 3 additions & 3 deletions account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"os"
"testing"

"github.com/beeper/desktop-api-go"
"github.com/beeper/desktop-api-go/internal/testutil"
"github.com/beeper/desktop-api-go/option"
"github.com/beeper/desktop-api-go/v5"
"github.com/beeper/desktop-api-go/v5/internal/testutil"
"github.com/beeper/desktop-api-go/v5/option"
)

func TestAccountList(t *testing.T) {
Expand Down
22 changes: 11 additions & 11 deletions accountcontact.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import (
"net/url"
"slices"

"github.com/beeper/desktop-api-go/internal/apijson"
"github.com/beeper/desktop-api-go/internal/apiquery"
"github.com/beeper/desktop-api-go/internal/requestconfig"
"github.com/beeper/desktop-api-go/option"
"github.com/beeper/desktop-api-go/packages/pagination"
"github.com/beeper/desktop-api-go/packages/param"
"github.com/beeper/desktop-api-go/packages/respjson"
"github.com/beeper/desktop-api-go/shared"
"github.com/beeper/desktop-api-go/v5/internal/apijson"
"github.com/beeper/desktop-api-go/v5/internal/apiquery"
"github.com/beeper/desktop-api-go/v5/internal/requestconfig"
"github.com/beeper/desktop-api-go/v5/option"
"github.com/beeper/desktop-api-go/v5/packages/pagination"
"github.com/beeper/desktop-api-go/v5/packages/param"
"github.com/beeper/desktop-api-go/v5/packages/respjson"
"github.com/beeper/desktop-api-go/v5/shared"
)

// Manage contacts on a specific account
Expand Down Expand Up @@ -48,7 +48,7 @@ func (r *AccountContactService) List(ctx context.Context, accountID string, quer
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
if accountID == "" {
err = errors.New("missing required accountID parameter")
return
return nil, err
}
path := fmt.Sprintf("v1/accounts/%s/contacts/list", accountID)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
Expand All @@ -74,11 +74,11 @@ func (r *AccountContactService) Search(ctx context.Context, accountID string, qu
opts = slices.Concat(r.Options, opts)
if accountID == "" {
err = errors.New("missing required accountID parameter")
return
return nil, err
}
path := fmt.Sprintf("v1/accounts/%s/contacts", accountID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
return
return res, err
}

type AccountContactSearchResponse struct {
Expand Down
6 changes: 3 additions & 3 deletions accountcontact_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"os"
"testing"

"github.com/beeper/desktop-api-go"
"github.com/beeper/desktop-api-go/internal/testutil"
"github.com/beeper/desktop-api-go/option"
"github.com/beeper/desktop-api-go/v5"
"github.com/beeper/desktop-api-go/v5/internal/testutil"
"github.com/beeper/desktop-api-go/v5/option"
)

func TestAccountContactListWithOptionalParams(t *testing.T) {
Expand Down
Loading
Loading