diff --git a/commerce.go b/commerce.go index 54e4b36..6373107 100644 --- a/commerce.go +++ b/commerce.go @@ -12,16 +12,16 @@ type CreateProductParams struct { Name string `json:"name"` Slug string `json:"slug"` Currency string `json:"currency"` - SubscriberType []string `json:"subscriber_type"` + PayerType []string `json:"payer_type"` OwnerEntityType string `json:"owner_entity_type"` } type UpdateProductParams struct { APIParams - Name *string `json:"name,omitempty"` - Slug *string `json:"slug,omitempty"` - Currency *string `json:"currency,omitempty"` - SubscriberType *[]string `json:"subscriber_type,omitempty"` + Name *string `json:"name,omitempty"` + Slug *string `json:"slug,omitempty"` + Currency *string `json:"currency,omitempty"` + PayerType *[]string `json:"payer_type,omitempty"` } type GetProductByIDParams struct { @@ -36,10 +36,10 @@ type CommerceProduct struct { Slug string `json:"slug"` Currency string `json:"currency"` Plans []*CommercePlan `json:"plans"` - SubscriberType []string `json:"subscriber_type"` + PayerType []string `json:"payer_type"` OwnerEntityType string `json:"owner_entity_type"` - CreatedAt string `json:"created_at"` - UpdatedAt string `json:"updated_at"` + CreatedAt int64 `json:"created_at"` + UpdatedAt int64 `json:"updated_at"` } type CommerceProductWithPlans struct { @@ -62,10 +62,20 @@ type CommerceFeatureUnitPricing struct { Qty int `json:"qty"` } +type CommercePlanFeature struct { + APIResource + ID string `json:"id"` + PlanID string `json:"plan_id"` + FeatureID string `json:"feature_id"` + CreatedAt int64 `json:"created_at"` + UpdatedAt int64 `json:"updated_at"` +} + +type CommercePlanFeatureList PaginatedList[CommercePlanFeature] + type CommerceFeature struct { APIResource ID string `json:"id"` - PlanID string `json:"plan_id"` Name string `json:"name"` Description string `json:"description"` AvatarURL string `json:"avatar_url"` @@ -82,17 +92,34 @@ type CommerceFeature struct { HasTrialUnits bool `json:"has_trial_units"` TrialUnits int `json:"trial_units"` UnitPricing []CommerceFeatureUnitPricing `json:"unit_pricing"` - CreatedAt string `json:"created_at"` - UpdatedAt string `json:"updated_at"` + CreatedAt int64 `json:"created_at"` + UpdatedAt int64 `json:"updated_at"` } type CommerceFeatureList PaginatedList[CommerceFeature] +type CreatePlanFeatureParams struct { + APIParams + PlanID string `json:"plan_id"` + FeatureID string `json:"feature_id"` +} + +type CreateMultiplePlanFeaturesParams struct { + APIParams + PlanID string `json:"plan_id"` + FeatureIDs []string `json:"feature_ids"` +} + +type DeletePlanFeaturesParams struct { + APIParams + FeatureIDs []string `json:"feature_ids"` + PlanID string `json:"plan_id"` +} + type CreateFeatureParams struct { APIParams Name string `json:"name"` Description string `json:"description"` - PlanID string `json:"plan_id"` AvatarURL string `json:"avatar_url"` Slug string `json:"slug"` PubliclyVisible bool `json:"publicly_visible"` @@ -108,6 +135,11 @@ type CreateFeatureParams struct { UnitPricing []CommerceFeatureUnitPricing `json:"unit_pricing"` } +type CreateMultipleFeaturesParams struct { + APIParams + Features []CreateFeatureParams `json:"features"` +} + type UpdateFeatureParams struct { APIParams ID string `json:"id"` @@ -144,9 +176,11 @@ type CreatePlanParams struct { APIParams Name string `json:"name"` ProductID string `json:"product_id"` + Slug string `json:"slug"` Amount int64 `json:"amount"` IsRecurring bool `json:"is_recurring"` IsProrated bool `json:"is_prorated"` + IsFree bool `json:"is_free"` Period string `json:"period"` Interval int `json:"interval"` AvatarURL string `json:"avatar_url"` @@ -158,8 +192,11 @@ type UpdatePlanParams struct { ID string `json:"id"` Name *string `json:"name,omitempty"` Amount *int64 `json:"amount,omitempty"` + Slug *string `json:"slug,omitempty"` IsRecurring *bool `json:"is_recurring,omitempty"` + Description *string `json:"description,omitempty"` IsProrated *bool `json:"is_prorated,omitempty"` + IsFree bool `json:"is_free"` Period *string `json:"period,omitempty"` Interval *int `json:"interval,omitempty"` AvatarURL *string `json:"avatar_url,omitempty"` @@ -172,22 +209,25 @@ type GetPlanByIDParams struct { type CommercePlan struct { APIResource - ID string `json:"id"` - Name string `json:"name"` - Product *CommerceProduct `json:"product,omitempty"` - Amount int64 `json:"amount"` - IsRecurring bool `json:"is_recurring"` - IsProrated bool `json:"is_prorated"` - Period string `json:"period"` - Interval int `json:"interval"` - AvatarURL string `json:"avatar_url"` - ProductID string `json:"product_id"` - Description string `json:"description"` - Slug string `json:"slug"` - BillingCycles *int `json:"billing_cycles,omitempty"` - SubscriberCount int64 `json:"subscriber_count"` - CreatedAt string `json:"created_at"` - UpdatedAt string `json:"updated_at"` + ID string `json:"id"` + Name string `json:"name"` + Product *CommerceProduct `json:"product,omitempty"` + Amount int64 `json:"amount"` + IsRecurring bool `json:"is_recurring"` + IsProrated bool `json:"is_prorated"` + IsFree bool `json:"is_free"` + IsDefault bool `json:"is_default"` + Period string `json:"period"` + Interval int `json:"interval"` + AvatarURL string `json:"avatar_url"` + ProductID string `json:"product_id"` + Description string `json:"description"` + Slug string `json:"slug"` + BillingCycles *int `json:"billing_cycles,omitempty"` + PayerCount int64 `json:"payer_count"` + CreatedAt int64 `json:"created_at"` + UpdatedAt int64 `json:"updated_at"` + Features []CommerceFeature `json:"features"` } type CommercePlanWithNoProduct struct { @@ -205,7 +245,7 @@ type ListPlansByInstanceIDParams struct { type CreateSubscriptionParams struct { APIParams - CustomerID string `json:"customer_id"` + PayerID string `json:"payer_id"` PlanID string `json:"plan_id"` PaymentSourceID string `json:"payment_source_id"` } @@ -222,24 +262,24 @@ type GetSubscriptionByIDParams struct { type ListSubscriptionsByUserIDParams struct { APIParams - ID string `json:"id"` - SubscriberType string `json:"subscriber_type"` + ID string `json:"id"` + PayerType string `json:"payer_type"` } type CommerceSubscription struct { APIResource - ID string `json:"id"` - AppID string `json:"app_id"` - Customer *CommerceCustomer `json:"customer,omitempty"` - InstanceID string `json:"instance_id"` - PaymentSourceID string `json:"payment_source_id"` - PlanID string `json:"plan_id"` - Plan *CommercePlan `json:"plan,omitempty"` - Status string `json:"status"` - LastInvoice *CommerceInvoice `json:"last_invoice,omitempty"` - NextInvoice *CommerceInvoice `json:"next_invoice,omitempty"` - CreatedAt string `json:"created_at"` // ISO 8601 format - UpdatedAt string `json:"updated_at"` // ISO 8601 format + ID string `json:"id"` + AppID string `json:"app_id"` + Payer *CommercePayer `json:"payer,omitempty"` + InstanceID string `json:"instance_id"` + PaymentSourceID string `json:"payment_source_id"` + PlanID string `json:"plan_id"` + Plan *CommercePlan `json:"plan,omitempty"` + Status string `json:"status"` + LastInvoice *CommerceInvoice `json:"last_invoice,omitempty"` + NextInvoice *CommerceInvoice `json:"next_invoice,omitempty"` + CreatedAt int64 `json:"created_at"` // ISO 8601 format + UpdatedAt int64 `json:"updated_at"` // ISO 8601 format } type ListCommerceSubscriptionsResponse struct { @@ -247,6 +287,31 @@ type ListCommerceSubscriptionsResponse struct { PaginatedList[CommerceSubscription] } +type CreatePaymentSourceParams struct { + APIParams + PayerID string `json:"payer_id"` + Gateway string `json:"gateway"` + PayeeID string `json:"payee_id"` + ExternalID string `json:"external_id"` + Last4 string `json:"last4"` + CardType string `json:"card_type"` +} + +type CommercePaymentSource struct { + APIResource + ID string `json:"id"` + PayerID string `json:"payer_id"` + Gateway string `json:"gateway"` + PayeeID string `json:"payee_id"` + ExternalID string `json:"external_id"` + CardType string `json:"card_type"` + LastFour string `json:"last4"` + CreatedAt int64 `json:"created_at"` + UpdatedAt int64 `json:"updated_at"` +} + +type CommercePaymentSourceList PaginatedList[CommercePaymentSource] + // --- Subscription Types --- type GetSubscriptionParams struct { @@ -254,20 +319,30 @@ type GetSubscriptionParams struct { ID string `json:"id"` } -type ListSubscribersParams struct { +type ListPayersParams struct { APIParams InstanceID string `json:"instance_id"` } -type CommerceSubscriber struct { +type CommercePayer struct { + APIResource ID string `json:"id"` Name string `json:"name"` Email string `json:"email"` } -type ListCommerceSubscribersResponse struct { +type CommercePayerList PaginatedList[CommercePayer] + +type CreatePayerParams struct { + APIParams + InstanceID string `json:"instance_id"` + Name string `json:"name"` + Email string `json:"email"` +} + +type ListCommercePayersResponse struct { APIResource - PaginatedList[CommerceSubscriber] + PaginatedList[CommercePayer] } // Supporting structs for emails @@ -304,13 +379,18 @@ type ListCommercePaymentAttemptsResponse struct { PaginatedList[CommercePaymentAttempt] } -// --- Customer Types --- +// --- Payee Types --- + +type CommercePayee struct { + APIResource -type CommerceCustomer struct { - ID string `json:"id"` - AppID string `json:"app_id"` - Entity *struct { - ID string `json:"id"` - Name string `json:"name"` - } `json:"entity"` + ID string `json:"id"` + GatewayStatus string `json:"gateway_status"` + GatewayType string `json:"gateway_type"` + StripeURL string `json:"stripe_url"` + StripeID string `json:"stripe_id"` + CreatedAt int64 `json:"created_at"` + UpdatedAt int64 `json:"updated_at"` } + +type CommercePayeeList PaginatedList[CommercePayee] diff --git a/commerce/features/api.go b/commerce/features/api.go index 473a96a..93b38ac 100644 --- a/commerce/features/api.go +++ b/commerce/features/api.go @@ -12,6 +12,14 @@ func Create(ctx context.Context, params *clerk.CreateFeatureParams) (*clerk.Comm return getClient().Create(ctx, params) } +func CreatePlanFeatures(ctx context.Context, params *clerk.CreateMultiplePlanFeaturesParams) (*clerk.CommercePlanFeatureList, error) { + return getClient().CreatePlanFeatures(ctx, params) +} + +func DeletePlanFeatures(ctx context.Context, params *clerk.DeletePlanFeaturesParams) (*clerk.DeletedResource, error) { + return getClient().DeletePlanFeatures(ctx, params) +} + func List(ctx context.Context, params *clerk.ListFeaturesByInstanceIDParams) (*clerk.CommerceFeatureList, error) { return getClient().List(ctx, params) } diff --git a/commerce/features/client.go b/commerce/features/client.go index 4fb60b5..58e88a9 100644 --- a/commerce/features/client.go +++ b/commerce/features/client.go @@ -24,7 +24,7 @@ func NewClient(config *clerk.ClientConfig) *Client { } func (c *Client) Create(ctx context.Context, params *clerk.CreateFeatureParams) (*clerk.CommerceFeature, error) { - reqPath, err := clerk.JoinPath(rootPath, "plans", params.PlanID, path) + reqPath, err := clerk.JoinPath(rootPath, path) if err != nil { return nil, err } @@ -35,6 +35,30 @@ func (c *Client) Create(ctx context.Context, params *clerk.CreateFeatureParams) return resource, err } +func (c *Client) CreatePlanFeatures(ctx context.Context, params *clerk.CreateMultiplePlanFeaturesParams) (*clerk.CommercePlanFeatureList, error) { + reqPath, err := clerk.JoinPath(rootPath, "plans", params.PlanID, path) + if err != nil { + return nil, err + } + req := clerk.NewAPIRequest(http.MethodPost, reqPath) + req.SetParams(params) + resource := &clerk.CommercePlanFeatureList{} + err = c.Backend.Call(ctx, req, resource) + return resource, err +} + +func (c *Client) DeletePlanFeatures(ctx context.Context, params *clerk.DeletePlanFeaturesParams) (*clerk.DeletedResource, error) { + reqPath, err := clerk.JoinPath(rootPath, "plans", params.PlanID, path) + if err != nil { + return nil, err + } + req := clerk.NewAPIRequest(http.MethodDelete, reqPath) + req.SetParams(params) + resource := &clerk.DeletedResource{} + err = c.Backend.Call(ctx, req, resource) + return resource, err +} + func (c *Client) List(ctx context.Context, params *clerk.ListFeaturesByInstanceIDParams) (*clerk.CommerceFeatureList, error) { reqPath, err := clerk.JoinPath(rootPath, path) if err != nil { diff --git a/commerce/payees/api.go b/commerce/payees/api.go new file mode 100644 index 0000000..0be56a0 --- /dev/null +++ b/commerce/payees/api.go @@ -0,0 +1,31 @@ +// Code generated by "gen"; DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. +package payees + +import ( + "context" + + "github.com/clerk/clerk-sdk-go/v2" +) + +func Create(ctx context.Context, params *CreateParams) (*clerk.CommercePayee, error) { + return getClient().Create(ctx, params) +} + +func List(ctx context.Context, params *ListParams) (*clerk.CommercePayeeList, error) { + return getClient().List(ctx, params) +} + +func Get(ctx context.Context, id string) (*clerk.CommercePayee, error) { + return getClient().Get(ctx, id) +} + +func Update(ctx context.Context, id string, params *UpdateParams) (*clerk.CommercePayee, error) { + return getClient().Update(ctx, id, params) +} + +func getClient() *Client { + return &Client{ + Backend: clerk.GetBackend(), + } +} diff --git a/commerce/payees/client.go b/commerce/payees/client.go new file mode 100644 index 0000000..f45e88c --- /dev/null +++ b/commerce/payees/client.go @@ -0,0 +1,84 @@ +package payees + +import ( + "context" + "net/http" + + "github.com/clerk/clerk-sdk-go/v2" +) + +//go:generate go run ../../cmd/gen/main.go +const ( + rootPath = "/commerce" + path = "/payees" +) + +type CreateParams struct { + clerk.APIParams + GatewayType string `json:"gateway_type" form:"gateway_type"` + Email string `json:"email" form:"email"` +} + +type UpdateParams struct { + clerk.APIParams +} + +type ListParams struct { + clerk.APIParams +} + +type Client struct { + Backend clerk.Backend +} + +func NewClient(config *clerk.ClientConfig) *Client { + return &Client{ + Backend: clerk.NewBackend(&config.BackendConfig), + } +} + +func (c *Client) Create(ctx context.Context, params *CreateParams) (*clerk.CommercePayee, error) { + reqPath, err := clerk.JoinPath(rootPath, path) + if err != nil { + return nil, err + } + req := clerk.NewAPIRequest(http.MethodPost, reqPath) + req.SetParams(params) + resource := &clerk.CommercePayee{} + err = c.Backend.Call(ctx, req, resource) + return resource, err +} + +func (c *Client) List(ctx context.Context, params *ListParams) (*clerk.CommercePayeeList, error) { + reqPath, err := clerk.JoinPath(rootPath, path) + if err != nil { + return nil, err + } + req := clerk.NewAPIRequest(http.MethodGet, reqPath) + resource := &clerk.CommercePayeeList{} + err = c.Backend.Call(ctx, req, resource) + return resource, err +} + +func (c *Client) Get(ctx context.Context, id string) (*clerk.CommercePayee, error) { + reqPath, err := clerk.JoinPath(rootPath, path, id) + if err != nil { + return nil, err + } + req := clerk.NewAPIRequest(http.MethodGet, reqPath) + resource := &clerk.CommercePayee{} + err = c.Backend.Call(ctx, req, resource) + return resource, err +} + +func (c *Client) Update(ctx context.Context, id string, params *UpdateParams) (*clerk.CommercePayee, error) { + reqPath, err := clerk.JoinPath(rootPath, path, id) + if err != nil { + return nil, err + } + req := clerk.NewAPIRequest(http.MethodPut, reqPath) + req.SetParams(params) + resource := &clerk.CommercePayee{} + err = c.Backend.Call(ctx, req, resource) + return resource, err +} diff --git a/commerce/payers/api.go b/commerce/payers/api.go new file mode 100644 index 0000000..06abd17 --- /dev/null +++ b/commerce/payers/api.go @@ -0,0 +1,31 @@ +// Code generated by "gen"; DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. +package payers + +import ( + "context" + + "github.com/clerk/clerk-sdk-go/v2" +) + +func Create(ctx context.Context, params *CreateParams) (*clerk.CommercePayer, error) { + return getClient().Create(ctx, params) +} + +func List(ctx context.Context, params *ListParams) (*clerk.CommercePayerList, error) { + return getClient().List(ctx, params) +} + +func Get(ctx context.Context, id string) (*clerk.CommercePayer, error) { + return getClient().Get(ctx, id) +} + +func Update(ctx context.Context, id string, params *UpdateParams) (*clerk.CommercePayer, error) { + return getClient().Update(ctx, id, params) +} + +func getClient() *Client { + return &Client{ + Backend: clerk.GetBackend(), + } +} diff --git a/commerce/payers/client.go b/commerce/payers/client.go new file mode 100644 index 0000000..a7a5922 --- /dev/null +++ b/commerce/payers/client.go @@ -0,0 +1,85 @@ +package payers + +import ( + "context" + "net/http" + + "github.com/clerk/clerk-sdk-go/v2" +) + +//go:generate go run ../../cmd/gen/main.go +const ( + rootPath = "/commerce" + path = "/payers" +) + +type CreateParams struct { + clerk.APIParams + Name string `json:"name" form:"name"` + Email string `json:"email" form:"email"` + UserID string `json:"user_id" form:"user_id"` +} + +type UpdateParams struct { + clerk.APIParams +} + +type ListParams struct { + clerk.APIParams +} + +type Client struct { + Backend clerk.Backend +} + +func NewClient(config *clerk.ClientConfig) *Client { + return &Client{ + Backend: clerk.NewBackend(&config.BackendConfig), + } +} + +func (c *Client) Create(ctx context.Context, params *CreateParams) (*clerk.CommercePayer, error) { + reqPath, err := clerk.JoinPath(rootPath, path) + if err != nil { + return nil, err + } + req := clerk.NewAPIRequest(http.MethodPost, reqPath) + req.SetParams(params) + resource := &clerk.CommercePayer{} + err = c.Backend.Call(ctx, req, resource) + return resource, err +} + +func (c *Client) List(ctx context.Context, params *ListParams) (*clerk.CommercePayerList, error) { + reqPath, err := clerk.JoinPath(rootPath, path) + if err != nil { + return nil, err + } + req := clerk.NewAPIRequest(http.MethodGet, reqPath) + resource := &clerk.CommercePayerList{} + err = c.Backend.Call(ctx, req, resource) + return resource, err +} + +func (c *Client) Get(ctx context.Context, id string) (*clerk.CommercePayer, error) { + reqPath, err := clerk.JoinPath(rootPath, path, id) + if err != nil { + return nil, err + } + req := clerk.NewAPIRequest(http.MethodGet, reqPath) + resource := &clerk.CommercePayer{} + err = c.Backend.Call(ctx, req, resource) + return resource, err +} + +func (c *Client) Update(ctx context.Context, id string, params *UpdateParams) (*clerk.CommercePayer, error) { + reqPath, err := clerk.JoinPath(rootPath, path, id) + if err != nil { + return nil, err + } + req := clerk.NewAPIRequest(http.MethodPut, reqPath) + req.SetParams(params) + resource := &clerk.CommercePayer{} + err = c.Backend.Call(ctx, req, resource) + return resource, err +} diff --git a/commerce/paymentsources/api.go b/commerce/paymentsources/api.go new file mode 100644 index 0000000..18c4f57 --- /dev/null +++ b/commerce/paymentsources/api.go @@ -0,0 +1,31 @@ +// Code generated by "gen"; DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. +package paymentsources + +import ( + "context" + + "github.com/clerk/clerk-sdk-go/v2" +) + +func Create(ctx context.Context, params *CreateParams) (*clerk.CommercePaymentSource, error) { + return getClient().Create(ctx, params) +} + +func List(ctx context.Context, params *ListParams) (*clerk.CommercePaymentSourceList, error) { + return getClient().List(ctx, params) +} + +func Get(ctx context.Context, id string) (*clerk.CommercePaymentSource, error) { + return getClient().Get(ctx, id) +} + +func Update(ctx context.Context, id string, params *UpdateParams) (*clerk.CommercePaymentSource, error) { + return getClient().Update(ctx, id, params) +} + +func getClient() *Client { + return &Client{ + Backend: clerk.GetBackend(), + } +} diff --git a/commerce/paymentsources/client.go b/commerce/paymentsources/client.go new file mode 100644 index 0000000..05242e2 --- /dev/null +++ b/commerce/paymentsources/client.go @@ -0,0 +1,85 @@ +package paymentsources + +import ( + "context" + "net/http" + + "github.com/clerk/clerk-sdk-go/v2" +) + +//go:generate go run ../../cmd/gen/main.go +const ( + rootPath = "/commerce" + path = "/payment_sources" +) + +type CreateParams struct { + clerk.APIParams + PayerID string `json:"payer_id"` + PayeeID string `json:"payee_id"` + Gateway string `json:"gateway"` +} + +type UpdateParams struct { + clerk.APIParams +} + +type ListParams struct { + clerk.APIParams +} + +type Client struct { + Backend clerk.Backend +} + +func NewClient(config *clerk.ClientConfig) *Client { + return &Client{ + Backend: clerk.NewBackend(&config.BackendConfig), + } +} + +func (c *Client) Create(ctx context.Context, params *CreateParams) (*clerk.CommercePaymentSource, error) { + reqPath, err := clerk.JoinPath(rootPath, path) + if err != nil { + return nil, err + } + req := clerk.NewAPIRequest(http.MethodPost, reqPath) + req.SetParams(params) + resource := &clerk.CommercePaymentSource{} + err = c.Backend.Call(ctx, req, resource) + return resource, err +} + +func (c *Client) List(ctx context.Context, params *ListParams) (*clerk.CommercePaymentSourceList, error) { + reqPath, err := clerk.JoinPath(rootPath, path) + if err != nil { + return nil, err + } + req := clerk.NewAPIRequest(http.MethodGet, reqPath) + resource := &clerk.CommercePaymentSourceList{} + err = c.Backend.Call(ctx, req, resource) + return resource, err +} + +func (c *Client) Get(ctx context.Context, id string) (*clerk.CommercePaymentSource, error) { + reqPath, err := clerk.JoinPath(rootPath, path, id) + if err != nil { + return nil, err + } + req := clerk.NewAPIRequest(http.MethodGet, reqPath) + resource := &clerk.CommercePaymentSource{} + err = c.Backend.Call(ctx, req, resource) + return resource, err +} + +func (c *Client) Update(ctx context.Context, id string, params *UpdateParams) (*clerk.CommercePaymentSource, error) { + reqPath, err := clerk.JoinPath(rootPath, path, id) + if err != nil { + return nil, err + } + req := clerk.NewAPIRequest(http.MethodPut, reqPath) + req.SetParams(params) + resource := &clerk.CommercePaymentSource{} + err = c.Backend.Call(ctx, req, resource) + return resource, err +} diff --git a/commerce/subscriptions/client.go b/commerce/subscriptions/client.go index e9e2458..26f02f3 100644 --- a/commerce/subscriptions/client.go +++ b/commerce/subscriptions/client.go @@ -73,7 +73,7 @@ func (c *Client) ListInvoices(ctx context.Context, subscriptionID string) (*cler } func (c *Client) ListByUserID(ctx context.Context, params *clerk.ListSubscriptionsByUserIDParams) (*clerk.ListCommerceSubscriptionsResponse, error) { - reqPath, err := clerk.JoinPath(rootPath, "subscribers", params.SubscriberType, params.ID, "subscriptions") + reqPath, err := clerk.JoinPath(rootPath, "subscribers", params.PayerType, params.ID, "subscriptions") if err != nil { return nil, err } diff --git a/organization/api.go b/organization/api.go index fa94275..f88096c 100644 --- a/organization/api.go +++ b/organization/api.go @@ -19,6 +19,12 @@ func Get(ctx context.Context, idOrSlug string) (*clerk.Organization, error) { return getClient().Get(ctx, idOrSlug) } +// GetWithParams retrieves details for an organization. +// The organization can be fetched by either the ID or its slug. +func GetWithParams(ctx context.Context, idOrSlug string, params *GetParams) (*clerk.Organization, error) { + return getClient().GetWithParams(ctx, idOrSlug, params) +} + // Update updates an organization. func Update(ctx context.Context, id string, params *UpdateParams) (*clerk.Organization, error) { return getClient().Update(ctx, id, params)