Class: SmplkitGeneratedClient::App::AuthApi

Inherits:
Object
  • Object
show all
Defined in:
lib/smplkit/_generated/app/lib/smplkit_app_client/api/auth_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AuthApi

Returns a new instance of AuthApi.



19
20
21
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/auth_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/auth_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#begin_oidc_login(provider, opts = {}) ⇒ nil

Begin OIDC Login Initiates the OIDC authorization flow by redirecting the user to the provider’s login page.

Parameters:

  • provider (OidcProvider)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :mode (String) — default: default to 'signin'
  • :source (String)
  • :entry_point (String)

Returns:

  • (nil)


30
31
32
33
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/auth_api.rb', line 30

def (provider, opts = {})
  (provider, opts)
  nil
end

#begin_oidc_login_with_http_info(provider, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Begin OIDC Login Initiates the OIDC authorization flow by redirecting the user to the provider&#39;s login page.

Parameters:

  • provider (OidcProvider)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :mode (String) — default: default to 'signin'
  • :source (String)
  • :entry_point (String)

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/auth_api.rb', line 43

def (provider, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthApi.begin_oidc_login ...'
  end
  # verify the required parameter 'provider' is set
  if @api_client.config.client_side_validation && provider.nil?
    fail ArgumentError, "Missing the required parameter 'provider' when calling AuthApi.begin_oidc_login"
  end
  # resource path
  local_var_path = '/api/v1/auth/oidc/{provider}'.sub('{provider}', CGI.escape(provider.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'mode'] = opts[:'mode'] if !opts[:'mode'].nil?
  query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?
  query_params[:'entry_point'] = opts[:'entry_point'] if !opts[:'entry_point'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"AuthApi.begin_oidc_login",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthApi#begin_oidc_login\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#handle_oidc_callback(provider, opts = {}) ⇒ nil

Handle OIDC Callback Handles the callback from the OIDC provider, exchanges the authorization code for tokens, and redirects to the frontend.

Parameters:

  • provider (OidcProvider)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :code (String)
  • :state (String)
  • :error (String)
  • :error_description (String)

Returns:

  • (nil)


103
104
105
106
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/auth_api.rb', line 103

def handle_oidc_callback(provider, opts = {})
  handle_oidc_callback_with_http_info(provider, opts)
  nil
end

#handle_oidc_callback_with_http_info(provider, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Handle OIDC Callback Handles the callback from the OIDC provider, exchanges the authorization code for tokens, and redirects to the frontend.

Parameters:

  • provider (OidcProvider)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :code (String)
  • :state (String)
  • :error (String)
  • :error_description (String)

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/auth_api.rb', line 117

def handle_oidc_callback_with_http_info(provider, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthApi.handle_oidc_callback ...'
  end
  # verify the required parameter 'provider' is set
  if @api_client.config.client_side_validation && provider.nil?
    fail ArgumentError, "Missing the required parameter 'provider' when calling AuthApi.handle_oidc_callback"
  end
  # resource path
  local_var_path = '/api/v1/auth/callback/{provider}'.sub('{provider}', CGI.escape(provider.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'code'] = opts[:'code'] if !opts[:'code'].nil?
  query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?
  query_params[:'error'] = opts[:'error'] if !opts[:'error'].nil?
  query_params[:'error_description'] = opts[:'error_description'] if !opts[:'error_description'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"AuthApi.handle_oidc_callback",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthApi#handle_oidc_callback\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#login(login_request, opts = {}) ⇒ AuthTokenResponse

Login Authenticates with email and password and returns an authentication token.

Parameters:

  • login_request (LoginRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



174
175
176
177
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/auth_api.rb', line 174

def (, opts = {})
  data, _status_code, _headers = (, opts)
  data
end

#login_with_http_info(login_request, opts = {}) ⇒ Array<(AuthTokenResponse, Integer, Hash)>

Login Authenticates with email and password and returns an authentication token.

Parameters:

  • login_request (LoginRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(AuthTokenResponse, Integer, Hash)>)

    AuthTokenResponse data, response status code and response headers



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/auth_api.rb', line 184

def (, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthApi.login ...'
  end
  # verify the required parameter 'login_request' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'login_request' when calling AuthApi.login"
  end
  # resource path
  local_var_path = '/api/v1/auth/login'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body()

  # return_type
  return_type = opts[:debug_return_type] || 'AuthTokenResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"AuthApi.login",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthApi#login\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#register(register_request, opts = {}) ⇒ AuthTokenResponse

Register Creates a new account with email and password and returns an authentication token.

Parameters:

  • register_request (RegisterRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



242
243
244
245
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/auth_api.rb', line 242

def register(register_request, opts = {})
  data, _status_code, _headers = register_with_http_info(register_request, opts)
  data
end

#register_with_http_info(register_request, opts = {}) ⇒ Array<(AuthTokenResponse, Integer, Hash)>

Register Creates a new account with email and password and returns an authentication token.

Parameters:

  • register_request (RegisterRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(AuthTokenResponse, Integer, Hash)>)

    AuthTokenResponse data, response status code and response headers



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/auth_api.rb', line 252

def register_with_http_info(register_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthApi.register ...'
  end
  # verify the required parameter 'register_request' is set
  if @api_client.config.client_side_validation && register_request.nil?
    fail ArgumentError, "Missing the required parameter 'register_request' when calling AuthApi.register"
  end
  # resource path
  local_var_path = '/api/v1/auth/register'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(register_request)

  # return_type
  return_type = opts[:debug_return_type] || 'AuthTokenResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"AuthApi.register",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthApi#register\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#resend_verification(opts = {}) ⇒ nil

Resend Verification Email Resends the email verification link to the authenticated user.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


309
310
311
312
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/auth_api.rb', line 309

def resend_verification(opts = {})
  resend_verification_with_http_info(opts)
  nil
end

#resend_verification_with_http_info(opts = {}) ⇒ Array<(nil, Integer, Hash)>

Resend Verification Email Resends the email verification link to the authenticated user.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/auth_api.rb', line 318

def resend_verification_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthApi.resend_verification ...'
  end
  # resource path
  local_var_path = '/api/v1/auth/resend-verification'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"AuthApi.resend_verification",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthApi#resend_verification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#verify_email(verify_email_request, opts = {}) ⇒ AuthTokenResponse

Verify Email Verifies a user’s email address using the token from the verification email.

Parameters:

  • verify_email_request (VerifyEmailRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



367
368
369
370
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/auth_api.rb', line 367

def verify_email(verify_email_request, opts = {})
  data, _status_code, _headers = verify_email_with_http_info(verify_email_request, opts)
  data
end

#verify_email_with_http_info(verify_email_request, opts = {}) ⇒ Array<(AuthTokenResponse, Integer, Hash)>

Verify Email Verifies a user&#39;s email address using the token from the verification email.

Parameters:

  • verify_email_request (VerifyEmailRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(AuthTokenResponse, Integer, Hash)>)

    AuthTokenResponse data, response status code and response headers



377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/auth_api.rb', line 377

def verify_email_with_http_info(verify_email_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthApi.verify_email ...'
  end
  # verify the required parameter 'verify_email_request' is set
  if @api_client.config.client_side_validation && verify_email_request.nil?
    fail ArgumentError, "Missing the required parameter 'verify_email_request' when calling AuthApi.verify_email"
  end
  # resource path
  local_var_path = '/api/v1/auth/verify-email'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(verify_email_request)

  # return_type
  return_type = opts[:debug_return_type] || 'AuthTokenResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"AuthApi.verify_email",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthApi#verify_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end