-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathspend-limit.ts
More file actions
144 lines (128 loc) · 3.61 KB
/
Copy pathspend-limit.ts
File metadata and controls
144 lines (128 loc) · 3.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
// File generated from our OpenAPI spec by Castiron. See CONTRIBUTING.md for details.
import { APIResource } from '../../../core/resource';
import { APIPromise } from '../../../core/api-promise';
import { RequestOptions } from '../../../internal/request-options';
export class SpendLimit extends APIResource {
/**
* Get the organization's hard spend limit.
*
* @example
* ```ts
* const organizationSpendLimit =
* await client.admin.organization.spendLimit.retrieve();
* ```
*/
retrieve(options?: RequestOptions): APIPromise<OrganizationSpendLimit> {
return this._client.get('/organization/spend_limit', {
...options,
__security: { adminAPIKeyAuth: true },
});
}
/**
* Create or replace the organization's hard spend limit.
*
* @example
* ```ts
* const organizationSpendLimit =
* await client.admin.organization.spendLimit.update({
* currency: 'USD',
* interval: 'month',
* threshold_amount: 1,
* });
* ```
*/
update(body: SpendLimitUpdateParams, options?: RequestOptions): APIPromise<OrganizationSpendLimit> {
return this._client.post('/organization/spend_limit', {
body,
...options,
__security: { adminAPIKeyAuth: true },
});
}
/**
* Delete the organization's hard spend limit.
*
* @example
* ```ts
* const organizationSpendLimitDeleted =
* await client.admin.organization.spendLimit.delete();
* ```
*/
delete(options?: RequestOptions): APIPromise<OrganizationSpendLimitDeleted> {
return this._client.delete('/organization/spend_limit', {
...options,
__security: { adminAPIKeyAuth: true },
});
}
}
/**
* Represents a hard spend limit configured at the organization level.
*/
export interface OrganizationSpendLimit {
/**
* The currency for the threshold amount. Currently, only `USD` is supported.
*/
currency: (string & {}) | 'USD';
/**
* The current enforcement state of the hard spend limit.
*/
enforcement: OrganizationSpendLimit.Enforcement;
/**
* The time interval for evaluating spend against the threshold. Currently, only
* `month` is supported.
*/
interval: (string & {}) | 'month';
/**
* The object type, which is always `organization.spend_limit`.
*/
object: 'organization.spend_limit';
/**
* The hard spend limit amount, in cents.
*/
threshold_amount: number;
}
export namespace OrganizationSpendLimit {
/**
* The current enforcement state of the hard spend limit.
*/
export interface Enforcement {
/**
* Whether the hard spend limit is currently enforcing.
*/
status: (string & {}) | 'inactive' | 'enforcing';
}
}
/**
* Confirmation payload returned after deleting an organization hard spend limit.
*/
export interface OrganizationSpendLimitDeleted {
/**
* Whether the hard spend limit was deleted.
*/
deleted: boolean;
/**
* The object type, which is always `organization.spend_limit.deleted`.
*/
object: 'organization.spend_limit.deleted';
}
export interface SpendLimitUpdateParams {
/**
* The currency for the threshold amount. Currently, only `USD` is supported.
*/
currency: 'USD';
/**
* The time interval for evaluating spend against the threshold. Currently, only
* `month` is supported.
*/
interval: 'month';
/**
* The hard spend limit amount, in cents.
*/
threshold_amount: number;
}
export declare namespace SpendLimit {
export {
type OrganizationSpendLimit as OrganizationSpendLimit,
type OrganizationSpendLimitDeleted as OrganizationSpendLimitDeleted,
type SpendLimitUpdateParams as SpendLimitUpdateParams,
};
}