-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from tspence/main
Initial Python SDK commit
- Loading branch information
Showing
97 changed files
with
6,486 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[build-system] | ||
requires = [ | ||
"setuptools>=42", | ||
"wheel" | ||
] | ||
build-backend = "setuptools.build_meta" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[metadata] | ||
name = lockstep-sdk | ||
version = 2021.39.690 | ||
author = Lockstep | ||
author_email = [email protected] | ||
description = Lockstep Platform SDK for Python | ||
long_description = file: README.md | ||
long_description_content_type = text/markdown | ||
url = https://github.com/Lockstep-Network/lockstep-sdk-python | ||
project_urls = | ||
Bug Tracker = https://github.com/Lockstep-Network/lockstep-sdk-python/issues | ||
classifiers = | ||
Programming Language :: Python :: 3 | ||
License :: OSI Approved :: MIT License | ||
Operating System :: OS Independent | ||
|
||
[options] | ||
package_dir = | ||
= src | ||
packages = find: | ||
python_requires = >=3.6 | ||
|
||
[options.packages.find] | ||
where = src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from LockstepApi import LockstepApi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
# | ||
# Lockstep Software Development Kit for Python | ||
# | ||
# (c) 2021-2022 Lockstep, Inc. | ||
# | ||
# For the full copyright and license information, please view the LICENSE | ||
# file that was distributed with this source code. | ||
# | ||
# @author Ted Spence <[email protected]> | ||
# @copyright 2021-2022 Lockstep, Inc. | ||
# @version 2021.39 | ||
# @link https://github.com/Lockstep-Network/lockstep-sdk-python | ||
# | ||
|
||
from src.lockstep_api import LockstepApi | ||
from src.models.lockstep_response import LockstepResponse | ||
from src.models.activitymodel import ActivityModel | ||
|
||
class ActivitiesClient: | ||
|
||
def __init__(self, client: LockstepApi): | ||
self.client = client | ||
|
||
""" | ||
Retrieves the Activity specified by this unique identifier, | ||
optionally including nested data sets. | ||
An Activity contains information about work being done on a specific | ||
accounting task. You can use Activities to track information about | ||
who has been assigned a specific task, the current status of the | ||
task, the name and description given for the particular task, the | ||
priority of the task, and any amounts collected, paid, or credited | ||
for the task. | ||
Parameters | ||
---------- | ||
id : str | ||
The unique Lockstep Platform ID number of this Activity | ||
include : str | ||
To fetch additional data on this object, specify the list of | ||
elements to retrieve. Available collections: Attachments, | ||
CustomFields, and Notes | ||
""" | ||
def retrieve_activity(self, id: str, include: str) -> LockstepResponse: | ||
path = f"/api/v1/Activities/{id}" | ||
return self.client.send_request("GET", path, None, {id: str, include: str}) | ||
|
||
""" | ||
Updates an activity that matches the specified id with the requested | ||
information. | ||
The PATCH method allows you to change specific values on the object | ||
while leaving other values alone. As input you should supply a list | ||
of field names and new values. If you do not provide the name of a | ||
field, that field will remain unchanged. This allows you to ensure | ||
that you are only updating the specific fields desired. | ||
An Activity contains information about work being done on a specific | ||
accounting task. You can use Activities to track information about | ||
who has been assigned a specific task, the current status of the | ||
task, the name and description given for the particular task, the | ||
priority of the task, and any amounts collected, paid, or credited | ||
for the task. | ||
Parameters | ||
---------- | ||
id : str | ||
The unique Lockstep Platform ID number of the Activity to update | ||
body : object | ||
A list of changes to apply to this Activity | ||
""" | ||
def update_activity(self, id: str, body: object) -> LockstepResponse: | ||
path = f"/api/v1/Activities/{id}" | ||
return self.client.send_request("PATCH", path, body, {id: str, body: object}) | ||
|
||
""" | ||
Delete the Activity referred to by this unique identifier. | ||
An Activity contains information about work being done on a specific | ||
accounting task. You can use Activities to track information about | ||
who has been assigned a specific task, the current status of the | ||
task, the name and description given for the particular task, the | ||
priority of the task, and any amounts collected, paid, or credited | ||
for the task. | ||
Parameters | ||
---------- | ||
id : str | ||
The unique Lockstep Platform ID number of the Activity to delete | ||
""" | ||
def delete_activity(self, id: str) -> LockstepResponse: | ||
path = f"/api/v1/Activities/{id}" | ||
return self.client.send_request("DELETE", path, None, {id: str}) | ||
|
||
""" | ||
Creates one or more activities from a given model. | ||
An Activity contains information about work being done on a specific | ||
accounting task. You can use Activities to track information about | ||
who has been assigned a specific task, the current status of the | ||
task, the name and description given for the particular task, the | ||
priority of the task, and any amounts collected, paid, or credited | ||
for the task. | ||
Parameters | ||
---------- | ||
body : list[ActivityModel] | ||
The Activities to create | ||
""" | ||
def create_activities(self, body: list[ActivityModel]) -> LockstepResponse: | ||
path = f"/api/v1/Activities" | ||
return self.client.send_request("POST", path, body, {body: list[ActivityModel]}) | ||
|
||
""" | ||
Queries Activities for this account using the specified filtering, | ||
sorting, nested fetch, and pagination rules requested. | ||
More information on querying can be found on the [Searchlight Query | ||
Language](https://developer.lockstep.io/docs/querying-with-searchlight) | ||
page on the Lockstep Developer website. | ||
An Activity contains information about work being done on a specific | ||
accounting task. You can use Activities to track information about | ||
who has been assigned a specific task, the current status of the | ||
task, the name and description given for the particular task, the | ||
priority of the task, and any amounts collected, paid, or credited | ||
for the task. | ||
Parameters | ||
---------- | ||
filter : str | ||
The filter for this query. See [Searchlight Query | ||
Language](https://developer.lockstep.io/docs/querying-with-searchlight) | ||
include : str | ||
To fetch additional data on this object, specify the list of | ||
elements to retrieve. Available collections: Attachments, | ||
CustomFields, and Notes | ||
order : str | ||
The sort order for this query. See See [Searchlight Query | ||
Language](https://developer.lockstep.io/docs/querying-with-searchlight) | ||
pageSize : int | ||
The page size for results (default 200). See [Searchlight Query | ||
Language](https://developer.lockstep.io/docs/querying-with-searchlight) | ||
pageNumber : int | ||
The page number for results (default 0). See [Searchlight Query | ||
Language](https://developer.lockstep.io/docs/querying-with-searchlight) | ||
""" | ||
def query_activities(self, filter: str, include: str, order: str, pageSize: int, pageNumber: int) -> LockstepResponse: | ||
path = f"/api/v1/Activities/query" | ||
return self.client.send_request("GET", path, None, {filter: str, include: str, order: str, pageSize: int, pageNumber: int}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
# | ||
# Lockstep Software Development Kit for Python | ||
# | ||
# (c) 2021-2022 Lockstep, Inc. | ||
# | ||
# For the full copyright and license information, please view the LICENSE | ||
# file that was distributed with this source code. | ||
# | ||
# @author Ted Spence <[email protected]> | ||
# @copyright 2021-2022 Lockstep, Inc. | ||
# @version 2021.39 | ||
# @link https://github.com/Lockstep-Network/lockstep-sdk-python | ||
# | ||
|
||
from src.lockstep_api import LockstepApi | ||
from src.models.lockstep_response import LockstepResponse | ||
from src.models.apikeymodel import ApiKeyModel | ||
|
||
class ApiKeysClient: | ||
|
||
def __init__(self, client: LockstepApi): | ||
self.client = client | ||
|
||
""" | ||
Retrieves the API Key with this identifier. | ||
An API Key is an authentication token that you may use with the | ||
Lockstep API. Because API Keys do not have an expiration date, they | ||
are well suited for unattended processes. Each API Key is associated | ||
with a user, and may be revoked to prevent it from accessing the | ||
Lockstep API. When you create an API Key, make sure to save the | ||
value in a secure location. Lockstep cannot retrieve an API Key once | ||
it is created. For more information, see [API | ||
Keys](https://developer.lockstep.io/docs/api-keys). | ||
Parameters | ||
---------- | ||
id : str | ||
The unique ID number of the API Key to retrieve | ||
include : str | ||
To fetch additional data on this object, specify the list of | ||
elements to retrieve. No collections are currently available but | ||
may be offered in the future. | ||
""" | ||
def retrieve_api_key(self, id: str, include: str) -> LockstepResponse: | ||
path = f"/api/v1/ApiKeys/{id}" | ||
return self.client.send_request("GET", path, None, {id: str, include: str}) | ||
|
||
""" | ||
Immediately revokes the API Key with the specified id so it cannot | ||
be used to call the API. The Lockstep Platform guarantees that | ||
revocation will be received by all servers within five minutes of | ||
revocation. API calls made using this API key after the revocation | ||
will fail. A revoked API Key cannot be un-revoked and may be removed | ||
60 days after revocation. | ||
An API Key is an authentication token that you may use with the | ||
Lockstep API. Because API Keys do not have an expiration date, they | ||
are well suited for unattended processes. Each API Key is associated | ||
with a user, and may be revoked to prevent it from accessing the | ||
Lockstep API. When you create an API Key, make sure to save the | ||
value in a secure location. Lockstep cannot retrieve an API Key once | ||
it is created. For more information, see [API | ||
Keys](https://developer.lockstep.io/docs/api-keys). | ||
Parameters | ||
---------- | ||
id : str | ||
The unique Lockstep Platform ID number of this API Key | ||
""" | ||
def revoke_api_key(self, id: str) -> LockstepResponse: | ||
path = f"/api/v1/ApiKeys/{id}" | ||
return self.client.send_request("DELETE", path, None, {id: str}) | ||
|
||
""" | ||
Creates an API key with the specified name. | ||
An API Key is an authentication token that you may use with the | ||
Lockstep API. Because API Keys do not have an expiration date, they | ||
are well suited for unattended processes. Each API Key is associated | ||
with a user, and may be revoked to prevent it from accessing the | ||
Lockstep API. When you create an API Key, make sure to save the | ||
value in a secure location. Lockstep cannot retrieve an API Key once | ||
it is created. For more information, see [API | ||
Keys](https://developer.lockstep.io/docs/api-keys). | ||
Parameters | ||
---------- | ||
body : ApiKeyModel | ||
Metadata about the API Key to create. | ||
""" | ||
def create_api_key(self, body: ApiKeyModel) -> LockstepResponse: | ||
path = f"/api/v1/ApiKeys" | ||
return self.client.send_request("POST", path, body, {body: ApiKeyModel}) | ||
|
||
""" | ||
Queries API Keys for this user using the specified filtering, | ||
sorting, nested fetch, and pagination rules requested. An API Key is | ||
an authentication token that you may use with the Lockstep API. | ||
Because API Keys do not have an expiration date, they are well | ||
suited for unattended processes. Each API Key is associated with a | ||
user, and may be revoked to prevent it from accessing the Lockstep | ||
API. When you create an API Key, make sure to save the value in a | ||
secure location. Lockstep cannot retrieve an API Key once it is | ||
created. For more information, see [API | ||
Keys](https://developer.lockstep.io/docs/api-keys). | ||
Parameters | ||
---------- | ||
filter : str | ||
The filter for this query. See [Searchlight Query | ||
Language](https://developer.lockstep.io/docs/querying-with-searchlight) | ||
include : str | ||
To fetch additional data on this object, specify the list of | ||
elements to retrieve. No collections are currently available but | ||
may be offered in the future. | ||
order : str | ||
The sort order for this query. See See [Searchlight Query | ||
Language](https://developer.lockstep.io/docs/querying-with-searchlight) | ||
pageSize : int | ||
The page size for results (default 200). See [Searchlight Query | ||
Language](https://developer.lockstep.io/docs/querying-with-searchlight) | ||
pageNumber : int | ||
The page number for results (default 0). See [Searchlight Query | ||
Language](https://developer.lockstep.io/docs/querying-with-searchlight) | ||
""" | ||
def query_api_keys(self, filter: str, include: str, order: str, pageSize: int, pageNumber: int) -> LockstepResponse: | ||
path = f"/api/v1/ApiKeys/query" | ||
return self.client.send_request("GET", path, None, {filter: str, include: str, order: str, pageSize: int, pageNumber: int}) |
Oops, something went wrong.