Class: OpenAI::Resources::Admin::Organization::SpendAlerts
- Inherits:
-
Object
- Object
- OpenAI::Resources::Admin::Organization::SpendAlerts
- Defined in:
- lib/openai/resources/admin/organization/spend_alerts.rb
Instance Method Summary collapse
-
#create(currency:, interval:, notification_channel:, threshold_amount:, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::OrganizationSpendAlert
Creates an organization spend alert.
-
#delete(alert_id, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::OrganizationSpendAlertDeleted
Deletes an organization spend alert.
-
#initialize(client:) ⇒ SpendAlerts
constructor
private
A new instance of SpendAlerts.
-
#list(after: nil, before: nil, limit: nil, order: nil, request_options: {}) ⇒ OpenAI::Internal::ConversationCursorPage<OpenAI::Models::Admin::Organization::OrganizationSpendAlert>
Some parameter documentations has been truncated, see Models::Admin::Organization::SpendAlertListParams for more details.
-
#retrieve(alert_id, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::OrganizationSpendAlert
Retrieves an organization spend alert.
-
#update(alert_id, currency:, interval:, notification_channel:, threshold_amount:, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::OrganizationSpendAlert
Updates an organization spend alert.
Constructor Details
#initialize(client:) ⇒ SpendAlerts
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of SpendAlerts.
147 148 149 |
# File 'lib/openai/resources/admin/organization/spend_alerts.rb', line 147 def initialize(client:) @client = client end |
Instance Method Details
#create(currency:, interval:, notification_channel:, threshold_amount:, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::OrganizationSpendAlert
Creates an organization spend alert.
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/openai/resources/admin/organization/spend_alerts.rb', line 25 def create(params) parsed, = OpenAI::Admin::Organization::SpendAlertCreateParams.dump_request(params) @client.request( method: :post, path: "organization/spend_alerts", body: parsed, model: OpenAI::Admin::Organization::OrganizationSpendAlert, security: {admin_api_key_auth: true}, options: ) end |
#delete(alert_id, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::OrganizationSpendAlertDeleted
Deletes an organization spend alert.
134 135 136 137 138 139 140 141 142 |
# File 'lib/openai/resources/admin/organization/spend_alerts.rb', line 134 def delete(alert_id, params = {}) @client.request( method: :delete, path: ["organization/spend_alerts/%1$s", alert_id], model: OpenAI::Admin::Organization::OrganizationSpendAlertDeleted, security: {admin_api_key_auth: true}, options: params[:request_options] ) end |
#list(after: nil, before: nil, limit: nil, order: nil, request_options: {}) ⇒ OpenAI::Internal::ConversationCursorPage<OpenAI::Models::Admin::Organization::OrganizationSpendAlert>
Some parameter documentations has been truncated, see Models::Admin::Organization::SpendAlertListParams for more details.
Lists organization spend alerts.
109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/openai/resources/admin/organization/spend_alerts.rb', line 109 def list(params = {}) parsed, = OpenAI::Admin::Organization::SpendAlertListParams.dump_request(params) query = OpenAI::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "organization/spend_alerts", query: query, page: OpenAI::Internal::ConversationCursorPage, model: OpenAI::Admin::Organization::OrganizationSpendAlert, security: {admin_api_key_auth: true}, options: ) end |
#retrieve(alert_id, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::OrganizationSpendAlert
Retrieves an organization spend alert.
48 49 50 51 52 53 54 55 56 |
# File 'lib/openai/resources/admin/organization/spend_alerts.rb', line 48 def retrieve(alert_id, params = {}) @client.request( method: :get, path: ["organization/spend_alerts/%1$s", alert_id], model: OpenAI::Admin::Organization::OrganizationSpendAlert, security: {admin_api_key_auth: true}, options: params[:request_options] ) end |
#update(alert_id, currency:, interval:, notification_channel:, threshold_amount:, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::OrganizationSpendAlert
Updates an organization spend alert.
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/openai/resources/admin/organization/spend_alerts.rb', line 77 def update(alert_id, params) parsed, = OpenAI::Admin::Organization::SpendAlertUpdateParams.dump_request(params) @client.request( method: :post, path: ["organization/spend_alerts/%1$s", alert_id], body: parsed, model: OpenAI::Admin::Organization::OrganizationSpendAlert, security: {admin_api_key_auth: true}, options: ) end |