Class: Braintrust::Resources::EnvVars
- Inherits:
-
Object
- Object
- Braintrust::Resources::EnvVars
- Defined in:
- lib/braintrust/resources/env_vars.rb
Instance Method Summary collapse
-
#create(params = {}, opts = {}) ⇒ Braintrust::Models::EnvVar
Create a new env_var.
-
#delete(env_var_id, opts = {}) ⇒ Braintrust::Models::EnvVar
Delete an env_var object by its id.
-
#initialize(client:) ⇒ EnvVars
constructor
A new instance of EnvVars.
-
#list(params = {}, opts = {}) ⇒ Braintrust::Models::EnvVarListResponse
List out all env_vars.
-
#replace(params = {}, opts = {}) ⇒ Braintrust::Models::EnvVar
Create or replace env_var.
-
#retrieve(env_var_id, opts = {}) ⇒ Braintrust::Models::EnvVar
Get an env_var object by its id.
-
#update(env_var_id, params = {}, opts = {}) ⇒ Braintrust::Models::EnvVar
Partially update an env_var object.
Constructor Details
#initialize(client:) ⇒ EnvVars
Returns a new instance of EnvVars.
6 7 8 |
# File 'lib/braintrust/resources/env_vars.rb', line 6 def initialize(client:) @client = client end |
Instance Method Details
#create(params = {}, opts = {}) ⇒ Braintrust::Models::EnvVar
Create a new env_var. If there is an existing env_var with the same name as the one specified in the request, will return the existing env_var unmodified
22 23 24 25 26 27 28 29 |
# File 'lib/braintrust/resources/env_vars.rb', line 22 def create(params = {}, opts = {}) req = {} req[:method] = :post req[:path] = "/v1/env_var" req[:body] = params req[:model] = Braintrust::Models::EnvVar @client.request(req, opts) end |
#delete(env_var_id, opts = {}) ⇒ Braintrust::Models::EnvVar
Delete an env_var object by its id
96 97 98 99 100 101 102 |
# File 'lib/braintrust/resources/env_vars.rb', line 96 def delete(env_var_id, opts = {}) req = {} req[:method] = :delete req[:path] = "/v1/env_var/#{env_var_id}" req[:model] = Braintrust::Models::EnvVar @client.request(req, opts) end |
#list(params = {}, opts = {}) ⇒ Braintrust::Models::EnvVarListResponse
List out all env_vars. The env_vars are sorted by creation date, with the most recently-created env_vars coming first
81 82 83 84 85 86 87 88 |
# File 'lib/braintrust/resources/env_vars.rb', line 81 def list(params = {}, opts = {}) req = {} req[:method] = :get req[:path] = "/v1/env_var" req[:query] = params req[:model] = Braintrust::Models::EnvVarListResponse @client.request(req, opts) end |
#replace(params = {}, opts = {}) ⇒ Braintrust::Models::EnvVar
Create or replace env_var. If there is an existing env_var with the same name as the one specified in the request, will replace the existing env_var with the provided fields
117 118 119 120 121 122 123 124 |
# File 'lib/braintrust/resources/env_vars.rb', line 117 def replace(params = {}, opts = {}) req = {} req[:method] = :put req[:path] = "/v1/env_var" req[:body] = params req[:model] = Braintrust::Models::EnvVar @client.request(req, opts) end |
#retrieve(env_var_id, opts = {}) ⇒ Braintrust::Models::EnvVar
Get an env_var object by its id
37 38 39 40 41 42 43 |
# File 'lib/braintrust/resources/env_vars.rb', line 37 def retrieve(env_var_id, opts = {}) req = {} req[:method] = :get req[:path] = "/v1/env_var/#{env_var_id}" req[:model] = Braintrust::Models::EnvVar @client.request(req, opts) end |
#update(env_var_id, params = {}, opts = {}) ⇒ Braintrust::Models::EnvVar
Partially update an env_var object. Specify the fields to update in the payload. Any object-type fields will be deep-merged with existing content. Currently we do not support removing fields or setting them to null.
58 59 60 61 62 63 64 65 |
# File 'lib/braintrust/resources/env_vars.rb', line 58 def update(env_var_id, params = {}, opts = {}) req = {} req[:method] = :patch req[:path] = "/v1/env_var/#{env_var_id}" req[:body] = params req[:model] = Braintrust::Models::EnvVar @client.request(req, opts) end |