1.6.0 • Published 9 months ago

@natyapp/meta v1.6.0

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

SDK MICROSSERVIÇO SECRETARIA NATY / META

_UNDER DEVELOPMENT_

First we will import and Initialize the sdk package

1. importing the package

  import SDKMeta from "NatyMeta"

2. set environment variable

The API URL for the integration with the Meta API. The default value is https://api.meta.naty.app

  API_META=https://api.meta.naty.app

3. initialize the class

  const SDK = new NatyMeta()
  // you can use new sdk(`YOUR-APP-TOKEN`) to connect right on the class creation

4. connect your app token (if you dont use your token on class creation)

  const connectSDK = await SDK.connect( {apptoken: { `YOUR-APP-TOKEN` } } )

  if(connectSDK.isError) throw new Error(connectSDK.isError.message)

  console.log(connectSDK.isSuccess)
        // Do what you need with the data... (connectSDK.isSuccess)

5. connect your app token (if you dont use your token on class creation)

 SDK.on('message', (res) => {
  res.sendTextMessage("teste");
});

6. than set your application context to use all the individual classes

In this example

  • Retun of any Promise is {isSuccess:AuthReturnType, isError:ErrorHandlingType}
  • If successed method (like the SDK.connect example too),
    the sdk will abstract and will handle properly with the token for you,
    the token will be automatic joined into axios instance header
  • ErrorHandling type { code: number, message: string | Object }
  • On the exemple, we are using "throw new Error" on every ErrorHandling to
    stop and handle it on a simple way, but u can work at your way like
    returning an alert using some alert lib like toastfy for the user.
(The link will be avalible soon)
All Rights Reserved for Ikiradev
1.5.5

9 months ago

1.5.4

9 months ago

1.5.3

9 months ago

1.5.2

9 months ago

1.6.0

9 months ago

1.5.0

9 months ago

1.5.9

9 months ago

1.5.8

9 months ago

1.5.7

9 months ago

1.5.6

9 months ago

1.2.0

1 year ago

1.5.1

12 months ago

1.4.1

12 months ago

1.4.0

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago