PyUp-LifeUp-API 0.1.1__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.
@@ -0,0 +1,21 @@
1
+ # MIT License
2
+
3
+ Copyright (c) 2024 deadend-g4mes
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,17 @@
1
+ Metadata-Version: 2.1
2
+ Name: PyUp-LifeUp-API
3
+ Version: 0.1.1
4
+ Summary: A python package for working with the LifeUp api
5
+ Author-email: leighton carpenter <leighton.h.carpenter@gmail.com>
6
+ Project-URL: Homepage, https://github.com/deadend-g4mes/PyUp
7
+ Project-URL: Issues, https://github.com/deadend-g4mes/PyUp/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.12.6
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+
15
+ # PyUp
16
+ a Python Library for easy usage of the LifeUp API.
17
+
@@ -0,0 +1,13 @@
1
+ pyup/__init__.py,sha256=y72A_0MRlgXzWQl0gX6TyKkqbOvOQhQ2nDkc-4KvZEk,344
2
+ pyup/__main__.py,sha256=7J-YOYwKQXRTYkqwzOfVOKLZwgvYzqkyNQTx6dcQbLE,658
3
+ pyup/atm.py,sha256=qTZblhmPMQYB4-bcsChk80-0CV-Ai8O78RgQ4KNGtp8,1516
4
+ pyup/general.py,sha256=1jopcEjvx6gl9Kk6Hx99nNjBqTq6fTQjKSumI4fmvAM,4643
5
+ pyup/pomodoro.py,sha256=Jkt9gPWphnSiKLSH3onJUU10M49q_5zOrb09qCiCbsU,5710
6
+ pyup/pyup.py,sha256=_G6hRpqPT704vEb38hJFCj-OwM4xZilFEcfRCZIQPvw,378
7
+ pyup/shop.py,sha256=OI2_WBMi6yQkwsBdLEX0F8FTdm7AQTA0yOTj95xScLM,6231
8
+ pyup/task.py,sha256=HKbWPivoIr4mwcJWsjXBPJAufWeI6v7cWJNu_AoYI28,5980
9
+ PyUp_LifeUp_API-0.1.1.dist-info/LICENSE,sha256=g5dDiZxko30Hy2848igw62F4ncpwGfojB88eS7QdiAw,1093
10
+ PyUp_LifeUp_API-0.1.1.dist-info/METADATA,sha256=-bXkhPFWBcwKuzS6J8Yn0yuJzezkE6pXmU7goCLmoc8,622
11
+ PyUp_LifeUp_API-0.1.1.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
12
+ PyUp_LifeUp_API-0.1.1.dist-info/top_level.txt,sha256=AvGXwDQc4gcvEvR_Hpw51L--8jy1EdA9C5BzBW4SAY4,5
13
+ PyUp_LifeUp_API-0.1.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.3.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ pyup
pyup/__init__.py ADDED
@@ -0,0 +1,15 @@
1
+ """
2
+ PyUp
3
+ =====
4
+
5
+ an easy to use python library for integrating LifeUp into your projects.
6
+ """
7
+ from .general import General
8
+ from .task import Task
9
+ from .shop import Shop
10
+ from .pyup import PyUp
11
+ from .atm import ATM
12
+ from .pomodoro import Pomodoro
13
+
14
+ __all__ = ["Task", "General", "PyUp", "Shop", "ATM", "Pomodoro"]
15
+ __version__ = "0.1.1"
pyup/__main__.py ADDED
@@ -0,0 +1,33 @@
1
+ from requests import Response, Session
2
+ from enum import Enum
3
+ import re
4
+ from datetime import datetime
5
+
6
+ http = Session()
7
+ class Type(Enum):
8
+ COIN = 'coin'
9
+ EXP = 'exp'
10
+ ITEM = 'item'
11
+
12
+ class CountSetType(Enum):
13
+ ABSOLUTE = 'absolute'
14
+ RELATIVE = 'relative'
15
+
16
+
17
+ def call(call,host,port) -> Response:
18
+
19
+ url = 'http://' + host + ':' + port + '/api?' + call
20
+ return http.get(url=url)
21
+
22
+ def color_check(hex: str):
23
+ match = re.seach(r'^#(?:[0-9a-fA-F]{3}){1,2}$', hex)
24
+
25
+ if match:
26
+ return True
27
+ else:
28
+ return False
29
+
30
+ def time_to_epoch(date:datetime):
31
+
32
+ return int(date.timestamp()) * 1000
33
+
pyup/atm.py ADDED
@@ -0,0 +1,58 @@
1
+ from .pyup import PyUp
2
+ from .__main__ import *
3
+
4
+ class ATM(PyUp):
5
+
6
+ def __init__(self, pyup:PyUp):
7
+ '''
8
+ Some api calls for communicating with the shop in LifeUp.
9
+ '''
10
+ super().__init__(pyup.host, pyup.port)
11
+ self.host = pyup.host
12
+ self.port = pyup.port
13
+
14
+ def deposit(self, amount: int):
15
+
16
+ params = vars()
17
+ try:
18
+ params.pop('self')
19
+ finally:
20
+ pass
21
+
22
+ if amount < 1:
23
+ raise ValueError('param: amount: value must be greater than 0')
24
+
25
+ url = 'url=lifeup://api/deposit?'
26
+ for key, value in params.items():
27
+ if value is not None:
28
+ url = url + key + '=' + str(value) + '%26'
29
+ else:
30
+ continue
31
+ url = url[:-3]
32
+
33
+ result = call(call=url,host=self.host,port=self.port)
34
+
35
+ return result
36
+
37
+ def withdraw(self, amount: int):
38
+
39
+ params = vars()
40
+ try:
41
+ params.pop('self')
42
+ finally:
43
+ pass
44
+
45
+ if amount < 1:
46
+ raise ValueError('param: amount: value must be greater than 0')
47
+
48
+ url = 'url=lifeup://api/withdraw?'
49
+ for key, value in params.items():
50
+ if value is not None:
51
+ url = url + key + '=' + str(value) + '%26'
52
+ else:
53
+ continue
54
+ url = url[:-3]
55
+
56
+ result = call(call=url,host=self.host,port=self.port)
57
+
58
+ return result
pyup/general.py ADDED
@@ -0,0 +1,114 @@
1
+ from .pyup import PyUp
2
+ from .__main__ import *
3
+
4
+ class General(PyUp):
5
+
6
+ def __init__(self, pyup: PyUp):
7
+ '''
8
+ Some general api calls for communication with LifeUp.
9
+ '''
10
+ super().__init__(pyup.host, pyup.port)
11
+ self.host = pyup.host
12
+ self.port = pyup.port
13
+
14
+ def reward(self, content: str, type: str, number: int, skills: list = None, item_id: int = None, item_name: str = None, silent: bool = None) -> Response:
15
+ '''
16
+ Provide the reward directly. The reason for the reward can be customized.
17
+
18
+ :param str content: text that appears on the reward notification.
19
+ :param str type: reward type (must be either 'coin', 'exp' or 'item').
20
+ :param int number: amount of reward given.
21
+ :param (optional) list skills: array of numbers greater than 0. dicates what skills recieve the exp reward.
22
+ :param (optional) int item_id: the numerical id of the item the user recieves as a reward.
23
+ :param (optional) str item_name: the name of the item the user recieves as a reward.
24
+ :param (optional) bool silent: wether the UI notification appears or not.
25
+ :return: :class:`Response <Response>` object
26
+ :rtype: requests.Response
27
+ '''
28
+ if type != 'coin' or 'exp' or 'item':
29
+ raise ValueError("param: content: value must be a value of 'coin', 'exp' or 'item'.")
30
+ if type == 'item' and item_id == 0 or item_name == '':
31
+ raise ValueError("param: type: value 'item' requires item_id and item_name to have values.")
32
+
33
+ params = vars()
34
+ try:
35
+ params.pop('self')
36
+ finally:
37
+ pass
38
+
39
+ url = 'url=lifeup://api/reward?'
40
+ for key, value in params.items():
41
+ if value is not None:
42
+ url = url + key + '=' + str(value) + '%26'
43
+ else:
44
+ continue
45
+ url = url[:-3]
46
+ result = call(call=url)
47
+ return result
48
+
49
+ def toast(self, text: str, type: int = 0, isLong: bool = False) -> Response:
50
+ '''
51
+ Various styles of messages pop up.
52
+
53
+ :param str text: the message that appears on the prompt.
54
+ :param (optional) int type: a number from 0-6 defining the text style.
55
+ :param (optional) bool isLong: display duration, True = long, False = short.
56
+ :return: :class:`Response <Response>` object
57
+ :rtype: requests.Response
58
+ '''
59
+ if type < 0 or type > 6 or not isinstance(type,int):
60
+ raise ValueError('param: type: value must be a whole number between 0 and 6')
61
+
62
+ params = vars()
63
+ try:
64
+ params.pop('self')
65
+ finally:
66
+ pass
67
+
68
+ url = 'url=lifeup://api/toast?'
69
+ for key, value in params.items():
70
+ if value is not None:
71
+ url = url + key + '=' + str(value) + '%26'
72
+ else:
73
+ continue
74
+ url = url[:-3]
75
+
76
+ result = call(call=url)
77
+
78
+ return result
79
+
80
+ def penality(self, content: str, type: str, number: int, skills: list = None, item_id:int = None, item_name: str = None, silent: bool = None) -> Response:
81
+ '''
82
+ Provide a penalty directly. The reason for the penalty can be customized.
83
+
84
+ :param str content: text that appears on the reward notification.
85
+ :param str type: reward type (must be either 'coin', 'exp' or 'item').
86
+ :param int number: amount of reward given.
87
+ :param (optional) list skills: array of numbers greater than 0. dicates what skills recieve the exp reward.
88
+ :param (optional) int item_id: the numerical id of the item the user recieves as a reward.
89
+ :param (optional) str item_name: the name of the item the user recieves as a reward.
90
+ :param (optional) bool silent: wether the UI notification appears or not.
91
+ :return: :class:`Response <Response>` object
92
+ :rtype: requests.Response
93
+ '''
94
+
95
+ if type == 'item' and item_id == 0 and item_name == '':
96
+ raise ValueError("param: type: value 'item' requires item_id and item_name.")
97
+
98
+ params = vars()
99
+ try:
100
+ params.pop('self')
101
+ finally:
102
+ pass
103
+
104
+ url = 'url=lifeup://api/penality?'
105
+ for key, value in params.items():
106
+ if value is not None:
107
+ url = url + key + '=' + str(value) + '%26'
108
+ else:
109
+ continue
110
+ url = url[:-3]
111
+
112
+ result = call(call=url)
113
+
114
+ return result
pyup/pomodoro.py ADDED
@@ -0,0 +1,128 @@
1
+ from .pyup import PyUp
2
+ from .__main__ import *
3
+
4
+ class Pomodoro(PyUp):
5
+
6
+ def __init__(self, pyup: PyUp):
7
+ '''
8
+ Some api calls for communication with the Pomodoro record in LifeUp.
9
+ '''
10
+ super().__init__(pyup.host, pyup.port)
11
+ self.host = pyup.host
12
+ self.port = pyup.port
13
+
14
+ def add_record(self, start_time: datetime = None, duration: int = None, end_time: datetime = None, reward_tomatoes: bool = None, task_id: int = None, task_gid: int = None, task_name: str = None):
15
+ '''
16
+ Adds new Pomodoro record to LifeUp.
17
+
18
+
19
+ :return: :class:`Response <Response>` object
20
+ :rtype: requests.Response
21
+ '''
22
+ if start_time is not None:
23
+ start_time = time_to_epoch(start_time)
24
+
25
+ if end_time is not None:
26
+ if duration is not None:
27
+ if start_time is not None and not duration <= start_time - end_time:
28
+ raise ValueError("param: duration: value must be less than or equal to start_time - end_time if all three params are given.")
29
+ elif duration < 30:
30
+ raise ValueError("param: duration: value must be greater than or equal to 30.")
31
+ else:
32
+ duration = duration * 1000
33
+ elif start_time is not None:
34
+ if end_time <= start_time:
35
+ raise ValueError("param: end_time: value must be greater than start_time.")
36
+ elif end_time - start_time < 30:
37
+ raise ValueError("param: end_time or start_time: the value of end_time - start_time must be greater than or equal to 30.")
38
+ else:
39
+ raise ValueError("param: end_time: requires a value given to either start_time or duration.")
40
+ end_time = time_to_epoch(end_time)
41
+ elif duration is not None and duration >= 30:
42
+ duration = duration * 1000
43
+ else:
44
+ raise ValueError("OneOfType: duration, end_time or start_time must have a value.")
45
+
46
+ if task_gid or task_id or task_name is None:
47
+ raise ValueError("OneOfType: task_id, task_gid or task_name must have a value.")
48
+ if task_id is not None and task_id < 1:
49
+ raise ValueError("param: task_id: value must be greater than 0")
50
+
51
+ if task_gid is not None and task_gid < 1:
52
+ raise ValueError("param: task_gid: value must be greater than 0")
53
+
54
+ params = vars()
55
+ try:
56
+ params.pop('self')
57
+ finally:
58
+ pass
59
+
60
+ url = 'url=lifeup://api/add_pomodoro?'
61
+ for key, value in params.items():
62
+ if value is not None:
63
+ url = url + key + '=' + str(value) + '%26'
64
+ else:
65
+ continue
66
+ url = url[:-3]
67
+
68
+ result = call(call=url,host=self.host,port=self.port)
69
+
70
+ return result
71
+
72
+ def edit_pomodoro(self, edit_item_id: int, start_time: datetime = None, duration: int = None, end_time: datetime = None, reward_tomatoes: bool = None, task_id: int = None, task_gid: int = None, task_name: str = None, ui: bool = None):
73
+ '''
74
+ Edits a record with the given edit_item_id. If not record is found, a new one will be created.
75
+
76
+
77
+ :return: :class:`Response <Response>` object
78
+ :rtype: requests.Response
79
+ '''
80
+ if start_time is not None:
81
+ start_time = time_to_epoch(start_time)
82
+
83
+ if end_time is not None:
84
+ if duration is not None:
85
+ if start_time is not None and not duration <= start_time - end_time:
86
+ raise ValueError("param: duration: value must be less than or equal to start_time - end_time if all three params are given.")
87
+ elif duration < 30:
88
+ raise ValueError("param: duration: value must be greater than or equal to 30.")
89
+ else:
90
+ duration = duration * 1000
91
+ elif start_time is not None:
92
+ if end_time <= start_time:
93
+ raise ValueError("param: end_time: value must be greater than start_time.")
94
+ elif end_time - start_time < 30:
95
+ raise ValueError("param: end_time or start_time: the value of end_time - start_time must be greater than or equal to 30.")
96
+ else:
97
+ raise ValueError("param: end_time: requires a value given to either start_time or duration.")
98
+ end_time = time_to_epoch(end_time)
99
+ elif duration is not None and duration >= 30:
100
+ duration = duration * 1000
101
+ else:
102
+ raise ValueError("OneOfType: duration, end_time or start_time must have a value.")
103
+
104
+ if task_gid or task_id or task_name is None:
105
+ raise ValueError("OneOfType: task_id, task_gid or task_name must have a value.")
106
+ if task_id is not None and task_id < 1:
107
+ raise ValueError("param: task_id: value must be greater than 0")
108
+
109
+ if task_gid is not None and task_gid < 1:
110
+ raise ValueError("param: task_gid: value must be greater than 0")
111
+
112
+ params = vars()
113
+ try:
114
+ params.pop('self')
115
+ finally:
116
+ pass
117
+
118
+ url = 'url=lifeup://api/edit_pomodoro?'
119
+ for key, value in params.items():
120
+ if value is not None:
121
+ url = url + key + '=' + str(value) + '%26'
122
+ else:
123
+ continue
124
+ url = url[:-3]
125
+
126
+ result = call(call=url,host=self.host,port=self.port)
127
+
128
+ return result
pyup/pyup.py ADDED
@@ -0,0 +1,13 @@
1
+ class PyUp:
2
+ host: str
3
+ port: str
4
+
5
+ def __init__(self,host:str,port:str):
6
+ '''
7
+ Creates the base LifeUp api interaction with a given host and port string.
8
+
9
+ :param str host: the ip address of your LifeUp Cloud.
10
+ :param str port: the port address of your LifeUp Cloud.
11
+ '''
12
+ self.host = host
13
+ self.port = port
pyup/shop.py ADDED
@@ -0,0 +1,150 @@
1
+ from .pyup import PyUp
2
+ from .__main__ import *
3
+
4
+ class Shop(PyUp):
5
+
6
+ def __init__(self, pyup:PyUp):
7
+ '''
8
+ Some api calls for communicating with the shop in LifeUp.
9
+ '''
10
+ super().__init__(pyup.host, pyup.port)
11
+ self.host = pyup.host
12
+ self.port = pyup.port
13
+
14
+ def add_item(self, name: str, desc: str = None, icon: str = None, price: int = None, action_text: str = None, disable_purchase: bool = None, stock_number: int = None, category: int = None, order: int = None, own_number: int = None, unlist: bool = None) -> Response:
15
+ '''
16
+ Adds a new item to the shop.
17
+
18
+ :param
19
+ :return: :class:`Response <Response>` object
20
+ :rtype: requests.Response
21
+ '''
22
+ if price != None and price < 1 or price > 999999:
23
+ raise ValueError("param: price: must have a value less than 999999 and greater than or equal to 1")
24
+ elif stock_number != None and stock_number < -1 or stock_number > 999999:
25
+ raise ValueError("param: stock_number: must have a value less than 999999 and greater than or equal to -1")
26
+ elif category != None and category < 0:
27
+ raise ValueError("param: category: must have a value greater than or equal to 0")
28
+
29
+ params = vars()
30
+ try:
31
+ params.pop('self')
32
+ finally:
33
+ pass
34
+
35
+ url = 'url=lifeup://api/add_item?'
36
+ for key, value in params.items():
37
+ if value is not None:
38
+ url = url + key + '=' + str(value) + '%26'
39
+ else:
40
+ continue
41
+ url = url[:-3]
42
+
43
+ result = call(call=url,host=self.host,port=self.port)
44
+
45
+ return result
46
+
47
+ def edit_item(self, id: int = None, name: str = None, set_name: str = None, set_desc: str = None, set_icon: str = None, set_price: int = None, set_price_type: CountSetType = None, action_text: str = None, disable_purchase: bool = None, disable_use: bool = None, stock_number: int = None, stock_number_type: CountSetType = None, title_color_string: str = None, category_id: int = None, order: int = None, own_number: int = None, own_number_type: CountSetType = None, unlist: bool = None) -> Response:
48
+ '''
49
+ Edits the specified item in the shop.
50
+
51
+ :param
52
+ :return: :class:`Response <Response>` object
53
+ :rtype: requests.Response
54
+ '''
55
+ if set_price != None and set_price < 1 or set_price > 999999:
56
+ raise ValueError("param: price: must have a value less than 999999 and greater than or equal to 1")
57
+ elif stock_number != None and stock_number < -1 or stock_number > 999999:
58
+ raise ValueError("param: stock_number: must have a value less than 999999 and greater than or equal to -1")
59
+ elif category_id != None and category_id < 0:
60
+ raise ValueError("param: category: must have a value greater than or equal to 0")
61
+ elif not color_check(title_color_string):
62
+ raise ValueError("param: title_color_string: must be a valid hex color code.")
63
+
64
+ params = vars()
65
+ try:
66
+ params.pop('self')
67
+ finally:
68
+ pass
69
+
70
+ url = 'url=lifeup://api/item?'
71
+ for key, value in params.items():
72
+ if value is not None:
73
+ url = url + key + '=' + str(value) + '%26'
74
+ else:
75
+ continue
76
+ url = url[:-3]
77
+
78
+ result = call(call=url,host=self.host,port=self.port)
79
+
80
+ return result
81
+
82
+ def edit_loot_box(self, id: int = None, name: str = None, sub_id: int = None, sub_name: str = None, set_type: CountSetType = None, amount: int = None, probability: int = None, fixed: bool = None) -> Response:
83
+ '''
84
+ Modify the loot box effect of the specified box item, support adjustment of probability, number of rewards and increase content.
85
+
86
+ :param
87
+ :return: :class:`Response <Response>` object
88
+ :rtype: requests.Response
89
+ '''
90
+
91
+ params = vars()
92
+ try:
93
+ params.pop('self')
94
+ finally:
95
+ pass
96
+
97
+ if id or name is None:
98
+ raise ValueError("param: id || name: must have a value.")
99
+ if sub_id or sub_name is None:
100
+ raise ValueError("param: sub_id || sub_name: must have a value.")
101
+ if id is not None and id < 1:
102
+ raise ValueError("param: id: must have a value greater than 0")
103
+ if sub_id is not None and sub_id < 1:
104
+ raise ValueError("param: sub_id: must have a value greater than 0")
105
+
106
+ url = 'url=lifeup://api/loot_box?'
107
+ for key, value in params.items():
108
+ if value is not None:
109
+ url = url + key + '=' + str(value) + '%26'
110
+ else:
111
+ continue
112
+ url = url[:-3]
113
+
114
+ result = call(call=url,host=self.host,port=self.port)
115
+
116
+ return result
117
+
118
+ def use_item(self, id: int = None, name: str = None, use_times: int = None) -> Response:
119
+ '''
120
+ Modify the loot box effect of the specified box item, support adjustment of probability, number of rewards and increase content.
121
+
122
+ :param
123
+ :return: :class:`Response <Response>` object
124
+ :rtype: requests.Response
125
+ '''
126
+
127
+ params = vars()
128
+ try:
129
+ params.pop('self')
130
+ finally:
131
+ pass
132
+
133
+ if id or name is None:
134
+ raise ValueError("param: id || name: must have a value.")
135
+ if id is not None and id < 1:
136
+ raise ValueError("param: id: must have a value greater than 0")
137
+ if use_times is not None and use_times < 1:
138
+ raise ValueError("param: use_times: must have a value greater than 0")
139
+
140
+ url = 'url=lifeup://api/use_item?'
141
+ for key, value in params.items():
142
+ if value is not None:
143
+ url = url + key + '=' + str(value) + '%26'
144
+ else:
145
+ continue
146
+ url = url[:-3]
147
+
148
+ result = call(call=url,host=self.host,port=self.port)
149
+
150
+ return result
pyup/task.py ADDED
@@ -0,0 +1,180 @@
1
+ from .pyup import PyUp
2
+ from .__main__ import *
3
+
4
+ class Task(PyUp):
5
+
6
+ def __init__(self, pyup:PyUp):
7
+ '''
8
+ Some api calls for communicating with task objects in LifeUp.
9
+ '''
10
+ super().__init__(pyup.host, pyup.port)
11
+ self.host = pyup.host
12
+ self.port = pyup.port
13
+
14
+ def add_task(self, todo: str, notes: str = None, coin: int = None, coin_var: int = None, exp: int = None, skills: list = None, category: int = None, frequency: int = None, importance: int = None, difficulty: int = None, item_id: int = None, item_name: str = None, item_amount: int = None, deadline: int = None, color: str = None, background_url: str = None, frozen: bool = None, freeze_until: int = None, coin_penality_factor: float = None, exp_pentalty_factor: float = None, write_feelings: bool = None) -> Response:
15
+ '''
16
+ Creates a task.
17
+
18
+ :param
19
+ :return: :class:`Response <Response>` object
20
+ :rtype: requests.Response
21
+ '''
22
+ if not color_check(color):
23
+ raise ValueError("param: title_color_string: value must be a valid hex color code.")
24
+
25
+ params = vars()
26
+ try:
27
+ params.pop('self')
28
+ finally:
29
+ pass
30
+
31
+ url = 'url=lifeup://api/add_task?'
32
+ for key, value in params.items():
33
+ if value is not None:
34
+ url = url + key + '=' + str(value) + '%26'
35
+ else:
36
+ continue
37
+ url = url[:-3]
38
+
39
+ result = call(call=url,host=self.host,port=self.port)
40
+
41
+ return result
42
+
43
+ def complete_task(self, id: int = None, gid: int = None, name: str = None, ui: bool = None, count: int = None, count_set_type: CountSetType = None, count_force_sum_up: bool = None, reward_factor: float = None) -> Response:
44
+ '''
45
+ Completes a task. Only unfinished tasks will be searched.
46
+ :return: :class:`Response <Response>` object
47
+ :rtype: requests.Response
48
+ '''
49
+ if id or gid or name == None:
50
+ raise ValueError("OneOfType: id, gid or name must have a value.")
51
+
52
+ params = vars()
53
+ try:
54
+ params.pop('self')
55
+ finally:
56
+ pass
57
+
58
+ url = 'url=lifeup://api/complete?'
59
+ for key, value in params.items():
60
+ if value is not None:
61
+ url = url + key + '=' + str(value) + '%26'
62
+ else:
63
+ continue
64
+ url = url[:-3]
65
+
66
+ result = call(call=url,host=self.host,port=self.port)
67
+
68
+ return result
69
+
70
+ def give_up_task(self, id: int = None, gid: int = None, name: str = None) -> Response:
71
+
72
+ '''
73
+ Gives up a task.
74
+ :return: :class:`Response <Response>` object
75
+ :rtype: requests.Response
76
+ '''
77
+ if id or gid or name == None:
78
+ raise ValueError("OneOfType: id, gid or name must have a value.")
79
+
80
+ params = vars()
81
+ try:
82
+ params.pop('self')
83
+ finally:
84
+ pass
85
+
86
+ url = 'url=lifeup://api/give_up?'
87
+ for key, value in params.items():
88
+ if value is not None:
89
+ url = url + key + '=' + str(value) + '%26'
90
+ else:
91
+ continue
92
+ url = url[:-3]
93
+
94
+ result = call(call=url,host=self.host,port=self.port)
95
+
96
+ return result
97
+
98
+ def freeze_task(self, id: int = None, gid: int = None, name: str = None) -> Response:
99
+
100
+ '''
101
+ Freezes a task, only for repeating tasks.
102
+ :return: :class:`Response <Response>` object
103
+ :rtype: requests.Response
104
+ '''
105
+ if id or gid or name == None:
106
+ raise ValueError("OneOfType: id, gid or name must have a value.")
107
+
108
+ params = vars()
109
+ try:
110
+ params.pop('self')
111
+ finally:
112
+ pass
113
+
114
+ url = 'url=lifeup://api/freeze?'
115
+ for key, value in params.items():
116
+ if value is not None:
117
+ url = url + key + '=' + str(value) + '%26'
118
+ else:
119
+ continue
120
+ url = url[:-3]
121
+
122
+ result = call(call=url,host=self.host,port=self.port)
123
+
124
+ return result
125
+
126
+ def unfreeze_task(self, id: int = None, gid: int = None, name: str = None) -> Response:
127
+
128
+ '''
129
+ Unfreezes a task, only for repeating tasks.
130
+ :return: :class:`Response <Response>` object
131
+ :rtype: requests.Response
132
+ '''
133
+ if id or gid or name == None:
134
+ raise ValueError("OneOfType: id, gid or name must have a value.")
135
+
136
+ params = vars()
137
+ try:
138
+ params.pop('self')
139
+ finally:
140
+ pass
141
+
142
+ url = 'url=lifeup://api/unfreeze?'
143
+ for key, value in params.items():
144
+ if value is not None:
145
+ url = url + key + '=' + str(value) + '%26'
146
+ else:
147
+ continue
148
+ url = url[:-3]
149
+
150
+ result = call(call=url,host=self.host,port=self.port)
151
+
152
+ return result
153
+
154
+ def delete_task(self, id: int = None, gid: int = None, name: str = None) -> Response:
155
+
156
+ '''
157
+ Deletes a task.
158
+ :return: :class:`Response <Response>` object
159
+ :rtype: requests.Response
160
+ '''
161
+ if id or gid or name == None:
162
+ raise ValueError("OneOfType: id, gid or name must have a value.")
163
+
164
+ params = vars()
165
+ try:
166
+ params.pop('self')
167
+ finally:
168
+ pass
169
+
170
+ url = 'url=lifeup://api/delete_task?'
171
+ for key, value in params.items():
172
+ if value is not None:
173
+ url = url + key + '=' + str(value) + '%26'
174
+ else:
175
+ continue
176
+ url = url[:-3]
177
+
178
+ result = call(call=url,host=self.host,port=self.port)
179
+
180
+ return result