Skip to main content

gapSolutions client package

Project description

gapSolutions Client

gapSolutions Client is a Python library designed to interact with the gapSolutions API, enabling developers to seamlessly integrate gapSolutions features into their applications.

This client simplifies communication with the API, offering functions to interact with measurement locations, organizations, and users. Whether you are looking to fetch data, modify records, or perform deletion tasks, gapSolutions Client has got you covered.


Features

  • Easy Authentication: Use an API token for quick, secure access.
  • Measurement Locations: Fetch, create, update, and delete measurement locations.
  • Organizations: Manage organizations easily with simple API requests.
  • User Management: Handle users' data with ease, including adding, deleting, and updating.
  • Automatic Handling of Responses: Built-in error handling for clean and efficient workflows.

Installation

You can install gapSolutions Client from PyPI using pip:

pip install gapSolutions_client

🔧 Configuration (Optional): Set Custom API Base URL

By default, the client uses:

https://testapp.gapsolutions.dk/api

If you're using a different environment (e.g., staging, local development, or production), you can override the base URL dynamically in your code:

set_base_url(url: str)

Sets a custom base URL for all API calls.

Parameters:

  • url (str): The new base URL to be used for all requests.

Example Usage:

from gapSolutions_client.config import set_base_url

set_base_url("https://your-env.example.com/api")

After setting this, all API functions will automatically use the new URL.


Usage

File Management Functions

from gapSolutions_client.file.file import ...

1. file_list(auth_token, query_params=None)

Retrieves a list of files from the API.

Parameters:

  • auth_token (str): API authentication token.
  • query_params (dict, optional): Query parameters to filter results.

Example Usage:

response = file_list(auth_token, query_params={"all": "true", "lang": "en"})
print(response)

2. file_create(auth_token, filename, file=None, status=None, note=None, folder_id=None, url=None, query_params=None)

Creates a new file in the API.

Parameters:

  • auth_token (str): API authentication token.
  • filename (str): Name of the file.
  • file (optional): File data.
  • status (optional): File status.
  • note (optional): Additional notes.
  • folder_id (optional): Folder identifier.
  • url (optional): External file URL.
  • query_params (dict, optional): Additional query parameters.

Example Usage:

response = file_create(auth_token, filename="document.pdf", status="active")
print(response)

3. file_update(auth_token, file_id, filename, file=None, note=None, folder_id=None, url=None, query_params=None)

Updates an existing file in the API.

Parameters:

  • auth_token (str): API authentication token.
  • file_id (str): ID of the file to update.
  • filename (str): Updated filename.
  • file (optional): New file data.
  • note (optional): Updated note.
  • folder_id (optional): Updated folder ID.
  • url (optional): Updated external URL.
  • query_params (dict, optional): Additional query parameters.

Example Usage:

response = file_update(auth_token, file_id="12345", filename="updated_doc.pdf")
print(response)

4. file_delete(auth_token, file_id, query_params=None)

Deletes a file from the API.

Parameters:

  • auth_token (str): API authentication token.
  • file_id (str): ID of the file to delete.
  • query_params (dict, optional): Additional query parameters.

Example Usage:

response = file_delete(auth_token, file_id="12345")
print(response)

Account Management Functions

from gapSolutions_client.account.account import ...

1. account_selection(auth_token, query_params=None)

Retrieves a list of accounts from the API.

Parameters:

  • auth_token (str): API authentication token used for authentication.
  • query_params (dict, optional): A dictionary containing query parameters for filtering the accounts list (e.g., { "all": "true", "lang": "en" }).

Example Usage:

response = account_selection(auth_token, query_params={"all": "true", "lang": "en"})
print(response)

Folder Management Functions

from gapSolutions_client.folder.folder import ...

1. folder_list(auth_token, query_params=None)

Retrieves a list of folders from the API.

Parameters:

  • auth_token (str): API authentication token used for authentication.
  • query_params (dict, optional): A dictionary containing optional query parameters to filter folder retrieval results.

Example Usage:

response = folder_list(auth_token)
print(response)

2. folder_create(auth_token, folder_id, folder_title, query_params=None)

Creates a folder in the API.

Parameters:

  • auth_token (str): API authentication token used for authentication.
  • folder_id (str): A unique identifier for the folder.
  • folder_title (str): The name/title of the folder to be created.
  • query_params (dict, optional): A dictionary containing optional query parameters.

Example Usage:

response = folder_create(auth_token, folder_id="123", folder_title="New Folder")
print(response)

3. folder_delete(auth_token, folder_id, query_params=None)

Deletes a folder using the API.

Parameters:

  • auth_token (str): API authentication token used for authentication.
  • folder_id (str): The unique identifier of the folder to be deleted.
  • query_params (dict, optional): A dictionary containing optional query parameters.

Example Usage:

response = folder_delete(auth_token, folder_id="123")
print(response)

4. folder_update(auth_token, folder_id, folder_data_text, query_params=None)

Updates a folder using the API.

Parameters:

  • auth_token (str): API authentication token used for authentication.
  • folder_id (str): The unique identifier of the folder to be updated.
  • folder_data_text (str): The updated text or data for the folder.
  • query_params (dict, optional): A dictionary containing optional query parameters.

Example Usage:

response = folder_update(auth_token, folder_id="123", folder_data_text="Updated Text")
print(response)

5. list_files_in_folder(auth_token, folder_id, query_params=None)

Retrieves a list of files in a specified folder using the API.

Parameters:

  • auth_token (str): API authentication token used for authentication.
  • folder_id (str): The unique identifier of the folder whose files are being retrieved.
  • query_params (dict, optional): A dictionary containing optional query parameters (e.g., sorting options like { "sort": "filename|asc" }).

Example Usage:

response = list_files_in_folder(auth_token, folder_id="123")
print(response)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gapSolutions_client-0.1.30.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gapSolutions_client-0.1.30-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file gapSolutions_client-0.1.30.tar.gz.

File metadata

  • Download URL: gapSolutions_client-0.1.30.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for gapSolutions_client-0.1.30.tar.gz
Algorithm Hash digest
SHA256 f8741173e9ff3b1825e44aa676270eb12bac03cbc0f6d8ea3f27e08b3cc700f0
MD5 2201cd677030ac96741f8d4b3f38b87b
BLAKE2b-256 7186a01c4247fb54889294707ee4535b5855ed3190017fdd373f50b15ed299b0

See more details on using hashes here.

File details

Details for the file gapSolutions_client-0.1.30-py3-none-any.whl.

File metadata

File hashes

Hashes for gapSolutions_client-0.1.30-py3-none-any.whl
Algorithm Hash digest
SHA256 5f2c97114088daf80059623880b0b587b9ccd88498415b55c50af483ef958143
MD5 da8f18e38c40d411eaa8d01b019ada0a
BLAKE2b-256 ac17a31cc75f8b43618c85ad3e6dd692e154e4f83d028ffb9344113c9a34ccc8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page