@deeprelay/sdk 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.openapi-generator/FILES +4 -8
- package/README.md +6 -6
- package/dist/apis/BillingApi.d.ts +29 -0
- package/dist/apis/BillingApi.js +88 -0
- package/dist/apis/index.d.ts +0 -1
- package/dist/apis/index.js +0 -1
- package/dist/esm/apis/BillingApi.d.ts +29 -0
- package/dist/esm/apis/BillingApi.js +88 -0
- package/dist/esm/apis/index.d.ts +0 -1
- package/dist/esm/apis/index.js +0 -1
- package/dist/esm/models/RefereeStatus.d.ts +79 -0
- package/dist/esm/models/RefereeStatus.js +70 -0
- package/dist/esm/models/Referral.d.ts +94 -0
- package/dist/esm/models/Referral.js +82 -0
- package/dist/esm/models/VideoJob.d.ts +6 -0
- package/dist/esm/models/VideoJob.js +2 -0
- package/dist/esm/models/index.d.ts +2 -3
- package/dist/esm/models/index.js +2 -3
- package/dist/esm/runtime.js +1 -1
- package/dist/models/RefereeStatus.d.ts +79 -0
- package/dist/models/RefereeStatus.js +78 -0
- package/dist/models/Referral.d.ts +94 -0
- package/dist/models/Referral.js +89 -0
- package/dist/models/VideoJob.d.ts +6 -0
- package/dist/models/VideoJob.js +2 -0
- package/dist/models/index.d.ts +2 -3
- package/dist/models/index.js +2 -3
- package/dist/runtime.js +1 -1
- package/docs/BillingApi.md +134 -0
- package/docs/RefereeStatus.md +47 -0
- package/docs/Referral.md +55 -0
- package/docs/VideoJob.md +2 -0
- package/package.json +1 -1
- package/src/apis/BillingApi.ts +98 -0
- package/src/apis/index.ts +0 -1
- package/src/models/RefereeStatus.ts +131 -0
- package/src/models/Referral.ts +164 -0
- package/src/models/VideoJob.ts +8 -0
- package/src/models/index.ts +2 -3
- package/src/runtime.ts +1 -1
- package/dist/apis/OperationsApi.d.ts +0 -33
- package/dist/apis/OperationsApi.js +0 -79
- package/dist/esm/apis/OperationsApi.d.ts +0 -33
- package/dist/esm/apis/OperationsApi.js +0 -75
- package/dist/esm/models/Operation.d.ts +0 -107
- package/dist/esm/models/Operation.js +0 -86
- package/dist/esm/models/OperationError.d.ts +0 -38
- package/dist/esm/models/OperationError.js +0 -43
- package/dist/esm/models/OperationResult.d.ts +0 -44
- package/dist/esm/models/OperationResult.js +0 -45
- package/dist/models/Operation.d.ts +0 -107
- package/dist/models/Operation.js +0 -94
- package/dist/models/OperationError.d.ts +0 -38
- package/dist/models/OperationError.js +0 -50
- package/dist/models/OperationResult.d.ts +0 -44
- package/dist/models/OperationResult.js +0 -52
- package/docs/Operation.md +0 -52
- package/docs/OperationError.md +0 -36
- package/docs/OperationResult.md +0 -39
- package/docs/OperationsApi.md +0 -80
- package/src/apis/OperationsApi.ts +0 -89
- package/src/models/Operation.ts +0 -179
- package/src/models/OperationError.ts +0 -73
- package/src/models/OperationResult.ts +0 -81
package/docs/BillingApi.md
CHANGED
|
@@ -7,8 +7,10 @@ All URIs are relative to *https://api.deeprelay.ai/v1*
|
|
|
7
7
|
| [**createCryptoDeposit**](BillingApi.md#createcryptodepositoperation) | **POST** /billing/deposits/crypto | Create a stablecoin deposit |
|
|
8
8
|
| [**createSubscriptionCheckout**](BillingApi.md#createsubscriptioncheckout) | **POST** /billing/subscription/checkout | Start a subscription checkout session |
|
|
9
9
|
| [**createSubscriptionPortal**](BillingApi.md#createsubscriptionportal) | **POST** /billing/subscription/portal | Open the billing portal to cancel or manage the subscription |
|
|
10
|
+
| [**deleteSpendingLimit**](BillingApi.md#deletespendinglimit) | **DELETE** /billing/spending-limit | Clear the org spending limit |
|
|
10
11
|
| [**getBalance**](BillingApi.md#getbalance) | **GET** /billing/balance | Get the org credit balance |
|
|
11
12
|
| [**getDeposit**](BillingApi.md#getdeposit) | **GET** /billing/deposits/{id} | Get one stablecoin deposit |
|
|
13
|
+
| [**getReferral**](BillingApi.md#getreferral) | **GET** /referrals | Get the org referral code, invite link, terms and stats |
|
|
12
14
|
| [**getSpendingLimit**](BillingApi.md#getspendinglimit) | **GET** /billing/spending-limit | Get the org spending limit |
|
|
13
15
|
| [**getSubscription**](BillingApi.md#getsubscription) | **GET** /billing/subscription | Get the org subscription status and quota usage |
|
|
14
16
|
| [**listDeposits**](BillingApi.md#listdeposits) | **GET** /billing/deposits | List stablecoin deposits |
|
|
@@ -245,6 +247,73 @@ example().catch(console.error);
|
|
|
245
247
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
246
248
|
|
|
247
249
|
|
|
250
|
+
## deleteSpendingLimit
|
|
251
|
+
|
|
252
|
+
> deleteSpendingLimit()
|
|
253
|
+
|
|
254
|
+
Clear the org spending limit
|
|
255
|
+
|
|
256
|
+
Removes the organization\'s monthly spending limit and daily spend cap entirely. Requires the `billing:write` scope AND org-admin privileges (a non-admin member gets 403). Returns 404 when no limit is configured. This is the only way to remove a limit through the API, because `PUT` floors `monthly_limit_dollars` at 1.00 and so cannot express \"no limit\".
|
|
257
|
+
|
|
258
|
+
### Example
|
|
259
|
+
|
|
260
|
+
```ts
|
|
261
|
+
import {
|
|
262
|
+
Configuration,
|
|
263
|
+
BillingApi,
|
|
264
|
+
} from '@deeprelay/sdk';
|
|
265
|
+
import type { DeleteSpendingLimitRequest } from '@deeprelay/sdk';
|
|
266
|
+
|
|
267
|
+
async function example() {
|
|
268
|
+
console.log("🚀 Testing @deeprelay/sdk SDK...");
|
|
269
|
+
const config = new Configuration({
|
|
270
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
271
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
272
|
+
});
|
|
273
|
+
const api = new BillingApi(config);
|
|
274
|
+
|
|
275
|
+
try {
|
|
276
|
+
const data = await api.deleteSpendingLimit();
|
|
277
|
+
console.log(data);
|
|
278
|
+
} catch (error) {
|
|
279
|
+
console.error(error);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// Run the test
|
|
284
|
+
example().catch(console.error);
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Parameters
|
|
288
|
+
|
|
289
|
+
This endpoint does not need any parameter.
|
|
290
|
+
|
|
291
|
+
### Return type
|
|
292
|
+
|
|
293
|
+
`void` (Empty response body)
|
|
294
|
+
|
|
295
|
+
### Authorization
|
|
296
|
+
|
|
297
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
298
|
+
|
|
299
|
+
### HTTP request headers
|
|
300
|
+
|
|
301
|
+
- **Content-Type**: Not defined
|
|
302
|
+
- **Accept**: `application/problem+json`
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
### HTTP response details
|
|
306
|
+
| Status code | Description | Response headers |
|
|
307
|
+
|-------------|-------------|------------------|
|
|
308
|
+
| **204** | No Content | - |
|
|
309
|
+
| **403** | Error response (RFC 7807) | - |
|
|
310
|
+
| **404** | Error response (RFC 7807) | - |
|
|
311
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
312
|
+
| **0** | Error response (RFC 7807) | - |
|
|
313
|
+
|
|
314
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
315
|
+
|
|
316
|
+
|
|
248
317
|
## getBalance
|
|
249
318
|
|
|
250
319
|
> Balance getBalance()
|
|
@@ -384,6 +453,71 @@ example().catch(console.error);
|
|
|
384
453
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
385
454
|
|
|
386
455
|
|
|
456
|
+
## getReferral
|
|
457
|
+
|
|
458
|
+
> Referral getReferral()
|
|
459
|
+
|
|
460
|
+
Get the org referral code, invite link, terms and stats
|
|
461
|
+
|
|
462
|
+
Returns the organization\'s shareable referral code and invite link (minting the code on first read), the program terms, the referrer\'s stats, and — when this organization itself signed up through someone else\'s link — its own progress toward the referee reward. Requires the `billing:read` scope. The organization is taken from the authenticated API key, never from a parameter. The program: share the invite link; when a friend signs up through it and spends `qualify_spend_cents` on inference, the referrer receives `reward_cents` and the friend receives `referee_reward_cents`, both as non-withdrawable credit, after a `hold_days` chargeback hold. The terms ride on the wire so a client never hard-codes the amounts. `referred` is ABSENT (not null) for an organization nobody referred — key on its presence. This is the same contract the dashboard\'s referral card reads.
|
|
463
|
+
|
|
464
|
+
### Example
|
|
465
|
+
|
|
466
|
+
```ts
|
|
467
|
+
import {
|
|
468
|
+
Configuration,
|
|
469
|
+
BillingApi,
|
|
470
|
+
} from '@deeprelay/sdk';
|
|
471
|
+
import type { GetReferralRequest } from '@deeprelay/sdk';
|
|
472
|
+
|
|
473
|
+
async function example() {
|
|
474
|
+
console.log("🚀 Testing @deeprelay/sdk SDK...");
|
|
475
|
+
const config = new Configuration({
|
|
476
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
477
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
478
|
+
});
|
|
479
|
+
const api = new BillingApi(config);
|
|
480
|
+
|
|
481
|
+
try {
|
|
482
|
+
const data = await api.getReferral();
|
|
483
|
+
console.log(data);
|
|
484
|
+
} catch (error) {
|
|
485
|
+
console.error(error);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
// Run the test
|
|
490
|
+
example().catch(console.error);
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
### Parameters
|
|
494
|
+
|
|
495
|
+
This endpoint does not need any parameter.
|
|
496
|
+
|
|
497
|
+
### Return type
|
|
498
|
+
|
|
499
|
+
[**Referral**](Referral.md)
|
|
500
|
+
|
|
501
|
+
### Authorization
|
|
502
|
+
|
|
503
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
504
|
+
|
|
505
|
+
### HTTP request headers
|
|
506
|
+
|
|
507
|
+
- **Content-Type**: Not defined
|
|
508
|
+
- **Accept**: `application/json`, `application/problem+json`
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
### HTTP response details
|
|
512
|
+
| Status code | Description | Response headers |
|
|
513
|
+
|-------------|-------------|------------------|
|
|
514
|
+
| **200** | OK | - |
|
|
515
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
516
|
+
| **0** | Error response (RFC 7807) | - |
|
|
517
|
+
|
|
518
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
519
|
+
|
|
520
|
+
|
|
387
521
|
## getSpendingLimit
|
|
388
522
|
|
|
389
523
|
> SpendingLimit getSpendingLimit()
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
|
|
2
|
+
# RefereeStatus
|
|
3
|
+
|
|
4
|
+
Present only when the organization signed up through someone else\'s invite link: where that referral sits and how far the organization is from unlocking its own reward.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`status` | string
|
|
11
|
+
`spentCents` | number
|
|
12
|
+
`qualifySpendCents` | number
|
|
13
|
+
`rewardCents` | number
|
|
14
|
+
`qualifiedAt` | Date
|
|
15
|
+
`holdUntil` | Date
|
|
16
|
+
`settledAt` | Date
|
|
17
|
+
|
|
18
|
+
## Example
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import type { RefereeStatus } from '@deeprelay/sdk'
|
|
22
|
+
|
|
23
|
+
// TODO: Update the object below with actual values
|
|
24
|
+
const example = {
|
|
25
|
+
"status": null,
|
|
26
|
+
"spentCents": null,
|
|
27
|
+
"qualifySpendCents": null,
|
|
28
|
+
"rewardCents": null,
|
|
29
|
+
"qualifiedAt": null,
|
|
30
|
+
"holdUntil": null,
|
|
31
|
+
"settledAt": null,
|
|
32
|
+
} satisfies RefereeStatus
|
|
33
|
+
|
|
34
|
+
console.log(example)
|
|
35
|
+
|
|
36
|
+
// Convert the instance to a JSON string
|
|
37
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
38
|
+
console.log(exampleJSON)
|
|
39
|
+
|
|
40
|
+
// Parse the JSON string back to an object
|
|
41
|
+
const exampleParsed = JSON.parse(exampleJSON) as RefereeStatus
|
|
42
|
+
console.log(exampleParsed)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
46
|
+
|
|
47
|
+
|
package/docs/Referral.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
|
|
2
|
+
# Referral
|
|
3
|
+
|
|
4
|
+
The organization\'s referral-program view: its invite link, the program terms, its referrer stats, and (only when it was itself referred) its referee progress. Amounts are USD cents.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`code` | string
|
|
11
|
+
`inviteUrl` | string
|
|
12
|
+
`pending` | number
|
|
13
|
+
`qualified` | number
|
|
14
|
+
`settled` | number
|
|
15
|
+
`earnedCents` | number
|
|
16
|
+
`rewardCents` | number
|
|
17
|
+
`refereeRewardCents` | number
|
|
18
|
+
`qualifySpendCents` | number
|
|
19
|
+
`holdDays` | number
|
|
20
|
+
`referred` | [RefereeStatus](RefereeStatus.md)
|
|
21
|
+
|
|
22
|
+
## Example
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import type { Referral } from '@deeprelay/sdk'
|
|
26
|
+
|
|
27
|
+
// TODO: Update the object below with actual values
|
|
28
|
+
const example = {
|
|
29
|
+
"code": GPU-7KQ2-M4XP,
|
|
30
|
+
"inviteUrl": https://deeprelay.ai/r/GPU-7KQ2-M4XP,
|
|
31
|
+
"pending": null,
|
|
32
|
+
"qualified": null,
|
|
33
|
+
"settled": null,
|
|
34
|
+
"earnedCents": null,
|
|
35
|
+
"rewardCents": null,
|
|
36
|
+
"refereeRewardCents": null,
|
|
37
|
+
"qualifySpendCents": null,
|
|
38
|
+
"holdDays": null,
|
|
39
|
+
"referred": null,
|
|
40
|
+
} satisfies Referral
|
|
41
|
+
|
|
42
|
+
console.log(example)
|
|
43
|
+
|
|
44
|
+
// Convert the instance to a JSON string
|
|
45
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
46
|
+
console.log(exampleJSON)
|
|
47
|
+
|
|
48
|
+
// Parse the JSON string back to an object
|
|
49
|
+
const exampleParsed = JSON.parse(exampleJSON) as Referral
|
|
50
|
+
console.log(exampleParsed)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
54
|
+
|
|
55
|
+
|
package/docs/VideoJob.md
CHANGED
|
@@ -17,6 +17,7 @@ Name | Type
|
|
|
17
17
|
`completedAt` | number
|
|
18
18
|
`expiresAt` | number
|
|
19
19
|
`error` | string
|
|
20
|
+
`errorMessage` | string
|
|
20
21
|
`costCents` | number
|
|
21
22
|
|
|
22
23
|
## Example
|
|
@@ -37,6 +38,7 @@ const example = {
|
|
|
37
38
|
"completedAt": null,
|
|
38
39
|
"expiresAt": null,
|
|
39
40
|
"error": null,
|
|
41
|
+
"errorMessage": null,
|
|
40
42
|
"costCents": null,
|
|
41
43
|
} satisfies VideoJob
|
|
42
44
|
|
package/package.json
CHANGED
package/src/apis/BillingApi.ts
CHANGED
|
@@ -38,6 +38,11 @@ import {
|
|
|
38
38
|
ProblemFromJSON,
|
|
39
39
|
ProblemToJSON,
|
|
40
40
|
} from '../models/Problem';
|
|
41
|
+
import {
|
|
42
|
+
type Referral,
|
|
43
|
+
ReferralFromJSON,
|
|
44
|
+
ReferralToJSON,
|
|
45
|
+
} from '../models/Referral';
|
|
41
46
|
import {
|
|
42
47
|
type SpendingLimit,
|
|
43
48
|
SpendingLimitFromJSON,
|
|
@@ -256,6 +261,52 @@ export class BillingApi extends runtime.BaseAPI {
|
|
|
256
261
|
return await response.value();
|
|
257
262
|
}
|
|
258
263
|
|
|
264
|
+
/**
|
|
265
|
+
* Creates request options for deleteSpendingLimit without sending the request
|
|
266
|
+
*/
|
|
267
|
+
async deleteSpendingLimitRequestOpts(): Promise<runtime.RequestOpts> {
|
|
268
|
+
const queryParameters: any = {};
|
|
269
|
+
|
|
270
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
271
|
+
|
|
272
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
273
|
+
const token = this.configuration.accessToken;
|
|
274
|
+
const tokenString = await token("bearerAuth", []);
|
|
275
|
+
|
|
276
|
+
if (tokenString) {
|
|
277
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
let urlPath = `/billing/spending-limit`;
|
|
282
|
+
|
|
283
|
+
return {
|
|
284
|
+
path: urlPath,
|
|
285
|
+
method: 'DELETE',
|
|
286
|
+
headers: headerParameters,
|
|
287
|
+
query: queryParameters,
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Removes the organization\'s monthly spending limit and daily spend cap entirely. Requires the `billing:write` scope AND org-admin privileges (a non-admin member gets 403). Returns 404 when no limit is configured. This is the only way to remove a limit through the API, because `PUT` floors `monthly_limit_dollars` at 1.00 and so cannot express \"no limit\".
|
|
293
|
+
* Clear the org spending limit
|
|
294
|
+
*/
|
|
295
|
+
async deleteSpendingLimitRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
296
|
+
const requestOptions = await this.deleteSpendingLimitRequestOpts();
|
|
297
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
298
|
+
|
|
299
|
+
return new runtime.VoidApiResponse(response);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Removes the organization\'s monthly spending limit and daily spend cap entirely. Requires the `billing:write` scope AND org-admin privileges (a non-admin member gets 403). Returns 404 when no limit is configured. This is the only way to remove a limit through the API, because `PUT` floors `monthly_limit_dollars` at 1.00 and so cannot express \"no limit\".
|
|
304
|
+
* Clear the org spending limit
|
|
305
|
+
*/
|
|
306
|
+
async deleteSpendingLimit(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
307
|
+
await this.deleteSpendingLimitRaw(initOverrides);
|
|
308
|
+
}
|
|
309
|
+
|
|
259
310
|
/**
|
|
260
311
|
* Creates request options for getBalance without sending the request
|
|
261
312
|
*/
|
|
@@ -358,6 +409,53 @@ export class BillingApi extends runtime.BaseAPI {
|
|
|
358
409
|
return await response.value();
|
|
359
410
|
}
|
|
360
411
|
|
|
412
|
+
/**
|
|
413
|
+
* Creates request options for getReferral without sending the request
|
|
414
|
+
*/
|
|
415
|
+
async getReferralRequestOpts(): Promise<runtime.RequestOpts> {
|
|
416
|
+
const queryParameters: any = {};
|
|
417
|
+
|
|
418
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
419
|
+
|
|
420
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
421
|
+
const token = this.configuration.accessToken;
|
|
422
|
+
const tokenString = await token("bearerAuth", []);
|
|
423
|
+
|
|
424
|
+
if (tokenString) {
|
|
425
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
let urlPath = `/referrals`;
|
|
430
|
+
|
|
431
|
+
return {
|
|
432
|
+
path: urlPath,
|
|
433
|
+
method: 'GET',
|
|
434
|
+
headers: headerParameters,
|
|
435
|
+
query: queryParameters,
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Returns the organization\'s shareable referral code and invite link (minting the code on first read), the program terms, the referrer\'s stats, and — when this organization itself signed up through someone else\'s link — its own progress toward the referee reward. Requires the `billing:read` scope. The organization is taken from the authenticated API key, never from a parameter. The program: share the invite link; when a friend signs up through it and spends `qualify_spend_cents` on inference, the referrer receives `reward_cents` and the friend receives `referee_reward_cents`, both as non-withdrawable credit, after a `hold_days` chargeback hold. The terms ride on the wire so a client never hard-codes the amounts. `referred` is ABSENT (not null) for an organization nobody referred — key on its presence. This is the same contract the dashboard\'s referral card reads.
|
|
441
|
+
* Get the org referral code, invite link, terms and stats
|
|
442
|
+
*/
|
|
443
|
+
async getReferralRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Referral>> {
|
|
444
|
+
const requestOptions = await this.getReferralRequestOpts();
|
|
445
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
446
|
+
|
|
447
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => ReferralFromJSON(jsonValue));
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Returns the organization\'s shareable referral code and invite link (minting the code on first read), the program terms, the referrer\'s stats, and — when this organization itself signed up through someone else\'s link — its own progress toward the referee reward. Requires the `billing:read` scope. The organization is taken from the authenticated API key, never from a parameter. The program: share the invite link; when a friend signs up through it and spends `qualify_spend_cents` on inference, the referrer receives `reward_cents` and the friend receives `referee_reward_cents`, both as non-withdrawable credit, after a `hold_days` chargeback hold. The terms ride on the wire so a client never hard-codes the amounts. `referred` is ABSENT (not null) for an organization nobody referred — key on its presence. This is the same contract the dashboard\'s referral card reads.
|
|
452
|
+
* Get the org referral code, invite link, terms and stats
|
|
453
|
+
*/
|
|
454
|
+
async getReferral(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Referral> {
|
|
455
|
+
const response = await this.getReferralRaw(initOverrides);
|
|
456
|
+
return await response.value();
|
|
457
|
+
}
|
|
458
|
+
|
|
361
459
|
/**
|
|
362
460
|
* Creates request options for getSpendingLimit without sending the request
|
|
363
461
|
*/
|
package/src/apis/index.ts
CHANGED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* deeprelay Public Developer API
|
|
5
|
+
* Programmatic API for deeprelay. Authenticate with API keys minted from the dashboard. See https://deeprelay.ai/docs for details.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.0
|
|
8
|
+
* Contact: support@deeprelay.ai
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { mapValues } from '../runtime';
|
|
16
|
+
/**
|
|
17
|
+
* Present only when the organization signed up through someone else's invite link: where that referral sits and how far the organization is from unlocking its own reward.
|
|
18
|
+
*
|
|
19
|
+
* @export
|
|
20
|
+
* @interface RefereeStatus
|
|
21
|
+
*/
|
|
22
|
+
export interface RefereeStatus {
|
|
23
|
+
/**
|
|
24
|
+
* Lifecycle state. `pending` until the spend gate is met; `qualified` inside the hold; `settled` once paid.
|
|
25
|
+
* @type {RefereeStatusStatusEnum}
|
|
26
|
+
* @memberof RefereeStatus
|
|
27
|
+
*/
|
|
28
|
+
status: RefereeStatusStatusEnum;
|
|
29
|
+
/**
|
|
30
|
+
* Cumulative inference spend so far.
|
|
31
|
+
* @type {number}
|
|
32
|
+
* @memberof RefereeStatus
|
|
33
|
+
*/
|
|
34
|
+
spentCents: number;
|
|
35
|
+
/**
|
|
36
|
+
* The spend that qualifies the referral.
|
|
37
|
+
* @type {number}
|
|
38
|
+
* @memberof RefereeStatus
|
|
39
|
+
*/
|
|
40
|
+
qualifySpendCents: number;
|
|
41
|
+
/**
|
|
42
|
+
* What this organization receives on settlement.
|
|
43
|
+
* @type {number}
|
|
44
|
+
* @memberof RefereeStatus
|
|
45
|
+
*/
|
|
46
|
+
rewardCents: number;
|
|
47
|
+
/**
|
|
48
|
+
* When the spend gate was met. Absent while pending.
|
|
49
|
+
* @type {Date}
|
|
50
|
+
* @memberof RefereeStatus
|
|
51
|
+
*/
|
|
52
|
+
qualifiedAt?: Date;
|
|
53
|
+
/**
|
|
54
|
+
* When the hold ends and both halves pay out. Absent while pending.
|
|
55
|
+
* @type {Date}
|
|
56
|
+
* @memberof RefereeStatus
|
|
57
|
+
*/
|
|
58
|
+
holdUntil?: Date;
|
|
59
|
+
/**
|
|
60
|
+
* When the reward was paid. Absent until settled.
|
|
61
|
+
* @type {Date}
|
|
62
|
+
* @memberof RefereeStatus
|
|
63
|
+
*/
|
|
64
|
+
settledAt?: Date;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @export
|
|
70
|
+
*/
|
|
71
|
+
export const RefereeStatusStatusEnum = {
|
|
72
|
+
Pending: 'pending',
|
|
73
|
+
Qualified: 'qualified',
|
|
74
|
+
Settled: 'settled',
|
|
75
|
+
Rejected: 'rejected'
|
|
76
|
+
} as const;
|
|
77
|
+
export type RefereeStatusStatusEnum = typeof RefereeStatusStatusEnum[keyof typeof RefereeStatusStatusEnum];
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Check if a given object implements the RefereeStatus interface.
|
|
82
|
+
*/
|
|
83
|
+
export function instanceOfRefereeStatus(value: object): value is RefereeStatus {
|
|
84
|
+
if (!('status' in value) || value['status'] === undefined) return false;
|
|
85
|
+
if ((!('spentCents' in (value as Record<string, any>)) && !('spent_cents' in (value as Record<string, any>))) || ((value as Record<string, any>)['spentCents'] === undefined && (value as Record<string, any>)['spent_cents'] === undefined)) return false;
|
|
86
|
+
if ((!('qualifySpendCents' in (value as Record<string, any>)) && !('qualify_spend_cents' in (value as Record<string, any>))) || ((value as Record<string, any>)['qualifySpendCents'] === undefined && (value as Record<string, any>)['qualify_spend_cents'] === undefined)) return false;
|
|
87
|
+
if ((!('rewardCents' in (value as Record<string, any>)) && !('reward_cents' in (value as Record<string, any>))) || ((value as Record<string, any>)['rewardCents'] === undefined && (value as Record<string, any>)['reward_cents'] === undefined)) return false;
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function RefereeStatusFromJSON(json: any): RefereeStatus {
|
|
92
|
+
return RefereeStatusFromJSONTyped(json, false);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function RefereeStatusFromJSONTyped(json: any, ignoreDiscriminator: boolean): RefereeStatus {
|
|
96
|
+
if (json == null) {
|
|
97
|
+
return json;
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
|
|
101
|
+
'status': json['status'],
|
|
102
|
+
'spentCents': json['spent_cents'],
|
|
103
|
+
'qualifySpendCents': json['qualify_spend_cents'],
|
|
104
|
+
'rewardCents': json['reward_cents'],
|
|
105
|
+
'qualifiedAt': json['qualified_at'] == null ? undefined : (new Date(json['qualified_at'])),
|
|
106
|
+
'holdUntil': json['hold_until'] == null ? undefined : (new Date(json['hold_until'])),
|
|
107
|
+
'settledAt': json['settled_at'] == null ? undefined : (new Date(json['settled_at'])),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function RefereeStatusToJSON(json: any): RefereeStatus {
|
|
112
|
+
return RefereeStatusToJSONTyped(json, false);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export function RefereeStatusToJSONTyped(value?: RefereeStatus | null, ignoreDiscriminator: boolean = false): any {
|
|
116
|
+
if (value == null) {
|
|
117
|
+
return value;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return {
|
|
121
|
+
|
|
122
|
+
'status': value['status'],
|
|
123
|
+
'spent_cents': value['spentCents'],
|
|
124
|
+
'qualify_spend_cents': value['qualifySpendCents'],
|
|
125
|
+
'reward_cents': value['rewardCents'],
|
|
126
|
+
'qualified_at': value['qualifiedAt'] == null ? value['qualifiedAt'] : value['qualifiedAt'].toISOString(),
|
|
127
|
+
'hold_until': value['holdUntil'] == null ? value['holdUntil'] : value['holdUntil'].toISOString(),
|
|
128
|
+
'settled_at': value['settledAt'] == null ? value['settledAt'] : value['settledAt'].toISOString(),
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|