Skip to content

Commit e294f5c

Browse files
authored
Merge pull request #1 from tspence/main
Initial Python SDK commit
2 parents 64c9948 + f707fa0 commit e294f5c

File tree

97 files changed

+6486
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+6486
-0
lines changed

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[build-system]
2+
requires = [
3+
"setuptools>=42",
4+
"wheel"
5+
]
6+
build-backend = "setuptools.build_meta"

setup.cfg

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[metadata]
2+
name = lockstep-sdk
3+
version = 2021.39.690
4+
author = Lockstep
5+
author_email = [email protected]
6+
description = Lockstep Platform SDK for Python
7+
long_description = file: README.md
8+
long_description_content_type = text/markdown
9+
url = https://github.com/Lockstep-Network/lockstep-sdk-python
10+
project_urls =
11+
Bug Tracker = https://github.com/Lockstep-Network/lockstep-sdk-python/issues
12+
classifiers =
13+
Programming Language :: Python :: 3
14+
License :: OSI Approved :: MIT License
15+
Operating System :: OS Independent
16+
17+
[options]
18+
package_dir =
19+
= src
20+
packages = find:
21+
python_requires = >=3.6
22+
23+
[options.packages.find]
24+
where = src

src/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from LockstepApi import LockstepApi

src/clients/activities_client.py

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
#
2+
# Lockstep Software Development Kit for Python
3+
#
4+
# (c) 2021-2022 Lockstep, Inc.
5+
#
6+
# For the full copyright and license information, please view the LICENSE
7+
# file that was distributed with this source code.
8+
#
9+
# @author Ted Spence <[email protected]>
10+
# @copyright 2021-2022 Lockstep, Inc.
11+
# @version 2021.39
12+
# @link https://github.com/Lockstep-Network/lockstep-sdk-python
13+
#
14+
15+
from src.lockstep_api import LockstepApi
16+
from src.models.lockstep_response import LockstepResponse
17+
from src.models.activitymodel import ActivityModel
18+
19+
class ActivitiesClient:
20+
21+
def __init__(self, client: LockstepApi):
22+
self.client = client
23+
24+
"""
25+
Retrieves the Activity specified by this unique identifier,
26+
optionally including nested data sets.
27+
28+
An Activity contains information about work being done on a specific
29+
accounting task. You can use Activities to track information about
30+
who has been assigned a specific task, the current status of the
31+
task, the name and description given for the particular task, the
32+
priority of the task, and any amounts collected, paid, or credited
33+
for the task.
34+
35+
Parameters
36+
----------
37+
id : str
38+
The unique Lockstep Platform ID number of this Activity
39+
include : str
40+
To fetch additional data on this object, specify the list of
41+
elements to retrieve. Available collections: Attachments,
42+
CustomFields, and Notes
43+
"""
44+
def retrieve_activity(self, id: str, include: str) -> LockstepResponse:
45+
path = f"/api/v1/Activities/{id}"
46+
return self.client.send_request("GET", path, None, {id: str, include: str})
47+
48+
"""
49+
Updates an activity that matches the specified id with the requested
50+
information.
51+
52+
The PATCH method allows you to change specific values on the object
53+
while leaving other values alone. As input you should supply a list
54+
of field names and new values. If you do not provide the name of a
55+
field, that field will remain unchanged. This allows you to ensure
56+
that you are only updating the specific fields desired.
57+
58+
An Activity contains information about work being done on a specific
59+
accounting task. You can use Activities to track information about
60+
who has been assigned a specific task, the current status of the
61+
task, the name and description given for the particular task, the
62+
priority of the task, and any amounts collected, paid, or credited
63+
for the task.
64+
65+
Parameters
66+
----------
67+
id : str
68+
The unique Lockstep Platform ID number of the Activity to update
69+
body : object
70+
A list of changes to apply to this Activity
71+
"""
72+
def update_activity(self, id: str, body: object) -> LockstepResponse:
73+
path = f"/api/v1/Activities/{id}"
74+
return self.client.send_request("PATCH", path, body, {id: str, body: object})
75+
76+
"""
77+
Delete the Activity referred to by this unique identifier.
78+
79+
An Activity contains information about work being done on a specific
80+
accounting task. You can use Activities to track information about
81+
who has been assigned a specific task, the current status of the
82+
task, the name and description given for the particular task, the
83+
priority of the task, and any amounts collected, paid, or credited
84+
for the task.
85+
86+
Parameters
87+
----------
88+
id : str
89+
The unique Lockstep Platform ID number of the Activity to delete
90+
"""
91+
def delete_activity(self, id: str) -> LockstepResponse:
92+
path = f"/api/v1/Activities/{id}"
93+
return self.client.send_request("DELETE", path, None, {id: str})
94+
95+
"""
96+
Creates one or more activities from a given model.
97+
98+
An Activity contains information about work being done on a specific
99+
accounting task. You can use Activities to track information about
100+
who has been assigned a specific task, the current status of the
101+
task, the name and description given for the particular task, the
102+
priority of the task, and any amounts collected, paid, or credited
103+
for the task.
104+
105+
Parameters
106+
----------
107+
body : list[ActivityModel]
108+
The Activities to create
109+
"""
110+
def create_activities(self, body: list[ActivityModel]) -> LockstepResponse:
111+
path = f"/api/v1/Activities"
112+
return self.client.send_request("POST", path, body, {body: list[ActivityModel]})
113+
114+
"""
115+
Queries Activities for this account using the specified filtering,
116+
sorting, nested fetch, and pagination rules requested.
117+
118+
More information on querying can be found on the [Searchlight Query
119+
Language](https://developer.lockstep.io/docs/querying-with-searchlight)
120+
page on the Lockstep Developer website.
121+
122+
An Activity contains information about work being done on a specific
123+
accounting task. You can use Activities to track information about
124+
who has been assigned a specific task, the current status of the
125+
task, the name and description given for the particular task, the
126+
priority of the task, and any amounts collected, paid, or credited
127+
for the task.
128+
129+
Parameters
130+
----------
131+
filter : str
132+
The filter for this query. See [Searchlight Query
133+
Language](https://developer.lockstep.io/docs/querying-with-searchlight)
134+
include : str
135+
To fetch additional data on this object, specify the list of
136+
elements to retrieve. Available collections: Attachments,
137+
CustomFields, and Notes
138+
order : str
139+
The sort order for this query. See See [Searchlight Query
140+
Language](https://developer.lockstep.io/docs/querying-with-searchlight)
141+
pageSize : int
142+
The page size for results (default 200). See [Searchlight Query
143+
Language](https://developer.lockstep.io/docs/querying-with-searchlight)
144+
pageNumber : int
145+
The page number for results (default 0). See [Searchlight Query
146+
Language](https://developer.lockstep.io/docs/querying-with-searchlight)
147+
"""
148+
def query_activities(self, filter: str, include: str, order: str, pageSize: int, pageNumber: int) -> LockstepResponse:
149+
path = f"/api/v1/Activities/query"
150+
return self.client.send_request("GET", path, None, {filter: str, include: str, order: str, pageSize: int, pageNumber: int})

