1.1.0 • Published 4 years ago

finops-andrew-sdk v1.1.0

Weekly downloads
28
License
-
Repository
-
Last release
4 years ago

Node.js SDK for the Prototype of our Service Catalogue

How to use

I have wrapped up the SDK to hide a lot of the functionality to help make it clearer how to use the sdk.

The current approach should give you intellisense via typescript defintions. However the functionality needed to give proper type checking on the client side via the use of typescript isn't yet functional. It won't be hard to implement however I didn't have time to figure out how to expose that while keeping the SDK api clean and simple to understand.

There are 3 endpoints you can hit:

  1. createProduct
  2. createUsage
  3. registerUsageOfProduct

However I would suggest just using the 3rd one. This is an endpoint which allows you to provide a usage along with either a ProductName or ProductId. If you provide a ProductName and there is no Product object in the DB it will automatically create it for you.

I think this is a nicer workflow which then allows the accountants to view all the automatically created products and assign the correct business area and pricing to it etc.

Basically this should be all the code you need to implement it into teammo

const SDK = require('finops-andrew-sdk')

const client = new SDK.Client()

const callback = (err, res) => {
  if (err) console.error(err);
  if (res) console.log(res);
}


client.registerUsageOfProduct({
  productName:'TeammoPaymentTypeX',
  usage:{
    name: 'A usage',      // Required
    code: '1234'          // Optional
    metadata: {           // Optional
      "Key": "Value",     // Must be a string value
      "Key2": "Value2"
    }
  }
}, callback)
1.2.0-beta.0

4 years ago

1.1.0

4 years ago

1.0.0

5 years ago

0.3.0

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago