Skip to content

Releases: Telios-org/client-sdk

4.0.0

05 Jan 19:03
Compare
Choose a tag to compare

!!! THIS RELEASE HAS BREAKING CHANGES THAT WILL REQUIRE CODE REFACTOR !!!

We refactored the SDK into one unified class that now can be called via new ClientSDK() it will also allow better usage of provider and auth objects across Mailbox and Account classes.

class ClientSDK {
  constructor(opts = {}) {
    this.client = new Client(opts)
    this.Account = new Account(this.client)
    this.Mailbox = new Mailbox(this.client)
    this.Crypto = Crypto
  }

  setAuthPayload(auth) {
    try{
      this.client.auth = auth
      return true
    }catch(e){
      console.log(e)
      return false
    }
  }

  setProvider(provider) {
    try{
      this.client.provider = provider
      return true
    }catch(e){
      console.log(e)
      return false
    }
  }

}

An additional endpoint was created in the sdk to allow for the retrieval of Account Level Stats.

const stats = Account.retrieveStats()

This method will retrieve stats about the account.

Example Response:

  {
    plan: "FREE", // Plan tier the account is on
    daily_email_used: 1, // Number of email sent since last reset aka whether or not they went over the daily quota
    daily_email_reset_date: "2021-12-21T19:00:35.000+00:00", // Date at which the daily_email_used will reset
    namespace_used: 1, // Number of Namespace registered by Account
    aliases_used: 3, // Number of Aliases registered by Account
    storage_space_used: 109635126 // Total Space used up by Account on backup server
  }