Class: Infrawrench::ProfileSessionsNamespace

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

Overview

client.profile.sessions

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ ProfileSessionsNamespace

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 ProfileSessionsNamespace.

Parameters:



2113
2114
2115
# File 'lib/infrawrench/client.rb', line 2113

def initialize(transport)
  @transport = transport
end

Instance Method Details

#delete(session_id:, request_options: nil) ⇒ Hash

Revoke one session

Refuses the session making the request — use sign-out for that.

DELETE /api/profile/sessions/sessionId

Raises on 400: Bad request

Raises on 401: Unauthenticated

Raises on 404: Not found

Parameters:

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

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

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

Returns:

  • (Hash)

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

Raises:



2133
2134
2135
2136
2137
2138
2139
2140
# File 'lib/infrawrench/client.rb', line 2133

def delete(session_id:, request_options: nil)
  @transport.request(
    http_method: "DELETE",
    path: "/api/profile/sessions/{sessionId}",
    path_params: { "sessionId" => session_id },
    request_options: request_options
  )
end

#list(request_options: nil) ⇒ Array<Hash>

List the signed-in user's active sessions

GET /api/profile/sessions

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:

  • (Array<Hash>)

    Parsed JSON, shaped as Array<UserSession> — see sig/infrawrench/sdk.rbs.

Raises:



2152
2153
2154
2155
2156
2157
2158
# File 'lib/infrawrench/client.rb', line 2152

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

#revoke_others(request_options: nil) ⇒ Hash

Revoke every session except the current one

POST /api/profile/sessions/revoke-others

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:



2172
2173
2174
2175
2176
2177
2178
# File 'lib/infrawrench/client.rb', line 2172

def revoke_others(request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/profile/sessions/revoke-others",
    request_options: request_options
  )
end