Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

Latest commit

 

History

History
25 lines (18 loc) · 1.12 KB

client-libraries.md

File metadata and controls

25 lines (18 loc) · 1.12 KB

Emblem - Client Libraries

Emblem applications and tools are expected to interact with application data through the Content API. They can operate that API via HTTP requests directly or use a client library.

The Content API is specified using the OpenAPI specification, in this case, using the file openapi.yaml.

One benefit of documenting an API this is the ability to automatically generate code compatible with it. We used one such tool, OpenAPI Generator, to create a Python client library for Emblem. See the link for the various options for installing the tool.

Once the tool is generated, open a shell and navigate to the client-libs/python directory, and run the command:

rm -rf generated && openapi-generator-cli generate -g python -i ../../content-api/openapi.yaml

Python programs can directly import from the newly generated library, or use an Emblem-specific shim that imports and wraps that library:

import emblem_client
client = emblem_client.EmblemClient(API_SERVER_URL, **kwargs)