Class: Braintrust::Resources::Users
- Inherits:
-
Object
- Object
- Braintrust::Resources::Users
- Defined in:
- lib/braintrust/resources/users.rb
Instance Method Summary collapse
-
#initialize(client:) ⇒ Users
constructor
A new instance of Users.
-
#list(params = {}, opts = {}) ⇒ Braintrust::ListObjects<Braintrust::Models::User>
List out all users.
-
#retrieve(user_id, opts = {}) ⇒ Braintrust::Models::User
Get a user object by its id.
Constructor Details
#initialize(client:) ⇒ Users
Returns a new instance of Users.
6 7 8 |
# File 'lib/braintrust/resources/users.rb', line 6 def initialize(client:) @client = client end |
Instance Method Details
#list(params = {}, opts = {}) ⇒ Braintrust::ListObjects<Braintrust::Models::User>
List out all users. The users are sorted by creation date, with the most recently-created users coming first
52 53 54 55 56 57 58 59 60 |
# File 'lib/braintrust/resources/users.rb', line 52 def list(params = {}, opts = {}) req = {} req[:method] = :get req[:path] = "/v1/user" req[:query] = params req[:page] = Braintrust::ListObjects req[:model] = Braintrust::Models::User @client.request(req, opts) end |
#retrieve(user_id, opts = {}) ⇒ Braintrust::Models::User
Get a user object by its id
16 17 18 19 20 21 22 |
# File 'lib/braintrust/resources/users.rb', line 16 def retrieve(user_id, opts = {}) req = {} req[:method] = :get req[:path] = "/v1/user/#{user_id}" req[:model] = Braintrust::Models::User @client.request(req, opts) end |