Class: Zyphr::AuthUserDirectoryApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zyphr/api/auth_user_directory_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AuthUserDirectoryApi

Returns a new instance of AuthUserDirectoryApi.



19
20
21
# File 'lib/zyphr/api/auth_user_directory_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/zyphr/api/auth_user_directory_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#delete_end_user_by_application(user_id, opts = {}) ⇒ nil

Delete an end user (server-side admin) Secret-key-scoped admin soft-delete for an arbitrary end user in the authenticating application. Works in both test and live environments. Scoped to the application via the application_id filter — a caller can never delete a user belonging to another application. Mirrors the self-service DELETE /auth/users/me flow: revokes all sessions, soft-deletes the row (status='deleted'), and emits a user.deleted webhook with method='application_admin'. The audit log row survives (no FK to end_users), so org-history queries still resolve.

Parameters:

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

    the optional parameters

Returns:

  • (nil)


27
28
29
30
# File 'lib/zyphr/api/auth_user_directory_api.rb', line 27

def delete_end_user_by_application(user_id, opts = {})
  delete_end_user_by_application_with_http_info(user_id, opts)
  nil
end

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

Delete an end user (server-side admin) Secret-key-scoped admin soft-delete for an arbitrary end user in the authenticating application. Works in both test and live environments. Scoped to the application via the application_id filter — a caller can never delete a user belonging to another application. Mirrors the self-service `DELETE /auth/users/me` flow: revokes all sessions, soft-deletes the row (status='deleted'), and emits a `user.deleted` webhook with `method='application_admin'`. The audit log row survives (no FK to end_users), so org-history queries still resolve.

Parameters:

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



37
38
39
40
41
42
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
# File 'lib/zyphr/api/auth_user_directory_api.rb', line 37

def delete_end_user_by_application_with_http_info(user_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthUserDirectoryApi.delete_end_user_by_application ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling AuthUserDirectoryApi.delete_end_user_by_application"
  end
  # resource path
  local_var_path = '/auth/users/{user_id}'.sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}

  # 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] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthUserDirectoryApi.delete_end_user_by_application",
    :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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthUserDirectoryApi#delete_end_user_by_application\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_end_user_by_email(email, opts = {}) ⇒ GetEndUserById200Response

Look up an end user by email (server-side admin) Secret-key-scoped lookup of a single end user by email address within the authenticating application. Scoped to the application — never resolves a user from another application. Does not return the password hash.

Parameters:

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

    the optional parameters

Returns:



88
89
90
91
# File 'lib/zyphr/api/auth_user_directory_api.rb', line 88

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

#get_end_user_by_email_with_http_info(email, opts = {}) ⇒ Array<(GetEndUserById200Response, Integer, Hash)>

Look up an end user by email (server-side admin) Secret-key-scoped lookup of a single end user by email address within the authenticating application. Scoped to the application — never resolves a user from another application. Does not return the password hash.

Parameters:

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

    the optional parameters

Returns:

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

    GetEndUserById200Response data, response status code and response headers



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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
# File 'lib/zyphr/api/auth_user_directory_api.rb', line 98

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

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

  # 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] || 'GetEndUserById200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthUserDirectoryApi.get_end_user_by_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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthUserDirectoryApi#get_end_user_by_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_end_user_by_id(user_id, opts = {}) ⇒ GetEndUserById200Response

Get an end user by id (server-side admin) Secret-key-scoped fetch of a single end user by id within the authenticating application. Scoped to the application — a caller can never read a user belonging to another application.

Parameters:

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

    the optional parameters

Returns:



152
153
154
155
# File 'lib/zyphr/api/auth_user_directory_api.rb', line 152

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

#get_end_user_by_id_with_http_info(user_id, opts = {}) ⇒ Array<(GetEndUserById200Response, Integer, Hash)>

Get an end user by id (server-side admin) Secret-key-scoped fetch of a single end user by id within the authenticating application. Scoped to the application — a caller can never read a user belonging to another application.

