Class: Braintrust::Resources::ProjectTags

Inherits:
Object
  • Object
show all
Defined in:
lib/braintrust/resources/project_tags.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ ProjectTags

Returns a new instance of ProjectTags.



6
7
8
# File 'lib/braintrust/resources/project_tags.rb', line 6

def initialize(client:)
  @client = client
end

Instance Method Details

#create(params = {}, opts = {}) ⇒ Braintrust::Models::ProjectTag

Create a new project_tag. If there is an existing project_tag in the project with the same name as the one specified in the request, will return the existing project_tag unmodified

Parameters:

  • params (Hash) (defaults to: {})

    Attributes to send in this request.

  • opts (Hash|RequestOptions) (defaults to: {})

    Options to specify HTTP behaviour for this request.

Options Hash (params):

  • :name (String)

    Name of the project tag

  • :project_id (String)

    Unique identifier for the project that the project tag belongs under

  • :color (String)

    Color of the tag for the UI

  • :description (String)

    Textual description of the project tag

Returns:



23
24
25
26
27
28
29
30
# File 'lib/braintrust/resources/project_tags.rb', line 23

def create(params = {}, opts = {})
  req = {}
  req[:method] = :post
  req[:path] = "/v1/project_tag"
  req[:body] = params
  req[:model] = Braintrust::Models::ProjectTag
  @client.request(req, opts)
end

#delete(project_tag_id, opts = {}) ⇒ Braintrust::Models::ProjectTag

Delete a project_tag object by its id

Parameters:

  • project_tag_id (String)

    ProjectTag id

  • opts (Hash|RequestOptions) (defaults to: {})

    Options to specify HTTP behaviour for this request.

Returns:



110
111
112
113
114
115
116
# File 'lib/braintrust/resources/project_tags.rb', line 110

def delete(project_tag_id, opts = {})
  req = {}
  req[:method] = :delete
  req[:path] = "/v1/project_tag/#{project_tag_id}"
  req[:model] = Braintrust::Models::ProjectTag
  @client.request(req, opts)
end

#list(params = {}, opts = {}) ⇒ Braintrust::ListObjects<Braintrust::Models::ProjectTag>

List out all project_tags. The project_tags are sorted by creation date, with the most recently-created project_tags coming first

Parameters:

  • params (Hash) (defaults to: {})

    Attributes to send in this request.

  • opts (Hash|RequestOptions) (defaults to: {})

    Options to specify HTTP behaviour for this request.

Options Hash (params):

  • :ending_before (String)

    Pagination cursor id.

    For example, if the initial item in the last page you fetched had an id of foo, pass ending_before=foo to fetch the previous page. Note: you may only pass one of starting_after and ending_before

  • :ids (Array<String>|String)

    Filter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times

  • :limit (Integer)

    Limit the number of objects to return

  • :org_name (String)

    Filter search results to within a particular organization

  • :project_id (String)

    Project id

  • :project_name (String)

    Name of the project to search for

  • :project_tag_name (String)

    Name of the project_tag to search for

  • :starting_after (String)

    Pagination cursor id.

    For example, if the final item in the last page you fetched had an id of foo, pass starting_after=foo to fetch the next page. Note: you may only pass one of starting_after and ending_before

Returns:



94
95
96
97
98
99
100
101
102
# File 'lib/braintrust/resources/project_tags.rb', line 94

def list(params = {}, opts = {})
  req = {}
  req[:method] = :get
  req[:path] = "/v1/project_tag"
  req[:query] = params
  req[:page] = Braintrust::ListObjects
  req[:model] = Braintrust::Models::ProjectTag
  @client.request(req, opts)
end

#replace(params = {}, opts = {}) ⇒ Braintrust::Models::ProjectTag

Create or replace project_tag. If there is an existing project_tag in the project with the same name as the one specified in the request, will replace the existing project_tag with the provided fields

Parameters:

  • params (Hash) (defaults to: {})

    Attributes to send in this request.

  • opts (Hash|RequestOptions) (defaults to: {})

    Options to specify HTTP behaviour for this request.

Options Hash (params):

  • :name (String)

    Name of the project tag

  • :project_id (String)

    Unique identifier for the project that the project tag belongs under

  • :color (String)

    Color of the tag for the UI

  • :description (String)

    Textual description of the project tag

Returns:



131
132
133
134
135
136
137
138
# File 'lib/braintrust/resources/project_tags.rb', line 131

def replace(params = {}, opts = {})
  req = {}
  req[:method] = :put
  req[:path] = "/v1/project_tag"
  req[:body] = params
  req[:model] = Braintrust::Models::ProjectTag
  @client.request(req, opts)
end

#retrieve(project_tag_id, opts = {}) ⇒ Braintrust::Models::ProjectTag

Get a project_tag object by its id

Parameters:

  • project_tag_id (String)

    ProjectTag id

  • opts (Hash|RequestOptions) (defaults to: {})

    Options to specify HTTP behaviour for this request.

Returns:



38
39
40
41
42
43
44
# File 'lib/braintrust/resources/project_tags.rb', line 38

def retrieve(project_tag_id, opts = {})
  req = {}
  req[:method] = :get
  req[:path] = "/v1/project_tag/#{project_tag_id}"
  req[:model] = Braintrust::Models::ProjectTag
  @client.request(req, opts)
end

#update(project_tag_id, params = {}, opts = {}) ⇒ Braintrust::Models::ProjectTag

Partially update a project_tag 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.

Parameters:

  • project_tag_id (String)

    ProjectTag id

  • params (Hash) (defaults to: {})

    Attributes to send in this request.

  • opts (Hash|RequestOptions) (defaults to: {})

    Options to specify HTTP behaviour for this request.

Options Hash (params):

  • :color (String)

    Color of the tag for the UI

  • :description (String)

    Textual description of the project tag

  • :name (String)

    Name of the project tag

Returns:



60
61
62
63
64
65
66
67
# File 'lib/braintrust/resources/project_tags.rb', line 60

def update(project_tag_id, params = {}, opts = {})
  req = {}
  req[:method] = :patch
  req[:path] = "/v1/project_tag/#{project_tag_id}"
  req[:body] = params
  req[:model] = Braintrust::Models::ProjectTag
  @client.request(req, opts)
end