Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rlancer/apimarket-node-client
Community supported, client library for AT&T API Marketplace
https://github.com/rlancer/apimarket-node-client
Last synced: about 2 months ago
JSON representation
Community supported, client library for AT&T API Marketplace
- Host: GitHub
- URL: https://github.com/rlancer/apimarket-node-client
- Owner: rlancer
- Created: 2019-04-10T19:11:55.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-05-07T20:28:01.000Z (over 5 years ago)
- Last Synced: 2024-11-06T18:08:36.567Z (2 months ago)
- Language: TypeScript
- Size: 47.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
AT&T API Marketplace - Community Nodejs Client
---[![npm version](https://badge.fury.io/js/%40collaborizm%2Fapimarket.svg)](https://badge.fury.io/js/%40collaborizm%2Fapimarket)
Get started with the new API Marketplace at
https://apimarket.att.com**Clone the examples! https://github.com/rlancer/apimarket-examples**
## Install
`$ npm i @collaborizm/apimarket`Built with Typescript, types included!
## Authentication
Library automatically refreshes access tokens, no need to worry about testing for token expiration.
```javascript
import { APIMarketplaceClient } from '@collaborizm/apimarket'// for user authentication
const apiMarketplaceClient = new APIMarketplaceClient({
username: '',
password: '',
grant_type: 'password',
client_id: '',
scope: 'openid'
})
// for project authentication
const apiMarketplaceClient = new APIMarketplaceClient({
grant_type: 'client_credentials',
client_id: '',
client_secret: '',
scope: 'openid'
})
// returns and object { id_token, access_token, id_token_decoded})
```## Usage with API Marketplace Javascript SDK
```javascript// Execute authentication on server
// getValidToken will automatically refresh your access token if it's about to expire
const tokenFromServer = await apiMarketplaceClient.getValidToken()// Include JS SDK included on client
const kandy = Kandy.create({
logs: {
logLevel: 'debug'
},
authentication: {
server: {
base: 'oauth-cpaas.att.com'
},
clientCorrelator: 'sampleCorrelator'
}
})const { id_token, access_token } = authenticateProject
this.kandy.setTokens({ idToken: id_token, accessToken: access_token })
```## Simple send SMS message
Creates a communication channel if one doesn't exist and sends an SMS
```javascript
await apiMarketplaceClient.simpleSmsSend({
toAddress: '+15555555555',
fromAddress: '',
message: 'Hey',
callbackUrl: 'http://example.com/callback'
})
```## REST API Methods
If you'd like to use any of the standard REST api methods, they're all here too```javascript
await apiMarketplaceClient.sendSMS({
toAddress: '+15555555555',
fromAddress: '',
message: 'Hey',
clientCorrelator: ''
})
```