Class: NewDemoApiClient::AsyncGroupClient
- Inherits:
-
Object
- Object
- NewDemoApiClient::AsyncGroupClient
- Defined in:
- lib/test_sdk/group/client.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#create_user_role(user_id:, group_id:, role_id: nil, role_name: nil, request_options: nil) ⇒ NewDemoApiClient::UserRoleResponse
Add a user role to a group.
-
#get(group_id:, request_options: nil) ⇒ NewDemoApiClient::GroupWithUsersResponse
Get a group by its ID.
-
#get_by_domain(domain:, sort_by: nil, sort_order: nil, page: nil, page_size: nil, request_options: nil) ⇒ NewDemoApiClient::GroupWithUsersResponse
Lookup a group by its domain.
- #initialize(request_client:) ⇒ NewDemoApiClient::AsyncGroupClient constructor
-
#list_users(group_id:, sort_by: nil, sort_order: nil, page: nil, page_size: nil, request_options: nil) ⇒ NewDemoApiClient::PaginatedResponseGroupUser
Get all users in a group.
-
#remove_user(user_id:, group_id:, request_options: nil) ⇒ NewDemoApiClient::UserRoleResponse
Remove a user from a group.
-
#search_users(group_id:, name: nil, email: nil, sort_by: nil, sort_order: nil, page: nil, page_size: nil, request_options: nil) ⇒ NewDemoApiClient::PaginatedResponseGroupUser
Get all users in a group.
-
#update(group_id:, name: nil, domain: nil, thumbnail_url: nil, analysis_email: nil, data_api_access: nil, account_manager_id: nil, request_options: nil) ⇒ NewDemoApiClient::GroupWithUsersResponse
Update a group.
-
#update_user_roles(user_id:, group_id:, role_ids:, request_options: nil) ⇒ NewDemoApiClient::UserRoleResponse
Update the roles of a user in a group.
-
#upload_group_avatar(group_id:, image:, request_options: nil) ⇒ NewDemoApiClient::GroupResponse
Upload an avatar for a group.
Constructor Details
#initialize(request_client:) ⇒ NewDemoApiClient::AsyncGroupClient
372 373 374 |
# File 'lib/test_sdk/group/client.rb', line 372 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ NewDemoApiClient::AsyncRequestClient (readonly)
368 369 370 |
# File 'lib/test_sdk/group/client.rb', line 368 def request_client @request_client end |
Instance Method Details
#create_user_role(user_id:, group_id:, role_id: nil, role_name: nil, request_options: nil) ⇒ NewDemoApiClient::UserRoleResponse
Add a user role to a group.
640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 |
# File 'lib/test_sdk/group/client.rb', line 640 def create_user_role(user_id:, group_id:, role_id: nil, role_name: nil, request_options: nil) Async do response = @request_client.conn.post do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), role_id: role_id, role_name: role_name }.compact req.url "#{@request_client.get_url(request_options: )}/api/v1/group/#{user_id}/user/#{group_id}" end NewDemoApiClient::UserRoleResponse.from_json(json_object: response.body) end end |
#get(group_id:, request_options: nil) ⇒ NewDemoApiClient::GroupWithUsersResponse
Get a group by its ID.
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
# File 'lib/test_sdk/group/client.rb', line 431 def get(group_id:, request_options: nil) Async do response = @request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/api/v1/group/#{group_id}" end NewDemoApiClient::GroupWithUsersResponse.from_json(json_object: response.body) end end |
#get_by_domain(domain:, sort_by: nil, sort_order: nil, page: nil, page_size: nil, request_options: nil) ⇒ NewDemoApiClient::GroupWithUsersResponse
Lookup a group by its domain.
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 |
# File 'lib/test_sdk/group/client.rb', line 392 def get_by_domain(domain:, sort_by: nil, sort_order: nil, page: nil, page_size: nil, request_options: nil) Async do response = @request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.params = { **(&.additional_query_parameters || {}), "domain": domain, "sort_by": sort_by, "sort_order": sort_order, "page": page, "page_size": page_size }.compact unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/api/v1/group" end NewDemoApiClient::GroupWithUsersResponse.from_json(json_object: response.body) end end |
#list_users(group_id:, sort_by: nil, sort_order: nil, page: nil, page_size: nil, request_options: nil) ⇒ NewDemoApiClient::PaginatedResponseGroupUser
Get all users in a group.
516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 |
# File 'lib/test_sdk/group/client.rb', line 516 def list_users(group_id:, sort_by: nil, sort_order: nil, page: nil, page_size: nil, request_options: nil) Async do response = @request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.params = { **(&.additional_query_parameters || {}), "sort_by": sort_by, "sort_order": sort_order, "page": page, "page_size": page_size }.compact unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/api/v1/group/#{group_id}/user/all" end NewDemoApiClient::PaginatedResponseGroupUser.from_json(json_object: response.body) end end |
#remove_user(user_id:, group_id:, request_options: nil) ⇒ NewDemoApiClient::UserRoleResponse
Remove a user from a group.
715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 |
# File 'lib/test_sdk/group/client.rb', line 715 def remove_user(user_id:, group_id:, request_options: nil) Async do response = @request_client.conn.delete do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/api/v1/group/#{user_id}/user/#{group_id}" end NewDemoApiClient::UserRoleResponse.from_json(json_object: response.body) end end |
#search_users(group_id:, name: nil, email: nil, sort_by: nil, sort_order: nil, page: nil, page_size: nil, request_options: nil) ⇒ NewDemoApiClient::PaginatedResponseGroupUser
Get all users in a group.
560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 |
# File 'lib/test_sdk/group/client.rb', line 560 def search_users(group_id:, name: nil, email: nil, sort_by: nil, sort_order: nil, page: nil, page_size: nil, request_options: nil) Async do response = @request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.params = { **(&.additional_query_parameters || {}), "name": name, "email": email, "sort_by": sort_by, "sort_order": sort_order, "page": page, "page_size": page_size }.compact unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/api/v1/group/#{group_id}/user/search" end NewDemoApiClient::PaginatedResponseGroupUser.from_json(json_object: response.body) end end |
#update(group_id:, name: nil, domain: nil, thumbnail_url: nil, analysis_email: nil, data_api_access: nil, account_manager_id: nil, request_options: nil) ⇒ NewDemoApiClient::GroupWithUsersResponse
Update a group.
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/test_sdk/group/client.rb', line 471 def update(group_id:, name: nil, domain: nil, thumbnail_url: nil, analysis_email: nil, data_api_access: nil, account_manager_id: nil, request_options: nil) Async do response = @request_client.conn.put do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), name: name, domain: domain, thumbnail_url: thumbnail_url, analysis_email: analysis_email, data_api_access: data_api_access, account_manager_id: account_manager_id }.compact req.url "#{@request_client.get_url(request_options: )}/api/v1/group/#{group_id}" end NewDemoApiClient::GroupWithUsersResponse.from_json(json_object: response.body) end end |
#update_user_roles(user_id:, group_id:, role_ids:, request_options: nil) ⇒ NewDemoApiClient::UserRoleResponse
Update the roles of a user in a group.
682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 |
# File 'lib/test_sdk/group/client.rb', line 682 def update_user_roles(user_id:, group_id:, role_ids:, request_options: nil) Async do response = @request_client.conn.put do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), role_ids: role_ids }.compact req.url "#{@request_client.get_url(request_options: )}/api/v1/group/#{user_id}/user/#{group_id}" end NewDemoApiClient::UserRoleResponse.from_json(json_object: response.body) end end |
#upload_group_avatar(group_id:, image:, request_options: nil) ⇒ NewDemoApiClient::GroupResponse
Upload an avatar for a group.
602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 |
# File 'lib/test_sdk/group/client.rb', line 602 def upload_group_avatar(group_id:, image:, request_options: nil) Async do response = @request_client.conn.post do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), image: NewDemoApiClient::FileUtilities.as_faraday_multipart(file_like: image) }.compact req.url "#{@request_client.get_url(request_options: )}/api/v1/group/#{group_id}/avatar" end NewDemoApiClient::GroupResponse.from_json(json_object: response.body) end end |