Class: Vapi::SquadsClient
- Inherits:
-
Object
- Object
- Vapi::SquadsClient
- Defined in:
- lib/vapi_server_sdk/squads/client.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
- #create(request:, request_options: nil) ⇒ Vapi::Squad
- #delete(id:, request_options: nil) ⇒ Vapi::Squad
- #get(id:, request_options: nil) ⇒ Vapi::Squad
- #initialize(request_client:) ⇒ Vapi::SquadsClient constructor
- #list(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::Squad>
- #update(id:, members:, name: nil, members_overrides: nil, request_options: nil) ⇒ Vapi::Squad
Constructor Details
#initialize(request_client:) ⇒ Vapi::SquadsClient
19 20 21 |
# File 'lib/vapi_server_sdk/squads/client.rb', line 19 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Vapi::RequestClient (readonly)
15 16 17 |
# File 'lib/vapi_server_sdk/squads/client.rb', line 15 def request_client @request_client end |
Instance Method Details
#create(request:, request_options: nil) ⇒ Vapi::Squad
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/vapi_server_sdk/squads/client.rb', line 170 def create(request:, request_options: nil) 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 = { **(request || {}), **(&.additional_body_parameters || {}) }.compact req.url "#{@request_client.get_url(request_options: )}/squad" end Vapi::Squad.from_json(json_object: response.body) end |
#delete(id:, request_options: nil) ⇒ Vapi::Squad
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'lib/vapi_server_sdk/squads/client.rb', line 228 def delete(id:, request_options: nil) 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: )}/squad/#{id}" end Vapi::Squad.from_json(json_object: response.body) end |
#get(id:, request_options: nil) ⇒ Vapi::Squad
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
# File 'lib/vapi_server_sdk/squads/client.rb', line 198 def get(id:, request_options: nil) 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: )}/squad/#{id}" end Vapi::Squad.from_json(json_object: response.body) end |
#list(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::Squad>
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 |
# File 'lib/vapi_server_sdk/squads/client.rb', line 45 def list(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) 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 || {}), "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: )}/squad" end parsed_json = JSON.parse(response.body) parsed_json&.map do |item| item = item.to_json Vapi::Squad.from_json(json_object: item) end end |
#update(id:, members:, name: nil, members_overrides: nil, request_options: nil) ⇒ Vapi::Squad
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 |
# File 'lib/vapi_server_sdk/squads/client.rb', line 503 def update(id:, members:, name: nil, members_overrides: nil, request_options: nil) 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, members: members, membersOverrides: members_overrides }.compact req.url "#{@request_client.get_url(request_options: )}/squad/#{id}" end Vapi::Squad.from_json(json_object: response.body) end |