From 7bee8acc3b180baef177cda228dfe9b2c5ebfdca Mon Sep 17 00:00:00 2001 From: Silas Sewell Date: Tue, 11 Jun 2024 14:47:12 -0400 Subject: [PATCH] Update generated code --- adminapi/users.go | 26 +++++++++++++++++++++++++- internal/constants.go | 4 ++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/adminapi/users.go b/adminapi/users.go index a953e93..ccefbca 100644 --- a/adminapi/users.go +++ b/adminapi/users.go @@ -644,17 +644,38 @@ type UserCreatePortalSessionInput struct { // The portal URL, this is the target URL on the portal site. // // If not defined the root URL for the portal will be used. + // + // This does not need to be the full URL, you have the option + // of passing in a path instead (e.g. `/`). + // + // You also have the option of including the `{accountId}` + // string in the path/URL which will be replaced with either the + // UserHub user ID (if `organizationId` is not specified) + // or the UserHub organization ID (if specified). + // + // Examples: + // * `/{accountId}` - the billing dashboard + // * `/{accountId}/plans` - select a plan to checkout + // * `/{accountId}/checkout/` - checkout specified plan + // * `/{accountId}/members` - manage organization members + // * `/{accountId}/invite` - invite a user to an organization PortalUrl string // The URL the user should be sent to when they want to return to // the app (e.g. cancel checkout). // // If not defined the app URL will be used. ReturnUrl string - // The URl the user should be sent after they successfully complete + // The URL the user should be sent after they successfully complete // an action (e.g. checkout). // // If not defined the return URL will be used. SuccessUrl string + // The organization ID. + // + // When specified the `{accountId}` in the `portalUrl` will be + // replaced with the organization ID, otherwise the user ID + // will be used. + OrganizationId string } func (n *usersImpl) CreatePortalSession(ctx context.Context, userId string, input *UserCreatePortalSessionInput) (*adminv1.CreatePortalSessionResponse, error) { @@ -679,6 +700,9 @@ func (n *usersImpl) CreatePortalSession(ctx context.Context, userId string, inpu if !internal.IsEmpty(input.SuccessUrl) { body["successUrl"] = input.SuccessUrl } + if !internal.IsEmpty(input.OrganizationId) { + body["organizationId"] = input.OrganizationId + } } req.SetBody(body) diff --git a/internal/constants.go b/internal/constants.go index 679129b..e007814 100644 --- a/internal/constants.go +++ b/internal/constants.go @@ -8,8 +8,8 @@ import ( const ( ApiBaseUrl = "https://api.userhub.com" - UserAgent = "UserHub-Go/0.6.3" - Version = "0.6.3" + UserAgent = "UserHub-Go/0.6.4" + Version = "0.6.4" AuthHeader = "Authorization" ApiKeyHeader = "UserHub-Api-Key"