0.6.0 • Published 7 months ago

@crowdin/crowdin-apps-functions v0.6.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Crowdin Apps Functions library

Lightweight library with utility functions to help you quickly create your own Crowdin App.

Information about Crowdin Apps can be found in the About Crowdin Apps and in the Quick Start guide.

npm npm CI codecov GitHub Release Date GitHub contributors License

Table of Contents

Installation

npm

npm i @crowdin/crowdin-apps-functions

yarn

yarn add @crowdin/crowdin-apps-functions

Quick Start

import { generateOAuthToken } from '@crowdin/crowdin-apps-functions';

generateOAuthToken({ clientId: 'app_client_id', clientSecret: 'app_client_secret', code: 'code_from_install_event'});
import { generateOAuthToken } from '@crowdin/crowdin-apps-functions';

generateOAuthToken({ clientId: 'app_client_id', clientSecret: 'app_client_secret', code: 'code_from_install_event'});
const crowdinFunctions = require('@crowdin/crowdin-apps-functions');

crowdinFunctions.generateOAuthToken({ clientId: 'app_client_id', clientSecret: 'app_client_secret', code: 'code_from_install_event'});

Functions summary

Mainly all functions are intended to help you quickly develop your app but they also can reduce some work when you are integrating with Crowdin API. Please refer to JSDoc for more details.

Method nameDescription
fetchAppTokenfetch API token for communication with Crowdin API
generateOAuthTokengenerates OAuth token for communication with Crowdin API
refreshOAuthTokenrefresh OAuth token in case if it was expired
constructCrowdinIdFromJwtPayloadcreates unique id of crowdin user and project from the context
getProjectIdextracts project id from crowdin id
validateJwtTokenvalidates if jwt token for your app is valid
updateOrCreateFilecreate or update file in Crowdin
getFolderget folder with and files under it
getOrCreateFolderget folder with files under it or create it
uploadTranslationsadds file to storage and sends it in upload translation request
updateSourceFilesupdates source files under specific directory
handleTranslationsexecutes side effect function for each translated file
createOrUpdateWebhookcreate or update webhook
getSubscriptionreturns an information about app subscription
convertStringconverts source or translation according to specified config
getBundleConfigurationFormreturns UI template config for custom formatters
generateReportgenerates Crowdin report, covers check if finished

Also please have a look to working example of the Crowdin App. It can be used as a basis for your app.

Contributing

If you want to contribute please read the Contributing guidelines.

Seeking Assistance

If you find any problems or would like to suggest a feature, please feel free to file an issue on Github at Issues Page.

If you've found an error in these samples, please Contact Customer Success Service.

License

0.6.0

7 months ago

0.5.0

1 year ago

0.5.1

12 months ago

0.4.0

1 year ago

0.3.0

1 year ago

0.3.1

1 year ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.3

2 years ago

0.1.0

2 years ago

0.0.7

2 years ago

0.0.5

2 years ago

0.0.4

3 years ago

0.0.6

2 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago