@narrative.io/data-collaboration-sdk-ts 0.0.49 → 0.0.50
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/build/contracts/index.d.ts +12 -5
- package/build/contracts/index.js +9 -0
- package/build/contracts/types.d.ts +32 -0
- package/build/index.d.ts +3 -2
- package/build/index.js +3 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseApi } from '../base-api';
|
|
2
|
-
import { type CustomerContract, type PaymentMethod } from './types';
|
|
2
|
+
import { type CustomerContractResponse, type CustomerContract, type PaymentMethod, type ContractRate } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* A class for accessing the Contracts API.
|
|
5
5
|
* @extends BaseApi
|
|
@@ -10,7 +10,7 @@ declare class ContractsApi extends BaseApi {
|
|
|
10
10
|
*
|
|
11
11
|
* @returns {Promise<CustomerContract[]>} A promise that resolves with the list of contracts.
|
|
12
12
|
*/
|
|
13
|
-
getContracts(): Promise<
|
|
13
|
+
getContracts(): Promise<CustomerContractResponse[]>;
|
|
14
14
|
/**
|
|
15
15
|
* Get a customer contract based on the contract ID
|
|
16
16
|
*
|
|
@@ -18,7 +18,7 @@ declare class ContractsApi extends BaseApi {
|
|
|
18
18
|
* @returns Promise that resolves to the customer contract
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
|
-
getContract(contractId: string): Promise<
|
|
21
|
+
getContract(contractId: string): Promise<CustomerContractResponse>;
|
|
22
22
|
/**
|
|
23
23
|
* Update a customer contract's payment method based on the contract ID
|
|
24
24
|
*
|
|
@@ -27,6 +27,13 @@ declare class ContractsApi extends BaseApi {
|
|
|
27
27
|
* @returns Promise that resolves to the updated customer contract
|
|
28
28
|
*
|
|
29
29
|
*/
|
|
30
|
-
updatePaymentMethod(contractId: string, paymentMethod: PaymentMethod): Promise<
|
|
30
|
+
updatePaymentMethod(contractId: string, paymentMethod: PaymentMethod): Promise<CustomerContractResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* Get the active contract for a company
|
|
33
|
+
*
|
|
34
|
+
* @returns Promise that resolves to the customer contract
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
getActiveContract(): Promise<CustomerContractResponse>;
|
|
31
38
|
}
|
|
32
|
-
export { ContractsApi, type CustomerContract, type PaymentMethod };
|
|
39
|
+
export { ContractsApi, type CustomerContractResponse, type CustomerContract, type PaymentMethod, type ContractRate };
|
package/build/contracts/index.js
CHANGED
|
@@ -40,5 +40,14 @@ class ContractsApi extends BaseApi {
|
|
|
40
40
|
async updatePaymentMethod(contractId, paymentMethod) {
|
|
41
41
|
return await this.put(`${resourceName}/${contractId}`, paymentMethod);
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Get the active contract for a company
|
|
45
|
+
*
|
|
46
|
+
* @returns Promise that resolves to the customer contract
|
|
47
|
+
*
|
|
48
|
+
*/
|
|
49
|
+
async getActiveContract() {
|
|
50
|
+
return await this.get(`${resourceName}/active`);
|
|
51
|
+
}
|
|
43
52
|
}
|
|
44
53
|
export { ContractsApi };
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export interface CustomerContractResponse {
|
|
2
|
+
contract?: CustomerContract;
|
|
3
|
+
rates?: ContractRate[];
|
|
4
|
+
}
|
|
1
5
|
export interface CustomerContract {
|
|
2
6
|
id: CustomerContractId;
|
|
3
7
|
payableCompanyId: CompanyId;
|
|
@@ -26,4 +30,32 @@ interface UserId {
|
|
|
26
30
|
interface CompanyId {
|
|
27
31
|
value: string;
|
|
28
32
|
}
|
|
33
|
+
export interface ContractRate {
|
|
34
|
+
rate?: Rate;
|
|
35
|
+
product?: ProductView;
|
|
36
|
+
start_at?: Date;
|
|
37
|
+
end_at?: Date;
|
|
38
|
+
created_at?: Date;
|
|
39
|
+
updated_at?: Date;
|
|
40
|
+
}
|
|
41
|
+
export interface Rate {
|
|
42
|
+
type: RateType;
|
|
43
|
+
unit_price: UnitPrice;
|
|
44
|
+
}
|
|
45
|
+
export type RateType = 'per_unit' | 'percent_of_gmv';
|
|
46
|
+
export interface UnitPrice {
|
|
47
|
+
value: number;
|
|
48
|
+
expressed_in: string;
|
|
49
|
+
currency?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface ProductView {
|
|
52
|
+
id?: string;
|
|
53
|
+
sku?: string;
|
|
54
|
+
sku_type?: string;
|
|
55
|
+
payable_company_id?: number;
|
|
56
|
+
name?: string;
|
|
57
|
+
unit?: string;
|
|
58
|
+
status?: ProductStatus;
|
|
59
|
+
}
|
|
60
|
+
export type ProductStatus = 'active' | 'archived';
|
|
29
61
|
export {};
|
package/build/index.d.ts
CHANGED
|
@@ -19,8 +19,9 @@ import { InstallationsApi, type Installation } from './installations';
|
|
|
19
19
|
import { NqlApi, type NqlCompileResult, type NqlQuery, type NqlResult } from './nql';
|
|
20
20
|
import { DataStreamsApi, type DataStream } from './data-streams';
|
|
21
21
|
import { ForecastApi, type ForecastRequest, type ForecastResponse, type CostForecastRequest, type CostForecastResponse, type JobState } from './forecast';
|
|
22
|
+
import { ContractsApi, type CustomerContractResponse, type CustomerContract, type PaymentMethod, type ContractRate } from './contracts';
|
|
22
23
|
declare class NarrativeApi extends BaseApi {
|
|
23
24
|
}
|
|
24
|
-
interface NarrativeApi extends BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi {
|
|
25
|
+
interface NarrativeApi extends BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi {
|
|
25
26
|
}
|
|
26
|
-
export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, type Resource, type UploadsResponse, type PingStatus, type Attribute, type Environment, type Config, type ApiRecords, type Dataset, type HealthCheckResult, type SampleRecords, type DatasetTableSummary, type DatasetTableSummaryAPIResponse, type Product, type MonetaryAmount, type CompanyInfo, type Installation, type FilePerSnapshotResponse, type BucketCreationRequest, type UpdateAccessTypeRequest, type NqlQuery, type NqlResult, type NqlCompileResult, type DataStream, type ForecastRequest, type ForecastResponse, type CostForecastRequest, type CostForecastResponse, type JobState };
|
|
27
|
+
export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, type Resource, type UploadsResponse, type PingStatus, type Attribute, type Environment, type Config, type ApiRecords, type Dataset, type HealthCheckResult, type SampleRecords, type DatasetTableSummary, type DatasetTableSummaryAPIResponse, type Product, type MonetaryAmount, type CompanyInfo, type Installation, type FilePerSnapshotResponse, type BucketCreationRequest, type UpdateAccessTypeRequest, type NqlQuery, type NqlResult, type NqlCompileResult, type DataStream, type ForecastRequest, type ForecastResponse, type CostForecastRequest, type CostForecastResponse, type JobState, type CustomerContractResponse, type CustomerContract, type PaymentMethod, type ContractRate };
|
package/build/index.js
CHANGED
|
@@ -13,7 +13,8 @@ import { InstallationsApi } from './installations';
|
|
|
13
13
|
import { NqlApi } from './nql';
|
|
14
14
|
import { DataStreamsApi } from './data-streams';
|
|
15
15
|
import { ForecastApi } from './forecast';
|
|
16
|
+
import { ContractsApi } from './contracts';
|
|
16
17
|
class NarrativeApi extends BaseApi {
|
|
17
18
|
}
|
|
18
|
-
applyMixins(NarrativeApi, [BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi]);
|
|
19
|
-
export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi };
|
|
19
|
+
applyMixins(NarrativeApi, [BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi]);
|
|
20
|
+
export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi };
|