Class: Vapi::AssistantVersionPaginatedResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/assistant_version_paginated_response.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(results:, metadata:, next_page_state: OMIT, additional_properties: nil) ⇒ Vapi::AssistantVersionPaginatedResponse

Parameters:

  • results (Array<Object>)
  • metadata (Vapi::PaginationMeta)
  • next_page_state (String) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



28
29
30
31
32
33
34
35
36
# File 'lib/vapi_server_sdk/types/assistant_version_paginated_response.rb', line 28

def initialize(results:, metadata:, next_page_state: OMIT, additional_properties: nil)
  @results = results
  @metadata = 
  @next_page_state = next_page_state if next_page_state != OMIT
  @additional_properties = additional_properties
  @_field_set = { "results": results, "metadata": , "nextPageState": next_page_state }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



16
17
18
# File 'lib/vapi_server_sdk/types/assistant_version_paginated_response.rb', line 16

def additional_properties
  @additional_properties
end

#metadataVapi::PaginationMeta (readonly)



12
13
14
# File 'lib/vapi_server_sdk/types/assistant_version_paginated_response.rb', line 12

def 
  @metadata
end

#next_page_stateString (readonly)

Returns:

  • (String)


14
15
16
# File 'lib/vapi_server_sdk/types/assistant_version_paginated_response.rb', line 14

def next_page_state
  @next_page_state
end

#resultsArray<Object> (readonly)

Returns:

  • (Array<Object>)


10
11
12
# File 'lib/vapi_server_sdk/types/assistant_version_paginated_response.rb', line 10

def results
  @results
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::AssistantVersionPaginatedResponse

Deserialize a JSON object to an instance of AssistantVersionPaginatedResponse

Parameters:

  • json_object (String)

Returns:



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/vapi_server_sdk/types/assistant_version_paginated_response.rb', line 42

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  results = parsed_json["results"]
  if parsed_json["metadata"].nil?
     = nil
  else
     = parsed_json["metadata"].to_json
     = Vapi::PaginationMeta.from_json(json_object: )
  end
  next_page_state = parsed_json["nextPageState"]
  new(
    results: results,
    metadata: ,
    next_page_state: next_page_state,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


74
75
76
77
78
# File 'lib/vapi_server_sdk/types/assistant_version_paginated_response.rb', line 74

def self.validate_raw(obj:)
  obj.results.is_a?(Array) != false || raise("Passed value for field obj.results is not the expected type, validation failed.")
  Vapi::PaginationMeta.validate_raw(obj: obj.)
  obj.next_page_state&.is_a?(String) != false || raise("Passed value for field obj.next_page_state is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of AssistantVersionPaginatedResponse to a JSON object

Returns:

  • (String)


64
65
66
# File 'lib/vapi_server_sdk/types/assistant_version_paginated_response.rb', line 64

def to_json(*_args)
  @_field_set&.to_json
end