Skip to content

Commit

Permalink
Update JSDoc for proper autocompletion (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
shazron authored Oct 25, 2019
1 parent 192fcf9 commit 643f237
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 23 deletions.
59 changes: 36 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,11 @@
<!--
Copyright 2019 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
-->

[![Version](https://img.shields.io/npm/v/@adobe/aio-lib-analytics.svg)](https://npmjs.org/package/@adobe/aio-lib-analytics)
[![Downloads/week](https://img.shields.io/npm/dw/@adobe/aio-lib-analytics.svg)](https://npmjs.org/package/@adobe/aio-lib-analytics)
[![Build Status](https://travis-ci.com/adobe/aio-lib-analytics.svg?branch=master)](https://travis-ci.com/adobe/aio-lib-analytics)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Greenkeeper badge](https://badges.greenkeeper.io/adobe/aio-lib-analytics.svg)](https://greenkeeper.io/)
[![Codecov Coverage](https://img.shields.io/codecov/c/github/adobe/aio-lib-analytics/master.svg?style=flat-square)](https://codecov.io/gh/adobe/aio-lib-analytics/)

# Adobe I/O - Adobe Analytics SDK
Javascript SDK wrapping [Adobe Analytics 2.0 APIs](https://adobedocs.github.io/analytics-2.0-apis/#/).
# I/O CNA Adobe Analytics Core SDK
Javascript Core SDK wrapping [Adobe Analytics 2.0 APIs](https://adobedocs.github.io/analytics-2.0-apis/#/).


### Installing

```bash
$ npm install @adobe/aio-lib-analytics
$ npm install
```

### Usage
Expand Down Expand Up @@ -60,6 +42,24 @@ async function sdkTest() {
```
All Methods available under sdk are documented [<code>here</code>](#AnalyticsCoreAPI)

## Classes

<dl>
<dt><a href="#AnalyticsCoreAPI">AnalyticsCoreAPI</a></dt>
<dd><p>This class provides methods to call Adobe Analytics APIs.
Before calling any method initialize the instance by calling init method on it
with valid company id, apiKey and auth token</p>
</dd>
</dl>

## Functions

<dl>
<dt><a href="#init">init(companyId, apiKey, token)</a> ⇒ <code><a href="#AnalyticsCoreAPI">Promise.&lt;AnalyticsCoreAPI&gt;</a></code></dt>
<dd><p>Returns a Promise that resolves with a new TargetCoreAPI object.</p>
</dd>
</dl>

<a name="AnalyticsCoreAPI"></a>

## AnalyticsCoreAPI
Expand All @@ -70,7 +70,7 @@ with valid company id, apiKey and auth token
**Kind**: global class

* [AnalyticsCoreAPI](#AnalyticsCoreAPI)
* [.init(companyId, apiKey, token)](#AnalyticsCoreAPI+init)
* [.init(companyId, apiKey, token)](#AnalyticsCoreAPI+init)[<code>AnalyticsCoreAPI</code>](#AnalyticsCoreAPI)
* [.getCalculatedMetrics(options)](#AnalyticsCoreAPI+getCalculatedMetrics)
* [.getCalculatedMetricById(id, options)](#AnalyticsCoreAPI+getCalculatedMetricById)
* [.getCollections(options)](#AnalyticsCoreAPI+getCollections)
Expand All @@ -89,7 +89,7 @@ with valid company id, apiKey and auth token

<a name="AnalyticsCoreAPI+init"></a>

### analyticsCoreAPI.init(companyId, apiKey, token)
### analyticsCoreAPI.init(companyId, apiKey, token)[<code>AnalyticsCoreAPI</code>](#AnalyticsCoreAPI)
Initialize sdk.

**Kind**: instance method of [<code>AnalyticsCoreAPI</code>](#AnalyticsCoreAPI)
Expand Down Expand Up @@ -345,6 +345,19 @@ Retrieves a list of all users for the company designated by the auth\ntoken.
Get the current user.

**Kind**: instance method of [<code>AnalyticsCoreAPI</code>](#AnalyticsCoreAPI)
<a name="init"></a>

## init(companyId, apiKey, token) ⇒ [<code>Promise.&lt;AnalyticsCoreAPI&gt;</code>](#AnalyticsCoreAPI)
Returns a Promise that resolves with a new TargetCoreAPI object.

**Kind**: global function

| Param | Type | Description |
| --- | --- | --- |
| companyId | <code>string</code> | company ID to be used with Adobe Analytics. |
| apiKey | <code>string</code> | Your api key |
| token | <code>string</code> | Valid auth token |

### Debug Logs

LOG_LEVEL=debug <your_call_here>
Expand Down
9 changes: 9 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ const Swagger = require('swagger-client')
const { codes } = require('./SDKErrors')
const logger = require('@adobe/aio-lib-core-logging')('aio-lib-analytics', { level: process.env.LOG_LEVEL })

/**
* Returns a Promise that resolves with a new AnalyticsCoreAPI object.
*
* @param companyId {string} company ID to be used with Adobe Analytics.
* @param apiKey {string} Your api key
* @param token {string} Valid auth token
* @returns {Promise<AnalyticsCoreAPI>}
*/
function init (companyId, apiKey, token) {
return new Promise((resolve, reject) => {
const clientWrapper = new AnalyticsCoreAPI()
Expand Down Expand Up @@ -42,6 +50,7 @@ class AnalyticsCoreAPI {
* @param companyId {string} company ID to be used with Adobe Analytics.
* @param apiKey {string} Your api key
* @param token {string} Valid auth token
* @returns {AnalyticsCoreAPI}
*/
async init (companyId, apiKey, token) {
const initErrors = []
Expand Down

0 comments on commit 643f237

Please sign in to comment.