Lingara Lingara Docs Guides API Libraries Apps Build Web app
Language: English

Lingara API libraries

The Lingara API libraries call the same API the reference describes, in the language you already write. Each one is generated from the same specification and keeps the same contract, so what you learn in one carries over to the others:

  • Authentication. You give the client your client ID and secret once. It exchanges them for an access token, caches it, refreshes it shortly before it expires, and retries a call once with a fresh token if the API answers 401.
  • Streams. Operations that stream, such as generating vocabulary, arrive as the language’s own kind of iterator. The library parses the events and ends the iteration when the stream finishes.
  • Errors. Every failure is one of four errors with a shared base type, so one handler can catch them all.
  • Retries. A 429 or 503 that says how long to wait is retried for you, up to a limit. Anything else is raised straight away.

Every code sample on these pages comes from a released version of the libraries, where it is compiled and tested before it ships.

Install

Pick your language below. Each language has its own page with a first call, and the pages under Using the libraries explain each behaviour in more detail.

TypeScript

npm install @lingara/api@0.1.0-alpha.6

Rust

cargo add lingara@0.1.0-alpha.6
cargo add tokio --features macros,rt-multi-thread

Go

go get github.com/Spinning-Cat-Studios/lingara_api_clients/go@v0.1.0-alpha.6

Java

<dependency>
  <groupId>com.getlingara</groupId>
  <artifactId>lingara-java</artifactId>
  <version>0.1.0-alpha.6</version>
</dependency>

Kotlin

implementation("com.getlingara:lingara-kotlin:0.1.0-alpha.6")

Ruby

gem install lingara -v 0.1.0-alpha.6

PHP

composer require spinningcatstudios/lingara:0.1.0-alpha.6

Languages

  • TypeScript

    The Lingara API library for Node.js, published on npm.

  • Rust

    The Lingara API library for async Rust, published on crates.io.

  • Go

    The Lingara API library for Go, a module with no dependencies outside the standard library.

  • Java

    The Lingara API library for Java 17 and later, published on Maven Central.

  • Kotlin

    The Lingara API library for Kotlin on the JVM, built on coroutines.

  • Ruby

    The Lingara API library for Ruby, a gem with no runtime dependencies.

  • PHP

    The Lingara API library for PHP 8.2 and later, published on Packagist.

Using the libraries

  • Authentication

    How every library turns your client ID and secret into access tokens, and keeps them fresh.

  • Streams

    How the libraries deliver streamed results, and when a stream ends or fails.

  • Errors and retries

    The four errors every library raises, and which failures it retries for you.