@narrative.io/data-collaboration-sdk-ts 0.0.40 → 0.0.41
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.
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type ApiRecords } from '../types';
|
|
2
|
+
import { BaseApi } from '../base-api';
|
|
3
|
+
import { type DataStream } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* @module DataStreramsApi
|
|
6
|
+
* @description This module provides methods for interacting with Data Streams.
|
|
7
|
+
* @extends BaseApi
|
|
8
|
+
*/
|
|
9
|
+
declare class DataStreamsApi extends BaseApi {
|
|
10
|
+
/**
|
|
11
|
+
* @function getDataStreamsForDSM
|
|
12
|
+
* @memberof DataStreramsApi
|
|
13
|
+
* @description Fetches a list Data Streams that contain an offer with the data_streams_market channel, given a search term
|
|
14
|
+
* @returns {Promise<ApiRecords<DataStream>>} A promise that resolves to the list of Data Streams.
|
|
15
|
+
*/
|
|
16
|
+
getDataStreamsForDSM(searchTerm: string, authenticated: boolean): Promise<ApiRecords<DataStream>>;
|
|
17
|
+
/**
|
|
18
|
+
* Gets a single Data Stream given a slug and companyId.
|
|
19
|
+
*
|
|
20
|
+
* @param {number} slug - The slug for the Data Stream to return.
|
|
21
|
+
* @param {number} companyId - The companyId for the Data Stream to return.
|
|
22
|
+
* @returns {Promise<DataStream>} A promise that resolves with the Data Stream.
|
|
23
|
+
*/
|
|
24
|
+
getDataStreamBySlug(slug: string, companyId: number, authenticated: boolean): Promise<DataStream>;
|
|
25
|
+
private getBaseUri;
|
|
26
|
+
}
|
|
27
|
+
export { DataStreamsApi, type DataStream };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BaseApi } from '../base-api';
|
|
2
|
+
const resourceName = 'data-stream';
|
|
3
|
+
/**
|
|
4
|
+
* @module DataStreramsApi
|
|
5
|
+
* @description This module provides methods for interacting with Data Streams.
|
|
6
|
+
* @extends BaseApi
|
|
7
|
+
*/
|
|
8
|
+
class DataStreamsApi extends BaseApi {
|
|
9
|
+
/**
|
|
10
|
+
* @function getDataStreamsForDSM
|
|
11
|
+
* @memberof DataStreramsApi
|
|
12
|
+
* @description Fetches a list Data Streams that contain an offer with the data_streams_market channel, given a search term
|
|
13
|
+
* @returns {Promise<ApiRecords<DataStream>>} A promise that resolves to the list of Data Streams.
|
|
14
|
+
*/
|
|
15
|
+
async getDataStreamsForDSM(searchTerm, authenticated) {
|
|
16
|
+
return await this.get(`${this.getBaseUri(authenticated)}/sales-channel/data-streams-market/search?q=${encodeURIComponent(searchTerm)}`);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Gets a single Data Stream given a slug and companyId.
|
|
20
|
+
*
|
|
21
|
+
* @param {number} slug - The slug for the Data Stream to return.
|
|
22
|
+
* @param {number} companyId - The companyId for the Data Stream to return.
|
|
23
|
+
* @returns {Promise<DataStream>} A promise that resolves with the Data Stream.
|
|
24
|
+
*/
|
|
25
|
+
async getDataStreamBySlug(slug, companyId, authenticated) {
|
|
26
|
+
return await this.get(`${this.getBaseUri(authenticated)}/company/${companyId}/slug/${slug}`);
|
|
27
|
+
}
|
|
28
|
+
getBaseUri(authenticated) {
|
|
29
|
+
if (authenticated) {
|
|
30
|
+
return resourceName;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return `public/${resourceName}`;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export { DataStreamsApi };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type Dataset } from '../datasets/types';
|
|
2
|
+
import { type DataRules } from './data-rules/types';
|
|
3
|
+
export interface DataStream {
|
|
4
|
+
id: number;
|
|
5
|
+
company_id: number;
|
|
6
|
+
name: string;
|
|
7
|
+
slug: string;
|
|
8
|
+
content?: DataStreamContent;
|
|
9
|
+
tags?: string[];
|
|
10
|
+
category?: string;
|
|
11
|
+
offers?: Offer[];
|
|
12
|
+
data_rules?: DataRules;
|
|
13
|
+
auth_rules?: AuthRules;
|
|
14
|
+
created_by: number;
|
|
15
|
+
created_at: Date;
|
|
16
|
+
updated_at: Date;
|
|
17
|
+
updated_by: number;
|
|
18
|
+
pagination_id: number;
|
|
19
|
+
datasets?: Dataset[];
|
|
20
|
+
}
|
|
21
|
+
export interface DataStreamContent {
|
|
22
|
+
description: string;
|
|
23
|
+
icon?: string;
|
|
24
|
+
sections?: string[];
|
|
25
|
+
}
|
|
26
|
+
export type SalesChannel = 'data_streams_market' | 'data_shop';
|
|
27
|
+
export interface Offer {
|
|
28
|
+
id: string;
|
|
29
|
+
channel: SalesChannel;
|
|
30
|
+
licensing: OfferLicensing;
|
|
31
|
+
pricing: OfferPricing;
|
|
32
|
+
shops?: string[];
|
|
33
|
+
}
|
|
34
|
+
export interface OfferLicensing {
|
|
35
|
+
period: string;
|
|
36
|
+
license: {
|
|
37
|
+
id: string;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export interface OfferPricing {
|
|
41
|
+
micro_cents_usd: number;
|
|
42
|
+
type: 'per_record' | 'max_price_per_record';
|
|
43
|
+
}
|
|
44
|
+
export interface AuthRules {
|
|
45
|
+
company_contstraint: CompanyConstraint;
|
|
46
|
+
}
|
|
47
|
+
export interface CompanyConstraint {
|
|
48
|
+
type: InclusionType;
|
|
49
|
+
}
|
|
50
|
+
export type InclusionType = 'include' | 'exclude';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/build/index.d.ts
CHANGED
|
@@ -17,8 +17,9 @@ import { type Product, ProductsApi } from './products';
|
|
|
17
17
|
import { CompanyInfoApi, type CompanyInfo } from './company-info';
|
|
18
18
|
import { InstallationsApi, type Installation } from './installations';
|
|
19
19
|
import { NqlApi, type NqlCompileResult, type NqlQuery, type NqlResult } from './nql';
|
|
20
|
+
import { DataStreamsApi, type DataStream } from './data-streams';
|
|
20
21
|
declare class NarrativeApi extends BaseApi {
|
|
21
22
|
}
|
|
22
23
|
interface NarrativeApi extends BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi {
|
|
23
24
|
}
|
|
24
|
-
export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, 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 };
|
|
25
|
+
export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, 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 };
|
package/build/index.js
CHANGED
|
@@ -11,7 +11,8 @@ import { ProductsApi } from './products';
|
|
|
11
11
|
import { CompanyInfoApi } from './company-info';
|
|
12
12
|
import { InstallationsApi } from './installations';
|
|
13
13
|
import { NqlApi } from './nql';
|
|
14
|
+
import { DataStreamsApi } from './data-streams';
|
|
14
15
|
class NarrativeApi extends BaseApi {
|
|
15
16
|
}
|
|
16
17
|
applyMixins(NarrativeApi, [BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi]);
|
|
17
|
-
export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi };
|
|
18
|
+
export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi };
|