npm package: @ryniaubenpm2/omnis-fuga-sed
Description: ![npm](https://img.shields.io/npm/v/@ryniaubenpm2/omnis-fuga-sed) ![CI](https://github.com/ryniaubenpm2/omnis-fuga-sed/actions/workflows/ci.yml/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/ryniaubenpm2/omnis-fuga-sed/badge.svg?branch=m
Author: ryniaube
Latest version: 1.0.0

# Lokalise API v2 official Node.js client

![npm](https://img.shields.io/npm/v/@ryniaubenpm2/omnis-fuga-sed)
![CI](https://github.com/ryniaubenpm2/omnis-fuga-sed/actions/workflows/ci.yml/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/ryniaubenpm2/omnis-fuga-sed/badge.svg?branch=master)](https://coveralls.io/github/ryniaubenpm2/omnis-fuga-sed?branch=master)
![Downloads total](https://img.shields.io/npm/dt/@ryniaubenpm2/omnis-fuga-sed)

Official Node interface for the [Lokalise API](https://app.lokalise.com/api2docs/curl/#resource-getting-started).

## Quickstart

**Please note that starting from version 9 this SDK is a pure [ESM](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) module. It does not provide a CommonJS export (`require`) anymore.** Therefore you should either [convert your project to ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c), use [dynamic import](https://v8.dev/features/dynamic-import) (please find an example below), or stay on [version 8](https://github.com/ryniaubenpm2/omnis-fuga-sed/tree/v8).

Install the library:

```bash
npm install @ryniaubenpm2/omnis-fuga-sed
```

Obtain Lokalise API token in your personal profile, initialize and use the client:

```ts
import { LokaliseApi } from "@ryniaubenpm2/omnis-fuga-sed";

const lokaliseApi = new LokaliseApi({ apiKey: '<apiKey>'});
const projects = await lokaliseApi.projects().list();
projects.items[0].name;

process = await lokaliseApi.files().upload(project_id,
  {data: data_base64, filename: 'test1.json', lang_iso: 'en'})
process.status // => 'queued'
```

Alternatively, you can use tokens obtained via [OAuth2](https://lokalise.github.io/node-lokalise-api/additional_info/oauth2_flow) (don't forget that these tokens have expiration dates):

```ts
import { LokaliseApiOAuth } from "@ryniaubenpm2/omnis-fuga-sed";

const lokaliseApi = new LokaliseApiOAuth({ apiKey: '<apiKeyObtainedViaOauth2>' });

const projects = lokaliseApi.projects().list();
```

Here's an example using dynamic import:

```ts
(async function () {
  const LokaliseApi = await (import('@ryniaubenpm2/omnis-fuga-sed').then(m => m.LokaliseApi));
  const lokaliseApi = new LokaliseApi({ apiKey: LOKALISE_API_TOKEN});

  // use lokaliseApi here as usual...
})();
```

## Usage

Detailed documentation can be found at [lokalise.github.io/node-lokalise-api](https://lokalise.github.io/node-lokalise-api/).

You can also check [this repo containing some usage examples](https://github.com/bodrovis-learning/Lokalise-APIv2-Samples) and [this blog post with explanations](https://lokalise.com/blog/lokalise-apiv2-in-practice). Finally, you might be interested in our [free course "Lokalise for developers"](https://academy.lokalise.com/course/lokalise-for-developers) that showcases Node SDK usage.

## License

This library is licensed under the [BSD 3 Clause](https://github.com/ryniaubenpm2/omnis-fuga-sed/blob/master/LICENSE). Prior to version 5.1.0 the license was MIT.

Copyright (c) [Lokalise group](http://lokalise.com) and [Ilya Krukowski](http://bodrovis.tech)