Skip to content
Open
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 .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.8.0"
".": "0.9.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: 7
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prelude%2Fprelude-a9b305af8d4d58930c33f8efdc51aa66a8f9b9b769361e03ffd8af5e3feeaff1.yml
openapi_spec_hash: ce664eeb97aa2ff5ec1787012d836585
config_hash: ca54a70a973ee01b90b5b0e6f0723980
configured_endpoints: 9
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prelude%2Fprelude-6a15f8e7ecdac60da12d1f5be6d42dbd814b368949323e4ca01b1095baae4dde.yml
openapi_spec_hash: 1b6927d5f6b8feb825513d005ad4f1d1
config_hash: 3e03f2533dcff7381e9cc132040c072c
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 0.9.0 (2025-10-17)

Full Changelog: [v0.8.0...v0.9.0](https://github.com/prelude-so/go-sdk/compare/v0.8.0...v0.9.0)

### Features

* **api:** api update ([7d03714](https://github.com/prelude-so/go-sdk/commit/7d03714a9b6d9e1b0bb763f6feca1a783e45fe78))
* **api:** api update ([ab44c73](https://github.com/prelude-so/go-sdk/commit/ab44c732d54e56ce52d2b9310fd8c53781084394))
* **api:** api update ([ae74d88](https://github.com/prelude-so/go-sdk/commit/ae74d88df68cccf5c6303db498834278de15f011))
* **api:** expose verification management methods ([852ff3b](https://github.com/prelude-so/go-sdk/commit/852ff3b4b849dab157bca92a08494e9190f3eaab))

## 0.8.0 (2025-09-25)

Full Changelog: [v0.7.0...v0.8.0](https://github.com/prelude-so/go-sdk/compare/v0.7.0...v0.8.0)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/prelude-so/go-sdk@v0.8.0'
go get -u 'github.com/prelude-so/go-sdk@v0.9.0'
```

<!-- x-release-please-end -->
Expand Down
12 changes: 12 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ Methods:
- <code title="post /v2/verification">client.Verification.<a href="https://pkg.go.dev/github.com/prelude-so/go-sdk#VerificationService.New">New</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, body <a href="https://pkg.go.dev/github.com/prelude-so/go-sdk">prelude</a>.<a href="https://pkg.go.dev/github.com/prelude-so/go-sdk#VerificationNewParams">VerificationNewParams</a>) (<a href="https://pkg.go.dev/github.com/prelude-so/go-sdk">prelude</a>.<a href="https://pkg.go.dev/github.com/prelude-so/go-sdk#VerificationNewResponse">VerificationNewResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /v2/verification/check">client.Verification.<a href="https://pkg.go.dev/github.com/prelude-so/go-sdk#VerificationService.Check">Check</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, body <a href="https://pkg.go.dev/github.com/prelude-so/go-sdk">prelude</a>.<a href="https://pkg.go.dev/github.com/prelude-so/go-sdk#VerificationCheckParams">VerificationCheckParams</a>) (<a href="https://pkg.go.dev/github.com/prelude-so/go-sdk">prelude</a>.<a href="https://pkg.go.dev/github.com/prelude-so/go-sdk#VerificationCheckResponse">VerificationCheckResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

# VerificationManagement

Response Types:

- <a href="https://pkg.go.dev/github.com/prelude-so/go-sdk">prelude</a>.<a href="https://pkg.go.dev/github.com/prelude-so/go-sdk#VerificationManagementListSenderIDsResponse">VerificationManagementListSenderIDsResponse</a>
- <a href="https://pkg.go.dev/github.com/prelude-so/go-sdk">prelude</a>.<a href="https://pkg.go.dev/github.com/prelude-so/go-sdk#VerificationManagementSubmitSenderIDResponse">VerificationManagementSubmitSenderIDResponse</a>

Methods:

- <code title="get /v2/verification/management/sender-id">client.VerificationManagement.<a href="https://pkg.go.dev/github.com/prelude-so/go-sdk#VerificationManagementService.ListSenderIDs">ListSenderIDs</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) (<a href="https://pkg.go.dev/github.com/prelude-so/go-sdk">prelude</a>.<a href="https://pkg.go.dev/github.com/prelude-so/go-sdk#VerificationManagementListSenderIDsResponse">VerificationManagementListSenderIDsResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /v2/verification/management/sender-id">client.VerificationManagement.<a href="https://pkg.go.dev/github.com/prelude-so/go-sdk#VerificationManagementService.SubmitSenderID">SubmitSenderID</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, body <a href="https://pkg.go.dev/github.com/prelude-so/go-sdk">prelude</a>.<a href="https://pkg.go.dev/github.com/prelude-so/go-sdk#VerificationManagementSubmitSenderIDParams">VerificationManagementSubmitSenderIDParams</a>) (<a href="https://pkg.go.dev/github.com/prelude-so/go-sdk">prelude</a>.<a href="https://pkg.go.dev/github.com/prelude-so/go-sdk#VerificationManagementSubmitSenderIDResponse">VerificationManagementSubmitSenderIDResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

# Watch

Response Types:
Expand Down
12 changes: 7 additions & 5 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ import (
// interacting with the Prelude API. You should not instantiate this client
// directly, and instead use the [NewClient] method instead.
type Client struct {
Options []option.RequestOption
Lookup *LookupService
Transactional *TransactionalService
Verification *VerificationService
Watch *WatchService
Options []option.RequestOption
Lookup *LookupService
Transactional *TransactionalService
Verification *VerificationService
VerificationManagement *VerificationManagementService
Watch *WatchService
}

// DefaultClientOptions read from the environment (API_TOKEN, PRELUDE_BASE_URL).
Expand Down Expand Up @@ -48,6 +49,7 @@ func NewClient(opts ...option.RequestOption) (r *Client) {
r.Lookup = NewLookupService(opts...)
r.Transactional = NewTransactionalService(opts...)
r.Verification = NewVerificationService(opts...)
r.VerificationManagement = NewVerificationManagementService(opts...)
r.Watch = NewWatchService(opts...)

return
Expand Down
2 changes: 1 addition & 1 deletion internal/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

package internal

const PackageVersion = "0.8.0" // x-release-please-version
const PackageVersion = "0.9.0" // x-release-please-version
34 changes: 34 additions & 0 deletions transactional.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,44 @@ type TransactionalSendParams struct {
// code of the phone number. If the language specified doesn't exist, the default
// set on the template will be used.
Locale param.Field[string] `json:"locale"`
// The preferred delivery channel for the message. When specified, the system will
// prioritize sending via the requested channel if the template is configured for
// it.
//
// If not specified and the template is configured for WhatsApp, the message will
// be sent via WhatsApp first, with automatic fallback to SMS if WhatsApp delivery
// is unavailable.
//
// Supported channels: `sms`, `whatsapp`.
PreferredChannel param.Field[TransactionalSendParamsPreferredChannel] `json:"preferred_channel"`
// The variables to be replaced in the template.
Variables param.Field[map[string]string] `json:"variables"`
}

func (r TransactionalSendParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

// The preferred delivery channel for the message. When specified, the system will
// prioritize sending via the requested channel if the template is configured for
// it.
//
// If not specified and the template is configured for WhatsApp, the message will
// be sent via WhatsApp first, with automatic fallback to SMS if WhatsApp delivery
// is unavailable.
//
// Supported channels: `sms`, `whatsapp`.
type TransactionalSendParamsPreferredChannel string

const (
TransactionalSendParamsPreferredChannelSMS TransactionalSendParamsPreferredChannel = "sms"
TransactionalSendParamsPreferredChannelWhatsapp TransactionalSendParamsPreferredChannel = "whatsapp"
)

func (r TransactionalSendParamsPreferredChannel) IsKnown() bool {
switch r {
case TransactionalSendParamsPreferredChannelSMS, TransactionalSendParamsPreferredChannelWhatsapp:
return true
}
return false
}
15 changes: 8 additions & 7 deletions transactional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ func TestTransactionalSendWithOptionalParams(t *testing.T) {
option.WithAPIToken("My API Token"),
)
_, err := client.Transactional.Send(context.TODO(), prelude.TransactionalSendParams{
TemplateID: prelude.F("template_01jd1xq0cffycayqtdkdbv4d61"),
To: prelude.F("+30123456789"),
CallbackURL: prelude.F("callback_url"),
CorrelationID: prelude.F("correlation_id"),
ExpiresAt: prelude.F("expires_at"),
From: prelude.F("from"),
Locale: prelude.F("el-GR"),
TemplateID: prelude.F("template_01jd1xq0cffycayqtdkdbv4d61"),
To: prelude.F("+30123456789"),
CallbackURL: prelude.F("callback_url"),
CorrelationID: prelude.F("correlation_id"),
ExpiresAt: prelude.F("expires_at"),
From: prelude.F("from"),
Locale: prelude.F("el-GR"),
PreferredChannel: prelude.F(prelude.TransactionalSendParamsPreferredChannelWhatsapp),
Variables: prelude.F(map[string]string{
"foo": "bar",
}),
Expand Down
4 changes: 3 additions & 1 deletion verification.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,9 @@ type VerificationNewParamsOptionsAppRealm struct {
// The platform the SMS will be sent to. We are currently only supporting
// "android".
Platform param.Field[VerificationNewParamsOptionsAppRealmPlatform] `json:"platform,required"`
// The Android SMS Retriever API hash code that identifies your app.
// The Android SMS Retriever API hash code that identifies your app. For more
// information, see
// [Google documentation](https://developers.google.com/identity/sms-retriever/verify#computing_your_apps_hash_string).
Value param.Field[string] `json:"value,required"`
}

Expand Down
187 changes: 187 additions & 0 deletions verificationmanagement.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

package prelude

import (
"context"
"net/http"
"slices"

"github.com/prelude-so/go-sdk/internal/apijson"
"github.com/prelude-so/go-sdk/internal/param"
"github.com/prelude-so/go-sdk/internal/requestconfig"
"github.com/prelude-so/go-sdk/option"
)

// VerificationManagementService contains methods and other services that help with
// interacting with the Prelude API.
//
// Note, unlike clients, this service does not read variables from the environment
// automatically. You should not instantiate this service directly, and instead use
// the [NewVerificationManagementService] method instead.
type VerificationManagementService struct {
Options []option.RequestOption
}

// NewVerificationManagementService generates a new service that applies the given
// options to each request. These options are applied after the parent client's
// options (if there is one), and before any request-specific options.
func NewVerificationManagementService(opts ...option.RequestOption) (r *VerificationManagementService) {
r = &VerificationManagementService{}
r.Options = opts
return
}

// Retrieve sender IDs list.
//
// In order to get access to this endpoint, contact our support team.
func (r *VerificationManagementService) ListSenderIDs(ctx context.Context, opts ...option.RequestOption) (res *VerificationManagementListSenderIDsResponse, err error) {
opts = slices.Concat(r.Options, opts)
path := "v2/verification/management/sender-id"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}

// This endpoint allows you to submit a new sender ID for verification purposes.
//
// In order to get access to this endpoint, contact our support team.
func (r *VerificationManagementService) SubmitSenderID(ctx context.Context, body VerificationManagementSubmitSenderIDParams, opts ...option.RequestOption) (res *VerificationManagementSubmitSenderIDResponse, err error) {
opts = slices.Concat(r.Options, opts)
path := "v2/verification/management/sender-id"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}

// A list of Sender ID.
type VerificationManagementListSenderIDsResponse struct {
SenderIDs []VerificationManagementListSenderIDsResponseSenderID `json:"sender_ids"`
JSON verificationManagementListSenderIDsResponseJSON `json:"-"`
}

// verificationManagementListSenderIDsResponseJSON contains the JSON metadata for
// the struct [VerificationManagementListSenderIDsResponse]
type verificationManagementListSenderIDsResponseJSON struct {
SenderIDs apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *VerificationManagementListSenderIDsResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r verificationManagementListSenderIDsResponseJSON) RawJSON() string {
return r.raw
}

type VerificationManagementListSenderIDsResponseSenderID struct {
// Value that will be presented as Sender ID
SenderID string `json:"sender_id"`
// It indicates the status of the Sender ID. Possible values are:
//
// - `approved` - The Sender ID is approved.
// - `pending` - The Sender ID is pending.
// - `rejected` - The Sender ID is rejected.
Status VerificationManagementListSenderIDsResponseSenderIDsStatus `json:"status"`
JSON verificationManagementListSenderIDsResponseSenderIDJSON `json:"-"`
}

// verificationManagementListSenderIDsResponseSenderIDJSON contains the JSON
// metadata for the struct [VerificationManagementListSenderIDsResponseSenderID]
type verificationManagementListSenderIDsResponseSenderIDJSON struct {
SenderID apijson.Field
Status apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *VerificationManagementListSenderIDsResponseSenderID) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r verificationManagementListSenderIDsResponseSenderIDJSON) RawJSON() string {
return r.raw
}

// It indicates the status of the Sender ID. Possible values are:
//
// - `approved` - The Sender ID is approved.
// - `pending` - The Sender ID is pending.
// - `rejected` - The Sender ID is rejected.
type VerificationManagementListSenderIDsResponseSenderIDsStatus string

const (
VerificationManagementListSenderIDsResponseSenderIDsStatusApproved VerificationManagementListSenderIDsResponseSenderIDsStatus = "approved"
VerificationManagementListSenderIDsResponseSenderIDsStatusPending VerificationManagementListSenderIDsResponseSenderIDsStatus = "pending"
VerificationManagementListSenderIDsResponseSenderIDsStatusRejected VerificationManagementListSenderIDsResponseSenderIDsStatus = "rejected"
)

func (r VerificationManagementListSenderIDsResponseSenderIDsStatus) IsKnown() bool {
switch r {
case VerificationManagementListSenderIDsResponseSenderIDsStatusApproved, VerificationManagementListSenderIDsResponseSenderIDsStatusPending, VerificationManagementListSenderIDsResponseSenderIDsStatusRejected:
return true
}
return false
}

type VerificationManagementSubmitSenderIDResponse struct {
// The sender ID that was added.
SenderID string `json:"sender_id,required"`
// It indicates the status of the sender ID. Possible values are:
//
// - `approved` - The sender ID is approved.
// - `pending` - The sender ID is pending.
// - `rejected` - The sender ID is rejected.
Status VerificationManagementSubmitSenderIDResponseStatus `json:"status,required"`
// The reason why the sender ID was rejected.
Reason string `json:"reason"`
JSON verificationManagementSubmitSenderIDResponseJSON `json:"-"`
}

// verificationManagementSubmitSenderIDResponseJSON contains the JSON metadata for
// the struct [VerificationManagementSubmitSenderIDResponse]
type verificationManagementSubmitSenderIDResponseJSON struct {
SenderID apijson.Field
Status apijson.Field
Reason apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *VerificationManagementSubmitSenderIDResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r verificationManagementSubmitSenderIDResponseJSON) RawJSON() string {
return r.raw
}

// It indicates the status of the sender ID. Possible values are:
//
// - `approved` - The sender ID is approved.
// - `pending` - The sender ID is pending.
// - `rejected` - The sender ID is rejected.
type VerificationManagementSubmitSenderIDResponseStatus string

const (
VerificationManagementSubmitSenderIDResponseStatusApproved VerificationManagementSubmitSenderIDResponseStatus = "approved"
VerificationManagementSubmitSenderIDResponseStatusPending VerificationManagementSubmitSenderIDResponseStatus = "pending"
VerificationManagementSubmitSenderIDResponseStatusRejected VerificationManagementSubmitSenderIDResponseStatus = "rejected"
)

func (r VerificationManagementSubmitSenderIDResponseStatus) IsKnown() bool {
switch r {
case VerificationManagementSubmitSenderIDResponseStatusApproved, VerificationManagementSubmitSenderIDResponseStatusPending, VerificationManagementSubmitSenderIDResponseStatusRejected:
return true
}
return false
}

type VerificationManagementSubmitSenderIDParams struct {
// The sender ID to add.
SenderID param.Field[string] `json:"sender_id,required"`
}

func (r VerificationManagementSubmitSenderIDParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
Loading