Class: Braintrust::Resources::Group
- Inherits:
-
Object
- Object
- Braintrust::Resources::Group
- Defined in:
- lib/braintrust/resources/group.rb
Instance Method Summary collapse
-
#create(params = {}, opts = {}) ⇒ Braintrust::Models::Group
Create a new group.
-
#delete(group_id, opts = {}) ⇒ Braintrust::Models::Group
Delete a group object by its id.
-
#initialize(client:) ⇒ Group
constructor
A new instance of Group.
-
#list(params = {}, opts = {}) ⇒ Braintrust::ListObjects<Braintrust::Models::Group>
List out all groups.
-
#replace(params = {}, opts = {}) ⇒ Braintrust::Models::Group
NOTE: This operation is deprecated and will be removed in a future revision of the API.
-
#retrieve(group_id, opts = {}) ⇒ Braintrust::Models::Group
Get a group object by its id.
-
#update(group_id, params = {}, opts = {}) ⇒ Braintrust::Models::Group
Partially update a group object.
Constructor Details
#initialize(client:) ⇒ Group
Returns a new instance of Group.
6 7 8 |
# File 'lib/braintrust/resources/group.rb', line 6 def initialize(client:) @client = client end |
Instance Method Details
#create(params = {}, opts = {}) ⇒ Braintrust::Models::Group
Create a new group. If there is an existing group with the same name as the one specified in the request, will return the existing group unmodified
28 29 30 31 32 33 34 35 |
# File 'lib/braintrust/resources/group.rb', line 28 def create(params = {}, opts = {}) req = {} req[:method] = :post req[:path] = "/v1/group" req[:body] = params req[:model] = Braintrust::Models::Group @client.request(req, opts) end |
#delete(group_id, opts = {}) ⇒ Braintrust::Models::Group
Delete a group object by its id
117 118 119 120 121 122 123 |
# File 'lib/braintrust/resources/group.rb', line 117 def delete(group_id, opts = {}) req = {} req[:method] = :delete req[:path] = "/v1/group/#{group_id}" req[:model] = Braintrust::Models::Group @client.request(req, opts) end |
#list(params = {}, opts = {}) ⇒ Braintrust::ListObjects<Braintrust::Models::Group>
List out all groups. The groups are sorted by creation date, with the most recently-created groups coming first
101 102 103 104 105 106 107 108 109 |
# File 'lib/braintrust/resources/group.rb', line 101 def list(params = {}, opts = {}) req = {} req[:method] = :get req[:path] = "/v1/group" req[:query] = params req[:page] = Braintrust::ListObjects req[:model] = Braintrust::Models::Group @client.request(req, opts) end |
#replace(params = {}, opts = {}) ⇒ Braintrust::Models::Group
NOTE: This operation is deprecated and will be removed in a future revision of the API. Create or replace a new group. If there is an existing group with the same name as the one specified in the request, will return the existing group unmodified, will replace the existing group with the provided fields
145 146 147 148 149 150 151 152 |
# File 'lib/braintrust/resources/group.rb', line 145 def replace(params = {}, opts = {}) req = {} req[:method] = :put req[:path] = "/v1/group" req[:body] = params req[:model] = Braintrust::Models::Group @client.request(req, opts) end |
#retrieve(group_id, opts = {}) ⇒ Braintrust::Models::Group
Get a group object by its id
43 44 45 46 47 48 49 |
# File 'lib/braintrust/resources/group.rb', line 43 def retrieve(group_id, opts = {}) req = {} req[:method] = :get req[:path] = "/v1/group/#{group_id}" req[:model] = Braintrust::Models::Group @client.request(req, opts) end |
#update(group_id, params = {}, opts = {}) ⇒ Braintrust::Models::Group
Partially update a group 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.
69 70 71 72 73 74 75 76 |
# File 'lib/braintrust/resources/group.rb', line 69 def update(group_id, params = {}, opts = {}) req = {} req[:method] = :patch req[:path] = "/v1/group/#{group_id}" req[:body] = params req[:model] = Braintrust::Models::Group @client.request(req, opts) end |