# frozen_string_literal: true require_relative "../../../../response/user_requests_response" require_relative "../../../../response/user_entitlement_requests_response" module ONEAccess module API module V1_1 module Entitlement module Research class UserRequests < Base api_path "/entitlement/research/userRequests" def self.create(user_id:, sell_side_org_id:, sales_contact_first_name: nil, sales_contact_last_name: nil, sales_contact_email: nil) response = send_post("create", UserId: user_id, SellSideOrgId: sell_side_org_id, SalesContact: { FirstName: sales_contact_first_name, LastName: sales_contact_last_name, Email: sales_contact_email }.reject { |_, value| value.nil? }) Response::UserRequestsResponse.from_json(response.body) end def self.get_list( # rubocop:disable Metrics/MethodLength user_ids: [], page_number: 0, page_size: 20, sort_by: "UserEntitlementRequestId", is_ascending: false, create_date_from: nil, create_date_to: nil, sell_side_org_ids: nil, entitlement_status: nil ) query = { UserIds: user_ids, PageNumber: page_number, PageSize: page_size, SortBy: sort_by, IsAscending: is_ascending, CreateDateFrom: create_date_from, CreateDateTo: create_date_to, SellSideOrgIds: sell_side_org_ids, EntitlementStatus: entitlement_status }.reject { |_, value| value.nil? } response = send_get("getListWithEntitlementsStatus", Query: query.to_json) Response::UserEntitlementRequestsResponse.from_json(response.body) end end end end end end end