0.1.0 ā€¢ Published 1 year ago

mtf-api v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Monotype

Node.js client library for MTF API

Release Downloads License

šŸ“š Documentation - šŸš€ Getting Started - šŸ’» API Reference - šŸ’¬ Feedback

Documentation

  • FAQs - frequently asked questions about mtf-api.
  • Docs Site - explore our docs site and learn more about MTF API

Getting Started

Requirements

This library supports the following tooling versions:

  • Node.js: >=18.15.0

Installation

Using npm in your project directory run the following command:

npm install mtf-api

Configure the API Client

Initialize your client class with a refresh token.

Response type

With the exception of constructor, all methods return in comma ok pattern. Example:

const [value, err] = await mtf.someMethod(params)
if(err){
// something went wrong
}
// use value
const MtfClient = require('mtf-api');

const mtf = new MtfClient({
  refreshToken: '{YOUR_API_V1_REFRESH_TOKEN}' // required
  accessToken: '' // optional
  scope: '' // optional
  expiresAt: '' // optional
  tokenType: '' // optional
});

Authorize

All requests will be authorized before API call if token has expired. Only necessary to force generate new access token.

Uses refreshToken from the instance.

  const [authData, err] =  await mtf.authorize();

Fonts

Documentation: valid options

  const [fonts, err] = await mtf.fonts({
    // options
  })

Font Details

Documentation: valid options

  const [font, err] = await mtf.font(fontId, {
    // options
  })

Font Download

Does not support options, successful response is an object with downloadLink

Download Documentation

  const [download, downloadError] = await mtf.download(sampleFontId)
 // download -> {downloadLink: URL}

For other examples see the EXAMPLES.md document.

API Reference

Feedback

Raise an issue

To provide feedback or report a bug, please raise an issue on our issue tracker.