Query Available Sources

Developer Chat Apache 2.0 License Typescript Web


The SDK Provides a function which you can use to determine what sources can be onboarded for your contract. The Contract you pass in must be a READ contract, which means it's a contract that asks for user's data.

Configuration Options

See all possible configurations when initializing the SDK.

Returns

The available sources.

Examples

The most basic initialization:

// Initialize the SDK
import {init} from "@digime/digime-sdk-nodejs";
const sdk = init({ applicationId: <you-application-id> });


// contractDetails - The same one passed into getAuthorizeUrl().
// sourcesBodyParams - Params for searching, paging, filtering, sorting and other options.

const contractDetails = {
contractId: <your-contract-id>,
privateKey: <private-key-for-contract-id>,
}

const sourcesBodyParams = {
limit: <number of items returned per page, default is 10>,
offset: <page offset, default is 0>,
sort: <sort options>,
query: {
search: <search options>,
include: <controle what fileds will be included in response>,
filter: {
id: <filter response by ID>,
publishedStatus: <filter by published status "approved" | "pending" | "deprecated" | "blocked" | "sampledataonly", approved is default>;
service: {
id: <filter by array of service IDs>,
},
/**
* Available countries with IDs can be fetched with queryCountries.
*/
country: {
id: <filter by array of country IDs>,
},
/**
* Available categories with IDs can be fetched with queryCategories.
*/
category: {
id: <filter by array of category IDs>,
},
/**
* Available platforms with IDs can be fetched with queryPlatforms.
*/
platform: {
<filter by array of platforms IDs>,
},
type: {
id: <filter by array of type IDs>,
},
sourceId: <filter by source IDs>,
};
};
}

const sources = await sdk.querySources({
contractDetails,
sourcesBodyParams,
});

More on sourcesBodyParams can be checked here.

Generated using TypeDoc