Skip to content

labinnovationdocapost/leia-api-python-sdk

Repository files navigation

leiaapi.generated

Leia API

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 1.0.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.PythonNextgenClientCodegen

Requirements.

Python 3.7+

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import leiaapi.generated

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import leiaapi.generated

Getting Started

Please follow the installation procedure and then run the following:

from __future__ import print_function

import time
import leiaapi.generated
from leiaapi.generated.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://dev.leia.id360docaposte.com/leia/1.0.0
# See configuration.py for a list of all supported configuration parameters.
configuration = leiaapi.generated.Configuration(
    host = "https://dev.leia.id360docaposte.com/leia/1.0.0"
)



# Enter a context with an instance of the API client
with leiaapi.generated.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = leiaapi.generated.AnnotationApi(api_client)
    token = 'token_example' # str | The login token obtained via POST /login/
    document_id = 'document_id_example' # str | The id of the document to annotate
    annotation_type = leiaapi.generated.AnnotationTypes() # AnnotationTypes | The type of the annotation
    body = None # object | The prediction that should be associated to document in this annotation, in free form json
    name = 'name_example' # str | The name of the annotation (for information purposes only) (optional)
    tags = ['tags_example'] # List[str] | The tags of the annotation (optional)

    try:
        # Creates an annotation
        api_response = api_instance.create_annotation(token, document_id, annotation_type, body, name=name, tags=tags)
        print("The response of AnnotationApi->create_annotation:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling AnnotationApi->create_annotation: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://dev.leia.id360docaposte.com/leia/1.0.0

Class Method HTTP request Description
AnnotationApi create_annotation POST /annotation/{document_id} Creates an annotation
AnnotationApi delete_annotation DELETE /annotation/{annotation_id} Deletes an annotation
AnnotationApi get_annotation GET /annotation/{annotation_id} Retrieves an annotation
AnnotationApi get_annotations GET /annotation Retrieves annotations (paginated)
AnnotationApi tag_annotation POST /annotation/{annotation_id}/tag/{tag} Tags an annotation
AnnotationApi untag_annotation DELETE /annotation/{annotation_id}/tag/{tag} Untags an annotation
AnnotationApi update_annotation PATCH /annotation/{annotation_id} Updates an annotation
ApplicationApi login_application_post POST /login Logs into Leia API
ApplicationApi logout_application GET /logout Logs out from Leia API
ApplicationApi who_am_i GET /whoami Gets the currently connected application
ApplicationAdminApi admin_create_application POST /admin/application Adds a new application to the system (admin only)
ApplicationAdminApi admin_delete_always_on_schedule DELETE /admin/application/{application_id}/always_on_schedules/{always_on_schedule_id} Removes a schedule from an application
ApplicationAdminApi admin_delete_application DELETE /admin/application/{application_id} Deletes an application (admin only)
ApplicationAdminApi admin_edit_application PATCH /admin/application/{application_id} Modifies an existing application in the system (admin only)
ApplicationAdminApi admin_get_application GET /admin/application/{application_id} Retrieves an application (admin only)
ApplicationAdminApi admin_get_applications GET /admin/application Retrieves applications (admin only) (paginated)
ApplicationAdminApi admin_reset_api_key POST /admin/application/{application_id}/reset_api_key Resets an API key (admin only)
DocumentApi create_document POST /document Uploads a document to the Leia API
DocumentApi delete_document DELETE /document/{document_id} Deletes a document from Leia API
DocumentApi edit_document PATCH /document/{document_id} Updates a document in Leia API
DocumentApi get_document GET /document/{document_id} Retrieves a document from Leia API
DocumentApi get_document_contents GET /document/{document_id}/file_contents Retrieves a document from Leia API
DocumentApi get_documents GET /document Retrieves documents from Leia API (paginated)
DocumentApi get_documents_tags GET /document/tag Retrieves documents' tags from Leia API
DocumentApi get_documents_zip GET /document/zip Retrieves documents from Leia API (paginated)
DocumentApi tag_document POST /document/{document_id}/tag/{tag} Tags a document
DocumentApi transform_document_async POST /document/{document_ids}/transform/{output_type} Asynchronously converts a document within Leia API
DocumentApi untag_document DELETE /document/{document_id}/tag/{tag} Untags an document
DocumentAdminApi admin_create_document POST /admin/{application_id}/document Uploads a document to the Leia API (admin only)
DocumentAdminApi admin_delete_document DELETE /admin/{application_id}/document/{document_id} Deletes a document from Leia API (admin only)
DocumentAdminApi admin_edit_document PATCH /admin/{application_id}/document/{document_id} Updates a document in Leia API (admin only)
DocumentAdminApi admin_get_document GET /admin/{application_id}/document/{document_id} Retrieves a document from Leia API (admin only)
DocumentAdminApi admin_get_document_contents GET /admin/{application_id}/document/{document_id}/file_contents Retrieves a document from Leia API (admin only)
DocumentAdminApi admin_get_documents GET /admin/document Retrieves documents from Leia API (admin only) (paginated)
DocumentAdminApi admin_get_documents_tags GET /admin/document/tag Retrieves documents' tags from Leia API (admin only)
DocumentAdminApi admin_get_documents_zip GET /admin/document/zip Retrieves documents from Leia API (admin only) (paginated)
DocumentAdminApi admin_tag_document POST /admin/{application_id}/document/{document_id}/tag/{tag} Tags a document (admin only)
DocumentAdminApi admin_transform_document_async POST /admin/{application_id}/document/{document_ids}/transform/{output_type} Asynchronously converts a document within Leia API (admin only)
DocumentAdminApi admin_untag_document DELETE /admin/{application_id}/document/{document_id}/tag/{tag} Untags an document (admin only)
HealthApi health_check GET /health Checks Leia API health
JobApi cancel_job DELETE /job/{job_id} Cancels a job in Leia API
JobApi create_conditional_job POST /job/conditional/{execute_after_id} Asynchronously and conditionaly applies model(s) on documents
JobApi get_job GET /job/{job_id} Retrieves a job from Leia API
JobApi get_job_statuses GET /job/{job_ids}/status Retrieves job statuses from Leia API
JobApi get_jobs GET /job Retrieves jobs (paginated)
JobApi start_job POST /job/{job_id}/start Starts a job in BLOCKED status within Leia API
JobAdminApi admin_cancel_job DELETE /admin/{submitter_id}/job/{job_id} Cancels a job in Leia API (admin only)
JobAdminApi admin_create_conditional_job POST /admin/{application_id}/job/conditional/{execute_after_id} Asynchronously and conditionaly applies model(s) on documents (admin only)
JobAdminApi admin_get_job GET /admin/{submitter_id}/job/{job_id} Retrieves a job from Leia API (admin only)
JobAdminApi admin_get_job_statuses GET /admin/{submitter_id}/job/{job_ids}/status Retrieves job statuses from Leia API (admin only)
JobAdminApi admin_get_jobs GET /admin/job Retrieves jobs (admin only) (paginated)
JobAdminApi admin_start_job POST /admin/{submitter_id}/job/{job_id}/start Starts a job in BLOCKED status within Leia API
ModelApi apply_model_async POST /model/{model_id}/apply/{document_ids} Asynchronously applies a model on documents
ModelApi get_model GET /model/{model_id} Get a model
ModelApi get_models GET /model Lists models (paginated)
ModelApi tag_model POST /model/{model_id}/tag/{tag} Tags a model
ModelApi train_model_async POST /model/{model_module}/train/{documents_tag} Asynchronously trains a model on documents (admin only)
ModelApi untag_model DELETE /model/{model_id}/tag/{tag} Untags a model
ModelAdminApi admin_apply_model_async POST /admin/{application_id}/model/{model_id}/apply/{document_ids} Asynchronously applies a model on documents (admin only)
ModelAdminApi admin_create_model POST /admin/{application_id}/model Adds a new model to the system (admin only)
ModelAdminApi admin_delete_model DELETE /admin/{application_id}/model/{model_id} Deletes a model (admin only)
ModelAdminApi admin_edit_model PATCH /admin/{application_id}/model/{model_id} Modifies an existing model in the system (admin only)
ModelAdminApi admin_get_model GET /admin/{application_id}/model/{model_id} Get a model (admin only)
ModelAdminApi admin_get_model_contents GET /admin/{application_id}/model/{model_id}/file_contents Get a model (admin only)
ModelAdminApi admin_get_models GET /admin/model Lists models (admin only) (paginated))
ModelAdminApi admin_tag_model POST /admin/{application_id}/model/{model_id}/tag/{tag} Tags a model (admin only)
ModelAdminApi admin_train_model_async POST /admin/{application_id}/model/{model_module}/train/{documents_tag} Asynchronously trains a model on documents (admin only)
ModelAdminApi admin_untag_model DELETE /admin/{application_id}/model/{model_id}/tag/{tag} Untags a model (admin only)
WorkerApi get_worker GET /worker/{job_type} Retrieves worker information from Leia API
WorkerApi get_workers GET /worker Retrieves worker information from Leia API
WorkerAdminApi kill_worker DELETE /worker/{job_type} Kills a worker (admin only)

Documentation For Models

Documentation For Authorization

All endpoints do not require authorization.

Author

contact@leia.io

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published