// Code generated by oagen. DO NOT EDIT.

package workos

import (
	
)

// AdminPortalService handles AdminPortal operations.
type AdminPortalService struct {
	client *Client
}

// AdminPortalGenerateLinkParams contains the parameters for GenerateLink.
type AdminPortalGenerateLinkParams struct {
	// ReturnURL is the URL to go to when an admin clicks on your logo in the Admin Portal. If not specified, the return URL configured on the [Admin Portal](https://dashboard.workos.com/admin-portal) page will be used.
	ReturnURL *string `json:"return_url,omitempty" url:"-"`
	// SuccessURL is the URL to redirect the admin to when they finish setup. If not specified, the success URL configured on the [Admin Portal](https://dashboard.workos.com/admin-portal) page will be used.
	SuccessURL *string `json:"success_url,omitempty" url:"-"`
	// Organization is an [Organization](https://workos.com/docs/reference/organization) identifier.
	Organization string `json:"organization" url:"-"`
	// ExternalUserID is the ID of the user in your application the link is generated for. The link and any Admin Portal sessions started from it can later be revoked by this ID, for example when that user is deprovisioned from your application.
	ExternalUserID *string `json:"external_user_id,omitempty" url:"-"`
	// Intent is       The intent of the Admin Portal.
	// - `sso` - Launch Admin Portal for creating SSO connections
	// - `dsync` - Launch Admin Portal for creating Directory Sync connections
	// - `audit_logs` - Launch Admin Portal for viewing Audit Logs
	// - `log_streams` - Launch Admin Portal for creating Log Streams
	// - `domain_verification` - Launch Admin Portal for Domain Verification
	// - `certificate_renewal` - Launch Admin Portal for renewing SAML Certificates
	// - `bring_your_own_key` - Launch Admin Portal for configuring Bring Your Own Key
	Intent *GenerateLinkIntent `json:"intent,omitempty" url:"-"`
	// ItContactEmails is the email addresses of the IT contacts to grant access to the Admin Portal for the given organization. Accepts up to 20 emails.
	ItContactEmails []string `json:"it_contact_emails,omitempty" url:"-"`
}

// GenerateLink generate a Portal Link
// Generate a Portal Link scoped to an Organization.
func ( *AdminPortalService) ( context.Context,  *AdminPortalGenerateLinkParams,  ...RequestOption) (*PortalLinkResponse, error) {
	var  PortalLinkResponse
	,  := .client.request(, "POST", "/portal/generate_link", nil, , &, )
	if  != nil {
		return nil, 
	}
	return &, nil
}

// AdminPortalRevokeLinkParams contains the parameters for RevokeLink.
type AdminPortalRevokeLinkParams struct {
	// Organization is an [Organization](https://workos.com/docs/reference/organization) identifier.
	Organization string `json:"organization" url:"-"`
	// ExternalUserID is the `external_user_id` the Portal Links were generated with for this organization. Every matching link is revoked, along with any Admin Portal sessions started from those links.
	ExternalUserID string `json:"external_user_id" url:"-"`
}

// RevokeLink revoke a Portal Link
// Revokes every Portal Link generated for the given organization with the given `external_user_id`, and immediately ends any Admin Portal sessions that were started from those links. Use this when an admin is deprovisioned from your application: unopened links stop working, and their already-open portal sessions are ended. Only links that were generated with an `external_user_id` can be revoked, so pass one to `generate_link` for every admin you may later need to deprovision.
func ( *AdminPortalService) ( context.Context,  *AdminPortalRevokeLinkParams,  ...RequestOption) error {
	,  := .client.request(, "POST", "/portal/revoke_link", nil, , nil, )
	return 
}