Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go: Pull in some generated code #1631

Merged
merged 1 commit into from
Jan 10, 2025
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
57 changes: 42 additions & 15 deletions go/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,52 +19,68 @@ type ApplicationListOptions struct {
Order *Ordering
}

func (a *Application) List(
// List of all the organization's applications.
func (application *Application) List(
ctx context.Context,
options *ApplicationListOptions,
) (*ListResponseApplicationOut, error) {
req := a.api.ApplicationAPI.V1ApplicationList(ctx)
req := application.api.ApplicationAPI.V1ApplicationList(
ctx,
)

if options != nil {
if options.Iterator != nil {
req = req.Iterator(*options.Iterator)
}
if options.Limit != nil {
req = req.Limit(*options.Limit)
}
if options.Iterator != nil {
req = req.Iterator(*options.Iterator)
}
if options.Order != nil {
req = req.Order(*options.Order)
}
}

ret, res, err := req.Execute()
if err != nil {
return nil, wrapError(err, res)
}

return ret, nil
}

func (a *Application) Create(
// Create a new application.
func (application *Application) Create(
ctx context.Context,
applicationIn *ApplicationIn,
) (*ApplicationOut, error) {
return a.CreateWithOptions(ctx, applicationIn, nil)
return application.CreateWithOptions(
ctx,
applicationIn,
nil,
)
}

func (a *Application) CreateWithOptions(
// Create a new application.
func (application *Application) CreateWithOptions(
ctx context.Context,
applicationIn *ApplicationIn,
options *PostOptions,
) (*ApplicationOut, error) {
req := a.api.ApplicationAPI.V1ApplicationCreate(ctx)
req = req.ApplicationIn(*applicationIn)
req := application.api.ApplicationAPI.V1ApplicationCreate(
ctx,
).ApplicationIn(*applicationIn)

if options != nil {
if options.IdempotencyKey != nil {
req = req.IdempotencyKey(*options.IdempotencyKey)
}
}

ret, res, err := req.Execute()
if err != nil {
return nil, wrapError(err, res)
}

return ret, nil
}

Expand Down Expand Up @@ -95,29 +111,40 @@ func (a *Application) GetOrCreateWithOptions(
return ret, nil
}

func (a *Application) Get(
// Get an application.
func (application *Application) Get(
ctx context.Context,
appId string,
) (*ApplicationOut, error) {
req := a.api.ApplicationAPI.V1ApplicationGet(ctx, appId)
req := application.api.ApplicationAPI.V1ApplicationGet(
ctx,
appId,
)

ret, res, err := req.Execute()
if err != nil {
return nil, wrapError(err, res)
}

return ret, nil
}

func (a *Application) Update(
// Update an application.
func (application *Application) Update(
ctx context.Context,
appId string,
applicationIn *ApplicationIn,
) (*ApplicationOut, error) {
req := a.api.ApplicationAPI.V1ApplicationUpdate(ctx, appId)
req = req.ApplicationIn(*applicationIn)
req := application.api.ApplicationAPI.V1ApplicationUpdate(
ctx,
appId,
).ApplicationIn(*applicationIn)

ret, res, err := req.Execute()
if err != nil {
return nil, wrapError(err, res)
}

return ret, nil
}

Expand Down
67 changes: 54 additions & 13 deletions go/authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,75 +10,116 @@ type Authentication struct {
api *openapi.APIClient
}

func (a *Authentication) AppPortalAccess(
// Use this function to get magic links (and authentication codes) for connecting your users to the Consumer Application Portal.
func (authentication *Authentication) AppPortalAccess(
ctx context.Context,
appId string,
appPortalAccessIn *AppPortalAccessIn,
) (*AppPortalAccessOut, error) {
return a.AppPortalAccessWithOptions(ctx, appId, appPortalAccessIn, nil)
return authentication.AppPortalAccessWithOptions(
ctx,
appId,
appPortalAccessIn,
nil,
)
}

func (a *Authentication) AppPortalAccessWithOptions(
// Use this function to get magic links (and authentication codes) for connecting your users to the Consumer Application Portal.
func (authentication *Authentication) AppPortalAccessWithOptions(
ctx context.Context,
appId string,
appPortalAccessIn *AppPortalAccessIn,
options *PostOptions,
) (*AppPortalAccessOut, error) {
req := a.api.AuthenticationAPI.V1AuthenticationAppPortalAccess(ctx, appId)
req = req.AppPortalAccessIn(*appPortalAccessIn)
req := authentication.api.AuthenticationAPI.V1AuthenticationAppPortalAccess(
ctx,
appId,
).AppPortalAccessIn(*appPortalAccessIn)

if options != nil {
if options.IdempotencyKey != nil {
req = req.IdempotencyKey(*options.IdempotencyKey)
}
}

ret, res, err := req.Execute()
if err != nil {
return nil, wrapError(err, res)
}

return ret, nil
}

func (a *Authentication) DashboardAccess(
// DEPRECATED: Please use `app-portal-access` instead.
//
// Use this function to get magic links (and authentication codes) for connecting your users to the Consumer Application Portal.
func (authentication *Authentication) DashboardAccess(
ctx context.Context,
appId string,
) (*DashboardAccessOut, error) {
return a.DashboardAccessWithOptions(ctx, appId, nil)
return authentication.DashboardAccessWithOptions(
ctx,
appId,
nil,
)
}

func (a *Authentication) DashboardAccessWithOptions(
// DEPRECATED: Please use `app-portal-access` instead.
//
// Use this function to get magic links (and authentication codes) for connecting your users to the Consumer Application Portal.
func (authentication *Authentication) DashboardAccessWithOptions(
ctx context.Context,
appId string,
options *PostOptions,
) (*DashboardAccessOut, error) {
req := a.api.AuthenticationAPI.V1AuthenticationDashboardAccess(ctx, appId)
req := authentication.api.AuthenticationAPI.V1AuthenticationDashboardAccess(
ctx,
appId,
)

if options != nil {
if options.IdempotencyKey != nil {
req = req.IdempotencyKey(*options.IdempotencyKey)
}
}

ret, res, err := req.Execute()
if err != nil {
return nil, wrapError(err, res)
}

return ret, nil
}

func (a *Authentication) Logout(
// Logout an app token.
//
// Trying to log out other tokens will fail.
func (authentication *Authentication) Logout(
ctx context.Context,
) error {
return a.LogoutWithOptions(ctx, nil)
return authentication.LogoutWithOptions(
ctx,
nil,
)
}

func (a *Authentication) LogoutWithOptions(
// Logout an app token.
//
// Trying to log out other tokens will fail.
func (authentication *Authentication) LogoutWithOptions(
ctx context.Context,
options *PostOptions,
) error {
req := a.api.AuthenticationAPI.V1AuthenticationLogout(ctx)
req := authentication.api.AuthenticationAPI.V1AuthenticationLogout(
ctx,
)

if options != nil {
if options.IdempotencyKey != nil {
req = req.IdempotencyKey(*options.IdempotencyKey)
}
}

res, err := req.Execute()
return wrapError(err, res)
}
Loading