Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ agent with email/web access) to finish.

```bash
band account register --phone +15555550100 --email [email protected] --first-name Jane --last-name Doe --accept-tos
# → registration submitted (POST /v1/express/registration)
# → registration submitted (POST /v1/build/registrations)

band account send-code --phone +15555550100 --email [email protected] --delivery-channel sms # or "voice"
# → verification code sent. Choosing "sms" IS the customer's consent to
Expand Down
16 changes: 8 additions & 8 deletions cmd/account/golden_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestRegisterPlainOutput(t *testing.T) {
"links": []interface{}{},
"data": map[string]interface{}{
"message": "Onboarding request received successfully",
"status": "USER_CREATION_PENDING",
"status": "USER_CREATION_INITIATED",
"registrationId": "reg-123",
},
"errors": []interface{}{},
Expand All @@ -47,13 +47,13 @@ func TestRegisterPlainOutput(t *testing.T) {
}
})

want := "{\n \"message\": \"Onboarding request received successfully\",\n \"registrationId\": \"reg-123\",\n \"status\": \"USER_CREATION_PENDING\"\n}\n"
want := "{\n \"message\": \"Onboarding request received successfully\",\n \"registrationId\": \"reg-123\",\n \"status\": \"USER_CREATION_INITIATED\"\n}\n"
if out != want {
t.Fatalf("golden mismatch:\n got: %q\nwant: %q", out, want)
}

if fake.PostPath != "/registration" {
t.Errorf("PostPath = %q, want %q", fake.PostPath, "/registration")
if fake.PostPath != "/registrations" {
t.Errorf("PostPath = %q, want %q", fake.PostPath, "/registrations")
}
body, ok := fake.PostBody.(map[string]interface{})
if !ok {
Expand Down Expand Up @@ -101,8 +101,8 @@ func TestSendCodePlainOutput(t *testing.T) {
t.Fatalf("golden mismatch:\n got: %q\nwant: %q", out, want)
}

if fake.PostPath != "/registration/code" {
t.Errorf("PostPath = %q, want %q", fake.PostPath, "/registration/code")
if fake.PostPath != "/registrations/code" {
t.Errorf("PostPath = %q, want %q", fake.PostPath, "/registrations/code")
}
body, ok := fake.PostBody.(map[string]interface{})
if !ok {
Expand Down Expand Up @@ -145,8 +145,8 @@ func TestVerifyPlainOutput(t *testing.T) {
t.Fatalf("golden mismatch:\n got: %q\nwant: %q", out, want)
}

if fake.PostPath != "/registration/code/verify" {
t.Errorf("PostPath = %q, want %q", fake.PostPath, "/registration/code/verify")
if fake.PostPath != "/registrations/code/verify" {
t.Errorf("PostPath = %q, want %q", fake.PostPath, "/registrations/code/verify")
}
body, ok := fake.PostBody.(map[string]interface{})
if !ok {
Expand Down
2 changes: 1 addition & 1 deletion cmd/account/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func runRegister(cmd *cobra.Command, args []string) error {
}

var result interface{}
if err := client.Post(cmd.Context(), "/registration", reqBody, &result); err != nil {
if err := client.Post(cmd.Context(), "/registrations", reqBody, &result); err != nil {
return fmt.Errorf("registering account: %w", err)
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/account/send_code.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func runSendCode(cmd *cobra.Command, args []string) error {
}

var result interface{}
if err := client.Post(cmd.Context(), "/registration/code", reqBody, &result); err != nil {
if err := client.Post(cmd.Context(), "/registrations/code", reqBody, &result); err != nil {
return fmt.Errorf("sending verification code: %w", err)
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/account/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func runVerify(cmd *cobra.Command, args []string) error {
}

var result interface{}
if err := client.Post(cmd.Context(), "/registration/code/verify", reqBody, &result); err != nil {
if err := client.Post(cmd.Context(), "/registrations/code/verify", reqBody, &result); err != nil {
return fmt.Errorf("verifying phone number: %w", err)
}

Expand Down
2 changes: 1 addition & 1 deletion internal/cmdutil/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func apiHostForEnvironment(env string) string {

// RegistrationHost returns the Build registration API base URL, honoring BW_API_URL like every other client in this file.
func RegistrationHost() string {
return apiHostForEnvironment("") + "/v1/express"
return apiHostForEnvironment("") + "/v1/build"
}

// voiceHostForEnvironment maps an environment name to its Voice API host.
Expand Down
14 changes: 14 additions & 0 deletions internal/cmdutil/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,20 @@ func TestMessagingHost_BW_MESSAGING_URL_TrailingSlash(t *testing.T) {
}
}

func TestRegistrationHost(t *testing.T) {
t.Setenv("BW_API_URL", "")
if got := RegistrationHost(); got != "https://api.bandwidth.com/v1/build" {
t.Errorf("RegistrationHost() = %q, want https://api.bandwidth.com/v1/build", got)
}
}

func TestRegistrationHost_BW_API_URL(t *testing.T) {
t.Setenv("BW_API_URL", "https://custom.example.com/")
if got := RegistrationHost(); got != "https://custom.example.com/v1/build" {
t.Errorf("RegistrationHost() with BW_API_URL = %q, want https://custom.example.com/v1/build", got)
}
}

func TestResolveEnvironment(t *testing.T) {
t.Run("no override returns profile env", func(t *testing.T) {
EnvironmentOverride = ""
Expand Down
Loading