Skip to main content

api methods for Triones.

Project description

triones_api

description

Triones_api provides methods encapsulated HTTP interface used when building a tenant of TrionesPaaS.

List the methods

from triones_api import Tenant
print(Tenant.__doc__)

Every secondary key in the dict below is a method name and the corresponding value demonstrate argument of the method.Additionally, keyword argument data will always be parsed as the request body of a HTTP Request.

{
  "one": {
    "get_metas": "all-metas?acl=false",
    "get_meta": "{meta_name}/meta",
    "get_records": "{meta_name}/query?{query:offset=0&limit=500&order_by=created_at&order_flag=DESC}",
    "get_record": "{meta_name}/{id}",
    "create_record": "{meta_name}",
    "update_record": "{meta_name}/{id}",
    "delete_record": "{meta_name}/{id}/?version={version}",
    "dsl_query": "dsl/query?dsl={dsl}",
    "get_common_scripts": "common-scripts",
    "get_common_script": "common-scripts/{name}",
    "create_territory_type": ""
  },
  "one/service/territory": {
    "get_territory_types": "type",
    "create_territory_type": "type",
    "update_territory_type": "type/name",
    "get_territory_models": "model?offset=-1&limit=-1",
    "create_territory_model": "model",
    "get_territory_nodes": "node/query?tenant_id={tenant_id}",
    "add_public_territory_node": "node",
    "add_private_territory_node": "node/private/{user_id}",
    "update_territory_node": "node/{territory_id}/config",
    "get_territory_members_in_node": "node/{territory_id}/member?offset=-1&limit=-1",
    "get_territory_members": "member?limit=-1&offset=-1",
    "add_member": "member",
    "delete_member": "member/{member_id}",
    "add_territory_permission": "permission",
    "add_member_to_node": "node/{node_id}/member",
    "remove_member_from_node": "node/{node_id}/member",
    "add_member_to_permission": "member-permission",
    "remove_member_from_permission": "member-permission"
  }
}

Invoke a method

from triones_api import Tenant

token = "******"
t = Tenant(token)

# positional argument
t.get_meta("User")
t.get_record("User", "AQACQqweGRMBAAAAAxqWI4VnaBXazAEA")
t.delete_record("Account", "AQACQqweGRMBAAAAnyK7Z6Q-cxVqXQUA", 0)

# positional argument with keyword argument
t.get_records("Account", query='offset=0&limit=1&order_by=created_at&order_flag=DESC')
t.get_records("Account")

# keyword argument `data` represent the request body of a HTTP Request.
t.create_record("Account", data={"objects": [{"t1": "John"}]})
t.update_display_name("Account", data={"display_name": "Customer"})

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

triones_api-0.0.1.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

triones_api-0.0.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file triones_api-0.0.1.tar.gz.

File metadata

  • Download URL: triones_api-0.0.1.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.2

File hashes

Hashes for triones_api-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b20cf39ea7ced191804148eba60db404fcf0c4ee6bc33fbef0f550815e3e200a
MD5 79bb558aa454860f076b7a9b163ced97
BLAKE2b-256 df6030c7dc9452dd5babb40ad0b093919486c9b40087369d1011ab4c8d7200f6

See more details on using hashes here.

File details

Details for the file triones_api-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: triones_api-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.2

File hashes

Hashes for triones_api-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 15ce223c7120ebc333708f211387e73aa5924ebda14f699a8ba1624124b4850e
MD5 98bc4eeb6ed16b95d7839c4e374b8635
BLAKE2b-256 84c964a6e348b430e3b9c88dc8c56fc609ca69da9a688ad1bcacc8bb4c0b2694

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