Skip to content

Commit ccd116d

Browse files
feat(api): add network, bridge fields to accounts
1 parent 5480c0e commit ccd116d

4 files changed

Lines changed: 13 additions & 116 deletions

File tree

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 23
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper%2Fbeeper-desktop-api-5a8ac7b545c48dc892e5c680303e305254921554dabee848e40a808659dbcf1e.yml
3-
openapi_spec_hash: 0103975601aac1445d3a4ef418c5d17a
4-
config_hash: 7d85c0b454fc78a59db6474c5c4d73c6
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper%2Fbeeper-desktop-api-611aa7641fbca8cf31d626bf86f9efd3c2b92778e897ebbb25c6ea44185ed1ed.yml
3+
openapi_spec_hash: d6c0a1776048dab04f6c5625c9893c9c
4+
config_hash: 39ed0717b5f415499aaace2468346e1a

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
The official CLI for the [Beeper Desktop REST API](https://developers.beeper.com/desktop-api/).
44

5-
It is generated with [Stainless](https://www.stainless.com/).
6-
75
<!-- x-release-please-start-version -->
86

97
## Installation
@@ -55,6 +53,7 @@ beeper-desktop-cli [resource] <command> [flags...]
5553

5654
```sh
5755
beeper-desktop-cli chats search \
56+
--access-token 'My Access Token' \
5857
--include-muted \
5958
--limit 3 \
6059
--type single

pkg/cmd/chat.go

Lines changed: 4 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -15,85 +15,19 @@ import (
1515
"github.com/urfave/cli/v3"
1616
)
1717

18-
var chatsCreate = requestflag.WithInnerFlags(cli.Command{
18+
var chatsCreate = cli.Command{
1919
Name: "create",
2020
Usage: "Create a single/group chat (mode='create') or start a direct chat from merged\nuser data (mode='start').",
2121
Suggest: true,
2222
Flags: []cli.Flag{
23-
&requestflag.Flag[string]{
24-
Name: "account-id",
25-
Usage: "Account to create or start the chat on.",
26-
Required: true,
27-
BodyPath: "accountID",
28-
},
29-
&requestflag.Flag[bool]{
30-
Name: "allow-invite",
31-
Usage: "Whether invite-based DM creation is allowed when required by the platform. Used for mode='start'.",
32-
Default: true,
33-
BodyPath: "allowInvite",
34-
},
35-
&requestflag.Flag[string]{
36-
Name: "message-text",
37-
Usage: "Optional first message content if the platform requires it to create the chat.",
38-
BodyPath: "messageText",
39-
},
40-
&requestflag.Flag[string]{
41-
Name: "mode",
42-
Usage: "Operation mode. Defaults to 'create' when omitted.",
43-
BodyPath: "mode",
44-
},
45-
&requestflag.Flag[[]string]{
46-
Name: "participant-id",
47-
Usage: "Required when mode='create'. User IDs to include in the new chat.",
48-
BodyPath: "participantIDs",
49-
},
50-
&requestflag.Flag[string]{
51-
Name: "title",
52-
Usage: "Optional title for group chats when mode='create'; ignored for single chats on most platforms.",
53-
BodyPath: "title",
54-
},
55-
&requestflag.Flag[string]{
56-
Name: "type",
57-
Usage: "Required when mode='create'. 'single' requires exactly one participantID; 'group' supports multiple participants and optional title.",
58-
BodyPath: "type",
59-
},
6023
&requestflag.Flag[map[string]any]{
61-
Name: "user",
62-
Usage: "Required when mode='start'. Merged user-like contact payload used to resolve the best identifier.",
63-
BodyPath: "user",
24+
Name: "params",
25+
BodyRoot: true,
6426
},
6527
},
6628
Action: handleChatsCreate,
6729
HideHelpCommand: true,
68-
}, map[string][]requestflag.HasOuterFlag{
69-
"user": {
70-
&requestflag.InnerFlag[string]{
71-
Name: "user.id",
72-
Usage: "Known user ID when available.",
73-
InnerField: "id",
74-
},
75-
&requestflag.InnerFlag[string]{
76-
Name: "user.email",
77-
Usage: "Email candidate.",
78-
InnerField: "email",
79-
},
80-
&requestflag.InnerFlag[string]{
81-
Name: "user.full-name",
82-
Usage: "Display name hint used for ranking only.",
83-
InnerField: "fullName",
84-
},
85-
&requestflag.InnerFlag[string]{
86-
Name: "user.phone-number",
87-
Usage: "Phone number candidate (E.164 preferred).",
88-
InnerField: "phoneNumber",
89-
},
90-
&requestflag.InnerFlag[string]{
91-
Name: "user.username",
92-
Usage: "Username/handle candidate.",
93-
InnerField: "username",
94-
},
95-
},
96-
})
30+
}
9731

9832
var chatsRetrieve = cli.Command{
9933
Name: "retrieve",

pkg/cmd/chat_test.go

Lines changed: 5 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"testing"
77

88
"github.com/beeper/desktop-api-cli/internal/mocktest"
9-
"github.com/beeper/desktop-api-cli/internal/requestflag"
109
)
1110

1211
func TestChatsCreate(t *testing.T) {
@@ -15,58 +14,23 @@ func TestChatsCreate(t *testing.T) {
1514
t,
1615
"--access-token", "string",
1716
"chats", "create",
18-
"--account-id", "accountID",
19-
"--allow-invite=true",
20-
"--message-text", "messageText",
21-
"--mode", "create",
22-
"--participant-id", "string",
23-
"--title", "title",
24-
"--type", "single",
25-
"--user", "{id: id, email: email, fullName: fullName, phoneNumber: phoneNumber, username: username}",
26-
)
27-
})
28-
29-
t.Run("inner flags", func(t *testing.T) {
30-
// Check that inner flags have been set up correctly
31-
requestflag.CheckInnerFlags(chatsCreate)
32-
33-
// Alternative argument passing style using inner flags
34-
mocktest.TestRunMockTestWithFlags(
35-
t,
36-
"--access-token", "string",
37-
"chats", "create",
38-
"--account-id", "accountID",
39-
"--allow-invite=true",
40-
"--message-text", "messageText",
41-
"--mode", "create",
42-
"--participant-id", "string",
43-
"--title", "title",
44-
"--type", "single",
45-
"--user.id", "id",
46-
"--user.email", "email",
47-
"--user.full-name", "fullName",
48-
"--user.phone-number", "phoneNumber",
49-
"--user.username", "username",
17+
"--params", "{accountID: accountID, mode: start, user: {id: id, email: email, fullName: fullName, phoneNumber: phoneNumber, username: username}, allowInvite: true, messageText: messageText}",
5018
)
5119
})
5220

5321
t.Run("piping data", func(t *testing.T) {
5422
// Test piping YAML data over stdin
5523
pipeData := []byte("" +
5624
"accountID: accountID\n" +
57-
"allowInvite: true\n" +
58-
"messageText: messageText\n" +
59-
"mode: create\n" +
60-
"participantIDs:\n" +
61-
" - string\n" +
62-
"title: title\n" +
63-
"type: single\n" +
25+
"mode: start\n" +
6426
"user:\n" +
6527
" id: id\n" +
6628
" email: email\n" +
6729
" fullName: fullName\n" +
6830
" phoneNumber: phoneNumber\n" +
69-
" username: username\n")
31+
" username: username\n" +
32+
"allowInvite: true\n" +
33+
"messageText: messageText\n")
7034
mocktest.TestRunMockTestWithPipeAndFlags(
7135
t, pipeData,
7236
"--access-token", "string",

0 commit comments

Comments
 (0)