Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: python client #5

Merged
merged 1 commit into from
Jul 25, 2023
Merged

feat: python client #5

merged 1 commit into from
Jul 25, 2023

Conversation

niryuu
Copy link
Collaborator

@niryuu niryuu commented Jul 19, 2023

tested on testpypi

https://packaging.python.org/en/latest/tutorials/packaging-projects/
https://stackoverflow.com/questions/34514703/pip-install-from-pypi-works-but-from-testpypi-fails-cannot-find-requirements

item fetch test code:

import reearthcmsapi
from reearthcmsapi.apis.tags import items_api
from reearthcmsapi.model.versioned_item import VersionedItem
from reearthcmsapi.model.asset_embedding import AssetEmbedding
from pprint import pprint
configuration = reearthcmsapi.Configuration(
    host = "http://localhost:8080/api",
    access_token = 'secret_dummy'
)
with reearthcmsapi.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = items_api.ItemsApi(api_client)

    # example passing only required values which don't have defaults set
    path_params = {
        'modelId': "dummy",
    }
    query_params = {
    }
    try:
        # Returns a list of items.
        api_response = api_instance.item_filter(
            path_params=path_params,
            query_params=query_params,
        )
        pprint(api_response)
    except reearthcmsapi.ApiException as e:
        print("Exception when calling ItemsApi->item_filter: %s\n" % e)

    # example passing only optional values
    path_params = {
        'modelId': "dummy",
    }
    query_params = {
        'sort': "createdAt",
        'dir': "desc",
        'page': 1,
        'perPage': 50,
        'ref': "latest",
        'asset': AssetEmbedding("all"),
    }
    try:
        # Returns a list of items.
        api_response = api_instance.item_filter(
            path_params=path_params,
            query_params=query_params,
        )
        pprint(api_response)
    except reearthcmsapi.ApiException as e:
        print("Exception when calling ItemsApi->item_filter: %s\n" % e)

@niryuu niryuu requested a review from rot1024 as a code owner July 19, 2023 08:40
@niryuu niryuu self-assigned this Jul 19, 2023
@niryuu niryuu requested a review from smellman July 20, 2023 05:32
Copy link
Collaborator

@smellman smellman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rot1024 rot1024 changed the title (refs #4) added python client feat: python client Jul 25, 2023
@niryuu niryuu merged commit 3cc4168 into main Jul 25, 2023
3 checks passed
@niryuu niryuu deleted the python branch July 25, 2023 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants