Skip to content

Commit f51a84f

Browse files
feat(api): api update
1 parent aac10e7 commit f51a84f

3 files changed

Lines changed: 25 additions & 37 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 21
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-d868ff00b7b07f6b6802b00f22fad531a91a76bb219a634f3f90fe488bd499ba.yml
3-
openapi_spec_hash: 20e9f2fc31feee78878cdf56e46dab60
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-78ef474b9e171a3eaa430a9dacdc2fa5c7f7d5f89147cb20573a355d3dbb9f0e.yml
3+
openapi_spec_hash: 11b6e43ef4ed724f9804c9d790a4faee
44
config_hash: 5509bb7a961ae2e79114b24c381606d4

inboundemail.go

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -67,26 +67,14 @@ func NewInboundEmailService(opts ...option.RequestOption) (r InboundEmailService
6767
}
6868

6969
// Create a dedicated inbound email address for collecting CAS statements via email
70-
// forwarding.
70+
// forwarding. When an investor forwards a CAS email to this address, we verify the
71+
// sender and make the file available to you.
7172
//
72-
// **How it works:**
73-
//
74-
// 1. Create an inbound email with your webhook URL
75-
// 2. Display the email address to your user (e.g., "Forward your CAS to
76-
// ie_xxx@import.casparser.in")
77-
// 3. When an investor forwards a CAS email, we verify the sender and deliver to
78-
// your webhook
79-
//
80-
// **Webhook Delivery:**
73+
// `callback_url` is **optional**:
8174
//
82-
// - We POST to your `callback_url` with JSON body containing files (matching
83-
// EmailCASFile schema)
84-
// - Failed deliveries are retried automatically with exponential backoff
85-
//
86-
// **Inactivity:**
87-
//
88-
// - Inbound emails with no activity in 30 days are marked inactive
89-
// - Active inbound emails remain operational indefinitely
75+
// - **Set it** — we POST each parsed email to your webhook as it arrives.
76+
// - **Omit it** — retrieve files via `GET /v4/inbound-email/{id}/files` without
77+
// building a webhook consumer.
9078
func (r *InboundEmailService) New(ctx context.Context, body InboundEmailNewParams, opts ...option.RequestOption) (res *InboundEmailNewResponse, err error) {
9179
opts = slices.Concat(r.Options, opts)
9280
path := "v4/inbound-email"
@@ -136,8 +124,9 @@ type InboundEmailNewResponse struct {
136124
//
137125
// Any of "cdsl", "nsdl", "cams", "kfintech".
138126
AllowedSources []string `json:"allowed_sources"`
139-
// Webhook URL for email notifications
140-
CallbackURL string `json:"callback_url" format:"uri"`
127+
// Webhook URL for email notifications. `null` means files are only retrievable via
128+
// `GET /v4/inbound-email/{id}/files` (pull delivery).
129+
CallbackURL string `json:"callback_url" api:"nullable" format:"uri"`
141130
// When the mailbox was created
142131
CreatedAt time.Time `json:"created_at" format:"date-time"`
143132
// The inbound email address to forward CAS statements to
@@ -190,8 +179,9 @@ type InboundEmailGetResponse struct {
190179
//
191180
// Any of "cdsl", "nsdl", "cams", "kfintech".
192181
AllowedSources []string `json:"allowed_sources"`
193-
// Webhook URL for email notifications
194-
CallbackURL string `json:"callback_url" format:"uri"`
182+
// Webhook URL for email notifications. `null` means files are only retrievable via
183+
// `GET /v4/inbound-email/{id}/files` (pull delivery).
184+
CallbackURL string `json:"callback_url" api:"nullable" format:"uri"`
195185
// When the mailbox was created
196186
CreatedAt time.Time `json:"created_at" format:"date-time"`
197187
// The inbound email address to forward CAS statements to
@@ -269,8 +259,9 @@ type InboundEmailListResponseInboundEmail struct {
269259
//
270260
// Any of "cdsl", "nsdl", "cams", "kfintech".
271261
AllowedSources []string `json:"allowed_sources"`
272-
// Webhook URL for email notifications
273-
CallbackURL string `json:"callback_url" format:"uri"`
262+
// Webhook URL for email notifications. `null` means files are only retrievable via
263+
// `GET /v4/inbound-email/{id}/files` (pull delivery).
264+
CallbackURL string `json:"callback_url" api:"nullable" format:"uri"`
274265
// When the mailbox was created
275266
CreatedAt time.Time `json:"created_at" format:"date-time"`
276267
// The inbound email address to forward CAS statements to
@@ -328,16 +319,13 @@ func (r *InboundEmailDeleteResponse) UnmarshalJSON(data []byte) error {
328319
}
329320

330321
type InboundEmailNewParams struct {
331-
// Webhook URL where we POST email notifications. Must be HTTPS in production (HTTP
332-
// allowed for localhost during development).
333-
CallbackURL string `json:"callback_url" api:"required" format:"uri"`
334-
// Optional custom email prefix for user-friendly addresses.
335-
//
336-
// - Must be 3-32 characters
337-
// - Alphanumeric + hyphens only
338-
// - Must start and end with letter/number
339-
// - Example: `john-portfolio@import.casparser.in`
340-
// - If omitted, generates random ID like `ie_abc123xyz@import.casparser.in`
322+
// Optional webhook URL where we POST parsed emails. Must be HTTPS in production
323+
// (HTTP allowed for localhost). If omitted, retrieve files via
324+
// `GET /v4/inbound-email/{id}/files`.
325+
CallbackURL param.Opt[string] `json:"callback_url,omitzero" format:"uri"`
326+
// Optional custom email prefix (e.g. `john-portfolio@import.casparser.in`). 3-32
327+
// chars, alphanumeric + hyphens, must start/end with a letter or number. If
328+
// omitted, a random ID is generated.
341329
Alias param.Opt[string] `json:"alias,omitzero"`
342330
// Your internal identifier (e.g., user_id, account_id). Returned in webhook
343331
// payload for correlation.

inboundemail_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ func TestInboundEmailNewWithOptionalParams(t *testing.T) {
2727
option.WithAPIKey("My API Key"),
2828
)
2929
_, err := client.InboundEmail.New(context.TODO(), casparser.InboundEmailNewParams{
30-
CallbackURL: "https://api.yourapp.com/webhooks/cas-email",
3130
Alias: casparser.String("john-portfolio"),
3231
AllowedSources: []string{"cdsl", "nsdl"},
32+
CallbackURL: casparser.String("https://api.yourapp.com/webhooks/cas-email"),
3333
Metadata: map[string]string{
3434
"plan": "premium",
3535
"source": "onboarding",

0 commit comments

Comments
 (0)