Exemple #1
0
def client(env: str, organization_id: int) -> IAC.InputApiClient:
    """
    Factory to use the Input Api Client
    """

    if env == "development" or env is None:
        auth_host = "http://annotell.org:8001"
        host = "http://annotell.org:8010"
    elif env == "staging":
        auth_host = "https://user.staging.annotell.com"
        host = "https://input.staging.annotell.com"
    else:
        raise RuntimeError(f"ENV: {env} is not supported")
    return IAC.InputApiClient(auth=None,
                              auth_host=auth_host,
                              host=host,
                              client_organization_id=organization_id)
from typing import List
import annotell.input_api.model as IAM
import annotell.input_api.input_api_client as IAC


def run(client: IAC.InputApiClient, input_uuid: str,
        invalidated_reason: IAM.InvalidatedReasonInput) -> List[IAM.Input]:
    print("Invalidating inputs...")
    return client.input.invalidate_inputs(
        input_uuids=[input_uuid], invalidated_reason=invalidated_reason)


if __name__ == '__main__':
    client = IAC.InputApiClient()

    # Input-identifier - Available via `client.input.get_inputs()`
    input_uuid = "Input-identifier"
    invalidated_reason = IAM.InvalidatedReasonInput.INCORRECTLY_CREATED
    run(client, input_uuid, invalidated_reason)