Parameters:

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

    the optional parameters

Returns:

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

    GetEndUserById200Response data, response status code and response headers



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
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
# File 'lib/zyphr/api/auth_user_directory_api.rb', line 162

def get_end_user_by_id_with_http_info(user_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthUserDirectoryApi.get_end_user_by_id ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling AuthUserDirectoryApi.get_end_user_by_id"
  end
  # resource path
  local_var_path = '/auth/users/{user_id}'.sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s))

  # 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] || 'GetEndUserById200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthUserDirectoryApi.get_end_user_by_id",
    :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: AuthUserDirectoryApi#get_end_user_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_end_user_claims(user_id, opts = {}) ⇒ GetEndUserClaims200Response

Get an end user's stored custom claims (server-side admin) Secret-key-scoped read of the authoritative custom_claims stored for an end user. These are the TRUSTED claims embedded into the user's JWTs on login/refresh — use them (not the client-writable metadata field) for authorization decisions. Returns an empty object when none are set.

Parameters:

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

    the optional parameters

Returns:



215
216
217
218
# File 'lib/zyphr/api/auth_user_directory_api.rb', line 215

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

#get_end_user_claims_with_http_info(user_id, opts = {}) ⇒ Array<(GetEndUserClaims200Response, Integer, Hash)>

Get an end user's stored custom claims (server-side admin) Secret-key-scoped read of the authoritative custom_claims stored for an end user. These are the TRUSTED claims embedded into the user's JWTs on login/refresh — use them (not the client-writable `metadata` field) for authorization decisions. Returns an empty object when none are set.

Parameters:

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

    the optional parameters

Returns:

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

    GetEndUserClaims200Response data, response status code and response headers



225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/zyphr/api/auth_user_directory_api.rb', line 225

def get_end_user_claims_with_http_info(user_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthUserDirectoryApi.get_end_user_claims ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling AuthUserDirectoryApi.get_end_user_claims"
  end
  # resource path
  local_var_path = '/auth/users/{user_id}/claims'.sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s))

  # 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] || 'GetEndUserClaims200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthUserDirectoryApi.get_end_user_claims",
    :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: AuthUserDirectoryApi#get_end_user_claims\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#invite_end_user(invite_end_user_request, opts = {}) ⇒ InviteEndUser200Response

Pre-provision (invite) an end user (server-side admin) Secret-key-scoped pre-provisioning for an end user. Creates a passwordless user in the authenticating application (idempotent on email — an existing, non-deleted user is reused, not duplicated) and, when send_link is set, sends a first-login link so the user can set up their account without self-registration. - send_link: \"magic\" sends a magic-link sign-in email. - send_link: \"password_reset\" sends a set-password email. - send_link: \"none\" (default) creates the user with no email. A redirect_url is required when send_link is "magic" or "password_reset"; it must match the application's redirect_uris allowlist (custom schemes such as yourapp://path are permitted).

Parameters:

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

    the optional parameters

Returns:



278
279
280
281
# File 'lib/zyphr/api/auth_user_directory_api.rb', line 278

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

#invite_end_user_with_http_info(invite_end_user_request, opts = {}) ⇒ Array<(InviteEndUser200Response, Integer, Hash)>

Pre-provision (invite) an end user (server-side admin) Secret-key-scoped pre-provisioning for an end user. Creates a passwordless user in the authenticating application (idempotent on email — an existing, non-deleted user is reused, not duplicated) and, when `send_link` is set, sends a first-login link so the user can set up their account without self-registration. - `send_link: &quot;magic&quot;` sends a magic-link sign-in email. - `send_link: &quot;password_reset&quot;` sends a set-password email. - `send_link: &quot;none&quot;` (default) creates the user with no email. A `redirect_url` is required when `send_link` is &quot;magic&quot; or &quot;password_reset&quot;; it must match the application's redirect_uris allowlist (custom schemes such as yourapp://path are permitted).

