Class: Braintrust::Resources::Projects
- Inherits:
-
Object
- Object
- Braintrust::Resources::Projects
- Defined in:
- lib/braintrust/resources/projects.rb,
lib/braintrust/resources/projects/logs.rb
Defined Under Namespace
Classes: Logs
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#create(params = {}, opts = {}) ⇒ Braintrust::Models::Project
Create a new project.
-
#delete(project_id, opts = {}) ⇒ Braintrust::Models::Project
Delete a project object by its id.
-
#initialize(client:) ⇒ Projects
constructor
A new instance of Projects.
-
#list(params = {}, opts = {}) ⇒ Braintrust::ListObjects<Braintrust::Models::Project>
List out all projects.
-
#retrieve(project_id, opts = {}) ⇒ Braintrust::Models::Project
Get a project object by its id.
-
#update(project_id, params = {}, opts = {}) ⇒ Braintrust::Models::Project
Partially update a project object.
Constructor Details
Instance Attribute Details
#logs ⇒ Braintrust::Resources::Projects::Logs (readonly)
7 8 9 |
# File 'lib/braintrust/resources/projects.rb', line 7 def logs @logs end |
Instance Method Details
#create(params = {}, opts = {}) ⇒ Braintrust::Models::Project
Create a new project. If there is an existing project with the same name as the one specified in the request, will return the existing project unmodified
26 27 28 29 30 31 32 33 |
# File 'lib/braintrust/resources/projects.rb', line 26 def create(params = {}, opts = {}) req = {} req[:method] = :post req[:path] = "/v1/project" req[:body] = params req[:model] = Braintrust::Models::Project @client.request(req, opts) end |
#delete(project_id, opts = {}) ⇒ Braintrust::Models::Project
Delete a project object by its id
111 112 113 114 115 116 117 |
# File 'lib/braintrust/resources/projects.rb', line 111 def delete(project_id, opts = {}) req = {} req[:method] = :delete req[:path] = "/v1/project/#{project_id}" req[:model] = Braintrust::Models::Project @client.request(req, opts) end |
#list(params = {}, opts = {}) ⇒ Braintrust::ListObjects<Braintrust::Models::Project>
List out all projects. The projects are sorted by creation date, with the most recently-created projects coming first
95 96 97 98 99 100 101 102 103 |
# File 'lib/braintrust/resources/projects.rb', line 95 def list(params = {}, opts = {}) req = {} req[:method] = :get req[:path] = "/v1/project" req[:query] = params req[:page] = Braintrust::ListObjects req[:model] = Braintrust::Models::Project @client.request(req, opts) end |
#retrieve(project_id, opts = {}) ⇒ Braintrust::Models::Project
Get a project object by its id
41 42 43 44 45 46 47 |
# File 'lib/braintrust/resources/projects.rb', line 41 def retrieve(project_id, opts = {}) req = {} req[:method] = :get req[:path] = "/v1/project/#{project_id}" req[:model] = Braintrust::Models::Project @client.request(req, opts) end |
#update(project_id, params = {}, opts = {}) ⇒ Braintrust::Models::Project
Partially update a project 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.
63 64 65 66 67 68 69 70 |
# File 'lib/braintrust/resources/projects.rb', line 63 def update(project_id, params = {}, opts = {}) req = {} req[:method] = :patch req[:path] = "/v1/project/#{project_id}" req[:body] = params req[:model] = Braintrust::Models::Project @client.request(req, opts) end |