Class: Vapi::CustomLlmCredential

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, authentication_plan: OMIT, authentication_session: OMIT, name: OMIT, additional_properties: nil) ⇒ Vapi::CustomLlmCredential

Parameters:

  • provider (String)
  • api_key (String)

    This is not returned in the API.

  • authentication_plan (Vapi::OAuth2AuthenticationPlan) (defaults to: OMIT)

    This is the authentication plan. Currently supports OAuth2 RFC 6749. To use Bearer authentication, use apiKey

  • id (String)

    This is the unique identifier for the credential.

  • org_id (String)

    This is the unique identifier for the org that this credential belongs to.

  • created_at (DateTime)

    This is the ISO 8601 date-time string of when the credential was created.

  • updated_at (DateTime)

    This is the ISO 8601 date-time string of when the assistant was last updated.

  • authentication_session (Vapi::Oauth2AuthenticationSession) (defaults to: OMIT)

    This is the authentication session for the credential. Available for credentials that have an authentication plan.

  • name (String) (defaults to: OMIT)

    This is the name of credential. This is just for your reference.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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/types/custom_llm_credential.rb', line 52

def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, authentication_plan: OMIT,
               authentication_session: OMIT, name: OMIT, additional_properties: nil)
  @provider = provider
  @api_key = api_key
  @authentication_plan = authentication_plan if authentication_plan != OMIT
  @id = id
  @org_id = org_id
  @created_at = created_at
  @updated_at = updated_at
  @authentication_session = authentication_session if authentication_session != OMIT
  @name = name if name != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "provider": provider,
    "apiKey": api_key,
    "authenticationPlan": authentication_plan,
    "id": id,
    "orgId": org_id,
    "createdAt": created_at,
    "updatedAt": updated_at,
    "authenticationSession": authentication_session,
    "name": name
  }.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



32
33
34
# File 'lib/vapi_server_sdk/types/custom_llm_credential.rb', line 32

def additional_properties
  @additional_properties
end

#api_keyString (readonly)

Returns This is not returned in the API.

Returns:

  • (String)

    This is not returned in the API.



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

def api_key
  @api_key
end

#authentication_planVapi::OAuth2AuthenticationPlan (readonly)

Returns This is the authentication plan. Currently supports OAuth2 RFC 6749. To use Bearer authentication, use apiKey.

Returns:



17
18
19
# File 'lib/vapi_server_sdk/types/custom_llm_credential.rb', line 17

def authentication_plan
  @authentication_plan
end

#authentication_sessionVapi::Oauth2AuthenticationSession (readonly)

Returns This is the authentication session for the credential. Available for credentials that have an authentication plan.

Returns:



28
29
30
# File 'lib/vapi_server_sdk/types/custom_llm_credential.rb', line 28

def authentication_session
  @authentication_session
end

#created_atDateTime (readonly)

Returns This is the ISO 8601 date-time string of when the credential was created.

Returns:

  • (DateTime)

    This is the ISO 8601 date-time string of when the credential was created.



23
24
25
# File 'lib/vapi_server_sdk/types/custom_llm_credential.rb', line 23

def created_at
  @created_at
end

#idString (readonly)

Returns This is the unique identifier for the credential.

Returns:

  • (String)

    This is the unique identifier for the credential.



19
20
21
# File 'lib/vapi_server_sdk/types/custom_llm_credential.rb', line 19

def id
  @id
end

#nameString (readonly)

Returns This is the name of credential. This is just for your reference.

Returns:

  • (String)

    This is the name of credential. This is just for your reference.



30
31
32
# File 'lib/vapi_server_sdk/types/custom_llm_credential.rb', line 30

def name
  @name
end

#org_idString (readonly)

Returns This is the unique identifier for the org that this credential belongs to.

Returns:

  • (String)

    This is the unique identifier for the org that this credential belongs to.



21
22
23
# File 'lib/vapi_server_sdk/types/custom_llm_credential.rb', line 21

def org_id
  @org_id
end

#providerString (readonly)

Returns:

  • (String)


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

def provider
  @provider
end

#updated_atDateTime (readonly)

Returns This is the ISO 8601 date-time string of when the assistant was last updated.

Returns:

  • (DateTime)

    This is the ISO 8601 date-time string of when the assistant was last updated.



25
26
27
# File 'lib/vapi_server_sdk/types/custom_llm_credential.rb', line 25

def updated_at
  @updated_at
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::CustomLlmCredential

Deserialize a JSON object to an instance of CustomLlmCredential

Parameters:

  • json_object (String)

Returns:



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/vapi_server_sdk/types/custom_llm_credential.rb', line 83

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  provider = parsed_json["provider"]
  api_key = parsed_json["apiKey"]
  if parsed_json["authenticationPlan"].nil?
    authentication_plan = nil
  else
    authentication_plan = parsed_json["authenticationPlan"].to_json
    authentication_plan = Vapi::OAuth2AuthenticationPlan.from_json(json_object: authentication_plan)
  end
  id = parsed_json["id"]
  org_id = parsed_json["orgId"]
  created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?)
  updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?)
  if parsed_json["authenticationSession"].nil?
    authentication_session = nil
  else
    authentication_session = parsed_json["authenticationSession"].to_json
    authentication_session = Vapi::Oauth2AuthenticationSession.from_json(json_object: authentication_session)
  end
  name = parsed_json["name"]
  new(
    provider: provider,
    api_key: api_key,
    authentication_plan: authentication_plan,
    id: id,
    org_id: org_id,
    created_at: created_at,
    updated_at: updated_at,
    authentication_session: authentication_session,
    name: name,
    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)


132
133
134
135
136
137
138
139
140
141
142
# File 'lib/vapi_server_sdk/types/custom_llm_credential.rb', line 132

def self.validate_raw(obj:)
  obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.")
  obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.")
  obj.authentication_plan.nil? || Vapi::OAuth2AuthenticationPlan.validate_raw(obj: obj.authentication_plan)
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.")
  obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.")
  obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.")
  obj.authentication_session.nil? || Vapi::Oauth2AuthenticationSession.validate_raw(obj: obj.authentication_session)
  obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of CustomLlmCredential to a JSON object

Returns:

  • (String)


122
123
124
# File 'lib/vapi_server_sdk/types/custom_llm_credential.rb', line 122

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