Parameters:

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

    the optional parameters

Returns:

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

    InviteEndUser200Response data, response status code and response headers



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/zyphr/api/auth_user_directory_api.rb', line 288

def invite_end_user_with_http_info(invite_end_user_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthUserDirectoryApi.invite_end_user ...'
  end
  # verify the required parameter 'invite_end_user_request' is set
  if @api_client.config.client_side_validation && invite_end_user_request.nil?
    fail ArgumentError, "Missing the required parameter 'invite_end_user_request' when calling AuthUserDirectoryApi.invite_end_user"
  end
  # resource path
  local_var_path = '/auth/users/invite'

  # 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(invite_end_user_request)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthUserDirectoryApi.invite_end_user",
    :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: AuthUserDirectoryApi#invite_end_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_end_users(opts = {}) ⇒ ListEndUsers200Response

List / search end users (server-side admin) Secret-key-scoped directory listing of end users in the authenticating application. Supports substring search over email, name, and phone, an optional environment filter (test/live), and pagination. Scoped to the application — never returns users from another application.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer) — default: default to 1
  • :per_page (Integer) — default: default to 20
  • :search (String)

    Substring match against email, name, or phone number.

  • :environment (String)

Returns:



349
350
351
352
# File 'lib/zyphr/api/auth_user_directory_api.rb', line 349

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

#list_end_users_with_http_info(opts = {}) ⇒ Array<(ListEndUsers200Response, Integer, Hash)>

List / search end users (server-side admin) Secret-key-scoped directory listing of end users in the authenticating application. Supports substring search over email, name, and phone, an optional environment filter (test/live), and pagination. Scoped to the application — never returns users from another application.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer) — default: default to 1
  • :per_page (Integer) — default: default to 20
  • :search (String)

    Substring match against email, name, or phone number.

  • :environment (String)

Returns:

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

    ListEndUsers200Response data, response status code and response headers



362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
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
# File 'lib/zyphr/api/auth_user_directory_api.rb', line 362

def list_end_users_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthUserDirectoryApi.list_end_users ...'
  end
  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling AuthUserDirectoryApi.list_end_users, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 100
    fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling AuthUserDirectoryApi.list_end_users, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling AuthUserDirectoryApi.list_end_users, must be greater than or equal to 1.'
  end

  allowable_values = ["test", "live"]
  if @api_client.config.client_side_validation && opts[:'environment'] && !allowable_values.include?(opts[:'environment'])
    fail ArgumentError, "invalid value for \"environment\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/auth/users'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
  query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
  query_params[:'environment'] = opts[:'environment'] if !opts[:'environment'].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] || 'ListEndUsers200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthUserDirectoryApi.list_end_users",
    :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: AuthUserDirectoryApi#list_end_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#set_end_user_claims(user_id, set_end_user_claims_request, opts = {}) ⇒ SetEndUserClaims200Response

Set an end user's stored custom claims (server-side admin) Secret-key-scoped upsert of the authoritative custom_claims for an end user. Set server-side only — clients cannot write these, which is what makes them safe for authorization (e.g. an account-type/admin flag). Claims are embedded into the user's JWTs on the next login/refresh. Max 4KB; reserved JWT/Zyphr claim names are rejected. Each write bumps a monotonic claims_version (returned in the response). The change applies seamlessly on the user's next login or token refresh — a token carrying an older claims_version is rejected on verification and the client silently re-mints with the new claims, without a forced logout. For a hard cut-off (log the user out of all sessions immediately), call POST /auth/sessions/revoke-all after updating claims.

