class StytchB2B::MagicLinks::Email

def initialize(connection)

def initialize(connection)
  @connection = connection
  @discovery = StytchB2B::MagicLinks::Email::Discovery.new(@connection)
end

def invite(

This method supports an optional +StytchB2B::MagicLinks::Email::InviteRequestOptions+ object which will modify the headers sent in the HTTP request.
== Method Options:

The type of this field is +Integer+.
The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
status_code::
The type of this field is +Organization+ (+object+).
The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
organization::
The type of this field is +Member+ (+object+).
The [Member object](https://stytch.com/docs/b2b/api/member-object)
member::
The type of this field is +String+.
Globally unique UUID that identifies a specific Member.
member_id::
The type of this field is +String+.
Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
request_id::
An object with the following fields:
== Returns:

The type of this field is nilable list of +String+.
for more information about role assignment.
Roles to explicitly assign to this Member. See the [RBAC guide](https://stytch.com/docs/b2b/guides/rbac/role-assignment)
roles::
The type of this field is nilable +InviteRequestLocale+ (string enum).

Request support for additional languages [here](https://docs.google.com/forms/d/e/1FAIpQLScZSpAu_m2AmLXRT3F3kap-s_mcV6UTBitYn6CdyWP0-o7YjQ/viewform?usp=sf_link")!

Currently supported languages are English (`"en"`), Spanish (`"es"`), and Brazilian Portuguese (`"pt-br"`); if no value is provided, the copy defaults to English.

Used to determine which language to use when sending the user this delivery method. Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
locale::
The type of this field is nilable +String+.
using our built-in customizations or a custom HTML email for Magic Links - Invite.
Use a custom template for invite emails. By default, it will use your default email template. The template must be a template
invite_template_id::
The type of this field is nilable +object+.
for complete field behavior details.
frontend SDK, and should not be used to store critical information. See the [Metadata resource](https://stytch.com/docs/b2b/api/metadata)
An arbitrary JSON object of application-specific data. These fields can be edited directly by the
untrusted_metadata::
The type of this field is nilable +object+.
An arbitrary JSON object for storing application-specific data or identity-provider-specific data.
trusted_metadata::
The type of this field is nilable +String+.
The name of the Member.
name::
The type of this field is nilable +String+.
The `member_id` of the Member who sends the invite.
invited_by_member_id::
The type of this field is nilable +String+.
that you set in your Dashboard is used. If you have not set a default `invite_redirect_url`, an error is returned.
the request by querying Stytch's authenticate endpoint and finishes the invite flow. If this value is not passed, the default `invite_redirect_url`
The URL that the Member clicks from the invite Email Magic Link. This URL should be an endpoint in the backend server that verifies
invite_redirect_url::
The type of this field is +String+.
The email address of the Member.
email_address::
The type of this field is +String+.
Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value.
organization_id::
== Parameters:

The magic link invite will be valid for 1 week.

Send an invite email to a new to join an. The Member will be created with an `invited` status until they successfully authenticate. Sending invites to `pending` Members will update their status to `invited`. Sending invites to already `active` Members will return an error.
def invite(
  organization_id:,
  email_address:,
  invite_redirect_url: nil,
  invited_by_member_id: nil,
  name: nil,
  trusted_metadata: nil,
  untrusted_metadata: nil,
  invite_template_id: nil,
  locale: nil,
  roles: nil,
  method_options: nil
)
  headers = {}
  headers = headers.merge(method_options.to_headers) unless method_options.nil?
  request = {
    organization_id: organization_id,
    email_address: email_address
  }
  request[:invite_redirect_url] = invite_redirect_url unless invite_redirect_url.nil?
  request[:invited_by_member_id] = invited_by_member_id unless invited_by_member_id.nil?
  request[:name] = name unless name.nil?
  request[:trusted_metadata] = trusted_metadata unless trusted_metadata.nil?
  request[:untrusted_metadata] = untrusted_metadata unless untrusted_metadata.nil?
  request[:invite_template_id] = invite_template_id unless invite_template_id.nil?
  request[:locale] = locale unless locale.nil?
  request[:roles] = roles unless roles.nil?
  post_request('/v1/b2b/magic_links/email/invite', request, headers)
end

def login_or_signup(

The type of this field is +Integer+.
The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
status_code::
The type of this field is +Organization+ (+object+).
The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
organization::
The type of this field is +Member+ (+object+).
The [Member object](https://stytch.com/docs/b2b/api/member-object)
member::
The type of this field is +Boolean+.
A flag indicating `true` if a new Member object was created and `false` if the Member object already existed.
member_created::
The type of this field is +String+.
Globally unique UUID that identifies a specific Member.
member_id::
The type of this field is +String+.
Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
request_id::
An object with the following fields:
== Returns:

The type of this field is nilable +LoginOrSignupRequestLocale+ (string enum).

Request support for additional languages [here](https://docs.google.com/forms/d/e/1FAIpQLScZSpAu_m2AmLXRT3F3kap-s_mcV6UTBitYn6CdyWP0-o7YjQ/viewform?usp=sf_link")!

Currently supported languages are English (`"en"`), Spanish (`"es"`), and Brazilian Portuguese (`"pt-br"`); if no value is provided, the copy defaults to English.

Used to determine which language to use when sending the user this delivery method. Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
locale::
The type of this field is nilable +String+.
built-in customizations or a custom HTML email for Magic Links - Signup.
Use a custom template for signup emails. By default, it will use your default email template. The template must be from Stytch's
signup_template_id::
The type of this field is nilable +String+.
built-in customizations or a custom HTML email for Magic Links - Login.
Use a custom template for login emails. By default, it will use your default email template. The template must be from Stytch's
login_template_id::
The type of this field is nilable +String+.
A base64url encoded SHA256 hash of a one time secret used to validate that the request starts and ends on the same device.
pkce_code_challenge::
The type of this field is nilable +String+.
that you set in your Dashboard is used. If you have not set a default sign-up redirect URL, an error is returned.
the request by querying Stytch's authenticate endpoint and finishes the login. If this value is not passed, the default sign-up redirect URL
The URL the Member clicks from the signup Email Magic Link. This URL should be an endpoint in the backend server that verifies
signup_redirect_url::
The type of this field is nilable +String+.
redirect URL that you set in your Dashboard is used. If you have not set a default login redirect URL, an error is returned.
verifies the request by querying Stytch's authenticate endpoint and finishes the login. If this value is not passed, the default login
The URL that the Member clicks from the login Email Magic Link. This URL should be an endpoint in the backend server that
login_redirect_url::
The type of this field is +String+.
The email address of the Member.
email_address::
The type of this field is +String+.
Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value.
organization_id::
== Parameters:

The magic link is valid for 60 minutes.

Send either a login or signup magic link to a Member. A new, pending, or invited Member will receive a signup Email Magic Link. Members will have a `pending` status until they successfully authenticate. An active Member will receive a login Email Magic Link.
def login_or_signup(
  organization_id:,
  email_address:,
  login_redirect_url: nil,
  signup_redirect_url: nil,
  pkce_code_challenge: nil,
  login_template_id: nil,
  signup_template_id: nil,
  locale: nil
)
  headers = {}
  request = {
    organization_id: organization_id,
    email_address: email_address
  }
  request[:login_redirect_url] = login_redirect_url unless login_redirect_url.nil?
  request[:signup_redirect_url] = signup_redirect_url unless signup_redirect_url.nil?
  request[:pkce_code_challenge] = pkce_code_challenge unless pkce_code_challenge.nil?
  request[:login_template_id] = login_template_id unless login_template_id.nil?
  request[:signup_template_id] = signup_template_id unless signup_template_id.nil?
  request[:locale] = locale unless locale.nil?
  post_request('/v1/b2b/magic_links/email/login_or_signup', request, headers)
end