Class: Infrawrench::ProfileNamespace

Inherits:
Object
  • Object
show all
Defined in:
lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs

Overview

client.profile

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ ProfileNamespace

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ProfileNamespace.

Parameters:



2192
2193
2194
2195
2196
2197
# File 'lib/infrawrench/client.rb', line 2192

def initialize(transport)
  @transport = transport
  @email_change = ProfileEmailChangeNamespace.new(@transport)
  @mfa = ProfileMfaNamespace.new(@transport)
  @sessions = ProfileSessionsNamespace.new(@transport)
end

Instance Attribute Details

#email_changeProfileEmailChangeNamespace (readonly)

Returns client.profile.email_change.

Returns:



2184
2185
2186
# File 'lib/infrawrench/client.rb', line 2184

def email_change
  @email_change
end

#mfaProfileMfaNamespace (readonly)

Returns client.profile.mfa.

Returns:



2186
2187
2188
# File 'lib/infrawrench/client.rb', line 2186

def mfa
  @mfa
end

#sessionsProfileSessionsNamespace (readonly)

Returns client.profile.sessions.

Returns:



2188
2189
2190
# File 'lib/infrawrench/client.rb', line 2188

def sessions
  @sessions
end

Instance Method Details

#get(request_options: nil) ⇒ Hash

The signed-in user's account profile

User-scoped, not organization-scoped: one WorkOS identity is shared across every organization the user belongs to.

GET /api/profile

Raises on 401: Unauthenticated

Parameters:

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as Profile — see sig/infrawrench/sdk.rbs.

Raises:



2211
2212
2213
2214
2215
2216
2217
# File 'lib/infrawrench/client.rb', line 2211

def get(request_options: nil)
  @transport.request(
    http_method: "GET",
    path: "/api/profile",
    request_options: request_options
  )
end

#password_reset(request_options: nil) ⇒ Hash

Mint a password reset link for the signed-in user

Returns a one-time AuthKit-hosted reset URL rather than emailing it — the caller already holds a valid session for the account. Also the way to set a first password on an SSO or OAuth-only account.

POST /api/profile/password-reset

Raises on 401: Unauthenticated

Raises on 403: Recent sign-in required. Send the user through sign-in again and retry; the request itself was well-formed.

Parameters:

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as Hash — see sig/infrawrench/sdk.rbs.

Raises:



2235
2236
2237
2238
2239
2240
2241
# File 'lib/infrawrench/client.rb', line 2235

def password_reset(request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/profile/password-reset",
    request_options: request_options
  )
end

#send_verification_email(request_options: nil) ⇒ Hash

Re-send the email verification message

POST /api/profile/send-verification-email

Raises on 400: Bad request

Raises on 401: Unauthenticated

Parameters:

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as Ok — see sig/infrawrench/sdk.rbs.

Raises:



2254
2255
2256
2257
2258
2259
2260
# File 'lib/infrawrench/client.rb', line 2254

def send_verification_email(request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/profile/send-verification-email",
    request_options: request_options
  )
end

#update(body: nil, request_options: nil) ⇒ Hash

Update the signed-in user's name

PATCH /api/profile

Raises on 400: Bad request

Raises on 401: Unauthenticated

Parameters:

  • body (Hash, nil) (defaults to: nil)

    Request body, shaped as Hash.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • body: ({ ?"firstName" => String, ?"lastName" => String }, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as ProfileSummary — see sig/infrawrench/sdk.rbs.

Raises:



2274
2275
2276
2277
2278
2279
2280
2281
# File 'lib/infrawrench/client.rb', line 2274

def update(body: nil, request_options: nil)
  @transport.request(
    http_method: "PATCH",
    path: "/api/profile",
    body: body,
    request_options: request_options
  )
end