Parameters:

  • user_id (String)
  • set_end_user_claims_request (SetEndUserClaimsRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



432
433
434
435
# File 'lib/zyphr/api/auth_user_directory_api.rb', line 432

def set_end_user_claims(user_id, set_end_user_claims_request, opts = {})
  data, _status_code, _headers = set_end_user_claims_with_http_info(user_id, set_end_user_claims_request, opts)
  data
end

#set_end_user_claims_with_http_info(user_id, set_end_user_claims_request, opts = {}) ⇒ Array<(SetEndUserClaims200Response, Integer, Hash)>

Set an end user's stored custom claims (server-side admin) Secret-key-scoped upsert of the authoritative custom_claims for an end user. Set server-side only — clients cannot write these, which is what makes them safe for authorization (e.g. an account-type/admin flag). Claims are embedded into the user's JWTs on the next login/refresh. Max 4KB; reserved JWT/Zyphr claim names are rejected. Each write bumps a monotonic `claims_version` (returned in the response). The change applies seamlessly on the user's next login or token refresh — a token carrying an older `claims_version` is rejected on verification and the client silently re-mints with the new claims, without a forced logout. For a hard cut-off (log the user out of all sessions immediately), call POST /auth/sessions/revoke-all after updating claims.

Parameters:

  • user_id (String)
  • set_end_user_claims_request (SetEndUserClaimsRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    SetEndUserClaims200Response data, response status code and response headers



443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
# File 'lib/zyphr/api/auth_user_directory_api.rb', line 443

def set_end_user_claims_with_http_info(user_id, set_end_user_claims_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthUserDirectoryApi.set_end_user_claims ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling AuthUserDirectoryApi.set_end_user_claims"
  end
  # verify the required parameter 'set_end_user_claims_request' is set
  if @api_client.config.client_side_validation && set_end_user_claims_request.nil?
    fail ArgumentError, "Missing the required parameter 'set_end_user_claims_request' when calling AuthUserDirectoryApi.set_end_user_claims"
  end
  # resource path
  local_var_path = '/auth/users/{user_id}/claims'.sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s))

  # 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(set_end_user_claims_request)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthUserDirectoryApi.set_end_user_claims",
    :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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthUserDirectoryApi#set_end_user_claims\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_end_user_by_application(user_id, update_end_user_by_application_request, opts = {}) ⇒ GetEndUserById200Response

Update an end user (server-side admin) Secret-key-scoped update of an arbitrary end user in the authenticating application. Updatable fields: email, name, avatar_url, metadata, status. Scoped to the application — a caller can never modify a user belonging to another application.

Parameters:

Returns:



506
507
508
509
# File 'lib/zyphr/api/auth_user_directory_api.rb', line 506

def update_end_user_by_application(user_id, update_end_user_by_application_request, opts = {})
  data, _status_code, _headers = update_end_user_by_application_with_http_info(user_id, update_end_user_by_application_request, opts)
  data
end

#update_end_user_by_application_with_http_info(user_id, update_end_user_by_application_request, opts = {}) ⇒ Array<(GetEndUserById200Response, Integer, Hash)>

Update an end user (server-side admin) Secret-key-scoped update of an arbitrary end user in the authenticating application. Updatable fields: email, name, avatar_url, metadata, status. Scoped to the application — a caller can never modify a user belonging to another application.

Parameters:

Returns:

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

    GetEndUserById200Response data, response status code and response headers



517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
# File 'lib/zyphr/api/auth_user_directory_api.rb', line 517

def update_end_user_by_application_with_http_info(user_id, update_end_user_by_application_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthUserDirectoryApi.update_end_user_by_application ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling AuthUserDirectoryApi.update_end_user_by_application"
  end
  # verify the required parameter 'update_end_user_by_application_request' is set
  if @api_client.config.client_side_validation && update_end_user_by_application_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_end_user_by_application_request' when calling AuthUserDirectoryApi.update_end_user_by_application"
  end
  # resource path
  local_var_path = '/auth/users/{user_id}'.sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s))

  # 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(update_end_user_by_application_request)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']

  new_options = opts.merge(
    :operation => :"AuthUserDirectoryApi.update_end_user_by_application",
    :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(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthUserDirectoryApi#update_end_user_by_application\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end