caredaily 1.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- caredaily/__init__.py +122 -0
- caredaily/__main__.py +3 -0
- caredaily/apis/__init__.py +94 -0
- caredaily/apis/admin/__init__.py +33 -0
- caredaily/apis/admin/billing.py +433 -0
- caredaily/apis/admin/challenges.py +282 -0
- caredaily/apis/admin/devices.py +90 -0
- caredaily/apis/admin/firmware.py +290 -0
- caredaily/apis/admin/groups.py +142 -0
- caredaily/apis/admin/locations.py +266 -0
- caredaily/apis/admin/narratives.py +108 -0
- caredaily/apis/admin/organizations.py +744 -0
- caredaily/apis/admin/reports.py +548 -0
- caredaily/apis/admin/system.py +97 -0
- caredaily/apis/admin/tags.py +133 -0
- caredaily/apis/admin/user_groups.py +211 -0
- caredaily/apis/admin/users.py +465 -0
- caredaily/apis/api.py +24 -0
- caredaily/apis/app/__init__.py +47 -0
- caredaily/apis/app/ai.py +89 -0
- caredaily/apis/app/app_files.py +208 -0
- caredaily/apis/app/authentication.py +437 -0
- caredaily/apis/app/cloud_connectivity.py +130 -0
- caredaily/apis/app/clouds_integration.py +627 -0
- caredaily/apis/app/device_files.py +587 -0
- caredaily/apis/app/device_measurements.py +436 -0
- caredaily/apis/app/device_types_and_parameters.py +856 -0
- caredaily/apis/app/devices.py +1297 -0
- caredaily/apis/app/energy_management.py +193 -0
- caredaily/apis/app/locations.py +1168 -0
- caredaily/apis/app/paid_services.py +489 -0
- caredaily/apis/app/professional_monitoring.py +217 -0
- caredaily/apis/app/rag.py +212 -0
- caredaily/apis/app/rules.py +326 -0
- caredaily/apis/app/system_and_user_properties.py +220 -0
- caredaily/apis/app/user_accounts.py +620 -0
- caredaily/apis/app/user_communication.py +895 -0
- caredaily/apis/app/weather.py +154 -0
- caredaily/apis/app/websocket.py +653 -0
- caredaily/apis/bot/__init__.py +17 -0
- caredaily/apis/bot/analytic.py +1492 -0
- caredaily/apis/bot/bot_developer.py +555 -0
- caredaily/apis/bot/bot_store.py +382 -0
- caredaily/apis/bot/developer_teams.py +261 -0
- caredaily/apis/bot/execution.py +57 -0
- caredaily/caredaily.py +258 -0
- caredaily/cli/__init__.py +9 -0
- caredaily/cli/app.py +135 -0
- caredaily/cli/configure.py +676 -0
- caredaily/exceptions.py +10 -0
- caredaily/http.py +296 -0
- caredaily/models.py +242 -0
- caredaily-1.0.2.dist-info/METADATA +271 -0
- caredaily-1.0.2.dist-info/RECORD +58 -0
- caredaily-1.0.2.dist-info/WHEEL +5 -0
- caredaily-1.0.2.dist-info/entry_points.txt +2 -0
- caredaily-1.0.2.dist-info/licenses/LICENSE.txt +201 -0
- caredaily-1.0.2.dist-info/top_level.txt +1 -0
caredaily/__init__.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# /// script
|
|
2
|
+
# requires-python = ">=3.8"
|
|
3
|
+
# ///
|
|
4
|
+
"""
|
|
5
|
+
CareDaily Python SDK
|
|
6
|
+
|
|
7
|
+
Provides APIs, models, and utilities for interacting with the CareDaily platform.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
__version__ = "1.0.2"
|
|
11
|
+
|
|
12
|
+
from .apis import (
|
|
13
|
+
AdminDevices,
|
|
14
|
+
AdminLocations,
|
|
15
|
+
AdminTags,
|
|
16
|
+
Analytic,
|
|
17
|
+
API,
|
|
18
|
+
AppFiles,
|
|
19
|
+
Authentication,
|
|
20
|
+
Billing,
|
|
21
|
+
BotDeveloper,
|
|
22
|
+
BotStore,
|
|
23
|
+
Challenges,
|
|
24
|
+
CloudConnectivity,
|
|
25
|
+
CloudsIntegration,
|
|
26
|
+
DeveloperTeams,
|
|
27
|
+
DeviceFiles,
|
|
28
|
+
DeviceMeasurements,
|
|
29
|
+
Devices,
|
|
30
|
+
DeviceTypesAndParameters,
|
|
31
|
+
EnergyManagement,
|
|
32
|
+
Execution,
|
|
33
|
+
Firmware,
|
|
34
|
+
Groups,
|
|
35
|
+
Locations,
|
|
36
|
+
Narratives,
|
|
37
|
+
Organizations,
|
|
38
|
+
PaidServices,
|
|
39
|
+
ProfessionalMonitoring,
|
|
40
|
+
RAG,
|
|
41
|
+
Reports,
|
|
42
|
+
Rules,
|
|
43
|
+
System,
|
|
44
|
+
SystemAndUserProperties,
|
|
45
|
+
UserAccounts,
|
|
46
|
+
UserCommunication,
|
|
47
|
+
UserGroups,
|
|
48
|
+
Users,
|
|
49
|
+
Weather,
|
|
50
|
+
Websocket,
|
|
51
|
+
)
|
|
52
|
+
from .caredaily import CareDaily
|
|
53
|
+
from .exceptions import CareDailyException
|
|
54
|
+
from .models import (
|
|
55
|
+
APIKeyType,
|
|
56
|
+
SignatureAlgorithm,
|
|
57
|
+
Cloud,
|
|
58
|
+
MQTT,
|
|
59
|
+
PythonRuntime,
|
|
60
|
+
Result,
|
|
61
|
+
ResultCode,
|
|
62
|
+
Server,
|
|
63
|
+
ServerType,
|
|
64
|
+
TimeZone,
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
__all__ = [
|
|
68
|
+
"APIKeyType",
|
|
69
|
+
"SignatureAlgorithm",
|
|
70
|
+
"CareDaily",
|
|
71
|
+
"CareDailyException",
|
|
72
|
+
"Cloud",
|
|
73
|
+
"MQTT",
|
|
74
|
+
"PythonRuntime",
|
|
75
|
+
"Result",
|
|
76
|
+
"ResultCode",
|
|
77
|
+
"Server",
|
|
78
|
+
"ServerType",
|
|
79
|
+
"TimeZone",
|
|
80
|
+
# APIs
|
|
81
|
+
"API",
|
|
82
|
+
# App APIs
|
|
83
|
+
"AppFiles",
|
|
84
|
+
"Authentication",
|
|
85
|
+
"CloudConnectivity",
|
|
86
|
+
"CloudsIntegration",
|
|
87
|
+
"DeviceFiles",
|
|
88
|
+
"DeviceMeasurements",
|
|
89
|
+
"Devices",
|
|
90
|
+
"DeviceTypesAndParameters",
|
|
91
|
+
"EnergyManagement",
|
|
92
|
+
"Locations",
|
|
93
|
+
"PaidServices",
|
|
94
|
+
"ProfessionalMonitoring",
|
|
95
|
+
"RAG",
|
|
96
|
+
"Rules",
|
|
97
|
+
"SystemAndUserProperties",
|
|
98
|
+
"UserAccounts",
|
|
99
|
+
"UserCommunication",
|
|
100
|
+
"Weather",
|
|
101
|
+
"Websocket",
|
|
102
|
+
# Admin APIs
|
|
103
|
+
"AdminDevices",
|
|
104
|
+
"AdminLocations",
|
|
105
|
+
"AdminTags",
|
|
106
|
+
"Billing",
|
|
107
|
+
"Challenges",
|
|
108
|
+
"Firmware",
|
|
109
|
+
"Groups",
|
|
110
|
+
"Narratives",
|
|
111
|
+
"Organizations",
|
|
112
|
+
"Reports",
|
|
113
|
+
"System",
|
|
114
|
+
"UserGroups",
|
|
115
|
+
"Users",
|
|
116
|
+
# Bot APIs
|
|
117
|
+
"Analytic",
|
|
118
|
+
"BotDeveloper",
|
|
119
|
+
"BotStore",
|
|
120
|
+
"DeveloperTeams",
|
|
121
|
+
"Execution",
|
|
122
|
+
]
|
caredaily/__main__.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# /// script
|
|
2
|
+
# requires-python = ">=3.8"
|
|
3
|
+
# ///
|
|
4
|
+
|
|
5
|
+
from .admin import (
|
|
6
|
+
Billing,
|
|
7
|
+
Challenges,
|
|
8
|
+
Devices as AdminDevices,
|
|
9
|
+
Firmware,
|
|
10
|
+
Groups,
|
|
11
|
+
Locations as AdminLocations,
|
|
12
|
+
Narratives,
|
|
13
|
+
Organizations,
|
|
14
|
+
Reports,
|
|
15
|
+
System,
|
|
16
|
+
Tags as AdminTags,
|
|
17
|
+
UserGroups,
|
|
18
|
+
Users,
|
|
19
|
+
)
|
|
20
|
+
from .api import API
|
|
21
|
+
from .app import (
|
|
22
|
+
AI,
|
|
23
|
+
AppFiles,
|
|
24
|
+
Authentication,
|
|
25
|
+
CloudConnectivity,
|
|
26
|
+
CloudsIntegration,
|
|
27
|
+
DeviceFiles,
|
|
28
|
+
DeviceMeasurements,
|
|
29
|
+
Devices,
|
|
30
|
+
DeviceTypesAndParameters,
|
|
31
|
+
EnergyManagement,
|
|
32
|
+
Locations,
|
|
33
|
+
PaidServices,
|
|
34
|
+
ProfessionalMonitoring,
|
|
35
|
+
RAG,
|
|
36
|
+
Rules,
|
|
37
|
+
SystemAndUserProperties,
|
|
38
|
+
UserAccounts,
|
|
39
|
+
UserCommunication,
|
|
40
|
+
Weather,
|
|
41
|
+
Websocket,
|
|
42
|
+
)
|
|
43
|
+
from .bot import (
|
|
44
|
+
Analytic,
|
|
45
|
+
BotDeveloper,
|
|
46
|
+
BotStore,
|
|
47
|
+
DeveloperTeams,
|
|
48
|
+
Execution,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
__all__ = [
|
|
52
|
+
"API",
|
|
53
|
+
# App APIs
|
|
54
|
+
"AI",
|
|
55
|
+
"AppFiles",
|
|
56
|
+
"Authentication",
|
|
57
|
+
"CloudConnectivity",
|
|
58
|
+
"CloudsIntegration",
|
|
59
|
+
"DeviceFiles",
|
|
60
|
+
"DeviceMeasurements",
|
|
61
|
+
"Devices",
|
|
62
|
+
"DeviceTypesAndParameters",
|
|
63
|
+
"EnergyManagement",
|
|
64
|
+
"Locations",
|
|
65
|
+
"PaidServices",
|
|
66
|
+
"ProfessionalMonitoring",
|
|
67
|
+
"RAG",
|
|
68
|
+
"Rules",
|
|
69
|
+
"SystemAndUserProperties",
|
|
70
|
+
"UserAccounts",
|
|
71
|
+
"UserCommunication",
|
|
72
|
+
"Weather",
|
|
73
|
+
"Websocket",
|
|
74
|
+
# Admin APIs
|
|
75
|
+
"AdminDevices",
|
|
76
|
+
"AdminLocations",
|
|
77
|
+
"AdminTags",
|
|
78
|
+
"Billing",
|
|
79
|
+
"Challenges",
|
|
80
|
+
"Firmware",
|
|
81
|
+
"Groups",
|
|
82
|
+
"Narratives",
|
|
83
|
+
"Organizations",
|
|
84
|
+
"Reports",
|
|
85
|
+
"System",
|
|
86
|
+
"UserGroups",
|
|
87
|
+
"Users",
|
|
88
|
+
# Bot APIs
|
|
89
|
+
"Analytic",
|
|
90
|
+
"BotDeveloper",
|
|
91
|
+
"BotStore",
|
|
92
|
+
"DeveloperTeams",
|
|
93
|
+
"Execution",
|
|
94
|
+
]
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# /// script
|
|
2
|
+
# requires-python = ">=3.8"
|
|
3
|
+
# ///
|
|
4
|
+
|
|
5
|
+
from .billing import Billing
|
|
6
|
+
from .challenges import Challenges
|
|
7
|
+
from .devices import Devices
|
|
8
|
+
from .firmware import Firmware
|
|
9
|
+
from .groups import Groups
|
|
10
|
+
from .locations import Locations
|
|
11
|
+
from .narratives import Narratives
|
|
12
|
+
from .organizations import Organizations
|
|
13
|
+
from .reports import Reports
|
|
14
|
+
from .system import System
|
|
15
|
+
from .tags import Tags
|
|
16
|
+
from .user_groups import UserGroups
|
|
17
|
+
from .users import Users
|
|
18
|
+
|
|
19
|
+
__all__ = [
|
|
20
|
+
"Billing",
|
|
21
|
+
"Challenges",
|
|
22
|
+
"Devices",
|
|
23
|
+
"Firmware",
|
|
24
|
+
"Groups",
|
|
25
|
+
"Locations",
|
|
26
|
+
"Narratives",
|
|
27
|
+
"Organizations",
|
|
28
|
+
"Reports",
|
|
29
|
+
"System",
|
|
30
|
+
"Tags",
|
|
31
|
+
"UserGroups",
|
|
32
|
+
"Users",
|
|
33
|
+
]
|
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
# /// script
|
|
2
|
+
# requires-python = ">=3.8"
|
|
3
|
+
# dependencies = [
|
|
4
|
+
# "requests",
|
|
5
|
+
# ]
|
|
6
|
+
# ///
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
from typing import Dict
|
|
10
|
+
|
|
11
|
+
from ..api import API
|
|
12
|
+
|
|
13
|
+
from ...models import (
|
|
14
|
+
APIKeyType,
|
|
15
|
+
Result,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class Billing(API):
|
|
20
|
+
"""
|
|
21
|
+
Billing API for managing organization billing items, plans, versions, and bills.
|
|
22
|
+
|
|
23
|
+
This class provides methods to retrieve, create, update, and delete billing items, plans, and bills for organizations.
|
|
24
|
+
Supports plan assignment, bill generation, and retrieval of bill content in various formats.
|
|
25
|
+
|
|
26
|
+
Reference:
|
|
27
|
+
https://app.peoplepowerco.com/cloud/apidocs/admin.html#tag/Billing
|
|
28
|
+
"""
|
|
29
|
+
def get_billing_items(
|
|
30
|
+
self,
|
|
31
|
+
) -> Result:
|
|
32
|
+
"""
|
|
33
|
+
Get billing items.
|
|
34
|
+
|
|
35
|
+
Billing items are base services for which organizations can be charged.
|
|
36
|
+
An organization billing plan includes prices for each required billing item.
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
Result: API response with billing items data
|
|
40
|
+
|
|
41
|
+
Reference:
|
|
42
|
+
https://app.peoplepowerco.com/cloud/apidocs/admin.html#tag/Billing/operation/Get%20Billing%20Items
|
|
43
|
+
"""
|
|
44
|
+
result: Result = self.adapter.get(
|
|
45
|
+
"/espapi/admin/json/billingItems",
|
|
46
|
+
ep_headers=self.adapter._get_headers(
|
|
47
|
+
api_key=self.adapter._headers.get("ADMIN_KEY"),
|
|
48
|
+
key_type=APIKeyType.USER
|
|
49
|
+
),
|
|
50
|
+
)
|
|
51
|
+
return result
|
|
52
|
+
|
|
53
|
+
def create_billing_plan(
|
|
54
|
+
self,
|
|
55
|
+
plan_data: Dict,
|
|
56
|
+
) -> Result:
|
|
57
|
+
"""
|
|
58
|
+
Create a new billing plan.
|
|
59
|
+
|
|
60
|
+
Args:
|
|
61
|
+
plan_data: Plan data as JSON object with 'plan' key containing 'name' field
|
|
62
|
+
|
|
63
|
+
Returns:
|
|
64
|
+
Result: API response with created plan data
|
|
65
|
+
|
|
66
|
+
Reference:
|
|
67
|
+
https://app.peoplepowerco.com/cloud/apidocs/admin.html#tag/Billing/operation/Get%20Billing%20Plans
|
|
68
|
+
"""
|
|
69
|
+
result: Result = self.adapter.post(
|
|
70
|
+
"/espapi/admin/json/billingPlans",
|
|
71
|
+
ep_json=plan_data if plan_data else None,
|
|
72
|
+
ep_headers=self.adapter._get_headers(
|
|
73
|
+
api_key=self.adapter._headers.get("ADMIN_KEY"),
|
|
74
|
+
key_type=APIKeyType.USER
|
|
75
|
+
),
|
|
76
|
+
)
|
|
77
|
+
return result
|
|
78
|
+
|
|
79
|
+
def update_billing_plan(
|
|
80
|
+
self,
|
|
81
|
+
plan_id: int,
|
|
82
|
+
plan_data: Dict,
|
|
83
|
+
) -> Result:
|
|
84
|
+
"""
|
|
85
|
+
Create or update an existing billing plan.
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
plan_id: Plan ID to update
|
|
89
|
+
plan_data: Plan data as JSON object with 'plan' key containing 'name' field
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
Result: API response confirming plan update
|
|
93
|
+
|
|
94
|
+
Reference:
|
|
95
|
+
https://app.peoplepowerco.com/cloud/apidocs/admin.html#tag/Billing/operation/Create%20or%20Update%20Billing%20Plan
|
|
96
|
+
"""
|
|
97
|
+
params = {
|
|
98
|
+
"planId": plan_id,
|
|
99
|
+
}
|
|
100
|
+
result: Result = self.adapter.post(
|
|
101
|
+
"/espapi/admin/json/billingPlans",
|
|
102
|
+
ep_params=params,
|
|
103
|
+
ep_json=plan_data if plan_data else None,
|
|
104
|
+
ep_headers=self.adapter._get_headers(
|
|
105
|
+
api_key=self.adapter._headers.get("ADMIN_KEY"),
|
|
106
|
+
key_type=APIKeyType.USER
|
|
107
|
+
),
|
|
108
|
+
)
|
|
109
|
+
return result
|
|
110
|
+
|
|
111
|
+
def get_billing_plans(
|
|
112
|
+
self,
|
|
113
|
+
) -> Result:
|
|
114
|
+
"""
|
|
115
|
+
Get billing plans.
|
|
116
|
+
|
|
117
|
+
A billing plan is a collection of billing prices for each time period.
|
|
118
|
+
A billing plan must be assigned to an organization to generate bills.
|
|
119
|
+
|
|
120
|
+
Returns:
|
|
121
|
+
Result: API response with billing plans data
|
|
122
|
+
|
|
123
|
+
Reference:
|
|
124
|
+
https://app.peoplepowerco.com/cloud/apidocs/admin.html#tag/Billing/operation/Get%20Billing%20Plans
|
|
125
|
+
"""
|
|
126
|
+
result: Result = self.adapter.get(
|
|
127
|
+
"/espapi/admin/json/billingPlans",
|
|
128
|
+
ep_headers=self.adapter._get_headers(
|
|
129
|
+
api_key=self.adapter._headers.get("ADMIN_KEY"),
|
|
130
|
+
key_type=APIKeyType.USER
|
|
131
|
+
),
|
|
132
|
+
)
|
|
133
|
+
return result
|
|
134
|
+
|
|
135
|
+
def create_billing_plan_version(
|
|
136
|
+
self,
|
|
137
|
+
plan_id: int,
|
|
138
|
+
version_data: Dict,
|
|
139
|
+
) -> Result:
|
|
140
|
+
"""
|
|
141
|
+
Create a new version of a billing plan.
|
|
142
|
+
|
|
143
|
+
Args:
|
|
144
|
+
plan_id: Billing plan ID
|
|
145
|
+
version_data: Version data as JSON object with 'version' key containing 'startDate' and 'prices' fields
|
|
146
|
+
|
|
147
|
+
Returns:
|
|
148
|
+
Result: API response with created version data
|
|
149
|
+
|
|
150
|
+
Reference:
|
|
151
|
+
https://app.peoplepowerco.com/cloud/apidocs/admin.html#tag/Billing/operation/Get%20Billing%20Plan%20Versions
|
|
152
|
+
"""
|
|
153
|
+
result: Result = self.adapter.post(
|
|
154
|
+
f"/espapi/admin/json/billingPlans/{plan_id}/versions",
|
|
155
|
+
ep_json=version_data if version_data else None,
|
|
156
|
+
ep_headers=self.adapter._get_headers(
|
|
157
|
+
api_key=self.adapter._headers.get("ADMIN_KEY"),
|
|
158
|
+
key_type=APIKeyType.USER
|
|
159
|
+
),
|
|
160
|
+
)
|
|
161
|
+
return result
|
|
162
|
+
|
|
163
|
+
def update_billing_plan_version(
|
|
164
|
+
self,
|
|
165
|
+
plan_id: int,
|
|
166
|
+
plan_version_id: int,
|
|
167
|
+
version_data: Dict,
|
|
168
|
+
) -> Result:
|
|
169
|
+
"""
|
|
170
|
+
Create or update an existing version of a billing plan.
|
|
171
|
+
|
|
172
|
+
Args:
|
|
173
|
+
plan_id: Billing plan ID
|
|
174
|
+
plan_version_id: Plan version ID to update
|
|
175
|
+
version_data: Version data as JSON object with 'version' key containing 'startDate' and 'prices' fields
|
|
176
|
+
|
|
177
|
+
Returns:
|
|
178
|
+
Result: API response confirming version update
|
|
179
|
+
|
|
180
|
+
Reference:
|
|
181
|
+
https://app.peoplepowerco.com/cloud/apidocs/admin.html#tag/Billing/operation/Create%20or%20Update%20Billing%20Plan%20Version
|
|
182
|
+
"""
|
|
183
|
+
params = {
|
|
184
|
+
"planVersionId": plan_version_id,
|
|
185
|
+
}
|
|
186
|
+
result: Result = self.adapter.post(
|
|
187
|
+
f"/espapi/admin/json/billingPlans/{plan_id}/versions",
|
|
188
|
+
ep_params=params,
|
|
189
|
+
ep_json=version_data if version_data else None,
|
|
190
|
+
ep_headers=self.adapter._get_headers(
|
|
191
|
+
api_key=self.adapter._headers.get("ADMIN_KEY"),
|
|
192
|
+
key_type=APIKeyType.USER
|
|
193
|
+
),
|
|
194
|
+
)
|
|
195
|
+
return result
|
|
196
|
+
|
|
197
|
+
def get_billing_plan_versions(
|
|
198
|
+
self,
|
|
199
|
+
plan_id: int,
|
|
200
|
+
) -> Result:
|
|
201
|
+
"""
|
|
202
|
+
Get billing plan versions for a specific plan.
|
|
203
|
+
|
|
204
|
+
Args:
|
|
205
|
+
plan_id: Billing plan ID
|
|
206
|
+
|
|
207
|
+
Returns:
|
|
208
|
+
Result: API response with billing plan versions data
|
|
209
|
+
|
|
210
|
+
Reference:
|
|
211
|
+
https://app.peoplepowerco.com/cloud/apidocs/admin.html#tag/Billing/operation/Get%20Billing%20Plan%20Versions
|
|
212
|
+
"""
|
|
213
|
+
result: Result = self.adapter.get(
|
|
214
|
+
f"/espapi/admin/json/billingPlans/{plan_id}/versions",
|
|
215
|
+
ep_headers=self.adapter._get_headers(
|
|
216
|
+
api_key=self.adapter._headers.get("ADMIN_KEY"),
|
|
217
|
+
key_type=APIKeyType.USER
|
|
218
|
+
),
|
|
219
|
+
)
|
|
220
|
+
return result
|
|
221
|
+
|
|
222
|
+
def get_organization_billing_plans(
|
|
223
|
+
self,
|
|
224
|
+
organization_id: int,
|
|
225
|
+
start_date: str = None,
|
|
226
|
+
end_date: str = None,
|
|
227
|
+
) -> Result:
|
|
228
|
+
"""
|
|
229
|
+
Get billing plans for a specific organization.
|
|
230
|
+
|
|
231
|
+
Args:
|
|
232
|
+
organization_id: Organization ID
|
|
233
|
+
start_date: Limit plans and versions by date (ISO 8601 format)
|
|
234
|
+
end_date: Limit plans and versions by date (ISO 8601 format)
|
|
235
|
+
|
|
236
|
+
Returns:
|
|
237
|
+
Result: API response with organization billing plans data
|
|
238
|
+
|
|
239
|
+
Reference:
|
|
240
|
+
https://app.peoplepowerco.com/cloud/apidocs/admin.html#tag/Billing/operation/Get%20Organization%20Billing%20Plans
|
|
241
|
+
"""
|
|
242
|
+
params = {
|
|
243
|
+
"startDate": start_date,
|
|
244
|
+
"endDate": end_date,
|
|
245
|
+
}
|
|
246
|
+
params = {k: v for k, v in params.items() if v is not None}
|
|
247
|
+
result: Result = self.adapter.get(
|
|
248
|
+
f"/espapi/admin/json/organizations/{organization_id}/billingPlans",
|
|
249
|
+
ep_params=params,
|
|
250
|
+
ep_headers=self.adapter._get_headers(
|
|
251
|
+
api_key=self.adapter._headers.get("ADMIN_KEY"),
|
|
252
|
+
key_type=APIKeyType.USER
|
|
253
|
+
),
|
|
254
|
+
)
|
|
255
|
+
return result
|
|
256
|
+
|
|
257
|
+
def set_organization_billing_plan(
|
|
258
|
+
self,
|
|
259
|
+
organization_id: int,
|
|
260
|
+
plan_id: int,
|
|
261
|
+
start_date: str = None,
|
|
262
|
+
) -> Result:
|
|
263
|
+
"""
|
|
264
|
+
Set or update billing plan for an organization.
|
|
265
|
+
|
|
266
|
+
Args:
|
|
267
|
+
organization_id: Organization ID
|
|
268
|
+
plan_id: Billing plan ID
|
|
269
|
+
start_date: New plan start date (ISO 8601 format)
|
|
270
|
+
|
|
271
|
+
Returns:
|
|
272
|
+
Result: API response confirming plan assignment
|
|
273
|
+
|
|
274
|
+
Reference:
|
|
275
|
+
https://app.peoplepowerco.com/cloud/apidocs/admin.html#tag/Billing/operation/Set%20Organization%20Billing%20Plan
|
|
276
|
+
"""
|
|
277
|
+
params = {
|
|
278
|
+
"planId": plan_id,
|
|
279
|
+
"startDate": start_date,
|
|
280
|
+
}
|
|
281
|
+
params = {k: v for k, v in params.items() if v is not None}
|
|
282
|
+
result: Result = self.adapter.post(
|
|
283
|
+
f"/espapi/admin/json/organizations/{organization_id}/billingPlans",
|
|
284
|
+
ep_params=params,
|
|
285
|
+
ep_headers=self.adapter._get_headers(
|
|
286
|
+
api_key=self.adapter._headers.get("ADMIN_KEY"),
|
|
287
|
+
key_type=APIKeyType.USER
|
|
288
|
+
),
|
|
289
|
+
)
|
|
290
|
+
return result
|
|
291
|
+
|
|
292
|
+
def delete_organization_billing_plan(
|
|
293
|
+
self,
|
|
294
|
+
organization_id: int,
|
|
295
|
+
start_date: str = None,
|
|
296
|
+
) -> Result:
|
|
297
|
+
"""
|
|
298
|
+
Delete billing plan assignment from an organization.
|
|
299
|
+
|
|
300
|
+
Args:
|
|
301
|
+
organization_id: Organization ID
|
|
302
|
+
start_date: Stop billing date (ISO 8601 format)
|
|
303
|
+
|
|
304
|
+
Returns:
|
|
305
|
+
Result: API response confirming plan deletion
|
|
306
|
+
|
|
307
|
+
Reference:
|
|
308
|
+
https://app.peoplepowerco.com/cloud/apidocs/admin.html#tag/Billing/operation/Delete%20Organization%20Billing%20Plan
|
|
309
|
+
"""
|
|
310
|
+
params = {
|
|
311
|
+
"startDate": start_date,
|
|
312
|
+
}
|
|
313
|
+
params = {k: v for k, v in params.items() if v is not None}
|
|
314
|
+
result: Result = self.adapter.delete(
|
|
315
|
+
f"/espapi/admin/json/organizations/{organization_id}/billingPlans",
|
|
316
|
+
ep_params=params,
|
|
317
|
+
ep_headers=self.adapter._get_headers(
|
|
318
|
+
api_key=self.adapter._headers.get("ADMIN_KEY"),
|
|
319
|
+
key_type=APIKeyType.USER
|
|
320
|
+
),
|
|
321
|
+
)
|
|
322
|
+
return result
|
|
323
|
+
|
|
324
|
+
def generate_bill(
|
|
325
|
+
self,
|
|
326
|
+
organization_id: int,
|
|
327
|
+
start_date: str = None,
|
|
328
|
+
end_date: str = None,
|
|
329
|
+
) -> Result:
|
|
330
|
+
"""
|
|
331
|
+
Generate bills for an organization for one or multiple billing periods.
|
|
332
|
+
|
|
333
|
+
The API (re)generates bills for one or multiple billing periods (months).
|
|
334
|
+
The generated bills are saved in the database and returned in the response body.
|
|
335
|
+
|
|
336
|
+
Bills can be generated starting from the previous organization's billing date or before it.
|
|
337
|
+
All previous bills will be deleted.
|
|
338
|
+
|
|
339
|
+
By default only one bill is generated. To generate multiple bills the endDate parameter must be provided.
|
|
340
|
+
|
|
341
|
+
Args:
|
|
342
|
+
organization_id: Organization ID
|
|
343
|
+
start_date: Start date of the first billing period (ISO 8601 format)
|
|
344
|
+
end_date: End date of the last billing period (ISO 8601 format)
|
|
345
|
+
|
|
346
|
+
Returns:
|
|
347
|
+
Result: API response with generated bill data
|
|
348
|
+
|
|
349
|
+
Reference:
|
|
350
|
+
https://app.peoplepowerco.com/cloud/apidocs/admin.html#tag/Billing/operation/Generate%20Bills
|
|
351
|
+
"""
|
|
352
|
+
params = {
|
|
353
|
+
"startDate": start_date,
|
|
354
|
+
"endDate": end_date,
|
|
355
|
+
}
|
|
356
|
+
params = {k: v for k, v in params.items() if v is not None}
|
|
357
|
+
result: Result = self.adapter.put(
|
|
358
|
+
f"/espapi/admin/json/organizations/{organization_id}/bills",
|
|
359
|
+
ep_params=params,
|
|
360
|
+
ep_headers=self.adapter._get_headers(
|
|
361
|
+
api_key=self.adapter._headers.get("ADMIN_KEY"),
|
|
362
|
+
key_type=APIKeyType.USER
|
|
363
|
+
),
|
|
364
|
+
)
|
|
365
|
+
return result
|
|
366
|
+
|
|
367
|
+
def get_bills(
|
|
368
|
+
self,
|
|
369
|
+
organization_id: int,
|
|
370
|
+
start_date: str,
|
|
371
|
+
end_date: str = None,
|
|
372
|
+
) -> Result:
|
|
373
|
+
"""
|
|
374
|
+
Get the list of bills generated for the organization for specified date range.
|
|
375
|
+
|
|
376
|
+
Args:
|
|
377
|
+
organization_id: Organization ID
|
|
378
|
+
start_date: Start date (ISO 8601 format, required)
|
|
379
|
+
end_date: End date, default is 1st day of the current month (ISO 8601 format)
|
|
380
|
+
|
|
381
|
+
Returns:
|
|
382
|
+
Result: API response with bills data
|
|
383
|
+
|
|
384
|
+
Reference:
|
|
385
|
+
https://app.peoplepowerco.com/cloud/apidocs/admin.html#tag/Billing/operation/Get%20Bills
|
|
386
|
+
"""
|
|
387
|
+
params = {
|
|
388
|
+
"startDate": start_date,
|
|
389
|
+
"endDate": end_date,
|
|
390
|
+
}
|
|
391
|
+
params = {k: v for k, v in params.items() if v is not None}
|
|
392
|
+
result: Result = self.adapter.get(
|
|
393
|
+
f"/espapi/admin/json/organizations/{organization_id}/bills",
|
|
394
|
+
ep_params=params,
|
|
395
|
+
ep_headers=self.adapter._get_headers(
|
|
396
|
+
api_key=self.adapter._headers.get("ADMIN_KEY"),
|
|
397
|
+
key_type=APIKeyType.USER
|
|
398
|
+
),
|
|
399
|
+
)
|
|
400
|
+
return result
|
|
401
|
+
|
|
402
|
+
def get_bill_content(
|
|
403
|
+
self,
|
|
404
|
+
organization_id: int,
|
|
405
|
+
bill_id: int,
|
|
406
|
+
format: str,
|
|
407
|
+
) -> Result:
|
|
408
|
+
"""
|
|
409
|
+
Return an organization bill in PDF or CSV format.
|
|
410
|
+
|
|
411
|
+
Args:
|
|
412
|
+
organization_id: Organization ID
|
|
413
|
+
bill_id: Bill ID
|
|
414
|
+
format: Bill file format ('pdf' or 'csv')
|
|
415
|
+
|
|
416
|
+
Returns:
|
|
417
|
+
Result: API response with bill content data
|
|
418
|
+
|
|
419
|
+
Reference:
|
|
420
|
+
https://app.peoplepowerco.com/cloud/apidocs/admin.html#tag/Billing/operation/Get%20Bill%20Content
|
|
421
|
+
"""
|
|
422
|
+
params = {
|
|
423
|
+
"format": format,
|
|
424
|
+
}
|
|
425
|
+
result: Result = self.adapter.get(
|
|
426
|
+
f"/espapi/admin/json/organizations/{organization_id}/bills/{bill_id}",
|
|
427
|
+
ep_params=params,
|
|
428
|
+
ep_headers=self.adapter._get_headers(
|
|
429
|
+
api_key=self.adapter._headers.get("ADMIN_KEY"),
|
|
430
|
+
key_type=APIKeyType.USER
|
|
431
|
+
),
|
|
432
|
+
)
|
|
433
|
+
return result
|