Class: Appwrite::Users
- Defined in:
- lib/appwrite/services/users.rb
Instance Method Summary collapse
-
#create(user_id:, email:, password:, name: nil) ⇒ User
Create a new user.
-
#delete(user_id:) ⇒ Object
Delete a user by its unique ID.
-
#delete_session(user_id:, session_id:) ⇒ Object
Delete a user sessions by its unique ID.
-
#delete_sessions(user_id:) ⇒ Object
Delete all user’s sessions by using the user’s unique ID.
-
#get(user_id:) ⇒ User
Get a user by its unique ID.
-
#get_logs(user_id:, limit: nil, offset: nil) ⇒ LogList
Get the user activity logs list by its unique ID.
-
#get_prefs(user_id:) ⇒ Preferences
Get the user preferences by its unique ID.
-
#get_sessions(user_id:) ⇒ SessionList
Get the user sessions list by its unique ID.
-
#list(search: nil, limit: nil, offset: nil, cursor: nil, cursor_direction: nil, order_type: nil) ⇒ UserList
Get a list of all the project’s users.
-
#update_email(user_id:, email:) ⇒ User
Update the user email by its unique ID.
-
#update_name(user_id:, name:) ⇒ User
Update the user name by its unique ID.
-
#update_password(user_id:, password:) ⇒ User
Update the user password by its unique ID.
-
#update_prefs(user_id:, prefs:) ⇒ Preferences
Update the user preferences by its unique ID.
-
#update_status(user_id:, status:) ⇒ User
Update the user status by its unique ID.
-
#update_verification(user_id:, email_verification:) ⇒ User
Update the user email verification status by its unique ID.
Methods inherited from Service
Constructor Details
This class inherits a constructor from Appwrite::Service
Instance Method Details
#create(user_id:, email:, password:, name: nil) ⇒ User
Create a new user.
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 |
# File 'lib/appwrite/services/users.rb', line 50 def create(user_id:, email:, password:, name: nil) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? raise Appwrite::Exception.new('Missing required parameter: "email"') end if password.nil? raise Appwrite::Exception.new('Missing required parameter: "password"') end path = '/users' params = { userId: user_id, email: email, password: password, name: name, } headers = { "content-type": 'application/json', } @client.call( method: 'POST', path: path, headers: headers, params: params, response_type: Models::User ) end |
#delete(user_id:) ⇒ Object
Delete a user by its unique ID.
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/appwrite/services/users.rb', line 119 def delete(user_id:) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end path = '/users/{userId}' .gsub('{userId}', user_id) params = { } headers = { "content-type": 'application/json', } @client.call( method: 'DELETE', path: path, headers: headers, params: params, ) end |
#delete_session(user_id:, session_id:) ⇒ Object
Delete a user sessions by its unique ID.
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 |
# File 'lib/appwrite/services/users.rb', line 409 def delete_session(user_id:, session_id:) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end if session_id.nil? raise Appwrite::Exception.new('Missing required parameter: "sessionId"') end path = '/users/{userId}/sessions/{sessionId}' .gsub('{userId}', user_id) .gsub('{sessionId}', session_id) params = { } headers = { "content-type": 'application/json', } @client.call( method: 'DELETE', path: path, headers: headers, params: params, ) end |
#delete_sessions(user_id:) ⇒ Object
Delete all user’s sessions by using the user’s unique ID.
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
# File 'lib/appwrite/services/users.rb', line 380 def delete_sessions(user_id:) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end path = '/users/{userId}/sessions' .gsub('{userId}', user_id) params = { } headers = { "content-type": 'application/json', } @client.call( method: 'DELETE', path: path, headers: headers, params: params, ) end |
#get(user_id:) ⇒ User
Get a user by its unique ID.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/appwrite/services/users.rb', line 90 def get(user_id:) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end path = '/users/{userId}' .gsub('{userId}', user_id) params = { } headers = { "content-type": 'application/json', } @client.call( method: 'GET', path: path, headers: headers, params: params, response_type: Models::User ) end |
#get_logs(user_id:, limit: nil, offset: nil) ⇒ LogList
Get the user activity logs list by its unique ID.
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/appwrite/services/users.rb', line 184 def get_logs(user_id:, limit: nil, offset: nil) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end path = '/users/{userId}/logs' .gsub('{userId}', user_id) params = { limit: limit, offset: offset, } headers = { "content-type": 'application/json', } @client.call( method: 'GET', path: path, headers: headers, params: params, response_type: Models::LogList ) end |
#get_prefs(user_id:) ⇒ Preferences
Get the user preferences by its unique ID.
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
# File 'lib/appwrite/services/users.rb', line 285 def get_prefs(user_id:) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end path = '/users/{userId}/prefs' .gsub('{userId}', user_id) params = { } headers = { "content-type": 'application/json', } @client.call( method: 'GET', path: path, headers: headers, params: params, response_type: Models::Preferences ) end |
#get_sessions(user_id:) ⇒ SessionList
Get the user sessions list by its unique ID.
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
# File 'lib/appwrite/services/users.rb', line 351 def get_sessions(user_id:) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end path = '/users/{userId}/sessions' .gsub('{userId}', user_id) params = { } headers = { "content-type": 'application/json', } @client.call( method: 'GET', path: path, headers: headers, params: params, response_type: Models::SessionList ) end |
#list(search: nil, limit: nil, offset: nil, cursor: nil, cursor_direction: nil, order_type: nil) ⇒ UserList
Get a list of all the project’s users. You can use the query params to filter your results.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/appwrite/services/users.rb', line 17 def list(search: nil, limit: nil, offset: nil, cursor: nil, cursor_direction: nil, order_type: nil) path = '/users' params = { search: search, limit: limit, offset: offset, cursor: cursor, cursorDirection: cursor_direction, orderType: order_type, } headers = { "content-type": 'application/json', } @client.call( method: 'GET', path: path, headers: headers, params: params, response_type: Models::UserList ) end |
#update_email(user_id:, email:) ⇒ User
Update the user email by its unique ID.
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/appwrite/services/users.rb', line 148 def update_email(user_id:, email:) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? raise Appwrite::Exception.new('Missing required parameter: "email"') end path = '/users/{userId}/email' .gsub('{userId}', user_id) params = { email: email, } headers = { "content-type": 'application/json', } @client.call( method: 'PATCH', path: path, headers: headers, params: params, response_type: Models::User ) end |
#update_name(user_id:, name:) ⇒ User
Update the user name by its unique ID.
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'lib/appwrite/services/users.rb', line 216 def update_name(user_id:, name:) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end if name.nil? raise Appwrite::Exception.new('Missing required parameter: "name"') end path = '/users/{userId}/name' .gsub('{userId}', user_id) params = { name: name, } headers = { "content-type": 'application/json', } @client.call( method: 'PATCH', path: path, headers: headers, params: params, response_type: Models::User ) end |
#update_password(user_id:, password:) ⇒ User
Update the user password by its unique ID.
251 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 |
# File 'lib/appwrite/services/users.rb', line 251 def update_password(user_id:, password:) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end if password.nil? raise Appwrite::Exception.new('Missing required parameter: "password"') end path = '/users/{userId}/password' .gsub('{userId}', user_id) params = { password: password, } headers = { "content-type": 'application/json', } @client.call( method: 'PATCH', path: path, headers: headers, params: params, response_type: Models::User ) end |
#update_prefs(user_id:, prefs:) ⇒ Preferences
Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.
317 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 |
# File 'lib/appwrite/services/users.rb', line 317 def update_prefs(user_id:, prefs:) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end if prefs.nil? raise Appwrite::Exception.new('Missing required parameter: "prefs"') end path = '/users/{userId}/prefs' .gsub('{userId}', user_id) params = { prefs: prefs, } headers = { "content-type": 'application/json', } @client.call( method: 'PATCH', path: path, headers: headers, params: params, response_type: Models::Preferences ) end |
#update_status(user_id:, status:) ⇒ User
Update the user status by its unique ID.
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 |
# File 'lib/appwrite/services/users.rb', line 443 def update_status(user_id:, status:) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end if status.nil? raise Appwrite::Exception.new('Missing required parameter: "status"') end path = '/users/{userId}/status' .gsub('{userId}', user_id) params = { status: status, } headers = { "content-type": 'application/json', } @client.call( method: 'PATCH', path: path, headers: headers, params: params, response_type: Models::User ) end |
#update_verification(user_id:, email_verification:) ⇒ User
Update the user email verification status by its unique ID.
478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 |
# File 'lib/appwrite/services/users.rb', line 478 def update_verification(user_id:, email_verification:) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email_verification.nil? raise Appwrite::Exception.new('Missing required parameter: "emailVerification"') end path = '/users/{userId}/verification' .gsub('{userId}', user_id) params = { emailVerification: email_verification, } headers = { "content-type": 'application/json', } @client.call( method: 'PATCH', path: path, headers: headers, params: params, response_type: Models::User ) end |