Skip to content

andrePankraz/alfresco_search_client

Repository files navigation

alfresco-search-api-client

Search API

Provides access to the search features of Alfresco Content Services.

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

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

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 alfresco_search_api_client

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 alfresco_search_api_client

Tests

Execute pytest to run the tests.

Getting Started

Please follow the installation procedure and then run the following:

import time
import alfresco_search_api_client
from alfresco_search_api_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost/alfresco/api/-default-/public/search/versions/1
# See configuration.py for a list of all supported configuration parameters.
configuration = alfresco_search_api_client.Configuration(
    host = "http://localhost/alfresco/api/-default-/public/search/versions/1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure HTTP basic authorization: basicAuth
configuration = alfresco_search_api_client.Configuration(
    username = os.environ["USERNAME"],
    password = os.environ["PASSWORD"]
)


# Enter a context with an instance of the API client
with alfresco_search_api_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = alfresco_search_api_client.SearchApi(api_client)
    query_body = alfresco_search_api_client.SearchRequest() # SearchRequest | Generic query API 

    try:
        # Searches Alfresco
        api_response = api_instance.search(query_body)
        print("The response of SearchApi->search:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling SearchApi->search: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to http://localhost/alfresco/api/-default-/public/search/versions/1

Class Method HTTP request Description
SearchApi search POST /search Searches Alfresco

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

basicAuth

  • Type: HTTP basic authentication

Author

Documentation for Client Generation

Generate Clients

  • Create via Generator in Docker container:
docker run --rm \
  -v ${PWD}:/local openapitools/openapi-generator-cli generate \
  -i https://raw.githubusercontent.com/Alfresco/rest-api-explorer/master/src/main/webapp/definitions/alfresco-search.yaml \
  -g python \
  -o /local/alfresco_search_api_client \
  --package-name alfresco_search_api_client

Fix Bugs

  • Bug in code generation with field validator around >12 files with nested quotes!
  • Replace in 2 lines each leading and trailing double quote with single quote: r"...\"..." ==> r'...\"...'
    @field_validator('name')
    def name_validate_regular_expression(cls, value):
        """Validates the regular expression"""
        if not re.match(r"^(?!(.*[\\"\*\\\>\<\?\/\:\|]+.*)|(.*[\.]?.*[\.]+$)|(.*[ ]+$))", value):
            raise ValueError(r"must validate the regular expression /^(?!(.*[\\"\*\\\>\<\?\/\:\|]+.*)|(.*[\.]?.*[\.]+$)|(.*[ ]+$))/")
        return value

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published