src/clients/apikeys_client.py

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
#
2+
# Lockstep Software Development Kit for Python
3+
#
4+
# (c) 2021-2022 Lockstep, Inc.
5+
#
6+
# For the full copyright and license information, please view the LICENSE
7+
# file that was distributed with this source code.
8+
#
9+
# @author Ted Spence <[email protected]>
10+
# @copyright 2021-2022 Lockstep, Inc.
11+
# @version 2021.39
12+
# @link https://github.com/Lockstep-Network/lockstep-sdk-python
13+
#
14+
15+
from src.lockstep_api import LockstepApi
16+
from src.models.lockstep_response import LockstepResponse
17+
from src.models.apikeymodel import ApiKeyModel
18+
19+
class ApiKeysClient:
20+
21+
def __init__(self, client: LockstepApi):
22+
self.client = client
23+
24+
"""
25+
Retrieves the API Key with this identifier.
26+
27+
An API Key is an authentication token that you may use with the
28+
Lockstep API. Because API Keys do not have an expiration date, they
29+
are well suited for unattended processes. Each API Key is associated
30+
with a user, and may be revoked to prevent it from accessing the
31+
Lockstep API. When you create an API Key, make sure to save the
32+
value in a secure location. Lockstep cannot retrieve an API Key once
33+
it is created. For more information, see [API
34+
Keys](https://developer.lockstep.io/docs/api-keys).
35+
36+
Parameters
37+
----------
38+
id : str
39+
The unique ID number of the API Key to retrieve
40+
include : str
41+
To fetch additional data on this object, specify the list of
42+
elements to retrieve. No collections are currently available but
43+
may be offered in the future.
44+
"""
45+
def retrieve_api_key(self, id: str, include: str) -> LockstepResponse:
46+
path = f"/api/v1/ApiKeys/{id}"
47+
return self.client.send_request("GET", path, None, {id: str, include: str})
48+
49+
"""
50+
Immediately revokes the API Key with the specified id so it cannot
51+
be used to call the API. The Lockstep Platform guarantees that
52+
revocation will be received by all servers within five minutes of
53+
revocation. API calls made using this API key after the revocation
54+
will fail. A revoked API Key cannot be un-revoked and may be removed
55+
60 days after revocation.
56+
57+
An API Key is an authentication token that you may use with the
58+
Lockstep API. Because API Keys do not have an expiration date, they
59+
are well suited for unattended processes. Each API Key is associated
60+
with a user, and may be revoked to prevent it from accessing the
61+
Lockstep API. When you create an API Key, make sure to save the
62+
value in a secure location. Lockstep cannot retrieve an API Key once
63+
it is created. For more information, see [API
64+
Keys](https://developer.lockstep.io/docs/api-keys).
65+
66+
Parameters
67+
----------
68+
id : str
69+
The unique Lockstep Platform ID number of this API Key
70+
"""
71+
def revoke_api_key(self, id: str) -> LockstepResponse:
72+
path = f"/api/v1/ApiKeys/{id}"
73+
return self.client.send_request("DELETE", path, None, {id: str})
74+
75+
"""
76+
Creates an API key with the specified name.
77+
78+
An API Key is an authentication token that you may use with the
79+
Lockstep API. Because API Keys do not have an expiration date, they
80+
are well suited for unattended processes. Each API Key is associated
81+
with a user, and may be revoked to prevent it from accessing the
82+
Lockstep API. When you create an API Key, make sure to save the
83+
value in a secure location. Lockstep cannot retrieve an API Key once
84+
it is created. For more information, see [API
85+
Keys](https://developer.lockstep.io/docs/api-keys).
86+
87+
Parameters
88+
----------
89+
body : ApiKeyModel
90+
Metadata about the API Key to create.
91+
"""
92+
def create_api_key(self, body: ApiKeyModel) -> LockstepResponse:
93+
path = f"/api/v1/ApiKeys"
94+
return self.client.send_request("POST", path, body, {body: ApiKeyModel})
95+
96+
"""
97+
Queries API Keys for this user using the specified filtering,
98+
sorting, nested fetch, and pagination rules requested. An API Key is
99+
an authentication token that you may use with the Lockstep API.
100+
Because API Keys do not have an expiration date, they are well
101+
suited for unattended processes. Each API Key is associated with a
102+
user, and may be revoked to prevent it from accessing the Lockstep
103+
API. When you create an API Key, make sure to save the value in a
104+
secure location. Lockstep cannot retrieve an API Key once it is
105+
created. For more information, see [API
106+
Keys](https://developer.lockstep.io/docs/api-keys).
107+
108+
Parameters
109+
----------
110+
filter : str
111+
The filter for this query. See [Searchlight Query
112+
Language](https://developer.lockstep.io/docs/querying-with-searchlight)
113+
include : str
114+
To fetch additional data on this object, specify the list of
115+
elements to retrieve. No collections are currently available but
116+
may be offered in the future.
117+
order : str
118+
The sort order for this query. See See [Searchlight Query
119+
Language](https://developer.lockstep.io/docs/querying-with-searchlight)
120+
pageSize : int
121+
The page size for results (default 200). See [Searchlight Query
122+
Language](https://developer.lockstep.io/docs/querying-with-searchlight)
123+
pageNumber : int
124+
The page number for results (default 0). See [Searchlight Query
125+
Language](https://developer.lockstep.io/docs/querying-with-searchlight)
126+
"""
127+
def query_api_keys(self, filter: str, include: str, order: str, pageSize: int, pageNumber: int) -> LockstepResponse:
128+
path = f"/api/v1/ApiKeys/query"
129+
return self.client.send_request("GET", path, None, {filter: str, include: str, order: str, pageSize: int, pageNumber: int})

0 commit comments

Comments
 (0)