Skip to content

Commit

Permalink
Release 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Dec 26, 2024
1 parent 1b067bc commit 70aaca5
Show file tree
Hide file tree
Showing 355 changed files with 18,219 additions and 1,413 deletions.
4 changes: 2 additions & 2 deletions lib/requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def get_url(request_options: nil)

# @return [Hash{String => String}]
def get_headers
headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "vapi_server_sdk", "X-Fern-SDK-Version": "0.1.0" }
headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "vapi_server_sdk", "X-Fern-SDK-Version": "0.2.0" }
headers["Authorization"] = ((@token.is_a? Method) ? @token.call : @token) unless @token.nil?
headers
end
Expand Down Expand Up @@ -90,7 +90,7 @@ def get_url(request_options: nil)

# @return [Hash{String => String}]
def get_headers
headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "vapi_server_sdk", "X-Fern-SDK-Version": "0.1.0" }
headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "vapi_server_sdk", "X-Fern-SDK-Version": "0.2.0" }
headers["Authorization"] = ((@token.is_a? Method) ? @token.call : @token) unless @token.nil?
headers
end
Expand Down
210 changes: 184 additions & 26 deletions lib/types_export.rb

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions lib/vapi_server_sdk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
require_relative "vapi_server_sdk/assistants/client"
require_relative "vapi_server_sdk/phone_numbers/client"
require_relative "vapi_server_sdk/squads/client"
require_relative "vapi_server_sdk/knowledge_bases/client"
require_relative "vapi_server_sdk/blocks/client"
require_relative "vapi_server_sdk/tools/client"
require_relative "vapi_server_sdk/files/client"
Expand All @@ -23,6 +24,8 @@ class Client
attr_reader :phone_numbers
# @return [Vapi::SquadsClient]
attr_reader :squads
# @return [Vapi::KnowledgeBasesClient]
attr_reader :knowledge_bases
# @return [Vapi::BlocksClient]
attr_reader :blocks
# @return [Vapi::ToolsClient]
Expand Down Expand Up @@ -53,6 +56,7 @@ def initialize(token:, base_url: nil, environment: Vapi::Environment::DEFAULT, m
@assistants = Vapi::AssistantsClient.new(request_client: @request_client)
@phone_numbers = Vapi::PhoneNumbersClient.new(request_client: @request_client)
@squads = Vapi::SquadsClient.new(request_client: @request_client)
@knowledge_bases = Vapi::KnowledgeBasesClient.new(request_client: @request_client)
@blocks = Vapi::BlocksClient.new(request_client: @request_client)
@tools = Vapi::ToolsClient.new(request_client: @request_client)
@files = Vapi::FilesClient.new(request_client: @request_client)
Expand All @@ -70,6 +74,8 @@ class AsyncClient
attr_reader :phone_numbers
# @return [Vapi::AsyncSquadsClient]
attr_reader :squads
# @return [Vapi::AsyncKnowledgeBasesClient]
attr_reader :knowledge_bases
# @return [Vapi::AsyncBlocksClient]
attr_reader :blocks
# @return [Vapi::AsyncToolsClient]
Expand Down Expand Up @@ -100,6 +106,7 @@ def initialize(token:, base_url: nil, environment: Vapi::Environment::DEFAULT, m
@assistants = Vapi::AsyncAssistantsClient.new(request_client: @async_request_client)
@phone_numbers = Vapi::AsyncPhoneNumbersClient.new(request_client: @async_request_client)
@squads = Vapi::AsyncSquadsClient.new(request_client: @async_request_client)
@knowledge_bases = Vapi::AsyncKnowledgeBasesClient.new(request_client: @async_request_client)
@blocks = Vapi::AsyncBlocksClient.new(request_client: @async_request_client)
@tools = Vapi::AsyncToolsClient.new(request_client: @async_request_client)
@files = Vapi::AsyncFilesClient.new(request_client: @async_request_client)
Expand Down
57 changes: 14 additions & 43 deletions lib/vapi_server_sdk/analytics/client.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# frozen_string_literal: true

require_relative "../../requests"
require_relative "../types/analytics_query"
require_relative "../types/analytics_query_result"
require "json"
require "async"

module Vapi
Expand All @@ -17,27 +14,17 @@ def initialize(request_client:)
@request_client = request_client
end

# @param queries [Array<Hash>] This is the list of metric queries you want to perform.Request of type Array<Vapi::AnalyticsQuery>, as a Hash
# * :table (String)
# * :group_by (Array<Vapi::AnalyticsQueryGroupByItem>)
# * :name (String)
# * :time_range (Hash)
# * :step (Vapi::TimeRangeStep)
# * :start (DateTime)
# * :end_ (DateTime)
# * :timezone (String)
# * :operations (Array<Vapi::AnalyticsOperation>)
# @param request_options [Vapi::RequestOptions]
# @return [Array<Vapi::AnalyticsQueryResult>]
# @return [Void]
# @example
# api = Vapi::Client.new(
# base_url: "https://api.example.com",
# environment: Vapi::Environment::DEFAULT,
# token: "YOUR_AUTH_TOKEN"
# )
# api.analytics.get(queries: [{ table: "call", name: "name", operations: [{ operation: SUM, column: ID }] }])
def get(queries:, request_options: nil)
response = @request_client.conn.post do |req|
# api.analytics.get
def get(request_options: nil)
@request_client.conn.post do |req|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
req.headers = {
Expand All @@ -48,14 +35,11 @@ def get(queries:, request_options: nil)
unless request_options.nil? || request_options&.additional_query_parameters.nil?
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
end
req.body = { **(request_options&.additional_body_parameters || {}), queries: queries }.compact
unless request_options.nil? || request_options&.additional_body_parameters.nil?
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
end
req.url "#{@request_client.get_url(request_options: request_options)}/analytics"
end
parsed_json = JSON.parse(response.body)
parsed_json&.map do |item|
item = item.to_json
Vapi::AnalyticsQueryResult.from_json(json_object: item)
end
end
end

Expand All @@ -69,28 +53,18 @@ def initialize(request_client:)
@request_client = request_client
end

# @param queries [Array<Hash>] This is the list of metric queries you want to perform.Request of type Array<Vapi::AnalyticsQuery>, as a Hash
# * :table (String)
# * :group_by (Array<Vapi::AnalyticsQueryGroupByItem>)
# * :name (String)
# * :time_range (Hash)
# * :step (Vapi::TimeRangeStep)
# * :start (DateTime)
# * :end_ (DateTime)
# * :timezone (String)
# * :operations (Array<Vapi::AnalyticsOperation>)
# @param request_options [Vapi::RequestOptions]
# @return [Array<Vapi::AnalyticsQueryResult>]
# @return [Void]
# @example
# api = Vapi::Client.new(
# base_url: "https://api.example.com",
# environment: Vapi::Environment::DEFAULT,
# token: "YOUR_AUTH_TOKEN"
# )
# api.analytics.get(queries: [{ table: "call", name: "name", operations: [{ operation: SUM, column: ID }] }])
def get(queries:, request_options: nil)
# api.analytics.get
def get(request_options: nil)
Async do
response = @request_client.conn.post do |req|
@request_client.conn.post do |req|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
req.headers = {
Expand All @@ -101,14 +75,11 @@ def get(queries:, request_options: nil)
unless request_options.nil? || request_options&.additional_query_parameters.nil?
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
end
req.body = { **(request_options&.additional_body_parameters || {}), queries: queries }.compact
unless request_options.nil? || request_options&.additional_body_parameters.nil?
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
end
req.url "#{@request_client.get_url(request_options: request_options)}/analytics"
end
parsed_json = JSON.parse(response.body)
parsed_json&.map do |item|
item = item.to_json
Vapi::AnalyticsQueryResult.from_json(json_object: item)
end
end
end
end
Expand Down
Loading

0 comments on commit 70aaca5

Please sign in to comment.