$ npm install @adobe/aio-lib-segmentation-service
- Initialize the SDK
const sdk = require('@adobe/aio-lib-segmentation-service')
async function sdkTest() {
//initialize sdk
const client = await sdk.init('<tenant>', 'x-api-key', '<valid auth token>')
}
- Call methods using the initialized SDK
const sdk = require('@adobe/aio-lib-segmentation-service')
async function sdkTest() {
// initialize sdk
const client = await sdk.init('<tenant>', 'x-api-key', '<valid auth token>')
// call methods
try {
// get... something
const result = await client.getSomething({})
console.log(result)
} catch (e) {
console.error(e)
}
}
- SegmentationServiceAPI
This class provides methods to call your SegmentationServiceAPI APIs. Before calling any method initialize the instance by calling the
init
method on it with valid values for tenantId, apiKey and accessToken
- responseBodyToString(response) β
Promise.<string>
Converts a fetch Response object's body contents to a string.
- filterUndefinedOrNull(json) β
object
Filters a json object, removing any undefined or null entries. Returns a new object (does not mutate original)
- requestToString(request) β
object
Converts a fetch Request object to a string.
- init(tenantId, apiKey, accessToken) β
Promise.<SegmentationServiceAPI>
Returns a Promise that resolves with a new SegmentationServiceAPI object.
- MyParameters :
object
An example of a typed object.
- AnotherThing :
object
Another typed object.
This class provides methods to call your SegmentationServiceAPI APIs.
Before calling any method initialize the instance by calling the init
method on it
with valid values for tenantId, apiKey and accessToken
Kind: global class
- SegmentationServiceAPI
- .tenantId :
string
- .apiKey :
string
- .accessToken :
string
- .init(tenantId, apiKey, accessToken) β
Promise.<SegmentationServiceAPI>
- .getSomething([parameters]) β
Promise.<Response>
- .tenantId :
The tenant id
Kind: instance property of SegmentationServiceAPI
The api key from your integration
Kind: instance property of SegmentationServiceAPI
The access token from your integration
Kind: instance property of SegmentationServiceAPI
segmentationServiceAPI.init(tenantId, apiKey, accessToken) β Promise.<SegmentationServiceAPI>
Initializes a SegmentationServiceAPI object and returns it.
Kind: instance method of SegmentationServiceAPI
Returns: Promise.<SegmentationServiceAPI>
- a SegmentationServiceAPI object
Param | Type | Description |
---|---|---|
tenantId | string |
the tenant id |
apiKey | string |
the API key for your integration |
accessToken | string |
the access token for your integration |
Get something.
Kind: instance method of SegmentationServiceAPI
Returns: Promise.<Response>
- the response
Param | Type | Default | Description |
---|---|---|---|
[parameters] | MyParameters |
{} |
parameters to pass |
Converts a fetch Response object's body contents to a string.
Kind: global function
Returns: Promise.<string>
- a Promise that resolves to the converted object's body contents
Param | Type | Description |
---|---|---|
response | Response |
the response object |
Filters a json object, removing any undefined or null entries. Returns a new object (does not mutate original)
Kind: global function
Returns: object
- the filtered object (a new object)
Param | Type | Description |
---|---|---|
json | object |
the json object to filter |
Converts a fetch Request object to a string.
Kind: global function
Returns: object
- the converted object
Param | Type | Description |
---|---|---|
request | Request |
the request object |
init(tenantId, apiKey, accessToken) β Promise.<SegmentationServiceAPI>
Returns a Promise that resolves with a new SegmentationServiceAPI object.
Kind: global function
Returns: Promise.<SegmentationServiceAPI>
- a Promise with a SegmentationServiceAPI object
Param | Type | Description |
---|---|---|
tenantId | string |
the tenant id |
apiKey | string |
the API key for your integration |
accessToken | string |
the access token for your integration |
An example of a typed object.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
optionA | string |
some option |
optionB | string |
another option |
Another typed object.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
mayBeSomething | boolean |
an option |
LOG_LEVEL=debug <your_call_here>
Prepend the LOG_LEVEL
environment variable and debug
value to the call that invokes your function, on the command line. This should output a lot of debug data for your SDK calls.
Contributions are welcome! Read the Contributing Guide for more information.
This project is licensed under the Apache V2 License. See LICENSE for more information.