Class: Vapi::AsyncCallsClient
- Inherits:
-
Object
- Object
- Vapi::AsyncCallsClient
- Defined in:
- lib/vapi_server_sdk/calls/client.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
- #create(name: nil, assistant_id: nil, assistant: nil, assistant_overrides: nil, squad_id: nil, squad: nil, phone_number_id: nil, phone_number: nil, customer_id: nil, customer: nil, request_options: nil) ⇒ Vapi::Call
- #delete(id:, request_options: nil) ⇒ Vapi::Call
- #get(id:, request_options: nil) ⇒ Vapi::Call
- #initialize(request_client:) ⇒ Vapi::AsyncCallsClient constructor
- #list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, created_at_le: nil, updated_at_gt: nil, updated_at_lt: nil, updated_at_ge: nil, updated_at_le: nil, request_options: nil) ⇒ Array<Vapi::Call>
- #update(id:, name: nil, request_options: nil) ⇒ Vapi::Call
Constructor Details
#initialize(request_client:) ⇒ Vapi::AsyncCallsClient
492 493 494 |
# File 'lib/vapi_server_sdk/calls/client.rb', line 492 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Vapi::AsyncRequestClient (readonly)
488 489 490 |
# File 'lib/vapi_server_sdk/calls/client.rb', line 488 def request_client @request_client end |
Instance Method Details
#create(name: nil, assistant_id: nil, assistant: nil, assistant_overrides: nil, squad_id: nil, squad: nil, phone_number_id: nil, phone_number: nil, customer_id: nil, customer: nil, request_options: nil) ⇒ Vapi::Call
838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 |
# File 'lib/vapi_server_sdk/calls/client.rb', line 838 def create(name: nil, assistant_id: nil, assistant: nil, assistant_overrides: nil, squad_id: nil, squad: nil, phone_number_id: nil, phone_number: nil, customer_id: nil, customer: 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 || {}), name: name, assistantId: assistant_id, assistant: assistant, assistantOverrides: assistant_overrides, squadId: squad_id, squad: squad, phoneNumberId: phone_number_id, phoneNumber: phone_number, customerId: customer_id, customer: customer }.compact req.url "#{@request_client.get_url(request_options: )}/call" end Vapi::Call.from_json(json_object: response.body) end end |
#delete(id:, request_options: nil) ⇒ Vapi::Call
913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 |
# File 'lib/vapi_server_sdk/calls/client.rb', line 913 def delete(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: )}/call/#{id}" end Vapi::Call.from_json(json_object: response.body) end end |
#get(id:, request_options: nil) ⇒ Vapi::Call
881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 |
# File 'lib/vapi_server_sdk/calls/client.rb', line 881 def get(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: )}/call/#{id}" end Vapi::Call.from_json(json_object: response.body) end end |
#list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, created_at_le: nil, updated_at_gt: nil, updated_at_lt: nil, updated_at_ge: nil, updated_at_le: nil, request_options: nil) ⇒ Array<Vapi::Call>
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 |
# File 'lib/vapi_server_sdk/calls/client.rb', line 519 def list(assistant_id: nil, limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, created_at_le: nil, updated_at_gt: nil, updated_at_lt: nil, updated_at_ge: nil, updated_at_le: 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 || {}), "assistantId": assistant_id, "limit": limit, "createdAtGt": created_at_gt, "createdAtLt": created_at_lt, "createdAtGe": created_at_ge, "createdAtLe": created_at_le, "updatedAtGt": updated_at_gt, "updatedAtLt": updated_at_lt, "updatedAtGe": updated_at_ge, "updatedAtLe": updated_at_le }.compact unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/call" end parsed_json = JSON.parse(response.body) parsed_json&.map do |item| item = item.to_json Vapi::Call.from_json(json_object: item) end end end |
#update(id:, name: nil, request_options: nil) ⇒ Vapi::Call
946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 |
# File 'lib/vapi_server_sdk/calls/client.rb', line 946 def update(id:, name: nil, request_options: nil) Async do response = @request_client.conn.patch 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 }.compact req.url "#{@request_client.get_url(request_options: )}/call/#{id}" end Vapi::Call.from_json(json_object: response.body) end end |