Class: OpenAI::Resources::Admin::Organization::Projects::SpendAlerts
- Inherits:
-
Object
- Object
- OpenAI::Resources::Admin::Organization::Projects::SpendAlerts
- Defined in:
- lib/openai/resources/admin/organization/projects/spend_alerts.rb
Instance Method Summary collapse
-
#create(project_id, currency:, interval:, notification_channel:, threshold_amount:, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::Projects::ProjectSpendAlert
Creates a project spend alert.
-
#delete(alert_id, project_id:, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::Projects::ProjectSpendAlertDeleted
Deletes a project spend alert.
-
#initialize(client:) ⇒ SpendAlerts
constructor
private
A new instance of SpendAlerts.
-
#list(project_id, after: nil, before: nil, limit: nil, order: nil, request_options: {}) ⇒ OpenAI::Internal::ConversationCursorPage<OpenAI::Models::Admin::Organization::Projects::ProjectSpendAlert>
Some parameter documentations has been truncated, see Models::Admin::Organization::Projects::SpendAlertListParams for more details.
-
#update(alert_id, project_id:, currency:, interval:, notification_channel:, threshold_amount:, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::Projects::ProjectSpendAlert
Updates a project 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.
145 146 147 |
# File 'lib/openai/resources/admin/organization/projects/spend_alerts.rb', line 145 def initialize(client:) @client = client end |
Instance Method Details
#create(project_id, currency:, interval:, notification_channel:, threshold_amount:, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::Projects::ProjectSpendAlert
Creates a project spend alert.
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/openai/resources/admin/organization/projects/spend_alerts.rb', line 28 def create(project_id, params) parsed, = OpenAI::Admin::Organization::Projects::SpendAlertCreateParams.dump_request(params) @client.request( method: :post, path: ["organization/projects/%1$s/spend_alerts", project_id], body: parsed, model: OpenAI::Admin::Organization::Projects::ProjectSpendAlert, security: {admin_api_key_auth: true}, options: ) end |
#delete(alert_id, project_id:, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::Projects::ProjectSpendAlertDeleted
Deletes a project spend alert.
127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/openai/resources/admin/organization/projects/spend_alerts.rb', line 127 def delete(alert_id, params) parsed, = OpenAI::Admin::Organization::Projects::SpendAlertDeleteParams.dump_request(params) project_id = parsed.delete(:project_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["organization/projects/%1$s/spend_alerts/%2$s", project_id, alert_id], model: OpenAI::Admin::Organization::Projects::ProjectSpendAlertDeleted, security: {admin_api_key_auth: true}, options: ) end |
#list(project_id, after: nil, before: nil, limit: nil, order: nil, request_options: {}) ⇒ OpenAI::Internal::ConversationCursorPage<OpenAI::Models::Admin::Organization::Projects::ProjectSpendAlert>
Some parameter documentations has been truncated, see Models::Admin::Organization::Projects::SpendAlertListParams for more details.
Lists project spend alerts.
100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/openai/resources/admin/organization/projects/spend_alerts.rb', line 100 def list(project_id, params = {}) parsed, = OpenAI::Admin::Organization::Projects::SpendAlertListParams.dump_request(params) query = OpenAI::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["organization/projects/%1$s/spend_alerts", project_id], query: query, page: OpenAI::Internal::ConversationCursorPage, model: OpenAI::Admin::Organization::Projects::ProjectSpendAlert, security: {admin_api_key_auth: true}, options: ) end |
#update(alert_id, project_id:, currency:, interval:, notification_channel:, threshold_amount:, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::Projects::ProjectSpendAlert
Updates a project spend alert.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/openai/resources/admin/organization/projects/spend_alerts.rb', line 61 def update(alert_id, params) parsed, = OpenAI::Admin::Organization::Projects::SpendAlertUpdateParams.dump_request(params) project_id = parsed.delete(:project_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :post, path: ["organization/projects/%1$s/spend_alerts/%2$s", project_id, alert_id], body: parsed, model: OpenAI::Admin::Organization::Projects::ProjectSpendAlert, security: {admin_api_key_auth: true}, options: ) end |