id
int64 0
843k
| repository_name
stringlengths 7
55
| file_path
stringlengths 9
332
| class_name
stringlengths 3
290
| human_written_code
stringlengths 12
4.36M
| class_skeleton
stringlengths 19
2.2M
| total_program_units
int64 1
9.57k
| total_doc_str
int64 0
4.2k
| AvgCountLine
float64 0
7.89k
| AvgCountLineBlank
float64 0
300
| AvgCountLineCode
float64 0
7.89k
| AvgCountLineComment
float64 0
7.89k
| AvgCyclomatic
float64 0
130
| CommentToCodeRatio
float64 0
176
| CountClassBase
float64 0
48
| CountClassCoupled
float64 0
589
| CountClassCoupledModified
float64 0
581
| CountClassDerived
float64 0
5.37k
| CountDeclInstanceMethod
float64 0
4.2k
| CountDeclInstanceVariable
float64 0
299
| CountDeclMethod
float64 0
4.2k
| CountDeclMethodAll
float64 0
4.2k
| CountLine
float64 1
115k
| CountLineBlank
float64 0
9.01k
| CountLineCode
float64 0
94.4k
| CountLineCodeDecl
float64 0
46.1k
| CountLineCodeExe
float64 0
91.3k
| CountLineComment
float64 0
27k
| CountStmt
float64 1
93.2k
| CountStmtDecl
float64 0
46.1k
| CountStmtExe
float64 0
90.2k
| MaxCyclomatic
float64 0
759
| MaxInheritanceTree
float64 0
16
| MaxNesting
float64 0
34
| SumCyclomatic
float64 0
6k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7,400 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/test/LoadBalancer.py
|
test.LoadBalancer.LoadBalancerTest
|
class LoadBalancerTest(unittest.TestCase):
def setUp(self):
self.loadBalancer = LoadBalancer(ws_uri=ws_uri, username=username, password=password)
def test_get(self):
response = self.loadBalancer.get()
self.assertIsNotNone(response)
self.assertIsInstance(response, list)
# def test_get_load_balancer_notifications(self):
# start_date = datetime.now() - timedelta(days=1)
# end_date = datetime.now()
# noinspection PyPep8Naming
def test_set_enqueue_load_balancer_creation(self):
"""
def __init__(self, healthCheckNotification, instance, ipAddressResourceId, loadBalancerClassOfServiceID, name,
notificationContacts, rules, *args, **kwargs):
:return:
"""
healthCheckNotification = True
instance = [Instance(ipAddress='127.0.0.1')]
ipAddressResourceId = 14211
name = 'testUnitLoadBalancer'
notificationContact = NotificationContact(contactValue='test@test.com', contactType=NotificationType.Email,
loadBalancerContactID=124142)
notificationContacts = [notificationContact]
rule = NewLoadBalancerRule(balancerType=LoadBalancerAlgorithmType.LeastConn,
certificate='',
instancePort=80,
loadBalancerPort=80,
protocol=LoadBalancerProtocol.Tcp,
id=1,
creationDate=datetime.now())
rules = [rule]
response = self.loadBalancer.create(
healthCheckNotification=healthCheckNotification,
instance=instance,
ipAddressResourceId=[ipAddressResourceId],
name=name,
notificationContacts=notificationContacts,
rules=rules
)
if __name__ == '__main__':
unittest.main()
|
class LoadBalancerTest(unittest.TestCase):
def setUp(self):
pass
def test_get(self):
pass
def test_set_enqueue_load_balancer_creation(self):
'''
def __init__(self, healthCheckNotification, instance, ipAddressResourceId, loadBalancerClassOfServiceID, name,
notificationContacts, rules, *args, **kwargs):
:return:
'''
pass
| 4 | 1 | 13 | 1 | 11 | 2 | 1 | 0.27 | 1 | 2 | 0 | 0 | 3 | 1 | 3 | 75 | 47 | 5 | 33 | 15 | 29 | 9 | 19 | 15 | 15 | 2 | 2 | 1 | 4 |
7,401 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/objects/VmTypes/__init__.py
|
ArubaCloud.objects.VmTypes.Pro
|
class Pro(VM):
def __init__(self, interface, sid):
super(Pro, self).__init__(interface)
self.cltype = 'pro'
self.sid = sid
self.ip_addr = Ip()
# Load HD information
self.hds = []
_hds = self.interface.get_server_detail(self.sid)['VirtualDisks']
for hd in _hds:
self.hds.append(hd)
"""
Methods specific for Pro VM
"""
def _commit_compute_resources(self):
method_json = {
"ServerId": self.sid,
"CpuQuantity": self.cpu_qty,
"RamQuantity": self.ram_qty,
"RestartAfterExecuted": 'true'
}
json_obj = self.interface.call_method_post(method='SetEnqueueHardwareUpdate',
json_scheme=self.interface.gen_def_json_scheme(
req='SetEnqueueHardwareUpdate',
method_fields=method_json)
)
return json_obj
def edit_cpu(self, cpu_qty, debug=False):
if not self.status == 2:
raise OperationNotPermitted("Cannot edit resources in the current state of the VM.")
self.cpu_qty = cpu_qty
json_obj = self._commit_compute_resources()
if debug is True:
print(json_obj)
return True if json_obj['Success'] is True else False
def edit_ram(self, ram_qty, debug=False):
if not self.status == 2:
raise OperationNotPermitted("Cannot edit resources in the current state of the VM.")
self.ram_qty = ram_qty
json_obj = self._commit_compute_resources()
if debug is True:
print(json_obj)
return True if json_obj['Success'] is True else False
def add_virtual_disk(self, size, debug=False):
if not self.status == 2:
raise OperationNotPermitted("Cannot edit resources in the current state of the VM.")
if len(self.hds) > 3:
raise ValueError("Cannot create more than 3 disks per VM.")
virtual_disk_operation = VirtualDiskOperation
method_json = {
'ServerId': self.sid,
'Disk': {
'CustomVirtualDiskPath': None,
'Size': size,
'VirtualDiskType': len(self.hds), # increment the counter of current present disks
'VirtualDiskUpdateType': virtual_disk_operation.create
}
}
json_obj = self.interface.call_method_post(method='SetEnqueueVirtualDiskManage',
json_scheme=self.interface.gen_def_json_scheme(
req='SetEnqueueVirtualDiskManage',
method_fields=method_json)
)
if debug is True:
print(json_obj)
return True if json_obj['Success'] is True else False
def resize_virtual_disk(self, size, debug=False):
if not self.status == 2:
raise OperationNotPermitted("Cannot edit resources in the current state of the VM.")
if self.hd_total_size > size:
raise OperationNotPermitted("Cannot decrease size of the disk")
virtual_disk_operation = VirtualDiskOperation
method_json = {
'ServerId': self.sid,
'Disk': {
'CustomVirtualDiskPath': None,
'Size': size,
'VirtualDiskType': self.hds,
'VirtualDiskUpdateType': virtual_disk_operation.resize
}
}
json_obj = self.interface.call_method_post(method='SetEnqueueVirtualDiskManage',
json_scheme=self.interface.gen_def_json_scheme(
req='SetEnqueueVirtualDiskManage',
method_fields=method_json)
)
if debug is True:
print(json_obj)
return True if json_obj['Success'] is True else False
def remove_virtual_disk(self, virtual_disk_id, debug=False):
if not self.status == 2:
raise OperationNotPermitted("Cannot edit resources in the current state of the VM.")
virtual_disk_operation = VirtualDiskOperation
method_json = {
'ServerId': self.sid,
'Disk': {
'CustomVirtualDiskPath': None,
'Size': 0,
'VirtualDiskType': virtual_disk_id,
'VirtualDiskUpdateType': virtual_disk_operation.delete
}
}
json_obj = self.interface.call_method_post(method='SetEnqueueVirtualDiskManage',
json_scheme=self.interface.gen_def_json_scheme(
req='SetEnqueueVirtualDiskManage',
method_fields=method_json)
)
if debug is True:
print(json_obj)
return True if json_obj['Success'] is True else False
def __str__(self):
msg = super(Pro, self).__str__()
msg += ' -> IPAddr: %s\n' % self.ip_addr
return msg
|
class Pro(VM):
def __init__(self, interface, sid):
pass
def _commit_compute_resources(self):
pass
def edit_cpu(self, cpu_qty, debug=False):
pass
def edit_ram(self, ram_qty, debug=False):
pass
def add_virtual_disk(self, size, debug=False):
pass
def resize_virtual_disk(self, size, debug=False):
pass
def remove_virtual_disk(self, virtual_disk_id, debug=False):
pass
def __str__(self):
pass
| 9 | 0 | 14 | 0 | 14 | 0 | 3 | 0.05 | 1 | 5 | 3 | 0 | 8 | 6 | 8 | 17 | 125 | 11 | 110 | 31 | 101 | 5 | 65 | 31 | 56 | 5 | 2 | 1 | 26 |
7,402 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/base/Errors.py
|
ArubaCloud.base.Errors.RequestFailed
|
class RequestFailed(Exception):
def __init__(self, message):
super(RequestFailed, self).__init__(message)
|
class RequestFailed(Exception):
def __init__(self, message):
pass
| 2 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 11 | 3 | 0 | 3 | 2 | 1 | 0 | 3 | 2 | 1 | 1 | 3 | 0 | 1 |
7,403 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/objects/__init__.py
|
ArubaCloud.objects.NetworkAdapter
|
class NetworkAdapter(object):
ip_addresses = []
id = None
mac_address = None
network_adapter_type = None
server_id = None
vlan_id = None
|
class NetworkAdapter(object):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | 0 | 7 | 6 | 6 | 0 | 7 | 6 | 6 | 0 | 1 | 0 | 0 |
7,404 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/PyArubaAPI.py
|
ArubaCloud.PyArubaAPI.LoadBalancer
|
class LoadBalancer(JsonInterfaceBase):
def __init__(self):
super(LoadBalancer, self).__init__()
self._name = ''
self.auth = Auth()
@property
def name(self):
return self._name
def get(self):
scheme = self.gen_def_json_scheme('GetLoadBalancers')
json_obj = self.call_method_post('GetLoadbalancers', json_scheme=scheme)
print(json_obj)
def login(self, username, password):
self.auth.username = username
self.auth.password = password
|
class LoadBalancer(JsonInterfaceBase):
def __init__(self):
pass
@property
def name(self):
pass
def get(self):
pass
def login(self, username, password):
pass
| 6 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 2 | 1 | 0 | 4 | 2 | 4 | 7 | 18 | 3 | 15 | 10 | 9 | 0 | 14 | 9 | 9 | 1 | 2 | 0 | 4 |
7,405 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/PyArubaAPI.py
|
ArubaCloud.PyArubaAPI.JsonInterface
|
class JsonInterface(JsonInterfaceBase):
pass
|
class JsonInterface(JsonInterfaceBase):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 3 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
7,406 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/objects/__init__.py
|
ArubaCloud.objects.ProVmCreator
|
class ProVmCreator(Creator):
def __init__(self, name, admin_password, template_id, auth_obj, note=None):
self.name = name
self.admin_password = admin_password
self.template_id = template_id
self.auth = auth_obj
self.note = 'Create by pyArubaCloud' if note is None else note
self.ethernet_counter = 0
self.virtual_disk_counter = 0
self.json_msg = {
'ApplicationId': 'SetEnqueueServerCreation',
'RequestId': 'SetEnqueueServerCreation',
'SessionId': '',
'Password': auth_obj.password,
'Username': self.auth.username,
'Server': {
'AdministratorPassword': self.admin_password,
'CPUQuantity': 0,
'Name': self.name,
'NetworkAdaptersConfiguration': [],
'Note': self.note,
'OSTemplateId': self.template_id,
'RAMQuantity': 0,
'VirtualDisks': []
}
}
def add_public_ip(self, public_ip_address_resource_id, primary_ip_address='true'):
if self.ethernet_counter > 0:
raise ValueError("Public IP Address must be bind to first Ethernet Interface.")
network_adapter = {
'NetworkAdapterType': self.ethernet_counter,
'PublicIpAddresses': [{
'PrimaryIPAddress': primary_ip_address,
'PublicIpAddressResourceId': public_ip_address_resource_id
}]
}
try:
self.json_msg['Server']['NetworkAdaptersConfiguration'].append(network_adapter)
self.ethernet_counter += 1
return True
except KeyError:
return False
def add_private_vlan(self, gateway, ip_address, private_vlan_resource_id, subnet_mask):
if self.ethernet_counter > 2:
raise ValueError("Cannot create more than 3 ethernet interface per VM.")
network_adapter = {
'NetworkAdapterType': self.ethernet_counter,
'PrivateVLan': {
'Gateway': gateway,
'IPAddress': ip_address,
'PrivateVLanResourceId': private_vlan_resource_id,
'SubNetMask': subnet_mask
}
}
try:
self.json_msg['Server']['NetworkAdaptersConfiguration'].append(network_adapter)
self.ethernet_counter += 1
return True
except KeyError:
return False
def add_virtual_disk(self, size):
if self.virtual_disk_counter > 3:
raise ValueError("Cannot create more than 4 disk.")
if size > 500:
raise ValueError("MaxSize per Disk: 500 GB.")
virtual_disk = {
"Size": size,
"VirtualDiskType": self.virtual_disk_counter
}
try:
self.json_msg['Server']['VirtualDisks'].append(virtual_disk)
self.virtual_disk_counter += 1
return True
except KeyError:
return False
def set_cpu_qty(self, cpu_qty):
self.json_msg['Server']['CPUQuantity'] = cpu_qty
def set_ram_qty(self, ram_qty):
self.json_msg['Server']['RAMQuantity'] = ram_qty
def set_ssh_key(self, public_key_path):
with open(public_key_path, 'r') as content_file:
content = content_file.read()
self.json_msg['Server']['SshKey'] = content
self.json_msg['Server']['SshPasswordAuthAllowed'] = True
|
class ProVmCreator(Creator):
def __init__(self, name, admin_password, template_id, auth_obj, note=None):
pass
def add_public_ip(self, public_ip_address_resource_id, primary_ip_address='true'):
pass
def add_private_vlan(self, gateway, ip_address, private_vlan_resource_id, subnet_mask):
pass
def add_virtual_disk(self, size):
pass
def set_cpu_qty(self, cpu_qty):
pass
def set_ram_qty(self, ram_qty):
pass
def set_ssh_key(self, public_key_path):
pass
| 8 | 0 | 12 | 0 | 12 | 0 | 2 | 0 | 1 | 2 | 0 | 0 | 7 | 8 | 7 | 10 | 90 | 6 | 84 | 21 | 76 | 0 | 51 | 20 | 43 | 4 | 2 | 1 | 15 |
7,407 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/Compute/LoadBalancer/Requests/SetEnqueueLoadBalancerStart.py
|
ArubaCloud.Compute.LoadBalancer.Requests.SetEnqueueLoadBalancerStart.SetEnqueueLoadBalancerStart
|
class SetEnqueueLoadBalancerStart(Request):
def __init__(self, loadBalancerID, *args, **kwargs):
self.LoadBalancerId = loadBalancerID
super(SetEnqueueLoadBalancerStart, self).__init__(*args, **kwargs)
def commit(self):
return self._commit()
|
class SetEnqueueLoadBalancerStart(Request):
def __init__(self, loadBalancerID, *args, **kwargs):
pass
def commit(self):
pass
| 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 10 | 7 | 1 | 6 | 4 | 3 | 0 | 6 | 4 | 3 | 1 | 3 | 0 | 2 |
7,408 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/Compute/LoadBalancer/Requests/SetEnqueueLoadBalancerPowerOff.py
|
ArubaCloud.Compute.LoadBalancer.Requests.SetEnqueueLoadBalancerPowerOff.SetEnqueueLoadBalancerPowerOff
|
class SetEnqueueLoadBalancerPowerOff(Request):
def __init__(self, loadBalancerID, *args, **kwargs):
self.LoadBalancerID = loadBalancerID
super(SetEnqueueLoadBalancerPowerOff, self).__init__(*args, **kwargs)
def commit(self):
return self._commit()
|
class SetEnqueueLoadBalancerPowerOff(Request):
def __init__(self, loadBalancerID, *args, **kwargs):
pass
def commit(self):
pass
| 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 10 | 7 | 1 | 6 | 4 | 3 | 0 | 6 | 4 | 3 | 1 | 3 | 0 | 2 |
7,409 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/Compute/LoadBalancer/Requests/SetEnqueueLoadBalancerDeletion.py
|
ArubaCloud.Compute.LoadBalancer.Requests.SetEnqueueLoadBalancerDeletion.SetEnqueueLoadBalancerDeletion
|
class SetEnqueueLoadBalancerDeletion(Request):
def __init__(self, loadBalancerID, *args, **kwargs):
self.LoadBalancerId = loadBalancerID
super(SetEnqueueLoadBalancerDeletion, self).__init__(*args, **kwargs)
def commit(self):
return self._commit()
|
class SetEnqueueLoadBalancerDeletion(Request):
def __init__(self, loadBalancerID, *args, **kwargs):
pass
def commit(self):
pass
| 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 10 | 7 | 1 | 6 | 4 | 3 | 0 | 6 | 4 | 3 | 1 | 3 | 0 | 2 |
7,410 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/Compute/LoadBalancer/Requests/SetEnqueueLoadBalancerCreation.py
|
ArubaCloud.Compute.LoadBalancer.Requests.SetEnqueueLoadBalancerCreation.SetEnqueueLoadBalancerCreation
|
class SetEnqueueLoadBalancerCreation(Request):
def __init__(self, healthCheckNotification, instance, ipAddressResourceId, loadBalancerClassOfServiceID, name,
notificationContacts, rules, *args, **kwargs):
"""
:type healthCheckNotification: bool
:type instance: Instance
:type ipAddressResourceId: list[int]
:type loadBalancerClassOfServiceID: int
:type name: str
:type notificationContacts: NotificationContacts or list[NotificationContact]
:type rules: Rules
:param healthCheckNotification:
:param instance:
:param ipAddressResourceId:
:param loadBalancerClassOfServiceID:
:param name:
:param notificationContacts:
:param rules:
:param args:
:param kwargs:
"""
self.HealthCheckNotification = healthCheckNotification
self.Instance = instance
self.IpAddressResourceId = ipAddressResourceId
self.LoadBalancerClassOfServiceID = loadBalancerClassOfServiceID
self.Name = name
self.NotificationContacts = notificationContacts
self.Rules = rules
super(SetEnqueueLoadBalancerCreation, self).__init__(*args, **kwargs)
def commit(self):
return self._commit()
|
class SetEnqueueLoadBalancerCreation(Request):
def __init__(self, healthCheckNotification, instance, ipAddressResourceId, loadBalancerClassOfServiceID, name,
notificationContacts, rules, *args, **kwargs):
'''
:type healthCheckNotification: bool
:type instance: Instance
:type ipAddressResourceId: list[int]
:type loadBalancerClassOfServiceID: int
:type name: str
:type notificationContacts: NotificationContacts or list[NotificationContact]
:type rules: Rules
:param healthCheckNotification:
:param instance:
:param ipAddressResourceId:
:param loadBalancerClassOfServiceID:
:param name:
:param notificationContacts:
:param rules:
:param args:
:param kwargs:
'''
pass
def commit(self):
pass
| 3 | 1 | 15 | 0 | 6 | 9 | 1 | 1.38 | 1 | 1 | 0 | 0 | 2 | 7 | 2 | 10 | 32 | 1 | 13 | 11 | 9 | 18 | 12 | 10 | 9 | 1 | 3 | 0 | 2 |
7,411 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/Compute/LoadBalancer/Requests/SetAddLoadBalancerRule.py
|
ArubaCloud.Compute.LoadBalancer.Requests.SetAddLoadBalancerRule.SetAddLoadBalancerRule
|
class SetAddLoadBalancerRule(Request):
def __init__(self, loadBalancerID, newLoadBalancerRule, *args, **kwargs):
"""
:type loadBalancerID: int
:type newLoadBalancerRule: NewLoadBalancerRule
:param loadBalancerID: ID of the Laod Balancer
:param newLoadBalancerRule: NotificationContacts object, or a list of NotificationContact
"""
self.LoadBalancerID = loadBalancerID
self.NewLoadBalancerRule = newLoadBalancerRule
super(SetAddLoadBalancerRule, self).__init__(*args, **kwargs)
def commit(self):
return self._commit()
|
class SetAddLoadBalancerRule(Request):
def __init__(self, loadBalancerID, newLoadBalancerRule, *args, **kwargs):
'''
:type loadBalancerID: int
:type newLoadBalancerRule: NewLoadBalancerRule
:param loadBalancerID: ID of the Laod Balancer
:param newLoadBalancerRule: NotificationContacts object, or a list of NotificationContact
'''
pass
def commit(self):
pass
| 3 | 1 | 6 | 0 | 3 | 3 | 1 | 0.86 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 10 | 14 | 1 | 7 | 5 | 4 | 6 | 7 | 5 | 4 | 1 | 3 | 0 | 2 |
7,412 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/Compute/LoadBalancer/Requests/SetAddLoadBalancerContacts.py
|
ArubaCloud.Compute.LoadBalancer.Requests.SetAddLoadBalancerContacts.SetAddLoadBalancerContacts
|
class SetAddLoadBalancerContacts(Request):
def __init__(self, loadBalancerID, notificationContacts, *args, **kwargs):
"""
:type loadBalancerID: int
:type notificationContacts: list[NotificationContact]
:param loadBalancerID: ID of the Laod Balancer
:param notificationContacts: NotificationContacts object, or a list of NotificationContact
"""
self.LoadBalancerID = loadBalancerID
self.NotificationContacts = notificationContacts
super(SetAddLoadBalancerContacts, self).__init__(*args, **kwargs)
def commit(self):
return self._commit()
|
class SetAddLoadBalancerContacts(Request):
def __init__(self, loadBalancerID, notificationContacts, *args, **kwargs):
'''
:type loadBalancerID: int
:type notificationContacts: list[NotificationContact]
:param loadBalancerID: ID of the Laod Balancer
:param notificationContacts: NotificationContacts object, or a list of NotificationContact
'''
pass
def commit(self):
pass
| 3 | 1 | 6 | 0 | 3 | 3 | 1 | 0.86 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 10 | 14 | 1 | 7 | 5 | 4 | 6 | 7 | 5 | 4 | 1 | 3 | 0 | 2 |
7,413 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/Compute/LoadBalancer/Requests/GetLoadBalancers.py
|
ArubaCloud.Compute.LoadBalancer.Requests.GetLoadBalancers.GetLoadBalancers
|
class GetLoadBalancers(Request):
def __init__(self, *args, **kwargs):
super(GetLoadBalancers, self).__init__(*args, **kwargs)
def commit(self):
return self._commit()
|
class GetLoadBalancers(Request):
def __init__(self, *args, **kwargs):
pass
def commit(self):
pass
| 3 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 0 | 2 | 10 | 6 | 1 | 5 | 3 | 2 | 0 | 5 | 3 | 2 | 1 | 3 | 0 | 2 |
7,414 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/Compute/LoadBalancer/Requests/GetLoadBalancerRuleStatistics.py
|
ArubaCloud.Compute.LoadBalancer.Requests.GetLoadBalancerRuleStatistics.GetLoadBalancerRuleStatistics
|
class GetLoadBalancerRuleStatistics (Request):
def __init__(self, startDate, endDate, loadBalancerRuleID, *args, **kwargs):
"""
Get the load balancer rule statistics within a specified time frame
:type startDate: datetime
:type endDate: datetime
:type loadBalancerRuleID: int
:param startDate: From Date
:param endDate: To Date
:param loadBalancerRuleID: ID of the Load Balancer Rule
"""
self.StartDate = startDate
self.EndDate = endDate
self.LoadBalancerRuleID = loadBalancerRuleID
super(GetLoadBalancerRuleStatistics, self).__init__(*args, **kwargs)
def commit(self):
return self._commit()
|
class GetLoadBalancerRuleStatistics (Request):
def __init__(self, startDate, endDate, loadBalancerRuleID, *args, **kwargs):
'''
Get the load balancer rule statistics within a specified time frame
:type startDate: datetime
:type endDate: datetime
:type loadBalancerRuleID: int
:param startDate: From Date
:param endDate: To Date
:param loadBalancerRuleID: ID of the Load Balancer Rule
'''
pass
def commit(self):
pass
| 3 | 1 | 8 | 0 | 4 | 5 | 1 | 1.13 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 10 | 18 | 1 | 8 | 6 | 5 | 9 | 8 | 6 | 5 | 1 | 3 | 0 | 2 |
7,415 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/Compute/LoadBalancer/Requests/GetLoadBalancerNotifications.py
|
ArubaCloud.Compute.LoadBalancer.Requests.GetLoadBalancerNotifications.GetLoadBalancerNotifications
|
class GetLoadBalancerNotifications (Request):
def __init__(self, startDate, endDate, loadBalancerID, loadBalancerRuleID, *args, **kwargs):
"""
Get the load balancer notifications for a specific rule within a specifying window time frame
:type startDate: datetime
:type endDate: datetime
:type laodBalancerID: int
:type loadBalancerRuleID: int
:param startDate: From Date
:param endDate: To Date
:param loadBalancerID: ID of the Laod Balancer
:param loadBalancerRuleID: ID of the Load Balancer Rule
"""
self.StartDate = startDate
self.EndDate = endDate
self.LoadBalancerID = loadBalancerID
self.LoadBalancerRuleID = loadBalancerRuleID
super(GetLoadBalancerNotifications, self).__init__(*args, **kwargs)
def commit(self):
return self._commit()
|
class GetLoadBalancerNotifications (Request):
def __init__(self, startDate, endDate, loadBalancerID, loadBalancerRuleID, *args, **kwargs):
'''
Get the load balancer notifications for a specific rule within a specifying window time frame
:type startDate: datetime
:type endDate: datetime
:type laodBalancerID: int
:type loadBalancerRuleID: int
:param startDate: From Date
:param endDate: To Date
:param loadBalancerID: ID of the Laod Balancer
:param loadBalancerRuleID: ID of the Load Balancer Rule
'''
pass
def commit(self):
pass
| 3 | 1 | 10 | 0 | 4 | 6 | 1 | 1.22 | 1 | 1 | 0 | 0 | 2 | 4 | 2 | 10 | 21 | 1 | 9 | 7 | 6 | 11 | 9 | 7 | 6 | 1 | 3 | 0 | 2 |
7,416 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/Compute/LoadBalancer/Requests/GetLoadBalancerLoads.py
|
ArubaCloud.Compute.LoadBalancer.Requests.GetLoadBalancerLoads.GetLoadBalancerLoads
|
class GetLoadBalancerLoads(Request):
def __init__(self, startDate, endDate, loadBalancerID, *args, **kwargs):
"""
Get the load balancer load within a specifying window time frame
:type startDate: datetime
:type endDate: datetime
:type laodBalancerID: int
:param startDate: From Date
:param endDate: To Date
:param loadBalancerID: ID of the LaodBalancer
"""
self.StartDate = startDate
self.EndDate = endDate
self.LoadBalancerID = loadBalancerID
super(GetLoadBalancerLoads, self).__init__(*args, **kwargs)
def commit(self):
return self._commit()
|
class GetLoadBalancerLoads(Request):
def __init__(self, startDate, endDate, loadBalancerID, *args, **kwargs):
'''
Get the load balancer load within a specifying window time frame
:type startDate: datetime
:type endDate: datetime
:type laodBalancerID: int
:param startDate: From Date
:param endDate: To Date
:param loadBalancerID: ID of the LaodBalancer
'''
pass
def commit(self):
pass
| 3 | 1 | 8 | 0 | 4 | 5 | 1 | 1.13 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 10 | 18 | 1 | 8 | 6 | 5 | 9 | 8 | 6 | 5 | 1 | 3 | 0 | 2 |
7,417 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/Compute/LoadBalancer/Models/Rules.py
|
ArubaCloud.Compute.LoadBalancer.Models.Rules.Rules
|
class Rules(list):
def __init__(self, *args, **kwargs):
super(Rules, self).__init__(*args, **kwargs)
def __setitem__(self, key, value):
assert isinstance(value, NewLoadBalancerRule), Exception(
'Expected NewLoadBalancerRule, got: {}'.format(type(value)))
super(Rules, self).__setitem__(key, value)
def __str__(self):
super(Rules, self).__str__()
def append(self, p_object):
assert isinstance(p_object, NewLoadBalancerRule), Exception(
'Expected NewLoadBalancerRule, got: {}'.format(type(p_object)))
super(Rules, self).append(p_object)
def insert(self, index, p_object):
assert isinstance(p_object, NewLoadBalancerRule), Exception(
'Expected NewLoadBalancerRule, got: {}'.format(type(p_object)))
super(Rules, self).insert(index, p_object)
|
class Rules(list):
def __init__(self, *args, **kwargs):
pass
def __setitem__(self, key, value):
pass
def __str__(self):
pass
def append(self, p_object):
pass
def insert(self, index, p_object):
pass
| 6 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 4 | 1 | 0 | 5 | 0 | 5 | 38 | 21 | 4 | 17 | 6 | 11 | 0 | 14 | 6 | 8 | 1 | 2 | 0 | 5 |
7,418 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/Compute/LoadBalancer/Models/NotificationType.py
|
ArubaCloud.Compute.LoadBalancer.Models.NotificationType.NotificationType
|
class NotificationType(object):
Email = 1
Sms = 2
|
class NotificationType(object):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 3 | 2 | 0 | 3 | 3 | 2 | 0 | 1 | 0 | 0 |
7,419 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/Compute/LoadBalancer/Models/NotificationContacts.py
|
ArubaCloud.Compute.LoadBalancer.Models.NotificationContacts.NotificationContacts
|
class NotificationContacts(list):
def __init__(self, *args, **kwargs):
super(NotificationContacts, self).__init__(*args, **kwargs)
def __setitem__(self, key, value):
assert isinstance(value, NotificationContact), Exception(
'Expected NotificationContact, got: {}'.format(type(value)))
super(NotificationContacts, self).__setitem__(key, value)
def __str__(self):
super(NotificationContacts, self).__str__()
def append(self, p_object):
assert isinstance(p_object, NotificationContact), Exception(
'Expected NotificationContact, got: {}'.format(type(p_object)))
super(NotificationContacts, self).append(p_object)
def insert(self, index, p_object):
assert isinstance(p_object, NotificationContact), Exception(
'Expected NotificationContact, got: {}'.format(type(p_object)))
super(NotificationContacts, self).insert(index, p_object)
|
class NotificationContacts(list):
def __init__(self, *args, **kwargs):
pass
def __setitem__(self, key, value):
pass
def __str__(self):
pass
def append(self, p_object):
pass
def insert(self, index, p_object):
pass
| 6 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 4 | 1 | 0 | 5 | 0 | 5 | 38 | 21 | 4 | 17 | 6 | 11 | 0 | 14 | 6 | 8 | 1 | 2 | 0 | 5 |
7,420 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/Compute/LoadBalancer/Models/NotificationContact.py
|
ArubaCloud.Compute.LoadBalancer.Models.NotificationContact.NotificationContact
|
class NotificationContact(object):
def __init__(self, contactValue=str(), loadBalancerContactID=int(), contactType=NotificationType.Email):
self.ContactValue = contactValue
self.LoadBalancerContactID = loadBalancerContactID
self.Type = contactType
|
class NotificationContact(object):
def __init__(self, contactValue=str(), loadBalancerContactID=int(), contactType=NotificationType.Email):
pass
| 2 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 3 | 1 | 0 | 1 | 3 | 1 | 1 | 5 | 0 | 5 | 5 | 3 | 0 | 5 | 5 | 3 | 1 | 1 | 0 | 1 |
7,421 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/Compute/LoadBalancer/Models/NewLoadBalancerRule.py
|
ArubaCloud.Compute.LoadBalancer.Models.NewLoadBalancerRule.NewLoadBalancerRule
|
class NewLoadBalancerRule(object):
def __init__(self, balancerType, certificate, creationDate, id, instancePort, loadBalancerPort, protocol):
"""
:type balancerType: LoadBalancerAlgorithmType
:type certificate: str
:type creationDate: datetime
:type id: int
:type instancePort: int
:type loadBalancerPort: int
:type protocol: LoadBalancerProtocol
:param balancerType:
:param certificate:
:param creationDate:
:param id:
:param instancePort:
:param loadBalancerPort:
:param protocol:
"""
self.BalancerType = balancerType
self.Certificate = certificate
self.CreationDate = creationDate
self.ID = id
self.InstancePort = instancePort
self.LoadBalancerPort = loadBalancerPort
self.Protocol = protocol
|
class NewLoadBalancerRule(object):
def __init__(self, balancerType, certificate, creationDate, id, instancePort, loadBalancerPort, protocol):
'''
:type balancerType: LoadBalancerAlgorithmType
:type certificate: str
:type creationDate: datetime
:type id: int
:type instancePort: int
:type loadBalancerPort: int
:type protocol: LoadBalancerProtocol
:param balancerType:
:param certificate:
:param creationDate:
:param id:
:param instancePort:
:param loadBalancerPort:
:param protocol:
'''
pass
| 2 | 1 | 24 | 0 | 8 | 16 | 1 | 1.78 | 1 | 0 | 0 | 0 | 1 | 7 | 1 | 1 | 25 | 0 | 9 | 9 | 7 | 16 | 9 | 9 | 7 | 1 | 1 | 0 | 1 |
7,422 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/Compute/LoadBalancer/Models/LoadBalancerStatus.py
|
ArubaCloud.Compute.LoadBalancer.Models.LoadBalancerStatus.LoadBalancerStatus
|
class LoadBalancerStatus(object):
Creating = 1
Running = 2
Stopped = 3
Deleted = 4
|
class LoadBalancerStatus(object):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 0 | 5 | 5 | 4 | 0 | 5 | 5 | 4 | 0 | 1 | 0 | 0 |
7,423 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/Compute/LoadBalancer/Models/LoadBalancerProtocol.py
|
ArubaCloud.Compute.LoadBalancer.Models.LoadBalancerProtocol.LoadBalancerProtocol
|
class LoadBalancerProtocol(object):
Http = 1
Https = 2
Tcp = 3
Ssl = 4
|
class LoadBalancerProtocol(object):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 0 | 5 | 5 | 4 | 0 | 5 | 5 | 4 | 0 | 1 | 0 | 0 |
7,424 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/Compute/LoadBalancer/Models/LoadBalancerAlgorithmType.py
|
ArubaCloud.Compute.LoadBalancer.Models.LoadBalancerAlgorithmType.LoadBalancerAlgorithmType
|
class LoadBalancerAlgorithmType(object):
Source = 1
LeastConn = 2
|
class LoadBalancerAlgorithmType(object):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 3 | 2 | 0 | 3 | 3 | 2 | 0 | 1 | 0 | 0 |
7,425 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/Compute/LoadBalancer/Models/Instance.py
|
ArubaCloud.Compute.LoadBalancer.Models.Instance.Instance
|
class Instance(object):
def __init__(self, ipAddress):
"""
:type ipAddress: str
:param ipAddress: (str) String representing the IP Address
"""
self.IPAddress = ipAddress
|
class Instance(object):
def __init__(self, ipAddress):
'''
:type ipAddress: str
:param ipAddress: (str) String representing the IP Address
'''
pass
| 2 | 1 | 6 | 0 | 2 | 4 | 1 | 1.33 | 1 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 7 | 0 | 3 | 3 | 1 | 4 | 3 | 3 | 1 | 1 | 1 | 0 | 1 |
7,426 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/Compute/LoadBalancer/LoadBalancer.py
|
ArubaCloud.Compute.LoadBalancer.LoadBalancer.LoadBalancer
|
class LoadBalancer(ArubaCloudService):
def __init__(self, *args, **kwargs):
super(LoadBalancer, self).__init__(*args, **kwargs)
def _call(self, method, *args, **kwargs):
request = method(Username=self.username, Password=self.password, uri=self.ws_uri, *args, **kwargs)
response = request.commit()
return response['Value']
def create(self, healthCheckNotification, instance, ipAddressResourceId, name, notificationContacts, rules,
loadBalancerClassOfServiceID=1, *args, **kwargs):
"""
:type healthCheckNotification: bool
:type instance: list[Instance]
:type ipAddressResourceId: list[int]
:type loadBalancerClassOfServiceID: int
:type name: str
:type notificationContacts: NotificationContacts or list[NotificationContact]
:type rules: Rules
:param healthCheckNotification: Enable or disable notifications
:param instance: List of balanced IP Addresses (VM or server)
:param ipAddressResourceId: ID of the IP Address resource of the Load Balancer
:param loadBalancerClassOfServiceID: default 1
:param name: Name of the Load Balancer
:param notificationContacts: Nullable if notificationContacts is false
:param rules: List of NewLoadBalancerRule object containing the list of rules to be configured with the service
"""
response = self._call(method=SetEnqueueLoadBalancerCreation,
healthCheckNotification=healthCheckNotification,
instance=instance,
ipAddressResourceId=ipAddressResourceId,
name=name,
notificationContacts=notificationContacts,
rules=rules,
loadBalancerClassOfServiceID=loadBalancerClassOfServiceID,
*args, **kwargs)
def get(self):
"""
Get the current active and inactive Load Balancer within the Datacenter
:return: (list) List of each LoadBalancer present in the Datacenter
"""
return self._call(GetLoadBalancers)
def get_notifications(self, startDate, endDate, loadBalancerID, loadBalancerRuleID):
"""
Get the load balancer notifications for a specific rule within a specifying window time frame
:type startDate: datetime
:type endDate: datetime
:type loadBalancerID: int
:type loadBalancerRuleID: int
:param startDate: From Date
:param endDate: To Date
:param loadBalancerID: ID of the Laod Balancer
:param loadBalancerRuleID: ID of the Load Balancer Rule
"""
return self._call(GetLoadBalancerNotifications, startDate=startDate, endDate=endDate,
loadBalancerID=loadBalancerID, loadBalancerRuleID=loadBalancerRuleID)
def start(self, loadBalancerID):
"""
Start a Load Balancer instance
:type loadBalancerID: int
:param loadBalancerID: ID of the Load Balancer to start
:return:
"""
return self._call(SetEnqueueLoadBalancerStart, loadBalancerID=loadBalancerID)
def stop(self, loadBalancerID):
"""
Stop a Load Balancer instance
:type loadBalancerID: int
:param loadBalancerID: ID of the Load Balancer to stop
:return:
"""
return self._call(SetEnqueueLoadBalancerPowerOff, loadBalancerID=loadBalancerID)
def delete(self, loadBalancerID):
"""
Enqueue a Load Balancer Deletion action
:type loadBalancerID: int
:param loadBalancerID: ID of the Load Balancer to be deleted
:return:
"""
return self._call(SetEnqueueLoadBalancerDeletion, loadBalancerID=loadBalancerID)
|
class LoadBalancer(ArubaCloudService):
def __init__(self, *args, **kwargs):
pass
def _call(self, method, *args, **kwargs):
pass
def create(self, healthCheckNotification, instance, ipAddressResourceId, name, notificationContacts, rules,
loadBalancerClassOfServiceID=1, *args, **kwargs):
'''
:type healthCheckNotification: bool
:type instance: list[Instance]
:type ipAddressResourceId: list[int]
:type loadBalancerClassOfServiceID: int
:type name: str
:type notificationContacts: NotificationContacts or list[NotificationContact]
:type rules: Rules
:param healthCheckNotification: Enable or disable notifications
:param instance: List of balanced IP Addresses (VM or server)
:param ipAddressResourceId: ID of the IP Address resource of the Load Balancer
:param loadBalancerClassOfServiceID: default 1
:param name: Name of the Load Balancer
:param notificationContacts: Nullable if notificationContacts is false
:param rules: List of NewLoadBalancerRule object containing the list of rules to be configured with the service
'''
pass
def get(self):
'''
Get the current active and inactive Load Balancer within the Datacenter
:return: (list) List of each LoadBalancer present in the Datacenter
'''
pass
def get_notifications(self, startDate, endDate, loadBalancerID, loadBalancerRuleID):
'''
Get the load balancer notifications for a specific rule within a specifying window time frame
:type startDate: datetime
:type endDate: datetime
:type loadBalancerID: int
:type loadBalancerRuleID: int
:param startDate: From Date
:param endDate: To Date
:param loadBalancerID: ID of the Laod Balancer
:param loadBalancerRuleID: ID of the Load Balancer Rule
'''
pass
def start(self, loadBalancerID):
'''
Start a Load Balancer instance
:type loadBalancerID: int
:param loadBalancerID: ID of the Load Balancer to start
:return:
'''
pass
def stop(self, loadBalancerID):
'''
Stop a Load Balancer instance
:type loadBalancerID: int
:param loadBalancerID: ID of the Load Balancer to stop
:return:
'''
pass
def delete(self, loadBalancerID):
'''
Enqueue a Load Balancer Deletion action
:type loadBalancerID: int
:param loadBalancerID: ID of the Load Balancer to be deleted
:return:
'''
pass
| 9 | 6 | 10 | 0 | 4 | 6 | 1 | 1.69 | 1 | 1 | 0 | 0 | 8 | 2 | 8 | 11 | 85 | 7 | 29 | 13 | 19 | 49 | 19 | 12 | 10 | 1 | 2 | 0 | 8 |
7,427 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/ReverseDns/Requests/GetReverseDns.py
|
ArubaCloud.ReverseDns.Requests.GetReverseDns.GetReverseDns
|
class GetReverseDns(BaseReverseDns):
def __init__(self, *args, **kwargs):
try:
self.IPs = kwargs.pop('IPs')
except KeyError:
# IPs parameter is not filled
self.IPs = []
super(GetReverseDns, self).__init__(*args, **kwargs)
def commit(self):
return self._commit()
|
class GetReverseDns(BaseReverseDns):
def __init__(self, *args, **kwargs):
pass
def commit(self):
pass
| 3 | 0 | 5 | 0 | 4 | 1 | 2 | 0.11 | 1 | 2 | 0 | 0 | 2 | 1 | 2 | 12 | 11 | 1 | 9 | 4 | 6 | 1 | 9 | 4 | 6 | 2 | 4 | 1 | 3 |
7,428 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/ReverseDns/Requests/SetEnqueueResetReverseDns.py
|
ArubaCloud.ReverseDns.Requests.SetEnqueueResetReverseDns.SetEnqueueResetReverseDns
|
class SetEnqueueResetReverseDns(BaseReverseDns):
def __init__(self, *args, **kwargs):
try:
self.IPs = kwargs.pop('IPs')
except KeyError:
# IPs parameter is not filled
self.IPs = []
super(SetEnqueueResetReverseDns, self).__init__(*args, **kwargs)
def commit(self):
return self._commit()
|
class SetEnqueueResetReverseDns(BaseReverseDns):
def __init__(self, *args, **kwargs):
pass
def commit(self):
pass
| 3 | 0 | 5 | 0 | 4 | 1 | 2 | 0.11 | 1 | 2 | 0 | 0 | 2 | 1 | 2 | 12 | 11 | 1 | 9 | 4 | 6 | 1 | 9 | 4 | 6 | 2 | 4 | 1 | 3 |
7,429 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/PyArubaAPI.py
|
ArubaCloud.PyArubaAPI.CloudInterface
|
class CloudInterface(JsonInterface):
templates = []
vmlist = VMList()
iplist = IpList()
json_templates = None
json_servers = None
ip_resource = None
hypervisors = {3: "LC", 4: "SMART", 2: "VW", 1: "HV"}
def __init__(self, dc, debug_level=logging.INFO):
super(CloudInterface, self).__init__()
assert isinstance(dc, int), Exception('dc must be an integer and must be not null.')
self.wcf_baseurl = 'https://api.dc%s.computing.cloud.it/WsEndUser/v2.9/WsEndUser.svc/json' % (str(dc))
self.logger = ArubaLog(level=debug_level, log_to_file=False)
self.logger.name = self.__class__
self.auth = None
def login(self, username, password, load=True):
"""
Set the authentication data in the object, and if load is True
(default is True) it also retrieve the ip list and the vm list
in order to build the internal objects list.
@param (str) username: username of the cloud
@param (str) password: password of the cloud
@param (bool) load: define if pre cache the objects.
@return: None
"""
self.auth = Auth(username, password)
if load is True:
self.get_ip()
self.get_servers()
def poweroff_server(self, server=None, server_id=None):
"""
Poweroff a VM. If possible to pass the VM object or simply the ID
of the VM that we want to turn on.
Args:
server: VM Object that represent the VM to power off,
server_id: Int or Str representing the ID of the VM to power off.
Returns:
return True if json_obj['Success'] is 'True' else False
"""
sid = server_id if server_id is not None else server.sid
if sid is None:
raise Exception('No Server Specified.')
json_scheme = self.gen_def_json_scheme('SetEnqueueServerPowerOff', dict(ServerId=sid))
json_obj = self.call_method_post('SetEnqueueServerPowerOff', json_scheme=json_scheme)
return True if json_obj['Success'] is 'True' else False
def poweron_server(self, server=None, server_id=None):
"""
Poweron a VM. If possible to pass the VM object or simply the ID
of the VM that we want to turn on.
Args:
server: VM Object that represent the VM to power on,
server_id: Int or Str representing the ID of the VM to power on.
Returns:
return True if json_obj['Success'] is 'True' else False
"""
sid = server_id if server_id is not None else server.sid
if sid is None:
raise Exception('No Server Specified.')
json_scheme = self.gen_def_json_scheme('SetEnqueueServerStart', dict(ServerId=sid))
json_obj = self.call_method_post('SetEnqueueServerStart', json_scheme=json_scheme)
return True if json_obj['Success'] is 'True' else False
def get_hypervisors(self):
"""
Initialize the internal list containing each template available for each
hypervisor.
:return: [bool] True in case of success, otherwise False
"""
json_scheme = self.gen_def_json_scheme('GetHypervisors')
json_obj = self.call_method_post(method='GetHypervisors', json_scheme=json_scheme)
self.json_templates = json_obj
d = dict(json_obj)
for elem in d['Value']:
hv = self.hypervisors[elem['HypervisorType']]
for inner_elem in elem['Templates']:
o = Template(hv)
o.template_id = inner_elem['Id']
o.descr = inner_elem['Description']
o.id_code = inner_elem['IdentificationCode']
o.name = inner_elem['Name']
o.enabled = inner_elem['Enabled']
if hv != 'SMART':
for rb in inner_elem['ResourceBounds']:
resource_type = rb['ResourceType']
if resource_type == 1:
o.resource_bounds.max_cpu = rb['Max']
if resource_type == 2:
o.resource_bounds.max_memory = rb['Max']
if resource_type == 3:
o.resource_bounds.hdd0 = rb['Max']
if resource_type == 7:
o.resource_bounds.hdd1 = rb['Max']
if resource_type == 8:
o.resource_bounds.hdd2 = rb['Max']
if resource_type == 9:
o.resource_bounds.hdd3 = rb['Max']
self.templates.append(o)
return True if json_obj['Success'] is 'True' else False
def get_servers(self):
"""
Create the list of Server object inside the Datacenter objects.
Build an internal list of VM Objects (pro or smart) as iterator.
:return: bool
"""
json_scheme = self.gen_def_json_scheme('GetServers')
json_obj = self.call_method_post(method='GetServers', json_scheme=json_scheme)
self.json_servers = json_obj
# if this method is called I assume that i must re-read the data
# so i reinitialize the vmlist
self.vmlist = VMList()
# getting all instanced IP in case the list is empty
if len(self.iplist) <= 0:
self.get_ip()
for elem in dict(json_obj)["Value"]:
if elem['HypervisorType'] is 4:
s = Smart(interface=self, sid=elem['ServerId'])
else:
s = Pro(interface=self, sid=elem['ServerId'])
s.vm_name = elem['Name']
s.cpu_qty = elem['CPUQuantity']
s.ram_qty = elem['RAMQuantity']
s.status = elem['ServerStatus']
s.datacenter_id = elem['DatacenterId']
s.wcf_baseurl = self.wcf_baseurl
s.auth = self.auth
s.hd_qty = elem['HDQuantity']
s.hd_total_size = elem['HDTotalSize']
if elem['HypervisorType'] is 4:
ssd = self.get_server_detail(elem['ServerId'])
try:
s.ip_addr = str(ssd['EasyCloudIPAddress']['Value'])
except TypeError:
s.ip_addr = 'Not retrieved.'
else:
s.ip_addr = []
for ip in self.iplist:
if ip.serverid == s.sid:
s.ip_addr.append(ip)
self.vmlist.append(s)
return True if json_obj['Success'] is True else False
def find_template(self, name=None, hv=None):
"""
Return a list of templates that could have one or more elements.
Args:
name: name of the template to find.
hv: the ID of the hypervisor to search the template in
Returns:
A list of templates object. If hv is None will return all the
templates matching the name if every hypervisor type. Otherwise
if name is None will return all templates of an hypervisor.
Raises:
ValidationError: if name and hv are None
"""
if len(self.templates) <= 0:
self.get_hypervisors()
if name is not None and hv is not None:
template_list = filter(
lambda x: name in x.descr and x.hypervisor == self.hypervisors[hv], self.templates
)
elif name is not None and hv is None:
template_list = filter(
lambda x: name in x.descr, self.templates
)
elif name is None and hv is not None:
template_list = filter(
lambda x: x.hypervisor == self.hypervisors[hv], self.templates
)
else:
raise Exception('Error, no pattern defined')
if sys.version_info.major < (3):
return template_list
else:
return(list(template_list))
def get_vm(self, pattern=None):
if len(self.vmlist) <= 0:
self.get_servers()
if pattern is None:
return self.vmlist
else:
return self.vmlist.find(pattern)
def get_ip_by_vm(self, vm):
self.get_ip() # call get ip list to create the internal list of IPs.
vm_id = self.get_vm(vm)[0].sid
for ip in self.iplist:
if ip.serverid == vm_id:
return ip
return 'IPNOTFOUND'
def purchase_ip(self, debug=False):
"""
Return an ip object representing a new bought IP
@param debug [Boolean] if true, request and response will be printed
@return (Ip): Ip object
"""
json_scheme = self.gen_def_json_scheme('SetPurchaseIpAddress')
json_obj = self.call_method_post(method='SetPurchaseIpAddress', json_scheme=json_scheme, debug=debug)
try:
ip = Ip()
ip.ip_addr = json_obj['Value']['Value']
ip.resid = json_obj['Value']['ResourceId']
return ip
except:
raise Exception('Unknown error retrieving IP.')
def purchase_vlan(self, vlan_name, debug=False):
"""
Purchase a new VLAN.
:param debug: Log the json response if True
:param vlan_name: String representing the name of the vlan (virtual switch)
:return: a Vlan Object representing the vlan created
"""
vlan_name = {'VLanName': vlan_name}
json_scheme = self.gen_def_json_scheme('SetPurchaseVLan', vlan_name)
json_obj = self.call_method_post(method="SetPurchaseVLan", json_scheme=json_scheme)
if debug is True:
self.logger.debug(json_obj)
if json_obj['Success'] is False:
raise Exception("Cannot purchase new vlan.")
vlan = Vlan()
vlan.name = json_obj['Value']['Name']
vlan.resource_id = json_obj['Value']['ResourceId']
vlan.vlan_code = json_obj['Value']['VlanCode']
return vlan
def remove_vlan(self, vlan_resource_id):
"""
Remove a VLAN
:param vlan_resource_id:
:return:
"""
vlan_id = {'VLanResourceId': vlan_resource_id}
json_scheme = self.gen_def_json_scheme('SetRemoveVLan', vlan_id)
json_obj = self.call_method_post(method='SetRemoveVLan', json_scheme=json_scheme)
return True if json_obj['Success'] is True else False
def get_vlan(self, vlan_name=None):
json_scheme = self.gen_def_json_scheme('GetPurchasedVLans')
json_obj = self.call_method_post(method='GetPurchasedVLans', json_scheme=json_scheme)
if vlan_name is not None:
raw_vlans = filter(lambda x: vlan_name in x['Name'], json_obj['Value'])
else:
raw_vlans = json_obj['Value']
vlans = []
for raw_vlan in raw_vlans:
v = Vlan()
v.name = raw_vlan['Name']
v.vlan_code = raw_vlan['VlanCode']
v.resource_id = raw_vlan['ResourceId']
vlans.append(v)
return vlans
def remove_ip(self, ip_id):
"""
Delete an Ip from the boughs ip list
@param (str) ip_id: a string representing the resource id of the IP
@return: True if json method had success else False
"""
ip_id = ' "IpAddressResourceId": %s' % ip_id
json_scheme = self.gen_def_json_scheme('SetRemoveIpAddress', ip_id)
json_obj = self.call_method_post(method='SetRemoveIpAddress', json_scheme=json_scheme)
pprint(json_obj)
return True if json_obj['Success'] is True else False
def get_package_id(self, name):
"""
Retrieve the smart package id given is English name
@param (str) name: the Aruba Smart package size name, ie: "small", "medium", "large", "extra large".
@return: The package id that depends on the Data center and the size choosen.
"""
json_scheme = self.gen_def_json_scheme('GetPreConfiguredPackages', dict(HypervisorType=4))
json_obj = self.call_method_post(method='GetPreConfiguredPackages ', json_scheme=json_scheme)
for package in json_obj['Value']:
packageId = package['PackageID']
for description in package['Descriptions']:
languageID = description['LanguageID']
packageName = description['Text']
if languageID == 2 and packageName.lower() == name.lower():
return packageId
def get_ip(self):
"""
Retrieve a complete list of bought ip address related only to PRO Servers.
It create an internal object (Iplist) representing all of the ips object
iterated form the WS.
@param: None
@return: None
"""
json_scheme = self.gen_def_json_scheme('GetPurchasedIpAddresses')
json_obj = self.call_method_post(method='GetPurchasedIpAddresses ', json_scheme=json_scheme)
self.iplist = IpList()
for ip in json_obj['Value']:
r = Ip()
r.ip_addr = ip['Value']
r.resid = ip['ResourceId']
r.serverid = ip['ServerId'] if 'None' not in str(ip['ServerId']) else None
self.iplist.append(r)
def delete_vm(self, server=None, server_id=None):
self.logger.debug('%s: Deleting: %s' % (self.__class__.__name__, server))
sid = server_id if server_id is not None else server.sid
self.logger.debug('%s: Deleting SID: %s' % (self.__class__.__name__, sid))
if sid is None:
raise Exception('NoServerSpecified')
json_scheme = self.gen_def_json_scheme('SetEnqueueServerDeletion', dict(ServerId=sid))
json_obj = self.call_method_post(method='SetEnqueueServerDeletion', json_scheme=json_scheme)
print('Deletion enqueued successfully for server_id: %s' % sid)
return True if json_obj['Success'] is 'True' else False
def get_jobs(self):
json_scheme = self.gen_def_json_scheme('GetJobs')
return self.call_method_post(method='GetJobs', json_scheme=json_scheme)
def find_job(self, vm_name):
jobs_list = self.get_jobs()
if jobs_list['Value'] is None:
_i = 0
while jobs_list['Value'] is not None:
_i += 1
jobs_list = self.get_jobs()
if _i > 10:
return 'JOBNOTFOUND'
if len(jobs_list['Value']) <= 0:
return 'JOBNOTFOUND'
for job in jobs_list['Value']:
if vm_name in job['ServerName']:
return job
return 'JOBNOTFOUND'
def get_virtual_datacenter(self):
json_scheme = self.gen_def_json_scheme('GetVirtualDatacenter')
json_obj = self.call_method_post(method='GetVirtualDatacenter', json_scheme=json_scheme)
return json_obj
def get_server_detail(self, server_id):
json_scheme = self.gen_def_json_scheme('GetServerDetails', dict(ServerId=server_id))
json_obj = self.call_method_post(method='GetServerDetails', json_scheme=json_scheme)
return json_obj['Value']
def attach_vlan(self, network_adapter_id, vlan_resource_id, ip=None, subnet_mask=None, gateway=None):
if gateway is not None:
additional_fields = {
"VLanRequest": {
"NetworkAdapterId": network_adapter_id,
"SetOnVirtualMachine": "true",
"VLanResourceId": vlan_resource_id,
"PrivateIps": [{
"GateWay": gateway,
"IP": ip,
"SubNetMask": subnet_mask
}]
}
}
else:
additional_fields = {
"VLanRequest": {
"NetworkAdapterId": network_adapter_id,
"SetOnVirtualMachine": "false",
"VLanResourceId": vlan_resource_id,
"PrivateIps": [{
"GateWay": None,
"IP": None,
"SubNetMask": None
}]
}
}
json_scheme = self.gen_def_json_scheme('SetEnqueueAssociateVLan', method_fields=additional_fields)
json_obj = self.call_method_post(method='SetEnqueueAssociateVLan', json_scheme=json_scheme)
return True if json_obj['Success'] is True else False
def detach_vlan(self, network_adapter_id, vlan_resource_id):
vlan_request = {
"VLanRequest": {
"NetworkAdapterId": network_adapter_id,
"SetOnVirtualMachine": "false",
"VLanResourceId": vlan_resource_id
}
}
json_scheme = self.gen_def_json_scheme('SetEnqueueDeassociateVLan', method_fields=vlan_request)
json_obj = self.call_method_post(method='SetEnqueueDeassociateVLan', json_scheme=json_scheme)
return True if json_obj['Success'] is True else False
def create_snapshot(self, dc, server_id=None):
sid = CloudInterface(dc).get_server_detail(server_id)
if sid['HypervisorType'] is not 4:
snapshot_request = {
"Snapshot": {
"ServerId": server_id,
"SnapshotOperationTypes": "Create"
}
}
json_scheme = self.gen_def_json_scheme('SetEnqueueServerSnapshot', method_fields=snapshot_request)
json_obj = self.call_method_post(method='SetEnqueueServerSnapshot', json_scheme=json_scheme)
return True if json_obj['Success'] is True else False
def restore_snapshot(self, server_id=None):
snapshot_request = {
"Snapshot": {
"ServerId": server_id,
"SnapshotOperationTypes": "Restore"
}
}
json_scheme = self.gen_def_json_scheme('SetEnqueueServerSnapshot', method_fields=snapshot_request)
json_obj = self.call_method_post(method='SetEnqueueServerSnapshot', json_scheme=json_scheme)
return True if json_obj['Success'] is True else False
def delete_snapshot(self, server_id=None):
snapshot_request = {
"Snapshot": {
"ServerId": server_id,
"SnapshotOperationTypes": "Delete"
}
}
json_scheme = self.gen_def_json_scheme('SetEnqueueServerSnapshot', method_fields=snapshot_request)
json_obj = self.call_method_post(method='SetEnqueueServerSnapshot', json_scheme=json_scheme)
return True if json_obj['Success'] is True else False
def archive_vm(self, dc, server_id=None):
sid = CloudInterface(dc).get_server_detail(server_id)
if sid['HypervisorType'] is not 4:
archive_request = {
"ArchiveVirtualServer": {
"ServerId": server_id
}
}
json_scheme = self.gen_def_json_scheme('ArchiveVirtualServer', method_fields=archive_request)
json_obj = self.call_method_post(method='ArchiveVirtualServer', json_scheme=json_scheme)
return True if json_obj['Success'] is True else False
def restore_vm(self, server_id=None, cpu_qty=None, ram_qty=None):
restore_request = {
"Server": {
"ServerId": server_id,
"CPUQuantity": cpu_qty,
"RAMQuantity": ram_qty
}
}
json_scheme = self.gen_def_json_scheme('SetEnqueueServerRestore', method_fields=restore_request)
json_obj = self.call_method_post(method='SetEnqueueServerRestore', json_scheme=json_scheme)
return True if json_obj['Success'] is True else False
|
class CloudInterface(JsonInterface):
def __init__(self, dc, debug_level=logging.INFO):
pass
def login(self, username, password, load=True):
'''
Set the authentication data in the object, and if load is True
(default is True) it also retrieve the ip list and the vm list
in order to build the internal objects list.
@param (str) username: username of the cloud
@param (str) password: password of the cloud
@param (bool) load: define if pre cache the objects.
@return: None
'''
pass
def poweroff_server(self, server=None, server_id=None):
'''
Poweroff a VM. If possible to pass the VM object or simply the ID
of the VM that we want to turn on.
Args:
server: VM Object that represent the VM to power off,
server_id: Int or Str representing the ID of the VM to power off.
Returns:
return True if json_obj['Success'] is 'True' else False
'''
pass
def poweron_server(self, server=None, server_id=None):
'''
Poweron a VM. If possible to pass the VM object or simply the ID
of the VM that we want to turn on.
Args:
server: VM Object that represent the VM to power on,
server_id: Int or Str representing the ID of the VM to power on.
Returns:
return True if json_obj['Success'] is 'True' else False
'''
pass
def get_hypervisors(self):
'''
Initialize the internal list containing each template available for each
hypervisor.
:return: [bool] True in case of success, otherwise False
'''
pass
def get_servers(self):
'''
Create the list of Server object inside the Datacenter objects.
Build an internal list of VM Objects (pro or smart) as iterator.
:return: bool
'''
pass
def find_template(self, name=None, hv=None):
'''
Return a list of templates that could have one or more elements.
Args:
name: name of the template to find.
hv: the ID of the hypervisor to search the template in
Returns:
A list of templates object. If hv is None will return all the
templates matching the name if every hypervisor type. Otherwise
if name is None will return all templates of an hypervisor.
Raises:
ValidationError: if name and hv are None
'''
pass
def get_vm(self, pattern=None):
pass
def get_ip_by_vm(self, vm):
pass
def purchase_ip(self, debug=False):
'''
Return an ip object representing a new bought IP
@param debug [Boolean] if true, request and response will be printed
@return (Ip): Ip object
'''
pass
def purchase_vlan(self, vlan_name, debug=False):
'''
Purchase a new VLAN.
:param debug: Log the json response if True
:param vlan_name: String representing the name of the vlan (virtual switch)
:return: a Vlan Object representing the vlan created
'''
pass
def remove_vlan(self, vlan_resource_id):
'''
Remove a VLAN
:param vlan_resource_id:
:return:
'''
pass
def get_vlan(self, vlan_name=None):
pass
def remove_ip(self, ip_id):
'''
Delete an Ip from the boughs ip list
@param (str) ip_id: a string representing the resource id of the IP
@return: True if json method had success else False
'''
pass
def get_package_id(self, name):
'''
Retrieve the smart package id given is English name
@param (str) name: the Aruba Smart package size name, ie: "small", "medium", "large", "extra large".
@return: The package id that depends on the Data center and the size choosen.
'''
pass
def get_ip_by_vm(self, vm):
'''
Retrieve a complete list of bought ip address related only to PRO Servers.
It create an internal object (Iplist) representing all of the ips object
iterated form the WS.
@param: None
@return: None
'''
pass
def delete_vm(self, server=None, server_id=None):
pass
def get_jobs(self):
pass
def find_job(self, vm_name):
pass
def get_virtual_datacenter(self):
pass
def get_server_detail(self, server_id):
pass
def attach_vlan(self, network_adapter_id, vlan_resource_id, ip=None, subnet_mask=None, gateway=None):
pass
def detach_vlan(self, network_adapter_id, vlan_resource_id):
pass
def create_snapshot(self, dc, server_id=None):
pass
def restore_snapshot(self, server_id=None):
pass
def delete_snapshot(self, server_id=None):
pass
def archive_vm(self, dc, server_id=None):
pass
def restore_vm(self, server_id=None, cpu_qty=None, ram_qty=None):
pass
| 29 | 12 | 15 | 0 | 12 | 3 | 3 | 0.26 | 1 | 17 | 9 | 0 | 28 | 3 | 28 | 31 | 448 | 29 | 334 | 125 | 305 | 86 | 266 | 125 | 237 | 12 | 3 | 5 | 94 |
7,430 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/ReverseDns/Requests/_BaseReverseDns.py
|
ArubaCloud.ReverseDns.Requests._BaseReverseDns.BaseReverseDns
|
class BaseReverseDns(Request):
def __init__(self, *args, **kwargs):
super(BaseReverseDns, self).__init__(*args, **kwargs)
# noinspection PyPep8Naming
def commit(self):
pass
|
class BaseReverseDns(Request):
def __init__(self, *args, **kwargs):
pass
def commit(self):
pass
| 3 | 0 | 2 | 0 | 2 | 0 | 1 | 0.2 | 1 | 1 | 0 | 3 | 2 | 0 | 2 | 10 | 7 | 1 | 5 | 3 | 2 | 1 | 5 | 3 | 2 | 1 | 3 | 0 | 2 |
7,431 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/objects/__init__.py
|
ArubaCloud.objects.IpList
|
class IpList(list):
def __init__(self, *args):
super(IpList, self).__init__(*args)
def show(self):
for elem in self:
print(elem)
def find(self, vm_name=None, ip_addr=None, resid=None):
# more defensive checks, just to have fun...
params = locals()
pattern = {}
ip = None
for _item in params:
if isinstance(params[_item], str) or isinstance(params[_item], int):
pattern['criteria'] = _item
pattern['value'] = params[_item]
for elem in self:
if not hasattr(elem, pattern['criteria']):
raise ValidationError('The criteria specified does not exists: %s' % (pattern['criteria']))
mtc = getattr(elem, pattern['criteria'])
if mtc == pattern['value']:
# we will return this object
ip = elem
# return the ip object which match the criteria
assert (ip.__class__.__name__ is 'Ip' or ip is None), 'the returning object is not as expected.'
return ip
|
class IpList(list):
def __init__(self, *args):
pass
def show(self):
pass
def find(self, vm_name=None, ip_addr=None, resid=None):
pass
| 4 | 0 | 8 | 0 | 7 | 1 | 3 | 0.14 | 1 | 4 | 1 | 0 | 3 | 0 | 3 | 36 | 27 | 2 | 22 | 11 | 18 | 3 | 22 | 11 | 18 | 6 | 2 | 2 | 9 |
7,432 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/objects/__init__.py
|
ArubaCloud.objects.Ip
|
class Ip(object):
ip_addr = None
resid = None
serverid = None
def __init__(self):
pass
def is_mapped(self):
return True if self.serverid is not None else False
|
class Ip(object):
def __init__(self):
pass
def is_mapped(self):
pass
| 3 | 0 | 2 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 10 | 2 | 8 | 6 | 5 | 0 | 8 | 6 | 5 | 2 | 1 | 0 | 3 |
7,433 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/objects/__init__.py
|
ArubaCloud.objects.Creator
|
class Creator(object):
__metaclass__ = ABCMeta
json_msg = OrderedDict()
def get_raw(self):
return self.json_msg
def get_json(self):
return json.dumps(self.json_msg)
def commit(self, url, debug=False):
from ArubaCloud.helper import Http
url = '{}/{}'.format(url, 'SetEnqueueServerCreation')
headers = {'Content-Type': 'application/json', 'Content-Length': str(len(self.get_json()))}
response = Http.post(url=url, data=self.get_json(), headers=headers)
if response.status_code != 200:
print(response.content)
return False
parsed_response = json.loads(response.content)
if debug is True:
print(parsed_response)
if parsed_response["Success"]:
return True
return False
|
class Creator(object):
def get_raw(self):
pass
def get_json(self):
pass
def commit(self, url, debug=False):
pass
| 4 | 0 | 6 | 0 | 6 | 0 | 2 | 0 | 1 | 2 | 1 | 2 | 3 | 0 | 3 | 3 | 24 | 3 | 21 | 10 | 16 | 0 | 21 | 10 | 16 | 4 | 1 | 1 | 6 |
7,434 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/helper/__init__.py
|
ArubaCloud.helper.Http
|
class Http(object):
@staticmethod
def _log_request(logger, data=None, headers=None):
if logger is not None:
if headers is not None:
for header in headers:
logger.debug('request header: %s: %s', header, headers[header])
if data is not None:
logger.debug('request data:\n %s', data)
@staticmethod
def _log_response(logger, response):
if logger is not None:
logger.debug('[%d] %s', response.status_code, response.text)
@staticmethod
def get(url, data=None, logger=None, **kwargs):
if logger is not None:
Http._log_request(logger, data=data, headers=kwargs.get('headers', None))
response = requests.get(url, data=data, **kwargs)
Http._log_response(logger, response)
return response
@staticmethod
def post(url, data=None, json=None, logger=None, **kwargs):
if logger is not None:
Http._log_request(logger, data=data, headers=kwargs.get('headers', None))
response = requests.post(url, data=data, json=json, **kwargs)
Http._log_response(logger, response)
return response
@staticmethod
def put(url, data=None, logger=None, **kwargs):
if logger is not None:
Http._log_request(logger, data=data, headers=kwargs.get('headers', None))
response = requests.put(url, data=data, **kwargs)
Http._log_response(logger, response)
return response
@staticmethod
def delete(url, data=None, logger=None, **kwargs):
if logger is not None:
Http._log_request(logger, data=data, headers=kwargs.get('headers', None))
response = requests.delete(url, data=data, **kwargs)
Http._log_response(logger, response)
return response
|
class Http(object):
@staticmethod
def _log_request(logger, data=None, headers=None):
pass
@staticmethod
def _log_response(logger, response):
pass
@staticmethod
def get(url, data=None, logger=None, **kwargs):
pass
@staticmethod
def post(url, data=None, json=None, logger=None, **kwargs):
pass
@staticmethod
def put(url, data=None, logger=None, **kwargs):
pass
@staticmethod
def delete(url, data=None, logger=None, **kwargs):
pass
| 13 | 0 | 6 | 0 | 6 | 0 | 3 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 6 | 6 | 46 | 5 | 41 | 18 | 28 | 0 | 35 | 12 | 28 | 5 | 1 | 3 | 15 |
7,435 |
Arubacloud/pyArubaCloud
|
/Users/umroot/Documents/PhD_works/PhD-Core-Contents/Class-level-dataset-curation/data/git_repos_for_analysis/Arubacloud_pyArubaCloud/ArubaCloud/objects/Templates.py
|
ArubaCloud.objects.Templates.Template.ResourceBounds
|
class ResourceBounds(object):
def __init__(self):
self.max_cpu = None
self.max_memory = None
self.hdd0 = None
self.hdd1 = None
self.hdd2 = None
self.hdd3 = None
|
class ResourceBounds(object):
def __init__(self):
pass
| 2 | 0 | 7 | 0 | 7 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 6 | 1 | 1 | 8 | 0 | 8 | 8 | 6 | 0 | 8 | 8 | 6 | 1 | 1 | 0 | 1 |
7,436 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/base/vm.py
|
ArubaCloud.base.vm.VMList
|
class VMList(list):
def __init__(self, *args, **kwargs):
super(VMList, self).__init__(*args)
self.last_search_result = []
def find(self, name):
"""
Return a list of subset of VM that match the pattern name
@param name (str): the vm name of the virtual machine
@param name (Obj): the vm object that represent the virtual
machine (can be Pro or Smart)
@return (list): the subset containing the serach result.
"""
if name.__class__ is 'base.Server.Pro' or name.__class__ is 'base.Server.Smart':
# print('DEBUG: matched VM object %s' % name.__class__)
pattern = name.vm_name
else:
# print('DEBUG: matched Str Object %s' % name.__class__)
pattern = name
# 14/06/2013: since this method is called within a thread and I wont to pass the return objects with queue or
# call back, I will allocate a list inside the Interface class object itself, which contain all of the vm found
# 02/11/2015: this must be changed ASAP! it's a mess this way... what was I thinking??
self.last_search_result = [vm for vm in self if pattern in vm.vm_name]
return self.last_search_result
def show(self):
for vm in self:
print(vm)
def find_ip(self, ip):
f = None
if ip.__class__ is 'base.Ip.Ip':
# logger.debug('DEBUG: matched IP Object: %s' % ip.__class__)
pattern = ip.ip_addr
else:
# logger.debug('DEBUG: matched Str Object: %s' % ip.__class__)
pattern = ip
for vm in self:
if vm.__class__.__name__ is 'Smart':
if pattern == vm.ip_addr:
f = vm
else:
if pattern == vm.ip_addr.ip_addr:
f = vm
return f
|
class VMList(list):
def __init__(self, *args, **kwargs):
pass
def find(self, name):
'''
Return a list of subset of VM that match the pattern name
@param name (str): the vm name of the virtual machine
@param name (Obj): the vm object that represent the virtual
machine (can be Pro or Smart)
@return (list): the subset containing the serach result.
'''
pass
def show(self):
pass
def find_ip(self, ip):
pass
| 5 | 1 | 10 | 0 | 7 | 4 | 3 | 0.5 | 1 | 1 | 0 | 0 | 4 | 1 | 4 | 37 | 45 | 3 | 28 | 11 | 23 | 14 | 25 | 11 | 20 | 6 | 2 | 3 | 11 |
7,437 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/base/vm.py
|
ArubaCloud.base.vm.VM
|
class VM(object):
vm_name = None
cpu_qty = None
ram_qty = None
status = None
sid = None
datacenter_id = None
auth = None
admin_password = None
wcf_baseurl = None
template_id = None
hd_total_size = None
hd_qty = None
def __init__(self, interface):
super(VM, self).__init__()
self.interface = interface
def poweroff(self, debug=False):
data = dict(
ServerId=self.sid
)
json_scheme = self.interface.gen_def_json_scheme('SetEnqueueServerPowerOff', data)
json_obj = self.interface.call_method_post('SetEnqueueServerPowerOff', json_scheme=json_scheme, debug=debug)
return True if json_obj['Success'] is True else False
def poweron(self, debug=False):
data = dict(
ServerId=self.sid
)
json_scheme = self.interface.gen_def_json_scheme('SetEnqueueServerStart', data)
json_obj = self.interface.call_method_post('SetEnqueueServerStart', json_scheme=json_scheme, debug=debug)
return True if json_obj['Success'] is 'True' else False
def reinitialize(self, admin_password=None, debug=False, ConfigureIPv6=False, OSTemplateID=None):
"""
Reinitialize a VM.
:param admin_password: Administrator password.
:param debug: Flag to enable debug output.
:param ConfigureIPv6: Flag to enable IPv6 on the VM.
:param OSTemplateID: TemplateID to reinitialize the VM with.
:return: True in case of success, otherwise False
:type admin_password: str
:type debug: bool
:type ConfigureIPv6: bool
:type OSTemplateID: int
"""
data = dict(
AdministratorPassword=admin_password,
ServerId=self.sid,
ConfigureIPv6=ConfigureIPv6
)
if OSTemplateID is not None:
data.update(OSTemplateID=OSTemplateID)
assert data['AdministratorPassword'] is not None, 'Error reinitializing VM: no admin password specified.'
assert data['ServerId'] is not None, 'Error reinitializing VM: no Server Id specified.'
json_scheme = self.interface.gen_def_json_scheme('SetEnqueueReinitializeServer', method_fields=data)
json_obj = self.interface.call_method_post('SetEnqueueReinitializeServer', json_scheme=json_scheme, debug=debug)
return True if json_obj['Success'] is 'True' else False
def edit_cpu(self, cpu_qty, debug=False):
raise NotImplemented()
def edit_ram(self, ram_qty, debug=False):
raise NotImplemented()
def add_virtual_disk(self, *args, **kwargs):
raise NotImplemented()
def remove_virtual_disk(self, *args, **kwargs):
raise NotImplemented()
def edit_virtual_disk_size(self, *args, **kwargs):
raise NotImplemented()
|
class VM(object):
def __init__(self, interface):
pass
def poweroff(self, debug=False):
pass
def poweron(self, debug=False):
pass
def reinitialize(self, admin_password=None, debug=False, ConfigureIPv6=False, OSTemplateID=None):
'''
Reinitialize a VM.
:param admin_password: Administrator password.
:param debug: Flag to enable debug output.
:param ConfigureIPv6: Flag to enable IPv6 on the VM.
:param OSTemplateID: TemplateID to reinitialize the VM with.
:return: True in case of success, otherwise False
:type admin_password: str
:type debug: bool
:type ConfigureIPv6: bool
:type OSTemplateID: int
'''
pass
def edit_cpu(self, cpu_qty, debug=False):
pass
def edit_ram(self, ram_qty, debug=False):
pass
def add_virtual_disk(self, *args, **kwargs):
pass
def remove_virtual_disk(self, *args, **kwargs):
pass
def edit_virtual_disk_size(self, *args, **kwargs):
pass
| 10 | 1 | 6 | 0 | 4 | 1 | 1 | 0.23 | 1 | 2 | 0 | 2 | 9 | 1 | 9 | 9 | 74 | 9 | 53 | 32 | 43 | 12 | 45 | 32 | 35 | 3 | 1 | 1 | 13 |
7,438 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/base/logsystem.py
|
ArubaCloud.base.logsystem.ArubaLog
|
class ArubaLog(object):
def __init__(self, level=logging.DEBUG, dst_file='debug.log', name=__name__, log_to_file=False,
log_to_stdout=True):
"""
Initialize Logging System
:param level: Debugging level.
:param dst_file: Log destination file.
:param name: the name of the debugger.
:param log_to_file: boolean, True in case logs must be placed on file too.
"""
self.level = level
self.dst_file = dst_file
self.log = logging.getLogger(name)
self.log.setLevel(level)
self.name = name
formatter = logging.Formatter("%(asctime)s %(threadName)-11s %(levelname)-10s %(message)s")
if log_to_file is True:
file_handler = logging.FileHandler(dst_file, "a")
file_handler.setLevel(level)
file_handler.setFormatter(formatter)
self.log.addHandler(file_handler)
elif log_to_stdout is True:
stream_handler = logging.StreamHandler()
stream_handler.setLevel(level)
stream_handler.setFormatter(formatter)
self.log.addHandler(stream_handler)
else:
raise ValueError("No Stream Handler Specified.")
def debug(self, msg):
self.log.debug(msg)
def critical(self, msg):
self.log.critical(msg)
def warning(self, msg):
self.log.warning(msg)
def info(self, msg):
self.log.info(msg)
def error(self, error):
self.log.error(error)
|
class ArubaLog(object):
def __init__(self, level=logging.DEBUG, dst_file='debug.log', name=__name__, log_to_file=False,
log_to_stdout=True):
'''
Initialize Logging System
:param level: Debugging level.
:param dst_file: Log destination file.
:param name: the name of the debugger.
:param log_to_file: boolean, True in case logs must be placed on file too.
'''
pass
def debug(self, msg):
pass
def critical(self, msg):
pass
def warning(self, msg):
pass
def info(self, msg):
pass
def error(self, error):
pass
| 7 | 1 | 7 | 1 | 5 | 1 | 1 | 0.23 | 1 | 4 | 0 | 0 | 6 | 4 | 6 | 6 | 47 | 9 | 31 | 15 | 23 | 7 | 28 | 14 | 21 | 3 | 1 | 1 | 8 |
7,439 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/ReverseDns/Requests/SetEnqueueSetReverseDns.py
|
ArubaCloud.ReverseDns.Requests.SetEnqueueSetReverseDns.SetEnqueueSetReverseDns
|
class SetEnqueueSetReverseDns(BaseReverseDns):
def __init__(self, *args, **kwargs):
"""
Assign one or more PTR record to a single IP Address
:type IP: str
:type Host: list[str]
:param IP: (str) The IP address to configure
:param Host: (list[str]) The list of strings representing PTR records
"""
try:
self.IP = kwargs.pop('IP')
except KeyError:
raise Exception('IP parameter cannot be null.')
try:
self.Hosts = kwargs.pop('Hosts')
except KeyError:
raise Exception('Hosts parameter cannot be null.')
super(SetEnqueueSetReverseDns, self).__init__(*args, **kwargs)
def commit(self):
return self._commit()
|
class SetEnqueueSetReverseDns(BaseReverseDns):
def __init__(self, *args, **kwargs):
'''
Assign one or more PTR record to a single IP Address
:type IP: str
:type Host: list[str]
:param IP: (str) The IP address to configure
:param Host: (list[str]) The list of strings representing PTR records
'''
pass
def commit(self):
pass
| 3 | 1 | 10 | 0 | 6 | 4 | 2 | 0.54 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 12 | 21 | 1 | 13 | 5 | 10 | 7 | 13 | 5 | 10 | 3 | 4 | 1 | 4 |
7,440 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/base/Errors.py
|
ArubaCloud.base.Errors.ValidationError
|
class ValidationError(Exception):
def __init__(self, message):
super(ValidationError, self).__init__(message)
|
class ValidationError(Exception):
def __init__(self, message):
pass
| 2 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 11 | 3 | 0 | 3 | 2 | 1 | 0 | 3 | 2 | 1 | 1 | 3 | 0 | 1 |
7,441 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/base/Errors.py
|
ArubaCloud.base.Errors.OperationNotPermitted
|
class OperationNotPermitted(Exception):
def __init__(self, message):
super(OperationNotPermitted, self).__init__(message)
|
class OperationNotPermitted(Exception):
def __init__(self, message):
pass
| 2 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 11 | 3 | 0 | 3 | 2 | 1 | 0 | 3 | 2 | 1 | 1 | 3 | 0 | 1 |
7,442 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/base/Errors.py
|
ArubaCloud.base.Errors.OperationAlreadyEnqueued
|
class OperationAlreadyEnqueued(Exception):
def __init__(self, message):
super(OperationAlreadyEnqueued, self).__init__(message)
|
class OperationAlreadyEnqueued(Exception):
def __init__(self, message):
pass
| 2 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 11 | 3 | 0 | 3 | 2 | 1 | 0 | 3 | 2 | 1 | 1 | 3 | 0 | 1 |
7,443 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/base/__init__.py
|
ArubaCloud.base.JsonInterfaceBase
|
class JsonInterfaceBase(object):
__metaclass__ = ABCMeta
def __init__(self):
pass
def gen_def_json_scheme(self, req, method_fields=None):
"""
Generate the scheme for the json request.
:param req: String representing the name of the method to call
:param method_fields: A dictionary containing the method-specified fields
:rtype : json object representing the method call
"""
json_dict = dict(
ApplicationId=req,
RequestId=req,
SessionId=req,
Password=self.auth.password,
Username=self.auth.username
)
if method_fields is not None:
json_dict.update(method_fields)
self.logger.debug(json.dumps(json_dict))
return json.dumps(json_dict)
def call_method_post(self, method, json_scheme, debug=False):
url = '{}/{}'.format(self.wcf_baseurl, method)
headers = {'Content-Type': 'application/json', 'Content-Length': str(len(json_scheme))}
response = Http.post(url=url, data=json_scheme, headers=headers)
parsed_response = json.loads(response.content.decode('utf-8'))
if response.status_code != 200:
from ArubaCloud.base.Errors import MalformedJsonRequest
raise MalformedJsonRequest("Request: {}, Status Code: {}".format(json_scheme, response.status_code))
if parsed_response['Success'] is False:
from ArubaCloud.base.Errors import RequestFailed
raise RequestFailed("Request: {}, Response: {}".format(json_scheme, parsed_response))
if debug is True:
msg = "Response Message: {}\nHTTP Status Code: {}".format(parsed_response, response.status_code)
self.logger.debug(msg)
print(msg)
return parsed_response
|
class JsonInterfaceBase(object):
def __init__(self):
pass
def gen_def_json_scheme(self, req, method_fields=None):
'''
Generate the scheme for the json request.
:param req: String representing the name of the method to call
:param method_fields: A dictionary containing the method-specified fields
:rtype : json object representing the method call
'''
pass
def call_method_post(self, method, json_scheme, debug=False):
pass
| 4 | 1 | 12 | 0 | 10 | 2 | 2 | 0.19 | 1 | 5 | 3 | 3 | 3 | 0 | 3 | 3 | 41 | 3 | 32 | 13 | 26 | 6 | 26 | 13 | 20 | 4 | 1 | 1 | 7 |
7,444 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/base/Errors.py
|
ArubaCloud.base.Errors.MalformedJsonRequest
|
class MalformedJsonRequest(Exception):
def __init__(self, message):
super(MalformedJsonRequest, self).__init__(message)
|
class MalformedJsonRequest(Exception):
def __init__(self, message):
pass
| 2 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 11 | 3 | 0 | 3 | 2 | 1 | 0 | 3 | 2 | 1 | 1 | 3 | 0 | 1 |
7,445 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/ReverseDns/ReverseDns.py
|
ArubaCloud.ReverseDns.ReverseDns.ReverseDns
|
class ReverseDns(ArubaCloudService):
def __init__(self, ws_uri, username, password):
super(ReverseDns, self).__init__(ws_uri, username, password)
def _call(self, method, *args, **kwargs):
return method(Username=self.username, Password=self.password, uri=self.ws_uri, *args, **kwargs)
def get(self, addresses):
"""
:type addresses: list[str]
:param addresses: (list[str]) List of addresses to retrieve their reverse dns
Retrieve the current configured ReverseDns entries
:return: (list) List containing the current ReverseDns Addresses
"""
request = self._call(GetReverseDns.GetReverseDns, IPs=addresses)
response = request.commit()
return response['Value']
def set(self, address, host_name):
"""
Assign one or more PTR record to a single IP Address
:type address: str
:type host_name: list[str]
:param address: (str) The IP address to configure
:param host_name: (list[str]) The list of strings representing PTR records
:return: (bool) True in case of success, False in case of failure
"""
request = self._call(SetEnqueueSetReverseDns.SetEnqueueSetReverseDns, IP=address, Hosts=host_name)
response = request.commit()
return response['Success']
def reset(self, addresses):
"""
Remove all PTR records from the given address
:type addresses: List[str]
:param addresses: (List[str]) The IP Address to reset
:return: (bool) True in case of success, False in case of failure
"""
request = self._call(SetEnqueueResetReverseDns.SetEnqueueResetReverseDns, IPs=addresses)
response = request.commit()
return response['Success']
|
class ReverseDns(ArubaCloudService):
def __init__(self, ws_uri, username, password):
pass
def _call(self, method, *args, **kwargs):
pass
def get(self, addresses):
'''
:type addresses: list[str]
:param addresses: (list[str]) List of addresses to retrieve their reverse dns
Retrieve the current configured ReverseDns entries
:return: (list) List containing the current ReverseDns Addresses
'''
pass
def set(self, address, host_name):
'''
Assign one or more PTR record to a single IP Address
:type address: str
:type host_name: list[str]
:param address: (str) The IP address to configure
:param host_name: (list[str]) The list of strings representing PTR records
:return: (bool) True in case of success, False in case of failure
'''
pass
def reset(self, addresses):
'''
Remove all PTR records from the given address
:type addresses: List[str]
:param addresses: (List[str]) The IP Address to reset
:return: (bool) True in case of success, False in case of failure
'''
pass
| 6 | 3 | 7 | 0 | 3 | 4 | 1 | 1.18 | 1 | 1 | 0 | 0 | 5 | 2 | 5 | 8 | 41 | 4 | 17 | 13 | 11 | 20 | 17 | 12 | 11 | 1 | 2 | 0 | 5 |
7,446 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/SharedStorage/Models/SharedStorageIQN.py
|
ArubaCloud.SharedStorage.Models.SharedStorageIQN.SharedStorageIQN
|
class SharedStorageIQN(object):
def __init__(self, iqnid=0, Status=SharedStorageStatus.Active, Value=""):
"""
Initialize a new IQN Object
:type iqnid: int
:type Status: str
:type Value: str
:param iqnid: IQNid
:param Status: default 'Active'
:param Value: Target IQN
"""
self.SharedStorageIQNID = iqnid
self.Status = Status
self.Value = Value
|
class SharedStorageIQN(object):
def __init__(self, iqnid=0, Status=SharedStorageStatus.Active, Value=""):
'''
Initialize a new IQN Object
:type iqnid: int
:type Status: str
:type Value: str
:param iqnid: IQNid
:param Status: default 'Active'
:param Value: Target IQN
'''
pass
| 2 | 1 | 13 | 0 | 4 | 9 | 1 | 1.8 | 1 | 1 | 1 | 0 | 1 | 3 | 1 | 1 | 14 | 0 | 5 | 5 | 3 | 9 | 5 | 5 | 3 | 1 | 1 | 0 | 1 |
7,447 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/SharedStorage/Models/SharedStorageProtocolType.py
|
ArubaCloud.SharedStorage.Models.SharedStorageProtocolType.SharedStorageProtocolType
|
class SharedStorageProtocolType(object):
CIFS = 1
ISCSI = 2
NFS = 3
|
class SharedStorageProtocolType(object):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 4 | 4 | 3 | 0 | 4 | 4 | 3 | 0 | 1 | 0 | 0 |
7,448 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/SharedStorage/Models/SharedStorageStatus.py
|
ArubaCloud.SharedStorage.Models.SharedStorageStatus.SharedStorageStatus
|
class SharedStorageStatus(object):
Creating = 1
Active = 2
Deleting = 3
Deleted = 4
|
class SharedStorageStatus(object):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 0 | 5 | 5 | 4 | 0 | 5 | 5 | 4 | 0 | 1 | 0 | 0 |
7,449 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/SharedStorage/Requests/GetSharedStorages.py
|
ArubaCloud.SharedStorage.Requests.GetSharedStorages.GetSharedStorages
|
class GetSharedStorages(Request):
def __init__(self, *args, **kwargs):
super(GetSharedStorages, self).__init__(*args, **kwargs)
def commit(self):
return self._commit()
|
class GetSharedStorages(Request):
def __init__(self, *args, **kwargs):
pass
def commit(self):
pass
| 3 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 0 | 2 | 10 | 6 | 1 | 5 | 3 | 2 | 0 | 5 | 3 | 2 | 1 | 3 | 0 | 2 |
7,450 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/SharedStorage/Requests/SetEnqueuePurchaseSharedStorage.py
|
ArubaCloud.SharedStorage.Requests.SetEnqueuePurchaseSharedStorage.SetEnqueuePurchaseSharedStorage
|
class SetEnqueuePurchaseSharedStorage(Request):
def __init__(self, *args, **kwargs):
"""
Purchase new SharedStorage Service
:type Quantity: int
:type SharedStorageName: str
:type SharedStorageProtocolType: SharedStorageProtocols
:type SharedStorageIQNs: list[SharedStorageIQN]
:param Quantity: Amount of GB
:param SharedStorageName: The name of the resource
:param SharedStorageProtocolType: the object representing the protocol to instantiate
"""
try:
self.Quantity = kwargs.pop('Quantity')
self.SharedStorageName = kwargs.pop('SharedStorageName')
self.SharedStorageProtocolType = kwargs.pop('SharedStorageProtocolType') \
if 'SharedStorageProtocolType' in kwargs.keys() else SharedStorageProtocolType.ISCSI
self.SharedStorageIQNs = kwargs.pop('SharedStorageIQNs')
except KeyError as e:
raise Exception('{} cannot be null.'.format(e.message))
super(SetEnqueuePurchaseSharedStorage, self).__init__(*args, **kwargs)
def commit(self):
self._commit()
|
class SetEnqueuePurchaseSharedStorage(Request):
def __init__(self, *args, **kwargs):
'''
Purchase new SharedStorage Service
:type Quantity: int
:type SharedStorageName: str
:type SharedStorageProtocolType: SharedStorageProtocols
:type SharedStorageIQNs: list[SharedStorageIQN]
:param Quantity: Amount of GB
:param SharedStorageName: The name of the resource
:param SharedStorageProtocolType: the object representing the protocol to instantiate
'''
pass
def commit(self):
pass
| 3 | 1 | 11 | 0 | 6 | 5 | 2 | 0.77 | 1 | 3 | 0 | 0 | 2 | 4 | 2 | 10 | 24 | 1 | 13 | 8 | 10 | 10 | 12 | 7 | 9 | 3 | 3 | 1 | 4 |
7,451 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/SharedStorage/Requests/SetEnqueueRemoveIQNSharedStorage.py
|
ArubaCloud.SharedStorage.Requests.SetEnqueueRemoveIQNSharedStorage.SetEnqueueRemoveIQNSharedStorage
|
class SetEnqueueRemoveIQNSharedStorage(Request):
def __init__(self, *args, **kwargs):
"""
Enqueue Shared Storage IQN Remove
:type SharedStorageID: str
:param SharedStorageID: (str) The ID of the Storage Resource
"""
try:
self.SharedStorageID = kwargs.pop('SharedStorageID')
except KeyError:
raise Exception('SharedStorageID cannot be Null.')
super(SetEnqueueRemoveIQNSharedStorage, self).__init__(*args, **kwargs)
def commit(self):
self._commit()
|
class SetEnqueueRemoveIQNSharedStorage(Request):
def __init__(self, *args, **kwargs):
'''
Enqueue Shared Storage IQN Remove
:type SharedStorageID: str
:param SharedStorageID: (str) The ID of the Storage Resource
'''
pass
def commit(self):
pass
| 3 | 1 | 7 | 0 | 4 | 3 | 2 | 0.56 | 1 | 3 | 0 | 0 | 2 | 1 | 2 | 10 | 15 | 1 | 9 | 4 | 6 | 5 | 9 | 4 | 6 | 2 | 3 | 1 | 3 |
7,452 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/SharedStorage/Requests/SetEnqueueRemoveSharedStorage.py
|
ArubaCloud.SharedStorage.Requests.SetEnqueueRemoveSharedStorage.SetEnqueueRemoveSharedStorage
|
class SetEnqueueRemoveSharedStorage(Request):
def __init__(self, *args, **kwargs):
"""
Enqueue Shared Storage Remove
:type SharedStorageID: str
:param SharedStorageID: (str) The ID of the Storage Resource
"""
try:
self.SharedStorageID = kwargs.pop('SharedStorageID')
except KeyError:
raise Exception('SharedStorageID cannot be Null.')
super(SetEnqueueRemoveSharedStorage, self).__init__(*args, **kwargs)
def commit(self):
self._commit()
|
class SetEnqueueRemoveSharedStorage(Request):
def __init__(self, *args, **kwargs):
'''
Enqueue Shared Storage Remove
:type SharedStorageID: str
:param SharedStorageID: (str) The ID of the Storage Resource
'''
pass
def commit(self):
pass
| 3 | 1 | 7 | 0 | 4 | 3 | 2 | 0.56 | 1 | 3 | 0 | 0 | 2 | 1 | 2 | 10 | 15 | 1 | 9 | 4 | 6 | 5 | 9 | 4 | 6 | 2 | 3 | 1 | 3 |
7,453 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/SharedStorage/SharedStorage.py
|
ArubaCloud.SharedStorage.SharedStorage.SharedStorage
|
class SharedStorage(ArubaCloudService):
def __init__(self, ws_uri, username, password):
super(SharedStorage, self).__init__(ws_uri, username, password)
def _call(self, method, *args, **kwargs):
return method(Username=self.username, Password=self.password, uri=self.ws_uri, *args, **kwargs)
def get(self):
"""
Retrieve the current configured SharedStorages entries
:return: [list] List containing the current SharedStorages entries
"""
request = self._call(GetSharedStorages)
response = request.commit()
return response['Value']
def purchase_iscsi(self, quantity, iqn, name, protocol=SharedStorageProtocolType.ISCSI):
"""
:type quantity: int
:type iqn: list[str]
:type name: str
:type protocol: SharedStorageProtocols
:param quantity: Amount of GB
:param iqn: List of IQN represented in string format
:param name: Name of the resource
:param protocol: Protocol to use
:return:
"""
iqns = []
for _iqn in iqn:
iqns.append(SharedStorageIQN(Value=_iqn))
request = self._call(SetEnqueuePurchaseSharedStorage, Quantity=quantity, SharedStorageName=name,
SharedStorageIQNs=iqns, SharedStorageProtocolType=protocol)
response = request.commit()
return response['Value']
|
class SharedStorage(ArubaCloudService):
def __init__(self, ws_uri, username, password):
pass
def _call(self, method, *args, **kwargs):
pass
def get(self):
'''
Retrieve the current configured SharedStorages entries
:return: [list] List containing the current SharedStorages entries
'''
pass
def purchase_iscsi(self, quantity, iqn, name, protocol=SharedStorageProtocolType.ISCSI):
'''
:type quantity: int
:type iqn: list[str]
:type name: str
:type protocol: SharedStorageProtocols
:param quantity: Amount of GB
:param iqn: List of IQN represented in string format
:param name: Name of the resource
:param protocol: Protocol to use
:return:
'''
pass
| 5 | 2 | 8 | 0 | 4 | 4 | 1 | 0.88 | 1 | 1 | 0 | 0 | 4 | 2 | 4 | 7 | 35 | 3 | 17 | 12 | 12 | 15 | 16 | 11 | 11 | 2 | 2 | 1 | 5 |
7,454 |
Arubacloud/pyArubaCloud
|
Arubacloud_pyArubaCloud/ArubaCloud/base/__init__.py
|
ArubaCloud.base.Auth
|
class Auth(object):
username = None
password = None
token = None
enc_pwd = None
def __init__(self, username=None, password=None):
self.username = username
self.password = password
|
class Auth(object):
def __init__(self, username=None, password=None):
pass
| 2 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 9 | 1 | 8 | 6 | 6 | 0 | 8 | 6 | 6 | 1 | 1 | 0 | 1 |
7,455 |
Arvedui/picuplib
|
Arvedui_picuplib/picuplib/exceptions.py
|
picuplib.exceptions.UnsupportedRotation
|
class UnsupportedRotation(Exception):
"""
Raised when unsupported rotation value is given.
"""
|
class UnsupportedRotation(Exception):
'''
Raised when unsupported rotation value is given.
'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 4 | 0 | 1 | 1 | 0 | 3 | 1 | 1 | 0 | 0 | 3 | 0 | 0 |
7,456 |
Arvedui/picuplib
|
Arvedui_picuplib/picuplib/exceptions.py
|
picuplib.exceptions.UnsupportedFormat
|
class UnsupportedFormat(Exception):
"""
Raised when file format is unsupported
"""
|
class UnsupportedFormat(Exception):
'''
Raised when file format is unsupported
'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 4 | 0 | 1 | 1 | 0 | 3 | 1 | 1 | 0 | 0 | 3 | 0 | 0 |
7,457 |
Arvedui/picuplib
|
Arvedui_picuplib/picuplib/exceptions.py
|
picuplib.exceptions.ServerError
|
class ServerError(Exception):
"""
Raised when a Server error occured
"""
|
class ServerError(Exception):
'''
Raised when a Server error occured
'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 4 | 0 | 1 | 1 | 0 | 3 | 1 | 1 | 0 | 0 | 3 | 0 | 0 |
7,458 |
Arvedui/picuplib
|
Arvedui_picuplib/picuplib/exceptions.py
|
picuplib.exceptions.PercentageOutOfRange
|
class PercentageOutOfRange(Exception):
"""
Raised when resize percentage is out of range
"""
|
class PercentageOutOfRange(Exception):
'''
Raised when resize percentage is out of range
'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 4 | 0 | 1 | 1 | 0 | 3 | 1 | 1 | 0 | 0 | 3 | 0 | 0 |
7,459 |
Arvedui/picuplib
|
Arvedui_picuplib/picuplib/exceptions.py
|
picuplib.exceptions.EmptyResponse
|
class EmptyResponse(Exception):
"""
Raised when the server response is emtpy
"""
|
class EmptyResponse(Exception):
'''
Raised when the server response is emtpy
'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 4 | 0 | 1 | 1 | 0 | 3 | 1 | 1 | 0 | 0 | 3 | 0 | 0 |
7,460 |
Arvedui/picuplib
|
Arvedui_picuplib/picuplib/exceptions.py
|
picuplib.exceptions.MallformedResize
|
class MallformedResize(Exception):
"""
Raised when resize value is mallformed
"""
|
class MallformedResize(Exception):
'''
Raised when resize value is mallformed
'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 4 | 0 | 1 | 1 | 0 | 3 | 1 | 1 | 0 | 0 | 3 | 0 | 0 |
7,461 |
Arvedui/picuplib
|
Arvedui_picuplib/picuplib/upload.py
|
picuplib.upload.Upload
|
class Upload(object):
"""
Class based wrapper for uploading.
It stores the apikey and default settings for resize, rotation
and the noexif parameter.
:param str apikey: Apikey needed for Autentication on picflash.
:param str resize: Aresolution in the folowing format: \
'80x80'(optional)
:param str|degree rotation: The picture will be rotated by this Value. \
Allowed values are 00, 90, 180, 270.(optional)
:param boolean noexif: set to True when exif data should be purged.\
(optional)
:param function callback: function witch will be called after every read. \
Need to take one argument. you can use the len function to \
determine the body length and call bytes_read(). Only for local Upload!
:ivar str resize:
:ivar str rotation:
:ivar boolean noexif: If true exif data will be deleted
:ivar function callback:
"""
# pylint: disable=too-many-arguments,attribute-defined-outside-init, too-many-instance-attributes
# I see no point in complicating things through parameter grouping
def __init__(self, apikey, resize=None, rotation='00', noexif=False,
callback=None):
self._apikey = apikey
self.resize = resize
self.rotation = rotation
self.noexif = noexif
self.callback = callback
# pylint: enable=too-many-arguments
@property
def resize(self):
"""getter for _resize"""
return self._resize
@resize.setter
def resize(self, value):
"""setter for _resize"""
check_resize(value)
self._resize = value
@property
def rotation(self):
"""getter for _rotation"""
return self._rotation
@rotation.setter
def rotation(self, value):
"""setter for rotation"""
check_rotation(value)
self._rotation = value
@property
def noexif(self):
"""getter for _noexif"""
return self._noexif
@noexif.setter
def noexif(self, value):
"""setter for _noexif"""
check_noexif(value)
self._noexif = value
@property
def callback(self):
""" getter for _callback"""
return self._callback
@callback.setter
def callback(self, value):
"""setter for _callback"""
check_callback(value)
self._callback = value
# pylint: disable=too-many-arguments
# I see no point in complicating things
def upload(self, picture, resize=None, rotation=None, noexif=None,
callback=None):
"""
wraps upload function
:param str/tuple/list picture: Path to picture as str or picture data. \
If data a tuple or list with the file name as str \
and data as byte object in that order.
:param str resize: Aresolution in the folowing format: \
'80x80'(optional)
:param str|degree rotation: The picture will be rotated by this Value.\
Allowed values are 00, 90, 180, 270.(optional)
:param boolean noexif: set to True when exif data should be purged.\
(optional)
:param function callback: function will be called after every read. \
Need to take one argument. you can use the len function to \
determine the body length and call bytes_read().
"""
if not resize:
resize = self._resize
if not rotation:
rotation = self._rotation
if not noexif:
noexif = self._noexif
if not callback:
callback = self._callback
return upload(self._apikey, picture, resize,
rotation, noexif, callback)
# pylint: enable=too-many-arguments
def remote_upload(self, picture_url, resize=None,
rotation=None, noexif=None):
"""
wraps remote_upload funktion
:param str picture_url: URL to picture allowd Protocols are: ftp,\
http, https
:param str resize: Aresolution in the folowing format: \
'80x80'(optional)
:param str|degree rotation: The picture will be rotated by this Value. \
Allowed values are 00, 90, 180, 270.(optional)
:param boolean noexif: set to True when exif data should be purged.\
(optional)
"""
if not resize:
resize = self._resize
if not rotation:
rotation = self._rotation
if not noexif:
noexif = self._noexif
return remote_upload(self._apikey, picture_url,
resize, rotation, noexif)
|
class Upload(object):
'''
Class based wrapper for uploading.
It stores the apikey and default settings for resize, rotation
and the noexif parameter.
:param str apikey: Apikey needed for Autentication on picflash.
:param str resize: Aresolution in the folowing format: '80x80'(optional)
:param str|degree rotation: The picture will be rotated by this Value. Allowed values are 00, 90, 180, 270.(optional)
:param boolean noexif: set to True when exif data should be purged. (optional)
:param function callback: function witch will be called after every read. Need to take one argument. you can use the len function to determine the body length and call bytes_read(). Only for local Upload!
:ivar str resize:
:ivar str rotation:
:ivar boolean noexif: If true exif data will be deleted
:ivar function callback:
'''
def __init__(self, apikey, resize=None, rotation='00', noexif=False,
callback=None):
pass
@property
def resize(self):
'''getter for _resize'''
pass
@resize.setter
def resize(self):
'''setter for _resize'''
pass
@property
def rotation(self):
'''getter for _rotation'''
pass
@rotation.setter
def rotation(self):
'''setter for rotation'''
pass
@property
def noexif(self):
'''getter for _noexif'''
pass
@noexif.setter
def noexif(self):
'''setter for _noexif'''
pass
@property
def callback(self):
''' getter for _callback'''
pass
@callback.setter
def callback(self):
'''setter for _callback'''
pass
def upload(self, picture, resize=None, rotation=None, noexif=None,
callback=None):
'''
wraps upload function
:param str/tuple/list picture: Path to picture as str or picture data. If data a tuple or list with the file name as str and data as byte object in that order.
:param str resize: Aresolution in the folowing format: '80x80'(optional)
:param str|degree rotation: The picture will be rotated by this Value. Allowed values are 00, 90, 180, 270.(optional)
:param boolean noexif: set to True when exif data should be purged. (optional)
:param function callback: function will be called after every read. Need to take one argument. you can use the len function to determine the body length and call bytes_read().
'''
pass
def remote_upload(self, picture_url, resize=None,
rotation=None, noexif=None):
'''
wraps remote_upload funktion
:param str picture_url: URL to picture allowd Protocols are: ftp, http, https
:param str resize: Aresolution in the folowing format: '80x80'(optional)
:param str|degree rotation: The picture will be rotated by this Value. Allowed values are 00, 90, 180, 270.(optional)
:param boolean noexif: set to True when exif data should be purged. (optional)
'''
pass
| 20 | 11 | 8 | 1 | 4 | 3 | 2 | 1.02 | 1 | 0 | 0 | 0 | 11 | 5 | 11 | 11 | 137 | 20 | 58 | 28 | 35 | 59 | 45 | 17 | 33 | 5 | 1 | 1 | 18 |
7,462 |
Arvedui/picuplib
|
Arvedui_picuplib/picuplib/exceptions.py
|
picuplib.exceptions.UnkownError
|
class UnkownError(Exception):
"""
Raised when an unkown error is returned by the API
"""
|
class UnkownError(Exception):
'''
Raised when an unkown error is returned by the API
'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 4 | 0 | 1 | 1 | 0 | 3 | 1 | 1 | 0 | 0 | 3 | 0 | 0 |
7,463 |
Asana/python-asana
|
Asana_python-asana/test/test_project_briefs_api.py
|
test.test_project_briefs_api.TestProjectBriefsApi
|
class TestProjectBriefsApi(unittest.TestCase):
"""ProjectBriefsApi unit test stubs"""
def setUp(self):
self.api = ProjectBriefsApi() # noqa: E501
def tearDown(self):
pass
def test_create_project_brief(self):
"""Test case for create_project_brief
Create a project brief # noqa: E501
"""
pass
def test_delete_project_brief(self):
"""Test case for delete_project_brief
Delete a project brief # noqa: E501
"""
pass
def test_get_project_brief(self):
"""Test case for get_project_brief
Get a project brief # noqa: E501
"""
pass
def test_update_project_brief(self):
"""Test case for update_project_brief
Update a project brief # noqa: E501
"""
pass
|
class TestProjectBriefsApi(unittest.TestCase):
'''ProjectBriefsApi unit test stubs'''
def setUp(self):
pass
def tearDown(self):
pass
def test_create_project_brief(self):
'''Test case for create_project_brief
Create a project brief # noqa: E501
'''
pass
def test_delete_project_brief(self):
'''Test case for delete_project_brief
Delete a project brief # noqa: E501
'''
pass
def test_get_project_brief(self):
'''Test case for get_project_brief
Get a project brief # noqa: E501
'''
pass
def test_update_project_brief(self):
'''Test case for update_project_brief
Update a project brief # noqa: E501
'''
pass
| 7 | 5 | 5 | 1 | 2 | 2 | 1 | 1.08 | 1 | 1 | 1 | 0 | 6 | 1 | 6 | 78 | 36 | 10 | 13 | 8 | 6 | 14 | 13 | 8 | 6 | 1 | 2 | 0 | 6 |
7,464 |
Asana/python-asana
|
Asana_python-asana/test/test_portfolios_api.py
|
test.test_portfolios_api.TestPortfoliosApi
|
class TestPortfoliosApi(unittest.TestCase):
"""PortfoliosApi unit test stubs"""
def setUp(self):
self.api = PortfoliosApi() # noqa: E501
def tearDown(self):
pass
def test_add_custom_field_setting_for_portfolio(self):
"""Test case for add_custom_field_setting_for_portfolio
Add a custom field to a portfolio # noqa: E501
"""
pass
def test_add_item_for_portfolio(self):
"""Test case for add_item_for_portfolio
Add a portfolio item # noqa: E501
"""
pass
def test_add_members_for_portfolio(self):
"""Test case for add_members_for_portfolio
Add users to a portfolio # noqa: E501
"""
pass
def test_create_portfolio(self):
"""Test case for create_portfolio
Create a portfolio # noqa: E501
"""
pass
def test_delete_portfolio(self):
"""Test case for delete_portfolio
Delete a portfolio # noqa: E501
"""
pass
def test_get_items_for_portfolio(self):
"""Test case for get_items_for_portfolio
Get portfolio items # noqa: E501
"""
pass
def test_get_portfolio(self):
"""Test case for get_portfolio
Get a portfolio # noqa: E501
"""
pass
def test_get_portfolios(self):
"""Test case for get_portfolios
Get multiple portfolios # noqa: E501
"""
pass
def test_remove_custom_field_setting_for_portfolio(self):
"""Test case for remove_custom_field_setting_for_portfolio
Remove a custom field from a portfolio # noqa: E501
"""
pass
def test_remove_item_for_portfolio(self):
"""Test case for remove_item_for_portfolio
Remove a portfolio item # noqa: E501
"""
pass
def test_remove_members_for_portfolio(self):
"""Test case for remove_members_for_portfolio
Remove users from a portfolio # noqa: E501
"""
pass
def test_update_portfolio(self):
"""Test case for update_portfolio
Update a portfolio # noqa: E501
"""
pass
|
class TestPortfoliosApi(unittest.TestCase):
'''PortfoliosApi unit test stubs'''
def setUp(self):
pass
def tearDown(self):
pass
def test_add_custom_field_setting_for_portfolio(self):
'''Test case for add_custom_field_setting_for_portfolio
Add a custom field to a portfolio # noqa: E501
'''
pass
def test_add_item_for_portfolio(self):
'''Test case for add_item_for_portfolio
Add a portfolio item # noqa: E501
'''
pass
def test_add_members_for_portfolio(self):
'''Test case for add_members_for_portfolio
Add users to a portfolio # noqa: E501
'''
pass
def test_create_portfolio(self):
'''Test case for create_portfolio
Create a portfolio # noqa: E501
'''
pass
def test_delete_portfolio(self):
'''Test case for delete_portfolio
Delete a portfolio # noqa: E501
'''
pass
def test_get_items_for_portfolio(self):
'''Test case for get_items_for_portfolio
Get portfolio items # noqa: E501
'''
pass
def test_get_portfolio(self):
'''Test case for get_portfolio
Get a portfolio # noqa: E501
'''
pass
def test_get_portfolios(self):
'''Test case for get_portfolios
Get multiple portfolios # noqa: E501
'''
pass
def test_remove_custom_field_setting_for_portfolio(self):
'''Test case for remove_custom_field_setting_for_portfolio
Remove a custom field from a portfolio # noqa: E501
'''
pass
def test_remove_item_for_portfolio(self):
'''Test case for remove_item_for_portfolio
Remove a portfolio item # noqa: E501
'''
pass
def test_remove_members_for_portfolio(self):
'''Test case for remove_members_for_portfolio
Remove users from a portfolio # noqa: E501
'''
pass
def test_update_portfolio(self):
'''Test case for update_portfolio
Update a portfolio # noqa: E501
'''
pass
| 15 | 13 | 5 | 1 | 2 | 3 | 1 | 1.31 | 1 | 1 | 1 | 0 | 14 | 1 | 14 | 86 | 92 | 26 | 29 | 16 | 14 | 38 | 29 | 16 | 14 | 1 | 2 | 0 | 14 |
7,465 |
Asana/python-asana
|
Asana_python-asana/test/test_task_templates_api.py
|
test.test_task_templates_api.TestTaskTemplatesApi
|
class TestTaskTemplatesApi(unittest.TestCase):
"""TaskTemplatesApi unit test stubs"""
def setUp(self):
self.api = TaskTemplatesApi() # noqa: E501
def tearDown(self):
pass
def test_get_task_template(self):
"""Test case for get_task_template
Get a task template # noqa: E501
"""
pass
def test_get_task_templates(self):
"""Test case for get_task_templates
Get multiple task templates # noqa: E501
"""
pass
def test_instantiate_task(self):
"""Test case for instantiate_task
Instantiate a task from a task template # noqa: E501
"""
pass
|
class TestTaskTemplatesApi(unittest.TestCase):
'''TaskTemplatesApi unit test stubs'''
def setUp(self):
pass
def tearDown(self):
pass
def test_get_task_template(self):
'''Test case for get_task_template
Get a task template # noqa: E501
'''
pass
def test_get_task_templates(self):
'''Test case for get_task_templates
Get multiple task templates # noqa: E501
'''
pass
def test_instantiate_task(self):
'''Test case for instantiate_task
Instantiate a task from a task template # noqa: E501
'''
pass
| 6 | 4 | 4 | 1 | 2 | 2 | 1 | 1 | 1 | 1 | 1 | 0 | 5 | 1 | 5 | 77 | 29 | 8 | 11 | 7 | 5 | 11 | 11 | 7 | 5 | 1 | 2 | 0 | 5 |
7,466 |
Asana/python-asana
|
Asana_python-asana/asana/api/typeahead_api.py
|
asana.api.typeahead_api.TypeaheadApi
|
class TypeaheadApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def typeahead_for_workspace(self, workspace_gid, resource_type, opts, **kwargs): # noqa: E501
"""Get objects via typeahead # noqa: E501
Retrieves objects in the workspace based via an auto-completion/typeahead search algorithm. This feature is meant to provide results quickly, so do not rely on this API to provide extremely accurate search results. The result set is limited to a single page of results with a maximum size, so you won’t be able to fetch large numbers of results. The typeahead search API provides search for objects from a single workspace. This endpoint should be used to query for objects when creating an auto-completion/typeahead search feature. This API is meant to provide results quickly and should not be relied upon for accurate or exhaustive search results. The results sets are limited in size and cannot be paginated. Queries return a compact representation of each object which is typically the gid and name fields. Interested in a specific set of fields or all of the fields?! Of course you are. Use field selectors to manipulate what data is included in a response. Resources with type `user` are returned in order of most contacted to least contacted. This is determined by task assignments, adding the user to projects, and adding the user as a follower to tasks, messages, etc. Resources with type `project` are returned in order of recency. This is determined when the user visits the project, is added to the project, and completes tasks in the project. Resources with type `task` are returned with priority placed on tasks the user is following, but no guarantee on the order of those tasks. Resources with type `project_template` are returned with priority placed on favorited project templates. Leaving the `query` string empty or omitted will give you results, still following the resource ordering above. This could be used to list users or projects that are relevant for the requesting user's api token. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.typeahead_for_workspace(workspace_gid, resource_type, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param str resource_type: The type of values the typeahead should return. You can choose from one of the following: `custom_field`, `goal`, `project`, `project_template`, `portfolio`, `tag`, `task`, `team`, and `user`. Note that unlike in the names of endpoints, the types listed here are in singular form (e.g. `task`). Using multiple types is not yet supported. (required)
:param str type: *Deprecated: new integrations should prefer the resource_type field.*
:param str query: The string that will be used to search for relevant objects. If an empty string is passed in, the API will return results.
:param int count: The number of results to return. The default is 20 if this parameter is omitted, with a minimum of 1 and a maximum of 100. If there are fewer results found than requested, all will be returned.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: AsanaNamedResourceArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.typeahead_for_workspace_with_http_info(workspace_gid, resource_type, opts, **kwargs) # noqa: E501
else:
(data) = self.typeahead_for_workspace_with_http_info(workspace_gid, resource_type, opts, **kwargs) # noqa: E501
return data
def typeahead_for_workspace_with_http_info(self, workspace_gid, resource_type, opts, **kwargs): # noqa: E501
"""Get objects via typeahead # noqa: E501
Retrieves objects in the workspace based via an auto-completion/typeahead search algorithm. This feature is meant to provide results quickly, so do not rely on this API to provide extremely accurate search results. The result set is limited to a single page of results with a maximum size, so you won’t be able to fetch large numbers of results. The typeahead search API provides search for objects from a single workspace. This endpoint should be used to query for objects when creating an auto-completion/typeahead search feature. This API is meant to provide results quickly and should not be relied upon for accurate or exhaustive search results. The results sets are limited in size and cannot be paginated. Queries return a compact representation of each object which is typically the gid and name fields. Interested in a specific set of fields or all of the fields?! Of course you are. Use field selectors to manipulate what data is included in a response. Resources with type `user` are returned in order of most contacted to least contacted. This is determined by task assignments, adding the user to projects, and adding the user as a follower to tasks, messages, etc. Resources with type `project` are returned in order of recency. This is determined when the user visits the project, is added to the project, and completes tasks in the project. Resources with type `task` are returned with priority placed on tasks the user is following, but no guarantee on the order of those tasks. Resources with type `project_template` are returned with priority placed on favorited project templates. Leaving the `query` string empty or omitted will give you results, still following the resource ordering above. This could be used to list users or projects that are relevant for the requesting user's api token. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.typeahead_for_workspace_with_http_info(workspace_gid, resource_type, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param str resource_type: The type of values the typeahead should return. You can choose from one of the following: `custom_field`, `goal`, `project`, `project_template`, `portfolio`, `tag`, `task`, `team`, and `user`. Note that unlike in the names of endpoints, the types listed here are in singular form (e.g. `task`). Using multiple types is not yet supported. (required)
:param str type: *Deprecated: new integrations should prefer the resource_type field.*
:param str query: The string that will be used to search for relevant objects. If an empty string is passed in, the API will return results.
:param int count: The number of results to return. The default is 20 if this parameter is omitted, with a minimum of 1 and a maximum of 100. If there are fewer results found than requested, all will be returned.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: AsanaNamedResourceArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method typeahead_for_workspace" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workspace_gid' is set
if (workspace_gid is None):
raise ValueError("Missing the required parameter `workspace_gid` when calling `typeahead_for_workspace`") # noqa: E501
# verify the required parameter 'resource_type' is set
if (resource_type is None):
raise ValueError("Missing the required parameter `resource_type` when calling `typeahead_for_workspace`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['workspace_gid'] = workspace_gid # noqa: E501
query_params = {}
query_params = opts
query_params['resource_type'] = resource_type
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/workspaces/{workspace_gid}/typeahead', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/workspaces/{workspace_gid}/typeahead',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/workspaces/{workspace_gid}/typeahead', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
class TypeaheadApi(object):
'''NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
'''
def __init__(self, api_client=None):
pass
def typeahead_for_workspace(self, workspace_gid, resource_type, opts, **kwargs):
'''Get objects via typeahead # noqa: E501
Retrieves objects in the workspace based via an auto-completion/typeahead search algorithm. This feature is meant to provide results quickly, so do not rely on this API to provide extremely accurate search results. The result set is limited to a single page of results with a maximum size, so you won’t be able to fetch large numbers of results. The typeahead search API provides search for objects from a single workspace. This endpoint should be used to query for objects when creating an auto-completion/typeahead search feature. This API is meant to provide results quickly and should not be relied upon for accurate or exhaustive search results. The results sets are limited in size and cannot be paginated. Queries return a compact representation of each object which is typically the gid and name fields. Interested in a specific set of fields or all of the fields?! Of course you are. Use field selectors to manipulate what data is included in a response. Resources with type `user` are returned in order of most contacted to least contacted. This is determined by task assignments, adding the user to projects, and adding the user as a follower to tasks, messages, etc. Resources with type `project` are returned in order of recency. This is determined when the user visits the project, is added to the project, and completes tasks in the project. Resources with type `task` are returned with priority placed on tasks the user is following, but no guarantee on the order of those tasks. Resources with type `project_template` are returned with priority placed on favorited project templates. Leaving the `query` string empty or omitted will give you results, still following the resource ordering above. This could be used to list users or projects that are relevant for the requesting user's api token. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.typeahead_for_workspace(workspace_gid, resource_type, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param str resource_type: The type of values the typeahead should return. You can choose from one of the following: `custom_field`, `goal`, `project`, `project_template`, `portfolio`, `tag`, `task`, `team`, and `user`. Note that unlike in the names of endpoints, the types listed here are in singular form (e.g. `task`). Using multiple types is not yet supported. (required)
:param str type: *Deprecated: new integrations should prefer the resource_type field.*
:param str query: The string that will be used to search for relevant objects. If an empty string is passed in, the API will return results.
:param int count: The number of results to return. The default is 20 if this parameter is omitted, with a minimum of 1 and a maximum of 100. If there are fewer results found than requested, all will be returned.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: AsanaNamedResourceArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def typeahead_for_workspace_with_http_info(self, workspace_gid, resource_type, opts, **kwargs):
'''Get objects via typeahead # noqa: E501
Retrieves objects in the workspace based via an auto-completion/typeahead search algorithm. This feature is meant to provide results quickly, so do not rely on this API to provide extremely accurate search results. The result set is limited to a single page of results with a maximum size, so you won’t be able to fetch large numbers of results. The typeahead search API provides search for objects from a single workspace. This endpoint should be used to query for objects when creating an auto-completion/typeahead search feature. This API is meant to provide results quickly and should not be relied upon for accurate or exhaustive search results. The results sets are limited in size and cannot be paginated. Queries return a compact representation of each object which is typically the gid and name fields. Interested in a specific set of fields or all of the fields?! Of course you are. Use field selectors to manipulate what data is included in a response. Resources with type `user` are returned in order of most contacted to least contacted. This is determined by task assignments, adding the user to projects, and adding the user as a follower to tasks, messages, etc. Resources with type `project` are returned in order of recency. This is determined when the user visits the project, is added to the project, and completes tasks in the project. Resources with type `task` are returned with priority placed on tasks the user is following, but no guarantee on the order of those tasks. Resources with type `project_template` are returned with priority placed on favorited project templates. Leaving the `query` string empty or omitted will give you results, still following the resource ordering above. This could be used to list users or projects that are relevant for the requesting user's api token. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.typeahead_for_workspace_with_http_info(workspace_gid, resource_type, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param str resource_type: The type of values the typeahead should return. You can choose from one of the following: `custom_field`, `goal`, `project`, `project_template`, `portfolio`, `tag`, `task`, `team`, and `user`. Note that unlike in the names of endpoints, the types listed here are in singular form (e.g. `task`). Using multiple types is not yet supported. (required)
:param str type: *Deprecated: new integrations should prefer the resource_type field.*
:param str query: The string that will be used to search for relevant objects. If an empty string is passed in, the API will return results.
:param int count: The number of results to return. The default is 20 if this parameter is omitted, with a minimum of 1 and a maximum of 100. If there are fewer results found than requested, all will be returned.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: AsanaNamedResourceArray
If the method is called asynchronously,
returns the request thread.
'''
pass
| 4 | 3 | 52 | 5 | 34 | 17 | 4 | 0.52 | 1 | 4 | 2 | 0 | 3 | 1 | 3 | 3 | 165 | 19 | 103 | 17 | 99 | 54 | 47 | 17 | 43 | 7 | 1 | 2 | 11 |
7,467 |
Asana/python-asana
|
Asana_python-asana/asana/api/user_task_lists_api.py
|
asana.api.user_task_lists_api.UserTaskListsApi
|
class UserTaskListsApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def get_user_task_list(self, user_task_list_gid, opts, **kwargs): # noqa: E501
"""Get a user task list # noqa: E501
Returns the full record for a user task list. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_user_task_list(user_task_list_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_task_list_gid: Globally unique identifier for the user task list. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserTaskListResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_user_task_list_with_http_info(user_task_list_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_user_task_list_with_http_info(user_task_list_gid, opts, **kwargs) # noqa: E501
return data
def get_user_task_list_with_http_info(self, user_task_list_gid, opts, **kwargs): # noqa: E501
"""Get a user task list # noqa: E501
Returns the full record for a user task list. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_user_task_list_with_http_info(user_task_list_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_task_list_gid: Globally unique identifier for the user task list. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserTaskListResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_user_task_list" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'user_task_list_gid' is set
if (user_task_list_gid is None):
raise ValueError("Missing the required parameter `user_task_list_gid` when calling `get_user_task_list`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['user_task_list_gid'] = user_task_list_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/user_task_lists/{user_task_list_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/user_task_lists/{user_task_list_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/user_task_lists/{user_task_list_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_user_task_list_for_user(self, user_gid, workspace, opts, **kwargs): # noqa: E501
"""Get a user's task list # noqa: E501
Returns the full record for a user's task list. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_user_task_list_for_user(user_gid, workspace, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required)
:param str workspace: The workspace in which to get the user task list. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserTaskListResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_user_task_list_for_user_with_http_info(user_gid, workspace, opts, **kwargs) # noqa: E501
else:
(data) = self.get_user_task_list_for_user_with_http_info(user_gid, workspace, opts, **kwargs) # noqa: E501
return data
def get_user_task_list_for_user_with_http_info(self, user_gid, workspace, opts, **kwargs): # noqa: E501
"""Get a user's task list # noqa: E501
Returns the full record for a user's task list. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_user_task_list_for_user_with_http_info(user_gid, workspace, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required)
:param str workspace: The workspace in which to get the user task list. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserTaskListResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_user_task_list_for_user" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'user_gid' is set
if (user_gid is None):
raise ValueError("Missing the required parameter `user_gid` when calling `get_user_task_list_for_user`") # noqa: E501
# verify the required parameter 'workspace' is set
if (workspace is None):
raise ValueError("Missing the required parameter `workspace` when calling `get_user_task_list_for_user`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['user_gid'] = user_gid # noqa: E501
query_params = {}
query_params = opts
query_params['workspace'] = workspace
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/users/{user_gid}/user_task_list', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/users/{user_gid}/user_task_list', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/users/{user_gid}/user_task_list', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
class UserTaskListsApi(object):
'''NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
'''
def __init__(self, api_client=None):
pass
def get_user_task_list(self, user_task_list_gid, opts, **kwargs):
'''Get a user task list # noqa: E501
Returns the full record for a user task list. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_user_task_list(user_task_list_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_task_list_gid: Globally unique identifier for the user task list. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserTaskListResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_user_task_list_with_http_info(self, user_task_list_gid, opts, **kwargs):
'''Get a user task list # noqa: E501
Returns the full record for a user task list. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_user_task_list_with_http_info(user_task_list_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_task_list_gid: Globally unique identifier for the user task list. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserTaskListResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_user_task_list_for_user(self, user_gid, workspace, opts, **kwargs):
'''Get a user's task list # noqa: E501
Returns the full record for a user's task list. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_user_task_list_for_user(user_gid, workspace, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_gid: A string identifying a user. This can either be the string "me", an email, or the gid of a user. (required)
:param str workspace: The workspace in which to get the user task list. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserTaskListResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_user_task_list_for_user_with_http_info(self, user_gid, workspace, opts, **kwargs):
'''Get a user's task list # noqa: E501
Returns the full record for a user's task list. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_user_task_list_for_user_with_http_info(user_gid, workspace, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_gid: A string identifying a user. This can either be the string "me", an email, or the gid of a user. (required)
:param str workspace: The workspace in which to get the user task list. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserTaskListResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
| 6 | 5 | 57 | 6 | 38 | 17 | 5 | 0.47 | 1 | 3 | 1 | 0 | 5 | 1 | 5 | 5 | 295 | 36 | 192 | 33 | 186 | 90 | 90 | 33 | 84 | 9 | 1 | 2 | 23 |
7,468 |
Asana/python-asana
|
Asana_python-asana/asana/api/users_api.py
|
asana.api.users_api.UsersApi
|
class UsersApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def get_favorites_for_user(self, user_gid, resource_type, workspace, opts, **kwargs): # noqa: E501
"""Get a user's favorites # noqa: E501
Returns all of a user's favorites within a specified workspace and of a given type. The results are ordered exactly as they appear in the user's Asana sidebar in the web application. Note that this endpoint currently only returns favorites for the current user (i.e., the user associated with the authentication token). # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_favorites_for_user(user_gid, resource_type, workspace, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required)
:param str resource_type: The resource type of favorites to be returned. (required)
:param str workspace: The workspace in which to get favorites. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: AsanaNamedResourceArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_favorites_for_user_with_http_info(user_gid, resource_type, workspace, opts, **kwargs) # noqa: E501
else:
(data) = self.get_favorites_for_user_with_http_info(user_gid, resource_type, workspace, opts, **kwargs) # noqa: E501
return data
def get_favorites_for_user_with_http_info(self, user_gid, resource_type, workspace, opts, **kwargs): # noqa: E501
"""Get a user's favorites # noqa: E501
Returns all of a user's favorites within a specified workspace and of a given type. The results are ordered exactly as they appear in the user's Asana sidebar in the web application. Note that this endpoint currently only returns favorites for the current user (i.e., the user associated with the authentication token). # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_favorites_for_user_with_http_info(user_gid, resource_type, workspace, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required)
:param str resource_type: The resource type of favorites to be returned. (required)
:param str workspace: The workspace in which to get favorites. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: AsanaNamedResourceArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_favorites_for_user" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'user_gid' is set
if (user_gid is None):
raise ValueError("Missing the required parameter `user_gid` when calling `get_favorites_for_user`") # noqa: E501
# verify the required parameter 'resource_type' is set
if (resource_type is None):
raise ValueError("Missing the required parameter `resource_type` when calling `get_favorites_for_user`") # noqa: E501
# verify the required parameter 'workspace' is set
if (workspace is None):
raise ValueError("Missing the required parameter `workspace` when calling `get_favorites_for_user`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['user_gid'] = user_gid # noqa: E501
query_params = {}
query_params = opts
query_params['resource_type'] = resource_type
query_params['workspace'] = workspace
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/users/{user_gid}/favorites', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/users/{user_gid}/favorites',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/users/{user_gid}/favorites', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_user(self, user_gid, opts, **kwargs): # noqa: E501
"""Get a user # noqa: E501
Returns the full user record for the single user with the provided ID. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_user(user_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_user_with_http_info(user_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_user_with_http_info(user_gid, opts, **kwargs) # noqa: E501
return data
def get_user_with_http_info(self, user_gid, opts, **kwargs): # noqa: E501
"""Get a user # noqa: E501
Returns the full user record for the single user with the provided ID. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_user_with_http_info(user_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_user" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'user_gid' is set
if (user_gid is None):
raise ValueError("Missing the required parameter `user_gid` when calling `get_user`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['user_gid'] = user_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/users/{user_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/users/{user_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/users/{user_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_users(self, opts, **kwargs): # noqa: E501
"""Get multiple users # noqa: E501
Returns the user records for all users in all workspaces and organizations accessible to the authenticated user. Accepts an optional workspace ID parameter. Results are sorted by user ID. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_users(async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace: The workspace or organization ID to filter users on.
:param str team: The team ID to filter users on.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_users_with_http_info(opts, **kwargs) # noqa: E501
else:
(data) = self.get_users_with_http_info(opts, **kwargs) # noqa: E501
return data
def get_users_with_http_info(self, opts, **kwargs): # noqa: E501
"""Get multiple users # noqa: E501
Returns the user records for all users in all workspaces and organizations accessible to the authenticated user. Accepts an optional workspace ID parameter. Results are sorted by user ID. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_users_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace: The workspace or organization ID to filter users on.
:param str team: The team ID to filter users on.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_users" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/users', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/users',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/users', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_users_for_team(self, team_gid, opts, **kwargs): # noqa: E501
"""Get users in a team # noqa: E501
Returns the compact records for all users that are members of the team. Results are sorted alphabetically and limited to 2000. For more results use the `/users` endpoint. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_users_for_team(team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str team_gid: Globally unique identifier for the team. (required)
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_users_for_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_users_for_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501
return data
def get_users_for_team_with_http_info(self, team_gid, opts, **kwargs): # noqa: E501
"""Get users in a team # noqa: E501
Returns the compact records for all users that are members of the team. Results are sorted alphabetically and limited to 2000. For more results use the `/users` endpoint. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_users_for_team_with_http_info(team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str team_gid: Globally unique identifier for the team. (required)
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_users_for_team" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'team_gid' is set
if (team_gid is None):
raise ValueError("Missing the required parameter `team_gid` when calling `get_users_for_team`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['team_gid'] = team_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/teams/{team_gid}/users', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/teams/{team_gid}/users',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/teams/{team_gid}/users', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_users_for_workspace(self, workspace_gid, opts, **kwargs): # noqa: E501
"""Get users in a workspace or organization # noqa: E501
Returns the compact records for all users in the specified workspace or organization. Results are sorted alphabetically and limited to 2000. For more results use the `/users` endpoint. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_users_for_workspace(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_users_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_users_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501
return data
def get_users_for_workspace_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501
"""Get users in a workspace or organization # noqa: E501
Returns the compact records for all users in the specified workspace or organization. Results are sorted alphabetically and limited to 2000. For more results use the `/users` endpoint. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_users_for_workspace_with_http_info(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_users_for_workspace" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workspace_gid' is set
if (workspace_gid is None):
raise ValueError("Missing the required parameter `workspace_gid` when calling `get_users_for_workspace`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['workspace_gid'] = workspace_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/workspaces/{workspace_gid}/users', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/workspaces/{workspace_gid}/users',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/workspaces/{workspace_gid}/users', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
class UsersApi(object):
'''NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
'''
def __init__(self, api_client=None):
pass
def get_favorites_for_user(self, user_gid, resource_type, workspace, opts, **kwargs):
'''Get a user's favorites # noqa: E501
Returns all of a user's favorites within a specified workspace and of a given type. The results are ordered exactly as they appear in the user's Asana sidebar in the web application. Note that this endpoint currently only returns favorites for the current user (i.e., the user associated with the authentication token). # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_favorites_for_user(user_gid, resource_type, workspace, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_gid: A string identifying a user. This can either be the string "me", an email, or the gid of a user. (required)
:param str resource_type: The resource type of favorites to be returned. (required)
:param str workspace: The workspace in which to get favorites. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: AsanaNamedResourceArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_favorites_for_user_with_http_info(self, user_gid, resource_type, workspace, opts, **kwargs):
'''Get a user's favorites # noqa: E501
Returns all of a user's favorites within a specified workspace and of a given type. The results are ordered exactly as they appear in the user's Asana sidebar in the web application. Note that this endpoint currently only returns favorites for the current user (i.e., the user associated with the authentication token). # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_favorites_for_user_with_http_info(user_gid, resource_type, workspace, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_gid: A string identifying a user. This can either be the string "me", an email, or the gid of a user. (required)
:param str resource_type: The resource type of favorites to be returned. (required)
:param str workspace: The workspace in which to get favorites. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: AsanaNamedResourceArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_user(self, user_gid, opts, **kwargs):
'''Get a user # noqa: E501
Returns the full user record for the single user with the provided ID. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_user(user_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_gid: A string identifying a user. This can either be the string "me", an email, or the gid of a user. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_user_with_http_info(self, user_gid, opts, **kwargs):
'''Get a user # noqa: E501
Returns the full user record for the single user with the provided ID. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_user_with_http_info(user_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_gid: A string identifying a user. This can either be the string "me", an email, or the gid of a user. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_users(self, opts, **kwargs):
'''Get multiple users # noqa: E501
Returns the user records for all users in all workspaces and organizations accessible to the authenticated user. Accepts an optional workspace ID parameter. Results are sorted by user ID. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_users(async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace: The workspace or organization ID to filter users on.
:param str team: The team ID to filter users on.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_users_with_http_info(self, opts, **kwargs):
'''Get multiple users # noqa: E501
Returns the user records for all users in all workspaces and organizations accessible to the authenticated user. Accepts an optional workspace ID parameter. Results are sorted by user ID. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_users_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace: The workspace or organization ID to filter users on.
:param str team: The team ID to filter users on.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_users_for_team(self, team_gid, opts, **kwargs):
'''Get users in a team # noqa: E501
Returns the compact records for all users that are members of the team. Results are sorted alphabetically and limited to 2000. For more results use the `/users` endpoint. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_users_for_team(team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str team_gid: Globally unique identifier for the team. (required)
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_users_for_team_with_http_info(self, team_gid, opts, **kwargs):
'''Get users in a team # noqa: E501
Returns the compact records for all users that are members of the team. Results are sorted alphabetically and limited to 2000. For more results use the `/users` endpoint. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_users_for_team_with_http_info(team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str team_gid: Globally unique identifier for the team. (required)
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_users_for_workspace(self, workspace_gid, opts, **kwargs):
'''Get users in a workspace or organization # noqa: E501
Returns the compact records for all users in the specified workspace or organization. Results are sorted alphabetically and limited to 2000. For more results use the `/users` endpoint. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_users_for_workspace(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_users_for_workspace_with_http_info(self, workspace_gid, opts, **kwargs):
'''Get users in a workspace or organization # noqa: E501
Returns the compact records for all users in the specified workspace or organization. Results are sorted alphabetically and limited to 2000. For more results use the `/users` endpoint. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_users_for_workspace_with_http_info(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
| 12 | 11 | 66 | 7 | 44 | 20 | 4 | 0.47 | 1 | 4 | 2 | 0 | 11 | 1 | 11 | 11 | 740 | 87 | 480 | 74 | 468 | 224 | 205 | 74 | 193 | 8 | 1 | 2 | 45 |
7,469 |
Asana/python-asana
|
Asana_python-asana/asana/api/webhooks_api.py
|
asana.api.webhooks_api.WebhooksApi
|
class WebhooksApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def create_webhook(self, body, opts, **kwargs): # noqa: E501
"""Establish a webhook # noqa: E501
Establishing a webhook is a two-part process. First, a simple HTTP POST request initiates the creation similar to creating any other resource. Next, in the middle of this request comes the confirmation handshake. When a webhook is created, we will send a test POST to the target with an `X-Hook-Secret` header. The target must respond with a `200 OK` or `204 No Content` and a matching `X-Hook-Secret` header to confirm that this webhook subscription is indeed expected. We strongly recommend storing this secret to be used to verify future webhook event signatures. The POST request to create the webhook will then return with the status of the request. If you do not acknowledge the webhook’s confirmation handshake it will fail to setup, and you will receive an error in response to your attempt to create it. This means you need to be able to receive and complete the webhook *while* the POST request is in-flight (in other words, have a server that can handle requests asynchronously). Invalid hostnames like localhost will receive a 403 Forbidden status code. ``` # Request curl -H \"Authorization: Bearer <personal_access_token>\" \\ -X POST https://app.asana.com/api/1.0/webhooks \\ -d \"resource=8675309\" \\ -d \"target=https://example.com/receive-webhook/7654\" ``` ``` # Handshake sent to https://example.com/ POST /receive-webhook/7654 X-Hook-Secret: b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81 ``` ``` # Handshake response sent by example.com HTTP/1.1 200 X-Hook-Secret: b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81 ``` ``` # Response HTTP/1.1 201 { \"data\": { \"gid\": \"43214\", \"resource\": { \"gid\": \"8675309\", \"name\": \"Bugs\" }, \"target\": \"https://example.com/receive-webhook/7654\", \"active\": false, \"last_success_at\": null, \"last_failure_at\": null, \"last_failure_content\": null }, \"X-Hook-Secret\": \"b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81\" } ``` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_webhook(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The webhook workspace and target. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WebhookResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.create_webhook_with_http_info(body, opts, **kwargs) # noqa: E501
else:
(data) = self.create_webhook_with_http_info(body, opts, **kwargs) # noqa: E501
return data
def create_webhook_with_http_info(self, body, opts, **kwargs): # noqa: E501
"""Establish a webhook # noqa: E501
Establishing a webhook is a two-part process. First, a simple HTTP POST request initiates the creation similar to creating any other resource. Next, in the middle of this request comes the confirmation handshake. When a webhook is created, we will send a test POST to the target with an `X-Hook-Secret` header. The target must respond with a `200 OK` or `204 No Content` and a matching `X-Hook-Secret` header to confirm that this webhook subscription is indeed expected. We strongly recommend storing this secret to be used to verify future webhook event signatures. The POST request to create the webhook will then return with the status of the request. If you do not acknowledge the webhook’s confirmation handshake it will fail to setup, and you will receive an error in response to your attempt to create it. This means you need to be able to receive and complete the webhook *while* the POST request is in-flight (in other words, have a server that can handle requests asynchronously). Invalid hostnames like localhost will receive a 403 Forbidden status code. ``` # Request curl -H \"Authorization: Bearer <personal_access_token>\" \\ -X POST https://app.asana.com/api/1.0/webhooks \\ -d \"resource=8675309\" \\ -d \"target=https://example.com/receive-webhook/7654\" ``` ``` # Handshake sent to https://example.com/ POST /receive-webhook/7654 X-Hook-Secret: b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81 ``` ``` # Handshake response sent by example.com HTTP/1.1 200 X-Hook-Secret: b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81 ``` ``` # Response HTTP/1.1 201 { \"data\": { \"gid\": \"43214\", \"resource\": { \"gid\": \"8675309\", \"name\": \"Bugs\" }, \"target\": \"https://example.com/receive-webhook/7654\", \"active\": false, \"last_success_at\": null, \"last_failure_at\": null, \"last_failure_content\": null }, \"X-Hook-Secret\": \"b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81\" } ``` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_webhook_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The webhook workspace and target. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WebhookResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create_webhook" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `create_webhook`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/webhooks', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/webhooks', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/webhooks', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def delete_webhook(self, webhook_gid, **kwargs): # noqa: E501
"""Delete a webhook # noqa: E501
This method *permanently* removes a webhook. Note that it may be possible to receive a request that was already in flight after deleting the webhook, but no further requests will be issued. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_webhook(webhook_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str webhook_gid: Globally unique identifier for the webhook. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.delete_webhook_with_http_info(webhook_gid, **kwargs) # noqa: E501
else:
(data) = self.delete_webhook_with_http_info(webhook_gid, **kwargs) # noqa: E501
return data
def delete_webhook_with_http_info(self, webhook_gid, **kwargs): # noqa: E501
"""Delete a webhook # noqa: E501
This method *permanently* removes a webhook. Note that it may be possible to receive a request that was already in flight after deleting the webhook, but no further requests will be issued. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_webhook_with_http_info(webhook_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str webhook_gid: Globally unique identifier for the webhook. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_webhook" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'webhook_gid' is set
if (webhook_gid is None):
raise ValueError("Missing the required parameter `webhook_gid` when calling `delete_webhook`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['webhook_gid'] = webhook_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/webhooks/{webhook_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/webhooks/{webhook_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/webhooks/{webhook_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_webhook(self, webhook_gid, opts, **kwargs): # noqa: E501
"""Get a webhook # noqa: E501
Returns the full record for the given webhook. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_webhook(webhook_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str webhook_gid: Globally unique identifier for the webhook. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WebhookResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_webhook_with_http_info(webhook_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_webhook_with_http_info(webhook_gid, opts, **kwargs) # noqa: E501
return data
def get_webhook_with_http_info(self, webhook_gid, opts, **kwargs): # noqa: E501
"""Get a webhook # noqa: E501
Returns the full record for the given webhook. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_webhook_with_http_info(webhook_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str webhook_gid: Globally unique identifier for the webhook. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WebhookResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_webhook" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'webhook_gid' is set
if (webhook_gid is None):
raise ValueError("Missing the required parameter `webhook_gid` when calling `get_webhook`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['webhook_gid'] = webhook_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/webhooks/{webhook_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/webhooks/{webhook_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/webhooks/{webhook_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_webhooks(self, workspace, opts, **kwargs): # noqa: E501
"""Get multiple webhooks # noqa: E501
Get the compact representation of all webhooks your app has registered for the authenticated user in the given workspace. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_webhooks(workspace, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace: The workspace to query for webhooks in. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param str resource: Only return webhooks for the given resource.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WebhookResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_webhooks_with_http_info(workspace, opts, **kwargs) # noqa: E501
else:
(data) = self.get_webhooks_with_http_info(workspace, opts, **kwargs) # noqa: E501
return data
def get_webhooks_with_http_info(self, workspace, opts, **kwargs): # noqa: E501
"""Get multiple webhooks # noqa: E501
Get the compact representation of all webhooks your app has registered for the authenticated user in the given workspace. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_webhooks_with_http_info(workspace, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace: The workspace to query for webhooks in. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param str resource: Only return webhooks for the given resource.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WebhookResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_webhooks" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workspace' is set
if (workspace is None):
raise ValueError("Missing the required parameter `workspace` when calling `get_webhooks`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = {}
query_params = opts
query_params['workspace'] = workspace
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/webhooks', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/webhooks',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/webhooks', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def update_webhook(self, body, webhook_gid, opts, **kwargs): # noqa: E501
"""Update a webhook # noqa: E501
An existing webhook's filters can be updated by making a PUT request on the URL for that webhook. Note that the webhook's previous `filters` array will be completely overwritten by the `filters` sent in the PUT request. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_webhook(body, webhook_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The updated filters for the webhook. (required)
:param str webhook_gid: Globally unique identifier for the webhook. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WebhookResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.update_webhook_with_http_info(body, webhook_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.update_webhook_with_http_info(body, webhook_gid, opts, **kwargs) # noqa: E501
return data
def update_webhook_with_http_info(self, body, webhook_gid, opts, **kwargs): # noqa: E501
"""Update a webhook # noqa: E501
An existing webhook's filters can be updated by making a PUT request on the URL for that webhook. Note that the webhook's previous `filters` array will be completely overwritten by the `filters` sent in the PUT request. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_webhook_with_http_info(body, webhook_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The updated filters for the webhook. (required)
:param str webhook_gid: Globally unique identifier for the webhook. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WebhookResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method update_webhook" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `update_webhook`") # noqa: E501
# verify the required parameter 'webhook_gid' is set
if (webhook_gid is None):
raise ValueError("Missing the required parameter `webhook_gid` when calling `update_webhook`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['webhook_gid'] = webhook_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/webhooks/{webhook_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/webhooks/{webhook_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/webhooks/{webhook_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
class WebhooksApi(object):
'''NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
'''
def __init__(self, api_client=None):
pass
def create_webhook(self, body, opts, **kwargs):
'''Establish a webhook # noqa: E501
Establishing a webhook is a two-part process. First, a simple HTTP POST request initiates the creation similar to creating any other resource. Next, in the middle of this request comes the confirmation handshake. When a webhook is created, we will send a test POST to the target with an `X-Hook-Secret` header. The target must respond with a `200 OK` or `204 No Content` and a matching `X-Hook-Secret` header to confirm that this webhook subscription is indeed expected. We strongly recommend storing this secret to be used to verify future webhook event signatures. The POST request to create the webhook will then return with the status of the request. If you do not acknowledge the webhook’s confirmation handshake it will fail to setup, and you will receive an error in response to your attempt to create it. This means you need to be able to receive and complete the webhook *while* the POST request is in-flight (in other words, have a server that can handle requests asynchronously). Invalid hostnames like localhost will receive a 403 Forbidden status code. ``` # Request curl -H "Authorization: Bearer <personal_access_token>" \ -X POST https://app.asana.com/api/1.0/webhooks \ -d "resource=8675309" \ -d "target=https://example.com/receive-webhook/7654" ``` ``` # Handshake sent to https://example.com/ POST /receive-webhook/7654 X-Hook-Secret: b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81 ``` ``` # Handshake response sent by example.com HTTP/1.1 200 X-Hook-Secret: b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81 ``` ``` # Response HTTP/1.1 201 { "data": { "gid": "43214", "resource": { "gid": "8675309", "name": "Bugs" }, "target": "https://example.com/receive-webhook/7654", "active": false, "last_success_at": null, "last_failure_at": null, "last_failure_content": null }, "X-Hook-Secret": "b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81" } ``` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_webhook(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The webhook workspace and target. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WebhookResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def create_webhook_with_http_info(self, body, opts, **kwargs):
'''Establish a webhook # noqa: E501
Establishing a webhook is a two-part process. First, a simple HTTP POST request initiates the creation similar to creating any other resource. Next, in the middle of this request comes the confirmation handshake. When a webhook is created, we will send a test POST to the target with an `X-Hook-Secret` header. The target must respond with a `200 OK` or `204 No Content` and a matching `X-Hook-Secret` header to confirm that this webhook subscription is indeed expected. We strongly recommend storing this secret to be used to verify future webhook event signatures. The POST request to create the webhook will then return with the status of the request. If you do not acknowledge the webhook’s confirmation handshake it will fail to setup, and you will receive an error in response to your attempt to create it. This means you need to be able to receive and complete the webhook *while* the POST request is in-flight (in other words, have a server that can handle requests asynchronously). Invalid hostnames like localhost will receive a 403 Forbidden status code. ``` # Request curl -H "Authorization: Bearer <personal_access_token>" \ -X POST https://app.asana.com/api/1.0/webhooks \ -d "resource=8675309" \ -d "target=https://example.com/receive-webhook/7654" ``` ``` # Handshake sent to https://example.com/ POST /receive-webhook/7654 X-Hook-Secret: b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81 ``` ``` # Handshake response sent by example.com HTTP/1.1 200 X-Hook-Secret: b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81 ``` ``` # Response HTTP/1.1 201 { "data": { "gid": "43214", "resource": { "gid": "8675309", "name": "Bugs" }, "target": "https://example.com/receive-webhook/7654", "active": false, "last_success_at": null, "last_failure_at": null, "last_failure_content": null }, "X-Hook-Secret": "b537207f20cbfa02357cf448134da559e8bd39d61597dcd5631b8012eae53e81" } ``` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_webhook_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The webhook workspace and target. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WebhookResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def delete_webhook(self, webhook_gid, **kwargs):
'''Delete a webhook # noqa: E501
This method *permanently* removes a webhook. Note that it may be possible to receive a request that was already in flight after deleting the webhook, but no further requests will be issued. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_webhook(webhook_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str webhook_gid: Globally unique identifier for the webhook. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def delete_webhook_with_http_info(self, webhook_gid, **kwargs):
'''Delete a webhook # noqa: E501
This method *permanently* removes a webhook. Note that it may be possible to receive a request that was already in flight after deleting the webhook, but no further requests will be issued. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_webhook_with_http_info(webhook_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str webhook_gid: Globally unique identifier for the webhook. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_webhook(self, webhook_gid, opts, **kwargs):
'''Get a webhook # noqa: E501
Returns the full record for the given webhook. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_webhook(webhook_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str webhook_gid: Globally unique identifier for the webhook. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WebhookResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_webhook_with_http_info(self, webhook_gid, opts, **kwargs):
'''Get a webhook # noqa: E501
Returns the full record for the given webhook. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_webhook_with_http_info(webhook_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str webhook_gid: Globally unique identifier for the webhook. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WebhookResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_webhooks(self, workspace, opts, **kwargs):
'''Get multiple webhooks # noqa: E501
Get the compact representation of all webhooks your app has registered for the authenticated user in the given workspace. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_webhooks(workspace, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace: The workspace to query for webhooks in. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param str resource: Only return webhooks for the given resource.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WebhookResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_webhooks_with_http_info(self, workspace, opts, **kwargs):
'''Get multiple webhooks # noqa: E501
Get the compact representation of all webhooks your app has registered for the authenticated user in the given workspace. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_webhooks_with_http_info(workspace, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace: The workspace to query for webhooks in. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param str resource: Only return webhooks for the given resource.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WebhookResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def update_webhook(self, body, webhook_gid, opts, **kwargs):
'''Update a webhook # noqa: E501
An existing webhook's filters can be updated by making a PUT request on the URL for that webhook. Note that the webhook's previous `filters` array will be completely overwritten by the `filters` sent in the PUT request. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_webhook(body, webhook_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The updated filters for the webhook. (required)
:param str webhook_gid: Globally unique identifier for the webhook. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WebhookResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def update_webhook_with_http_info(self, body, webhook_gid, opts, **kwargs):
'''Update a webhook # noqa: E501
An existing webhook's filters can be updated by making a PUT request on the URL for that webhook. Note that the webhook's previous `filters` array will be completely overwritten by the `filters` sent in the PUT request. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_webhook_with_http_info(body, webhook_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The updated filters for the webhook. (required)
:param str webhook_gid: Globally unique identifier for the webhook. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WebhookResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
| 12 | 11 | 64 | 7 | 43 | 20 | 5 | 0.47 | 1 | 4 | 2 | 0 | 11 | 1 | 11 | 11 | 724 | 89 | 472 | 77 | 460 | 220 | 210 | 77 | 198 | 9 | 1 | 2 | 51 |
7,470 |
Asana/python-asana
|
Asana_python-asana/asana/api/workspace_memberships_api.py
|
asana.api.workspace_memberships_api.WorkspaceMembershipsApi
|
class WorkspaceMembershipsApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def get_workspace_membership(self, workspace_membership_gid, opts, **kwargs): # noqa: E501
"""Get a workspace membership # noqa: E501
Returns the complete workspace record for a single workspace membership. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workspace_membership(workspace_membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_membership_gid: (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WorkspaceMembershipResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_workspace_membership_with_http_info(workspace_membership_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_workspace_membership_with_http_info(workspace_membership_gid, opts, **kwargs) # noqa: E501
return data
def get_workspace_membership_with_http_info(self, workspace_membership_gid, opts, **kwargs): # noqa: E501
"""Get a workspace membership # noqa: E501
Returns the complete workspace record for a single workspace membership. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workspace_membership_with_http_info(workspace_membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_membership_gid: (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WorkspaceMembershipResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_workspace_membership" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workspace_membership_gid' is set
if (workspace_membership_gid is None):
raise ValueError("Missing the required parameter `workspace_membership_gid` when calling `get_workspace_membership`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['workspace_membership_gid'] = workspace_membership_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/workspace_memberships/{workspace_membership_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/workspace_memberships/{workspace_membership_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/workspace_memberships/{workspace_membership_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_workspace_memberships_for_user(self, user_gid, opts, **kwargs): # noqa: E501
"""Get workspace memberships for a user # noqa: E501
Returns the compact workspace membership records for the user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workspace_memberships_for_user(user_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WorkspaceMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_workspace_memberships_for_user_with_http_info(user_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_workspace_memberships_for_user_with_http_info(user_gid, opts, **kwargs) # noqa: E501
return data
def get_workspace_memberships_for_user_with_http_info(self, user_gid, opts, **kwargs): # noqa: E501
"""Get workspace memberships for a user # noqa: E501
Returns the compact workspace membership records for the user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workspace_memberships_for_user_with_http_info(user_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WorkspaceMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_workspace_memberships_for_user" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'user_gid' is set
if (user_gid is None):
raise ValueError("Missing the required parameter `user_gid` when calling `get_workspace_memberships_for_user`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['user_gid'] = user_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/users/{user_gid}/workspace_memberships', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/users/{user_gid}/workspace_memberships',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/users/{user_gid}/workspace_memberships', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_workspace_memberships_for_workspace(self, workspace_gid, opts, **kwargs): # noqa: E501
"""Get the workspace memberships for a workspace # noqa: E501
Returns the compact workspace membership records for the workspace. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workspace_memberships_for_workspace(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WorkspaceMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_workspace_memberships_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_workspace_memberships_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501
return data
def get_workspace_memberships_for_workspace_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501
"""Get the workspace memberships for a workspace # noqa: E501
Returns the compact workspace membership records for the workspace. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workspace_memberships_for_workspace_with_http_info(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WorkspaceMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_workspace_memberships_for_workspace" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workspace_gid' is set
if (workspace_gid is None):
raise ValueError("Missing the required parameter `workspace_gid` when calling `get_workspace_memberships_for_workspace`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['workspace_gid'] = workspace_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/workspaces/{workspace_gid}/workspace_memberships', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/workspaces/{workspace_gid}/workspace_memberships',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/workspaces/{workspace_gid}/workspace_memberships', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
class WorkspaceMembershipsApi(object):
'''NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
'''
def __init__(self, api_client=None):
pass
def get_workspace_membership(self, workspace_membership_gid, opts, **kwargs):
'''Get a workspace membership # noqa: E501
Returns the complete workspace record for a single workspace membership. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workspace_membership(workspace_membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_membership_gid: (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WorkspaceMembershipResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_workspace_membership_with_http_info(self, workspace_membership_gid, opts, **kwargs):
'''Get a workspace membership # noqa: E501
Returns the complete workspace record for a single workspace membership. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workspace_membership_with_http_info(workspace_membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_membership_gid: (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WorkspaceMembershipResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_workspace_memberships_for_user(self, user_gid, opts, **kwargs):
'''Get workspace memberships for a user # noqa: E501
Returns the compact workspace membership records for the user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workspace_memberships_for_user(user_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_gid: A string identifying a user. This can either be the string "me", an email, or the gid of a user. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WorkspaceMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_workspace_memberships_for_user_with_http_info(self, user_gid, opts, **kwargs):
'''Get workspace memberships for a user # noqa: E501
Returns the compact workspace membership records for the user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workspace_memberships_for_user_with_http_info(user_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_gid: A string identifying a user. This can either be the string "me", an email, or the gid of a user. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WorkspaceMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_workspace_memberships_for_workspace(self, workspace_gid, opts, **kwargs):
'''Get the workspace memberships for a workspace # noqa: E501
Returns the compact workspace membership records for the workspace. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workspace_memberships_for_workspace(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param str user: A string identifying a user. This can either be the string "me", an email, or the gid of a user.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WorkspaceMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_workspace_memberships_for_workspace_with_http_info(self, workspace_gid, opts, **kwargs):
'''Get the workspace memberships for a workspace # noqa: E501
Returns the compact workspace membership records for the workspace. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workspace_memberships_for_workspace_with_http_info(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param str user: A string identifying a user. This can either be the string "me", an email, or the gid of a user.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WorkspaceMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
| 8 | 7 | 62 | 6 | 41 | 19 | 4 | 0.47 | 1 | 4 | 2 | 0 | 7 | 1 | 7 | 7 | 444 | 53 | 287 | 46 | 279 | 135 | 124 | 46 | 116 | 8 | 1 | 2 | 28 |
7,471 |
Asana/python-asana
|
Asana_python-asana/asana/api/workspaces_api.py
|
asana.api.workspaces_api.WorkspacesApi
|
class WorkspacesApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def add_user_for_workspace(self, body, workspace_gid, opts, **kwargs): # noqa: E501
"""Add a user to a workspace or organization # noqa: E501
Add a user to a workspace or organization. The user can be referenced by their globally unique user ID or their email address. Returns the full user record for the invited user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_user_for_workspace(body, workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The user to add to the workspace. (required)
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserBaseResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.add_user_for_workspace_with_http_info(body, workspace_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.add_user_for_workspace_with_http_info(body, workspace_gid, opts, **kwargs) # noqa: E501
return data
def add_user_for_workspace_with_http_info(self, body, workspace_gid, opts, **kwargs): # noqa: E501
"""Add a user to a workspace or organization # noqa: E501
Add a user to a workspace or organization. The user can be referenced by their globally unique user ID or their email address. Returns the full user record for the invited user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_user_for_workspace_with_http_info(body, workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The user to add to the workspace. (required)
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserBaseResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method add_user_for_workspace" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `add_user_for_workspace`") # noqa: E501
# verify the required parameter 'workspace_gid' is set
if (workspace_gid is None):
raise ValueError("Missing the required parameter `workspace_gid` when calling `add_user_for_workspace`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['workspace_gid'] = workspace_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/workspaces/{workspace_gid}/addUser', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/workspaces/{workspace_gid}/addUser', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/workspaces/{workspace_gid}/addUser', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_workspace(self, workspace_gid, opts, **kwargs): # noqa: E501
"""Get a workspace # noqa: E501
Returns the full workspace record for a single workspace. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workspace(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WorkspaceResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501
return data
def get_workspace_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501
"""Get a workspace # noqa: E501
Returns the full workspace record for a single workspace. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workspace_with_http_info(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WorkspaceResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_workspace" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workspace_gid' is set
if (workspace_gid is None):
raise ValueError("Missing the required parameter `workspace_gid` when calling `get_workspace`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['workspace_gid'] = workspace_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/workspaces/{workspace_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/workspaces/{workspace_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/workspaces/{workspace_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_workspace_events(self, workspace_gid, opts, **kwargs): # noqa: E501
"""Get workspace events # noqa: E501
Returns the full record for all events that have occurred since the sync token was created. The response is a list of events and the schema of each event is as described [here](/reference/events). Asana limits a single sync token to 1000 events. If more than 1000 events exist for a given domain, `has_more: true` will be returned in the response, indicating that there are more events to pull. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workspace_events(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param str sync: A sync token received from the last request, or none on first sync. Events will be returned from the point in time that the sync token was generated. *Note: On your first request, omit the sync token. The response will be the same as for an expired sync token, and will include a new valid sync token. If the sync token is too old (which may happen from time to time) the API will return a `412 Precondition Failed` error, and include a fresh sync token in the response.*
:return: EventResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_workspace_events_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_workspace_events_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501
return data
def get_workspace_events_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501
"""Get workspace events # noqa: E501
Returns the full record for all events that have occurred since the sync token was created. The response is a list of events and the schema of each event is as described [here](/reference/events). Asana limits a single sync token to 1000 events. If more than 1000 events exist for a given domain, `has_more: true` will be returned in the response, indicating that there are more events to pull. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workspace_events_with_http_info(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param str sync: A sync token received from the last request, or none on first sync. Events will be returned from the point in time that the sync token was generated. *Note: On your first request, omit the sync token. The response will be the same as for an expired sync token, and will include a new valid sync token. If the sync token is too old (which may happen from time to time) the API will return a `412 Precondition Failed` error, and include a fresh sync token in the response.*
:return: EventResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_workspace_events" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workspace_gid' is set
if (workspace_gid is None):
raise ValueError("Missing the required parameter `workspace_gid` when calling `get_workspace_events`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['workspace_gid'] = workspace_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/workspaces/{workspace_gid}/events', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/workspaces/{workspace_gid}/events',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/workspaces/{workspace_gid}/events', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_workspaces(self, opts, **kwargs): # noqa: E501
"""Get multiple workspaces # noqa: E501
Returns the compact records for all workspaces visible to the authorized user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workspaces(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WorkspaceResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_workspaces_with_http_info(opts, **kwargs) # noqa: E501
else:
(data) = self.get_workspaces_with_http_info(opts, **kwargs) # noqa: E501
return data
def get_workspaces_with_http_info(self, opts, **kwargs): # noqa: E501
"""Get multiple workspaces # noqa: E501
Returns the compact records for all workspaces visible to the authorized user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workspaces_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WorkspaceResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_workspaces" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/workspaces', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/workspaces',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/workspaces', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def remove_user_for_workspace(self, body, workspace_gid, **kwargs): # noqa: E501
"""Remove a user from a workspace or organization # noqa: E501
Remove a user from a workspace or organization. The user making this call must be an admin in the workspace. The user can be referenced by their globally unique user ID or their email address. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_user_for_workspace(body, workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The user to remove from the workspace. (required)
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.remove_user_for_workspace_with_http_info(body, workspace_gid, **kwargs) # noqa: E501
else:
(data) = self.remove_user_for_workspace_with_http_info(body, workspace_gid, **kwargs) # noqa: E501
return data
def remove_user_for_workspace_with_http_info(self, body, workspace_gid, **kwargs): # noqa: E501
"""Remove a user from a workspace or organization # noqa: E501
Remove a user from a workspace or organization. The user making this call must be an admin in the workspace. The user can be referenced by their globally unique user ID or their email address. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_user_for_workspace_with_http_info(body, workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The user to remove from the workspace. (required)
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method remove_user_for_workspace" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `remove_user_for_workspace`") # noqa: E501
# verify the required parameter 'workspace_gid' is set
if (workspace_gid is None):
raise ValueError("Missing the required parameter `workspace_gid` when calling `remove_user_for_workspace`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['workspace_gid'] = workspace_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/workspaces/{workspace_gid}/removeUser', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/workspaces/{workspace_gid}/removeUser', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/workspaces/{workspace_gid}/removeUser', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def update_workspace(self, body, workspace_gid, opts, **kwargs): # noqa: E501
"""Update a workspace # noqa: E501
A specific, existing workspace can be updated by making a PUT request on the URL for that workspace. Only the fields provided in the data block will be updated; any unspecified fields will remain unchanged. Currently the only field that can be modified for a workspace is its name. Returns the complete, updated workspace record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_workspace(body, workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The workspace object with all updated properties. (required)
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WorkspaceResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.update_workspace_with_http_info(body, workspace_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.update_workspace_with_http_info(body, workspace_gid, opts, **kwargs) # noqa: E501
return data
def update_workspace_with_http_info(self, body, workspace_gid, opts, **kwargs): # noqa: E501
"""Update a workspace # noqa: E501
A specific, existing workspace can be updated by making a PUT request on the URL for that workspace. Only the fields provided in the data block will be updated; any unspecified fields will remain unchanged. Currently the only field that can be modified for a workspace is its name. Returns the complete, updated workspace record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_workspace_with_http_info(body, workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The workspace object with all updated properties. (required)
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WorkspaceResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method update_workspace" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `update_workspace`") # noqa: E501
# verify the required parameter 'workspace_gid' is set
if (workspace_gid is None):
raise ValueError("Missing the required parameter `workspace_gid` when calling `update_workspace`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['workspace_gid'] = workspace_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/workspaces/{workspace_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/workspaces/{workspace_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/workspaces/{workspace_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
class WorkspacesApi(object):
'''NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
'''
def __init__(self, api_client=None):
pass
def add_user_for_workspace(self, body, workspace_gid, opts, **kwargs):
'''Add a user to a workspace or organization # noqa: E501
Add a user to a workspace or organization. The user can be referenced by their globally unique user ID or their email address. Returns the full user record for the invited user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_user_for_workspace(body, workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The user to add to the workspace. (required)
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserBaseResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def add_user_for_workspace_with_http_info(self, body, workspace_gid, opts, **kwargs):
'''Add a user to a workspace or organization # noqa: E501
Add a user to a workspace or organization. The user can be referenced by their globally unique user ID or their email address. Returns the full user record for the invited user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_user_for_workspace_with_http_info(body, workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The user to add to the workspace. (required)
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: UserBaseResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_workspace(self, workspace_gid, opts, **kwargs):
'''Get a workspace # noqa: E501
Returns the full workspace record for a single workspace. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workspace(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WorkspaceResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_workspace_with_http_info(self, workspace_gid, opts, **kwargs):
'''Get a workspace # noqa: E501
Returns the full workspace record for a single workspace. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workspace_with_http_info(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WorkspaceResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_workspace_events(self, workspace_gid, opts, **kwargs):
'''Get workspace events # noqa: E501
Returns the full record for all events that have occurred since the sync token was created. The response is a list of events and the schema of each event is as described [here](/reference/events). Asana limits a single sync token to 1000 events. If more than 1000 events exist for a given domain, `has_more: true` will be returned in the response, indicating that there are more events to pull. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workspace_events(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param str sync: A sync token received from the last request, or none on first sync. Events will be returned from the point in time that the sync token was generated. *Note: On your first request, omit the sync token. The response will be the same as for an expired sync token, and will include a new valid sync token. If the sync token is too old (which may happen from time to time) the API will return a `412 Precondition Failed` error, and include a fresh sync token in the response.*
:return: EventResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_workspace_events_with_http_info(self, workspace_gid, opts, **kwargs):
'''Get workspace events # noqa: E501
Returns the full record for all events that have occurred since the sync token was created. The response is a list of events and the schema of each event is as described [here](/reference/events). Asana limits a single sync token to 1000 events. If more than 1000 events exist for a given domain, `has_more: true` will be returned in the response, indicating that there are more events to pull. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workspace_events_with_http_info(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param str sync: A sync token received from the last request, or none on first sync. Events will be returned from the point in time that the sync token was generated. *Note: On your first request, omit the sync token. The response will be the same as for an expired sync token, and will include a new valid sync token. If the sync token is too old (which may happen from time to time) the API will return a `412 Precondition Failed` error, and include a fresh sync token in the response.*
:return: EventResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_workspaces(self, opts, **kwargs):
'''Get multiple workspaces # noqa: E501
Returns the compact records for all workspaces visible to the authorized user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workspaces(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WorkspaceResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_workspaces_with_http_info(self, opts, **kwargs):
'''Get multiple workspaces # noqa: E501
Returns the compact records for all workspaces visible to the authorized user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_workspaces_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WorkspaceResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def remove_user_for_workspace(self, body, workspace_gid, **kwargs):
'''Remove a user from a workspace or organization # noqa: E501
Remove a user from a workspace or organization. The user making this call must be an admin in the workspace. The user can be referenced by their globally unique user ID or their email address. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_user_for_workspace(body, workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The user to remove from the workspace. (required)
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def remove_user_for_workspace_with_http_info(self, body, workspace_gid, **kwargs):
'''Remove a user from a workspace or organization # noqa: E501
Remove a user from a workspace or organization. The user making this call must be an admin in the workspace. The user can be referenced by their globally unique user ID or their email address. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_user_for_workspace_with_http_info(body, workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The user to remove from the workspace. (required)
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def update_workspace(self, body, workspace_gid, opts, **kwargs):
'''Update a workspace # noqa: E501
A specific, existing workspace can be updated by making a PUT request on the URL for that workspace. Only the fields provided in the data block will be updated; any unspecified fields will remain unchanged. Currently the only field that can be modified for a workspace is its name. Returns the complete, updated workspace record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_workspace(body, workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The workspace object with all updated properties. (required)
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WorkspaceResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def update_workspace_with_http_info(self, body, workspace_gid, opts, **kwargs):
'''Update a workspace # noqa: E501
A specific, existing workspace can be updated by making a PUT request on the URL for that workspace. Only the fields provided in the data block will be updated; any unspecified fields will remain unchanged. Currently the only field that can be modified for a workspace is its name. Returns the complete, updated workspace record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_workspace_with_http_info(body, workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The workspace object with all updated properties. (required)
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: WorkspaceResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
| 14 | 13 | 66 | 7 | 44 | 20 | 5 | 0.47 | 1 | 4 | 2 | 0 | 13 | 1 | 13 | 13 | 873 | 107 | 571 | 91 | 557 | 266 | 252 | 91 | 238 | 9 | 1 | 2 | 60 |
7,472 |
Asana/python-asana
|
Asana_python-asana/asana/api_client.py
|
asana.api_client.ApiClient
|
class ApiClient(object):
"""Generic API client for Swagger client library builds.
Swagger generic API client. This client handles the client-
server communication, and is invariant across implementations. Specifics of
the methods and models for each application are generated from the Swagger
templates.
NOTE: This class is auto generated by the swagger code generator program.
Ref: https://github.com/swagger-api/swagger-codegen
Do not edit the class manually.
:param configuration: .Configuration object for this client
:param header_name: a header to pass when making calls to the API.
:param header_value: a header value to pass when making calls to
the API.
:param cookie: a cookie to include in the header when making calls
to the API
"""
PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types
NATIVE_TYPES_MAPPING = {
'int': int,
'long': int if six.PY3 else long, # noqa: F821
'float': float,
'str': str,
'bool': bool,
'date': datetime.date,
'datetime': datetime.datetime,
'object': object,
}
def __init__(self, configuration=None, header_name=None, header_value=None,
cookie=None):
if configuration is None:
configuration = Configuration()
self.configuration = configuration
try:
self.pool = ThreadPool()
except OSError:
logging.warning('Looks like your system does not support ThreadPool but it will try without it if you do not use async requests')
self.rest_client = rest.RESTClientObject(configuration)
self.default_headers = {}
if header_name is not None:
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'Swagger-Codegen/5.1.0/python'
# Add custom header
self.default_headers['X-Asana-Client-Lib'] = urlencode(
{
'language': 'Python',
'version': '5.1.0',
'language_version': platform.python_version(),
'os': platform.system(),
'os_version': platform.release()
}
)
def __del__(self):
if hasattr(self, "pool"):
self.pool.close()
self.pool.join()
@property
def user_agent(self):
"""User agent for this API client"""
return self.default_headers['User-Agent']
@user_agent.setter
def user_agent(self, value):
self.default_headers['User-Agent'] = value
def set_default_header(self, header_name, header_value):
self.default_headers[header_name] = header_value
def __call_api(
self, resource_path, method, path_params=None,
query_params=None, header_params=None, body=None, post_params=None,
files=None, response_type=None, auth_settings=None,
_return_http_data_only=None, collection_formats=None,
_preload_content=True, _request_timeout=None):
config = self.configuration
# header parameters
header_params = header_params or {}
header_params.update(self.default_headers)
if self.cookie:
header_params['Cookie'] = self.cookie
if header_params:
header_params = self.sanitize_for_serialization(header_params)
header_params = dict(self.parameters_to_tuples(header_params,
collection_formats))
# path parameters
if path_params:
path_params = self.sanitize_for_serialization(path_params)
path_params = self.parameters_to_tuples(path_params,
collection_formats)
for k, v in path_params:
# specified safe chars, encode everything
resource_path = resource_path.replace(
'{%s}' % k,
quote(str(v), safe=config.safe_chars_for_path_param)
)
# query parameters
if query_params:
query_params = self.sanitize_for_serialization(query_params)
query_params = self.parameters_to_tuples(query_params,
collection_formats)
# post parameters
if post_params or files:
post_params = self.prepare_post_parameters(post_params, files)
post_params = self.sanitize_for_serialization(post_params)
post_params = self.parameters_to_tuples(post_params,
collection_formats)
# auth setting
self.update_params_for_auth(header_params, query_params, auth_settings)
# body
if body:
body = self.sanitize_for_serialization(body)
# request url
url = self.configuration.host + resource_path
# perform request and return response
response_data = self.request(
method, url, query_params=query_params, headers=header_params,
post_params=post_params, body=body,
_preload_content=_preload_content,
_request_timeout=_request_timeout)
self.last_response = response_data
return_data = response_data
if _preload_content:
# deserialize response data
if response_type:
return_data = self.deserialize(response_data, response_type)
else:
return_data = None
if _return_http_data_only:
return (return_data)
else:
return (return_data, response_data.status,
response_data.getheaders())
def sanitize_for_serialization(self, obj):
"""Builds a JSON POST object.
If obj is None, return None.
If obj is str, int, long, float, bool, return directly.
If obj is datetime.datetime, datetime.date
convert to string in iso8601 format.
If obj is list, sanitize each element in the list.
If obj is dict, return the dict.
If obj is swagger model, return the properties dict.
:param obj: The data to serialize.
:return: The serialized form of data.
"""
if obj is None:
return None
elif isinstance(obj, self.PRIMITIVE_TYPES):
return obj
elif isinstance(obj, list):
return [self.sanitize_for_serialization(sub_obj)
for sub_obj in obj]
elif isinstance(obj, tuple):
return tuple(self.sanitize_for_serialization(sub_obj)
for sub_obj in obj)
elif isinstance(obj, (datetime.datetime, datetime.date)):
return obj.isoformat()
if isinstance(obj, dict):
obj_dict = obj
else:
# Convert model obj to dict except
# attributes `swagger_types`, `attribute_map`
# and attributes which value is not None.
# Convert attribute name to json key in
# model definition for request.
obj_dict = {obj.attribute_map[attr]: getattr(obj, attr)
for attr, _ in six.iteritems(obj.swagger_types)
if getattr(obj, attr) is not None}
return {key: self.sanitize_for_serialization(val)
for key, val in six.iteritems(obj_dict)}
def deserialize(self, response, response_type):
"""Deserializes response into an object.
:param response: RESTResponse object to be deserialized.
:param response_type: class literal for
deserialized object, or string of class name.
:return: deserialized object.
"""
# handle file downloading
# save response body into a tmp file and return the instance
if response_type == "file":
return self.__deserialize_file(response)
# fetch data from response object
try:
# Decode the byte string and replace non-breaking space characters with regular
# spaces then parse the json bytes into a python dict
data = json.loads(response.data.decode('utf8').replace('\xa0', ' '))
except ValueError:
data = response.data
return self.__deserialize(data, response_type)
def __deserialize(self, data, klass):
"""Deserializes dict, list, str into an object.
:param data: dict, list or str.
:param klass: class literal, or string of class name.
:return: object.
"""
if data is None:
return None
if type(klass) == str:
if klass.startswith('list['):
sub_kls = re.match(r'list\[(.*)\]', klass).group(1)
return [self.__deserialize(sub_data, sub_kls)
for sub_data in data]
if klass.startswith('dict('):
sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2)
return {k: self.__deserialize(v, sub_kls)
for k, v in six.iteritems(data)}
# convert str to class
if klass in self.NATIVE_TYPES_MAPPING:
klass = self.NATIVE_TYPES_MAPPING[klass]
if klass in self.PRIMITIVE_TYPES:
return self.__deserialize_primitive(data, klass)
elif klass == object:
return self.__deserialize_object(data)
elif klass == datetime.date:
return self.__deserialize_date(data)
elif klass == datetime.datetime:
return self.__deserialize_datatime(data)
else:
return data
def call_api(self, resource_path, method,
path_params=None, query_params=None, header_params=None,
body=None, post_params=None, files=None,
response_type=None, auth_settings=None, async_req=None,
_return_http_data_only=None, collection_formats=None,
_preload_content=True, _request_timeout=None):
"""Makes the HTTP request (synchronous) and returns deserialized data.
To make an async request, set the async_req parameter.
:param resource_path: Path to method endpoint.
:param method: Method to call.
:param path_params: Path parameters in the url.
:param query_params: Query parameters in the url.
:param header_params: Header parameters to be
placed in the request header.
:param body: Request body.
:param post_params dict: Request post form parameters,
for `application/x-www-form-urlencoded`, `multipart/form-data`.
:param auth_settings list: Auth Settings names for the request.
:param response: Response data type.
:param files dict: key -> filename, value -> filepath,
for `multipart/form-data`.
:param async_req bool: execute request asynchronously
:param _return_http_data_only: response data without head status code
and headers
:param collection_formats: dict of collection formats for path, query,
header, and post parameters.
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return:
If async_req parameter is True,
the request will be called asynchronously.
The method will return the request thread.
If parameter async_req is False or missing,
then the method will return the response directly.
"""
# Convert query params dict into a list of query param tuples.
# This step was previous implemented in the api.mustache but we needed
# to modify the query params dict for pagination so we move this conversion step here
if query_params:
query_params = [(k, v) for k, v in query_params.items()]
if not async_req:
return self.__call_api(resource_path, method,
path_params, query_params, header_params,
body, post_params, files,
response_type, auth_settings,
_return_http_data_only, collection_formats,
_preload_content, _request_timeout)
else:
thread = self.pool.apply_async(self.__call_api, (resource_path,
method, path_params, query_params,
header_params, body,
post_params, files,
response_type, auth_settings,
_return_http_data_only,
collection_formats,
_preload_content, _request_timeout))
return thread
def request(self, method, url, query_params=None, headers=None,
post_params=None, body=None, _preload_content=True,
_request_timeout=None):
"""Makes the HTTP request using RESTClient."""
if method == "GET":
return self.rest_client.GET(url,
query_params=query_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
headers=headers)
elif method == "HEAD":
return self.rest_client.HEAD(url,
query_params=query_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
headers=headers)
elif method == "OPTIONS":
return self.rest_client.OPTIONS(url,
query_params=query_params,
headers=headers,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
elif method == "POST":
return self.rest_client.POST(url,
query_params=query_params,
headers=headers,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
elif method == "PUT":
return self.rest_client.PUT(url,
query_params=query_params,
headers=headers,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
elif method == "PATCH":
return self.rest_client.PATCH(url,
query_params=query_params,
headers=headers,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
elif method == "DELETE":
return self.rest_client.DELETE(url,
query_params=query_params,
headers=headers,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
else:
raise ValueError(
"http method must be `GET`, `HEAD`, `OPTIONS`,"
" `POST`, `PATCH`, `PUT` or `DELETE`."
)
def parameters_to_tuples(self, params, collection_formats):
"""Get parameters as list of tuples, formatting collections.
:param params: Parameters as dict or list of two-tuples
:param dict collection_formats: Parameter collection formats
:return: Parameters as list of tuples, collections formatted
"""
new_params = []
if collection_formats is None:
collection_formats = {}
for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501
if k in collection_formats:
collection_format = collection_formats[k]
if collection_format == 'multi':
new_params.extend((k, value) for value in v)
else:
if collection_format == 'ssv':
delimiter = ' '
elif collection_format == 'tsv':
delimiter = '\t'
elif collection_format == 'pipes':
delimiter = '|'
else: # csv is the default
delimiter = ','
new_params.append(
(k, delimiter.join(str(value) for value in v)))
else:
new_params.append((k, v))
return new_params
def prepare_post_parameters(self, post_params=None, files=None):
"""Builds form parameters.
:param post_params: Normal form parameters.
:param files: File parameters.
:return: Form parameters with files.
"""
params = []
if post_params:
params = post_params
if files:
for k, v in six.iteritems(files):
if not v:
continue
file_names = v if type(v) is list else [v]
for n in file_names:
with open(n, 'rb') as f:
filename = os.path.basename(f.name)
filedata = f.read()
mimetype = (mimetypes.guess_type(filename)[0] or
'application/octet-stream')
params.append(
tuple([k, tuple([filename, filedata, mimetype])]))
return params
def select_header_accept(self, accepts):
"""Returns `Accept` based on an array of accepts provided.
:param accepts: List of headers.
:return: Accept (e.g. application/json).
"""
if not accepts:
return
accepts = [x.lower() for x in accepts]
if 'application/json' in accepts:
return 'application/json'
else:
return ', '.join(accepts)
def select_header_content_type(self, content_types):
"""Returns `Content-Type` based on an array of content_types provided.
:param content_types: List of content-types.
:return: Content-Type (e.g. application/json).
"""
if not content_types:
return 'application/json'
content_types = [x.lower() for x in content_types]
if 'application/json' in content_types or '*/*' in content_types:
return 'application/json'
else:
return content_types[0]
def update_params_for_auth(self, headers, querys, auth_settings):
"""Updates header and query params based on authentication setting.
:param headers: Header parameters dict to be updated.
:param querys: Query parameters tuple list to be updated.
:param auth_settings: Authentication setting identifiers list.
"""
if not auth_settings:
return
for auth in auth_settings:
# In the OAS we define "personalAccessToken" but for the SDK we want users to use the term "token"
# this logic will get the auth_settings for "token" settings that we've added
if auth == 'personalAccessToken':
auth_setting = self.configuration.auth_settings().get('token')
else:
auth_setting = self.configuration.auth_settings().get(auth)
if auth_setting:
if not auth_setting['value']:
continue
elif auth_setting['in'] == 'header':
headers[auth_setting['key']] = auth_setting['value']
elif auth_setting['in'] == 'query':
querys.append((auth_setting['key'], auth_setting['value']))
else:
raise ValueError(
'Authentication token must be in `query` or `header`'
)
def __deserialize_file(self, response):
"""Deserializes body to file
Saves response body into a file in a temporary folder,
using the filename from the `Content-Disposition` header if provided.
:param response: RESTResponse.
:return: file path.
"""
fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path)
os.close(fd)
os.remove(path)
content_disposition = response.getheader("Content-Disposition")
if content_disposition:
filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?',
content_disposition).group(1)
path = os.path.join(os.path.dirname(path), filename)
response_data = response.data
with open(path, "wb") as f:
if isinstance(response_data, str):
# change str to bytes so we can write it
response_data = response_data.encode('utf-8')
f.write(response_data)
else:
f.write(response_data)
return path
def __deserialize_primitive(self, data, klass):
"""Deserializes string to primitive type.
:param data: str.
:param klass: class literal.
:return: int, long, float, str, bool.
"""
try:
return klass(data)
except UnicodeEncodeError:
return six.text_type(data)
except TypeError:
return data
def __deserialize_object(self, value):
"""Return a original value.
:return: object.
"""
return value
def __deserialize_date(self, string):
"""Deserializes string to date.
:param string: str.
:return: date.
"""
try:
from dateutil.parser import parse
return parse(string).date()
except ImportError:
return string
except ValueError:
raise rest.ApiException(
status=0,
reason="Failed to parse `{0}` as date object".format(string)
)
def __deserialize_datatime(self, string):
"""Deserializes string to datetime.
The string should be in iso8601 datetime format.
:param string: str.
:return: datetime.
"""
try:
from dateutil.parser import parse
return parse(string)
except ImportError:
return string
except ValueError:
raise rest.ApiException(
status=0,
reason=(
"Failed to parse `{0}` as datetime object"
.format(string)
)
)
def __hasattr(self, object, name):
return name in object.__class__.__dict__
|
class ApiClient(object):
'''Generic API client for Swagger client library builds.
Swagger generic API client. This client handles the client-
server communication, and is invariant across implementations. Specifics of
the methods and models for each application are generated from the Swagger
templates.
NOTE: This class is auto generated by the swagger code generator program.
Ref: https://github.com/swagger-api/swagger-codegen
Do not edit the class manually.
:param configuration: .Configuration object for this client
:param header_name: a header to pass when making calls to the API.
:param header_value: a header value to pass when making calls to
the API.
:param cookie: a cookie to include in the header when making calls
to the API
'''
def __init__(self, configuration=None, header_name=None, header_value=None,
cookie=None):
pass
def __del__(self):
pass
@property
def user_agent(self):
'''User agent for this API client'''
pass
@user_agent.setter
def user_agent(self):
pass
def set_default_header(self, header_name, header_value):
pass
def __call_api(
self, resource_path, method, path_params=None,
query_params=None, header_params=None, body=None, post_params=None,
files=None, response_type=None, auth_settings=None,
_return_http_data_only=None, collection_formats=None,
_preload_content=True, _request_timeout=None):
pass
def sanitize_for_serialization(self, obj):
'''Builds a JSON POST object.
If obj is None, return None.
If obj is str, int, long, float, bool, return directly.
If obj is datetime.datetime, datetime.date
convert to string in iso8601 format.
If obj is list, sanitize each element in the list.
If obj is dict, return the dict.
If obj is swagger model, return the properties dict.
:param obj: The data to serialize.
:return: The serialized form of data.
'''
pass
def deserialize(self, response, response_type):
'''Deserializes response into an object.
:param response: RESTResponse object to be deserialized.
:param response_type: class literal for
deserialized object, or string of class name.
:return: deserialized object.
'''
pass
def __deserialize(self, data, klass):
'''Deserializes dict, list, str into an object.
:param data: dict, list or str.
:param klass: class literal, or string of class name.
:return: object.
'''
pass
def call_api(self, resource_path, method,
path_params=None, query_params=None, header_params=None,
body=None, post_params=None, files=None,
response_type=None, auth_settings=None, async_req=None,
_return_http_data_only=None, collection_formats=None,
_preload_content=True, _request_timeout=None):
'''Makes the HTTP request (synchronous) and returns deserialized data.
To make an async request, set the async_req parameter.
:param resource_path: Path to method endpoint.
:param method: Method to call.
:param path_params: Path parameters in the url.
:param query_params: Query parameters in the url.
:param header_params: Header parameters to be
placed in the request header.
:param body: Request body.
:param post_params dict: Request post form parameters,
for `application/x-www-form-urlencoded`, `multipart/form-data`.
:param auth_settings list: Auth Settings names for the request.
:param response: Response data type.
:param files dict: key -> filename, value -> filepath,
for `multipart/form-data`.
:param async_req bool: execute request asynchronously
:param _return_http_data_only: response data without head status code
and headers
:param collection_formats: dict of collection formats for path, query,
header, and post parameters.
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return:
If async_req parameter is True,
the request will be called asynchronously.
The method will return the request thread.
If parameter async_req is False or missing,
then the method will return the response directly.
'''
pass
def request(self, method, url, query_params=None, headers=None,
post_params=None, body=None, _preload_content=True,
_request_timeout=None):
'''Makes the HTTP request using RESTClient.'''
pass
def parameters_to_tuples(self, params, collection_formats):
'''Get parameters as list of tuples, formatting collections.
:param params: Parameters as dict or list of two-tuples
:param dict collection_formats: Parameter collection formats
:return: Parameters as list of tuples, collections formatted
'''
pass
def prepare_post_parameters(self, post_params=None, files=None):
'''Builds form parameters.
:param post_params: Normal form parameters.
:param files: File parameters.
:return: Form parameters with files.
'''
pass
def select_header_accept(self, accepts):
'''Returns `Accept` based on an array of accepts provided.
:param accepts: List of headers.
:return: Accept (e.g. application/json).
'''
pass
def select_header_content_type(self, content_types):
'''Returns `Content-Type` based on an array of content_types provided.
:param content_types: List of content-types.
:return: Content-Type (e.g. application/json).
'''
pass
def update_params_for_auth(self, headers, querys, auth_settings):
'''Updates header and query params based on authentication setting.
:param headers: Header parameters dict to be updated.
:param querys: Query parameters tuple list to be updated.
:param auth_settings: Authentication setting identifiers list.
'''
pass
def __deserialize_file(self, response):
'''Deserializes body to file
Saves response body into a file in a temporary folder,
using the filename from the `Content-Disposition` header if provided.
:param response: RESTResponse.
:return: file path.
'''
pass
def __deserialize_primitive(self, data, klass):
'''Deserializes string to primitive type.
:param data: str.
:param klass: class literal.
:return: int, long, float, str, bool.
'''
pass
def __deserialize_object(self, value):
'''Return a original value.
:return: object.
'''
pass
def __deserialize_date(self, string):
'''Deserializes string to date.
:param string: str.
:return: date.
'''
pass
def __deserialize_datatime(self, string):
'''Deserializes string to datetime.
The string should be in iso8601 datetime format.
:param string: str.
:return: datetime.
'''
pass
def __hasattr(self, object, name):
pass
| 25 | 17 | 25 | 2 | 16 | 6 | 4 | 0.41 | 1 | 16 | 3 | 0 | 22 | 6 | 22 | 22 | 595 | 79 | 368 | 77 | 328 | 151 | 219 | 59 | 194 | 11 | 1 | 4 | 95 |
7,473 |
Asana/python-asana
|
Asana_python-asana/asana/pagination/event_iterator.py
|
asana.pagination.event_iterator.EventIterator
|
class EventIterator(PageIterator):
def __init__(self, api_client, api_request_data, **kwargs):
super().__init__(api_client, api_request_data, **kwargs)
self.sync = False
self.has_more = True
def __next__(self):
if not self.has_more:
raise StopIteration
result = {}
try:
result = self.call_api()
except ApiException as e:
if (e.status == 412):
errors = json.loads(e.body.decode("utf-8"))
self.sync = errors["sync"]
else:
raise e
if (self.sync):
self.api_request_data["query_params"]["sync"] = self.sync
else:
self.sync = result.get('sync', None)
if not result:
try:
result = self.call_api()
except ApiException as e:
raise e
self.has_more = result.get('has_more', False)
return result["data"]
|
class EventIterator(PageIterator):
def __init__(self, api_client, api_request_data, **kwargs):
pass
def __next__(self):
pass
| 3 | 0 | 16 | 3 | 14 | 0 | 4 | 0 | 1 | 3 | 1 | 0 | 2 | 2 | 2 | 8 | 34 | 6 | 28 | 8 | 25 | 0 | 26 | 7 | 23 | 7 | 2 | 2 | 8 |
7,474 |
Asana/python-asana
|
Asana_python-asana/asana/api/portfolio_memberships_api.py
|
asana.api.portfolio_memberships_api.PortfolioMembershipsApi
|
class PortfolioMembershipsApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def get_portfolio_membership(self, portfolio_membership_gid, opts, **kwargs): # noqa: E501
"""Get a portfolio membership # noqa: E501
Returns the complete portfolio record for a single portfolio membership. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_portfolio_membership(portfolio_membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str portfolio_membership_gid: (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: DeprecatedPortfolioMembershipResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_portfolio_membership_with_http_info(portfolio_membership_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_portfolio_membership_with_http_info(portfolio_membership_gid, opts, **kwargs) # noqa: E501
return data
def get_portfolio_membership_with_http_info(self, portfolio_membership_gid, opts, **kwargs): # noqa: E501
"""Get a portfolio membership # noqa: E501
Returns the complete portfolio record for a single portfolio membership. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_portfolio_membership_with_http_info(portfolio_membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str portfolio_membership_gid: (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: DeprecatedPortfolioMembershipResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_portfolio_membership" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'portfolio_membership_gid' is set
if (portfolio_membership_gid is None):
raise ValueError("Missing the required parameter `portfolio_membership_gid` when calling `get_portfolio_membership`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['portfolio_membership_gid'] = portfolio_membership_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/portfolio_memberships/{portfolio_membership_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/portfolio_memberships/{portfolio_membership_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/portfolio_memberships/{portfolio_membership_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_portfolio_memberships(self, opts, **kwargs): # noqa: E501
"""Get multiple portfolio memberships # noqa: E501
Returns a list of portfolio memberships in compact representation. You must specify `portfolio`, `portfolio` and `user`, or `workspace` and `user`. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_portfolio_memberships(async_req=True)
>>> result = thread.get()
:param async_req bool
:param str portfolio: The portfolio to filter results on.
:param str workspace: The workspace to filter results on.
:param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: DeprecatedPortfolioMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_portfolio_memberships_with_http_info(opts, **kwargs) # noqa: E501
else:
(data) = self.get_portfolio_memberships_with_http_info(opts, **kwargs) # noqa: E501
return data
def get_portfolio_memberships_with_http_info(self, opts, **kwargs): # noqa: E501
"""Get multiple portfolio memberships # noqa: E501
Returns a list of portfolio memberships in compact representation. You must specify `portfolio`, `portfolio` and `user`, or `workspace` and `user`. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_portfolio_memberships_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param str portfolio: The portfolio to filter results on.
:param str workspace: The workspace to filter results on.
:param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: DeprecatedPortfolioMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_portfolio_memberships" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/portfolio_memberships', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/portfolio_memberships',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/portfolio_memberships', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_portfolio_memberships_for_portfolio(self, portfolio_gid, opts, **kwargs): # noqa: E501
"""Get memberships from a portfolio # noqa: E501
Returns the compact portfolio membership records for the portfolio. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_portfolio_memberships_for_portfolio(portfolio_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str portfolio_gid: Globally unique identifier for the portfolio. (required)
:param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: DeprecatedPortfolioMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_portfolio_memberships_for_portfolio_with_http_info(portfolio_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_portfolio_memberships_for_portfolio_with_http_info(portfolio_gid, opts, **kwargs) # noqa: E501
return data
def get_portfolio_memberships_for_portfolio_with_http_info(self, portfolio_gid, opts, **kwargs): # noqa: E501
"""Get memberships from a portfolio # noqa: E501
Returns the compact portfolio membership records for the portfolio. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_portfolio_memberships_for_portfolio_with_http_info(portfolio_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str portfolio_gid: Globally unique identifier for the portfolio. (required)
:param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: DeprecatedPortfolioMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_portfolio_memberships_for_portfolio" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'portfolio_gid' is set
if (portfolio_gid is None):
raise ValueError("Missing the required parameter `portfolio_gid` when calling `get_portfolio_memberships_for_portfolio`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['portfolio_gid'] = portfolio_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/portfolios/{portfolio_gid}/portfolio_memberships', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/portfolios/{portfolio_gid}/portfolio_memberships',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/portfolios/{portfolio_gid}/portfolio_memberships', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
class PortfolioMembershipsApi(object):
'''NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
'''
def __init__(self, api_client=None):
pass
def get_portfolio_membership(self, portfolio_membership_gid, opts, **kwargs):
'''Get a portfolio membership # noqa: E501
Returns the complete portfolio record for a single portfolio membership. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_portfolio_membership(portfolio_membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str portfolio_membership_gid: (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: DeprecatedPortfolioMembershipResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_portfolio_membership_with_http_info(self, portfolio_membership_gid, opts, **kwargs):
'''Get a portfolio membership # noqa: E501
Returns the complete portfolio record for a single portfolio membership. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_portfolio_membership_with_http_info(portfolio_membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str portfolio_membership_gid: (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: DeprecatedPortfolioMembershipResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_portfolio_memberships(self, opts, **kwargs):
'''Get multiple portfolio memberships # noqa: E501
Returns a list of portfolio memberships in compact representation. You must specify `portfolio`, `portfolio` and `user`, or `workspace` and `user`. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_portfolio_memberships(async_req=True)
>>> result = thread.get()
:param async_req bool
:param str portfolio: The portfolio to filter results on.
:param str workspace: The workspace to filter results on.
:param str user: A string identifying a user. This can either be the string "me", an email, or the gid of a user.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: DeprecatedPortfolioMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_portfolio_memberships_with_http_info(self, opts, **kwargs):
'''Get multiple portfolio memberships # noqa: E501
Returns a list of portfolio memberships in compact representation. You must specify `portfolio`, `portfolio` and `user`, or `workspace` and `user`. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_portfolio_memberships_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param str portfolio: The portfolio to filter results on.
:param str workspace: The workspace to filter results on.
:param str user: A string identifying a user. This can either be the string "me", an email, or the gid of a user.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: DeprecatedPortfolioMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_portfolio_memberships_for_portfolio(self, portfolio_gid, opts, **kwargs):
'''Get memberships from a portfolio # noqa: E501
Returns the compact portfolio membership records for the portfolio. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_portfolio_memberships_for_portfolio(portfolio_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str portfolio_gid: Globally unique identifier for the portfolio. (required)
:param str user: A string identifying a user. This can either be the string "me", an email, or the gid of a user.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: DeprecatedPortfolioMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_portfolio_memberships_for_portfolio_with_http_info(self, portfolio_gid, opts, **kwargs):
'''Get memberships from a portfolio # noqa: E501
Returns the compact portfolio membership records for the portfolio. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_portfolio_memberships_for_portfolio_with_http_info(portfolio_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str portfolio_gid: Globally unique identifier for the portfolio. (required)
:param str user: A string identifying a user. This can either be the string "me", an email, or the gid of a user.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: DeprecatedPortfolioMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
| 8 | 7 | 62 | 6 | 40 | 19 | 4 | 0.48 | 1 | 4 | 2 | 0 | 7 | 1 | 7 | 7 | 444 | 53 | 284 | 46 | 276 | 136 | 121 | 46 | 113 | 8 | 1 | 2 | 27 |
7,475 |
Asana/python-asana
|
Asana_python-asana/asana/pagination/page_iterator.py
|
asana.pagination.page_iterator.PageIterator
|
class PageIterator(object):
def __init__(self, api_client, api_request_data, **kwargs):
self.__api_client = api_client
self.api_request_data = api_request_data
self.next_page = False
self.item_limit = float('inf') if kwargs.get('item_limit', None) == None else kwargs.get('item_limit')
self.count = 0
def __iter__(self):
"""Iterator interface, self is an iterator"""
return self
def __next__(self):
limit = self.api_request_data["query_params"].get("limit", None)
if limit:
self.api_request_data["query_params"]["limit"] = min(limit, self.item_limit - self.count)
if self.next_page is None or self.api_request_data["query_params"].get("limit", None) == 0:
raise StopIteration
try:
result = self.call_api()
except ApiException as e:
raise e
# If the response has a next_page add the offset to the api_request_data for the next request
self.next_page = result.get('next_page', None)
if (self.next_page):
self.api_request_data["query_params"]["offset"] = self.next_page["offset"]
data = result['data']
if data != None:
self.count += len(data)
return data
def next(self):
"""Alias for __next__"""
return self.__next__()
def items(self):
"""Returns an iterator for each item in each page"""
for page in self:
for item in page:
yield item
def call_api(self):
return self.__api_client.call_api(
self.api_request_data["resource_path"],
self.api_request_data["method"],
self.api_request_data["path_params"],
self.api_request_data["query_params"],
self.api_request_data["header_params"],
self.api_request_data["body"],
self.api_request_data["post_params"],
self.api_request_data["files"],
self.api_request_data["response_type"],
self.api_request_data["auth_settings"],
self.api_request_data["async_req"],
self.api_request_data["_return_http_data_only"],
self.api_request_data["collection_formats"],
self.api_request_data["_preload_content"],
self.api_request_data["_request_timeout"]
)
|
class PageIterator(object):
def __init__(self, api_client, api_request_data, **kwargs):
pass
def __iter__(self):
'''Iterator interface, self is an iterator'''
pass
def __next__(self):
pass
def next(self):
'''Alias for __next__'''
pass
def items(self):
'''Returns an iterator for each item in each page'''
pass
def call_api(self):
pass
| 7 | 3 | 9 | 1 | 8 | 1 | 2 | 0.08 | 1 | 3 | 1 | 1 | 6 | 5 | 6 | 6 | 62 | 8 | 50 | 18 | 43 | 4 | 34 | 17 | 27 | 6 | 1 | 2 | 14 |
7,476 |
Asana/python-asana
|
Asana_python-asana/asana/rest.py
|
asana.rest.RESTClientObject
|
class RESTClientObject(object):
def __init__(self, configuration, pools_size=4, maxsize=None):
# urllib3.PoolManager will pass all kw parameters to connectionpool
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
# maxsize is the number of requests to host that are allowed in parallel # noqa: E501
# Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
# cert_reqs
if configuration.verify_ssl:
cert_reqs = ssl.CERT_REQUIRED
else:
cert_reqs = ssl.CERT_NONE
# ca_certs
if configuration.ssl_ca_cert:
ca_certs = configuration.ssl_ca_cert
else:
# if not set certificate file, use Mozilla's root certificates.
ca_certs = certifi.where()
addition_pool_args = {}
if configuration.assert_hostname is not None:
addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501
if maxsize is None:
if configuration.connection_pool_maxsize is not None:
maxsize = configuration.connection_pool_maxsize
else:
maxsize = 4
# https pool manager
if configuration.proxy:
self.pool_manager = urllib3.ProxyManager(
num_pools=pools_size,
maxsize=maxsize,
cert_reqs=cert_reqs,
ca_certs=ca_certs,
cert_file=configuration.cert_file,
key_file=configuration.key_file,
proxy_url=configuration.proxy,
retries=configuration.retry_strategy,
**addition_pool_args
)
else:
self.pool_manager = urllib3.PoolManager(
num_pools=pools_size,
maxsize=maxsize,
cert_reqs=cert_reqs,
ca_certs=ca_certs,
cert_file=configuration.cert_file,
key_file=configuration.key_file,
retries=configuration.retry_strategy,
**addition_pool_args
)
def request(self, method, url, query_params=None, headers=None,
body=None, post_params=None, _preload_content=True,
_request_timeout=None):
"""Perform requests.
:param method: http request method
:param url: http request url
:param query_params: query parameters in the url
:param headers: http request headers
:param body: request json body, for `application/json`
:param post_params: request post parameters,
`application/x-www-form-urlencoded`
and `multipart/form-data`
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
"""
method = method.upper()
assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT',
'PATCH', 'OPTIONS']
if post_params and body:
raise ValueError(
"body parameter cannot be used with post_params parameter."
)
post_params = post_params or {}
headers = headers or {}
timeout = None
if _request_timeout:
if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821
timeout = urllib3.Timeout(total=_request_timeout)
elif (isinstance(_request_timeout, tuple) and
len(_request_timeout) == 2):
timeout = urllib3.Timeout(
connect=_request_timeout[0], read=_request_timeout[1])
if 'Content-Type' not in headers:
headers['Content-Type'] = 'application/json'
try:
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
if query_params:
url += '?' + urlencode(query_params)
if re.search('json', headers['Content-Type'], re.IGNORECASE):
request_body = '{}'
if body is not None:
request_body = json.dumps(body)
r = self.pool_manager.request(
method, url,
body=request_body,
preload_content=_preload_content,
timeout=timeout,
headers=headers)
elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501
r = self.pool_manager.request(
method, url,
fields=post_params,
encode_multipart=False,
preload_content=_preload_content,
timeout=timeout,
headers=headers)
elif headers['Content-Type'] == 'multipart/form-data':
# must del headers['Content-Type'], or the correct
# Content-Type which generated by urllib3 will be
# overwritten.
del headers['Content-Type']
r = self.pool_manager.request(
method, url,
fields=post_params,
encode_multipart=True,
preload_content=_preload_content,
timeout=timeout,
headers=headers)
# Pass a `string` parameter directly in the body to support
# other content types than Json when `body` argument is
# provided in serialized form
elif isinstance(body, str):
request_body = body
r = self.pool_manager.request(
method, url,
body=request_body,
preload_content=_preload_content,
timeout=timeout,
headers=headers)
else:
# Cannot generate the request from given parameters
msg = """Cannot prepare a request message for provided
arguments. Please check that your arguments match
declared content type."""
raise ApiException(status=0, reason=msg)
# For `GET`, `HEAD`
else:
r = self.pool_manager.request(method, url,
fields=query_params,
preload_content=_preload_content,
timeout=timeout,
headers=headers)
except urllib3.exceptions.SSLError as e:
msg = "{0}\n{1}".format(type(e).__name__, str(e))
raise ApiException(status=0, reason=msg)
if _preload_content:
r = RESTResponse(r)
# log response body
logger.debug("response body: %s", r.data)
if not 200 <= r.status <= 299:
raise ApiException(http_resp=r)
return r
def GET(self, url, headers=None, query_params=None, _preload_content=True,
_request_timeout=None):
return self.request("GET", url,
headers=headers,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
query_params=query_params)
def HEAD(self, url, headers=None, query_params=None, _preload_content=True,
_request_timeout=None):
return self.request("HEAD", url,
headers=headers,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
query_params=query_params)
def OPTIONS(self, url, headers=None, query_params=None, post_params=None,
body=None, _preload_content=True, _request_timeout=None):
return self.request("OPTIONS", url,
headers=headers,
query_params=query_params,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
def DELETE(self, url, headers=None, query_params=None, body=None,
_preload_content=True, _request_timeout=None):
return self.request("DELETE", url,
headers=headers,
query_params=query_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
def POST(self, url, headers=None, query_params=None, post_params=None,
body=None, _preload_content=True, _request_timeout=None):
return self.request("POST", url,
headers=headers,
query_params=query_params,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
def PUT(self, url, headers=None, query_params=None, post_params=None,
body=None, _preload_content=True, _request_timeout=None):
return self.request("PUT", url,
headers=headers,
query_params=query_params,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
def PATCH(self, url, headers=None, query_params=None, post_params=None,
body=None, _preload_content=True, _request_timeout=None):
return self.request("PATCH", url,
headers=headers,
query_params=query_params,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
|
class RESTClientObject(object):
def __init__(self, configuration, pools_size=4, maxsize=None):
pass
def request(self, method, url, query_params=None, headers=None,
body=None, post_params=None, _preload_content=True,
_request_timeout=None):
'''Perform requests.
:param method: http request method
:param url: http request url
:param query_params: query parameters in the url
:param headers: http request headers
:param body: request json body, for `application/json`
:param post_params: request post parameters,
`application/x-www-form-urlencoded`
and `multipart/form-data`
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
'''
pass
def GET(self, url, headers=None, query_params=None, _preload_content=True,
_request_timeout=None):
pass
def HEAD(self, url, headers=None, query_params=None, _preload_content=True,
_request_timeout=None):
pass
def OPTIONS(self, url, headers=None, query_params=None, post_params=None,
body=None, _preload_content=True, _request_timeout=None):
pass
def DELETE(self, url, headers=None, query_params=None, body=None,
_preload_content=True, _request_timeout=None):
pass
def POST(self, url, headers=None, query_params=None, post_params=None,
body=None, _preload_content=True, _request_timeout=None):
pass
def PUT(self, url, headers=None, query_params=None, post_params=None,
body=None, _preload_content=True, _request_timeout=None):
pass
def PATCH(self, url, headers=None, query_params=None, post_params=None,
body=None, _preload_content=True, _request_timeout=None):
pass
| 10 | 1 | 26 | 2 | 20 | 4 | 3 | 0.22 | 1 | 11 | 2 | 0 | 9 | 1 | 9 | 9 | 240 | 24 | 180 | 28 | 161 | 39 | 72 | 18 | 62 | 17 | 1 | 4 | 31 |
7,477 |
Asana/python-asana
|
Asana_python-asana/build_tests/test_projects_api.py
|
build_tests.test_projects_api.TestProjectsApi
|
class TestProjectsApi(unittest.TestCase):
"""ProjectsApi unit test stubs"""
@classmethod
def setUpClass(cls):
load_dotenv()
# Load environment variables
cls.TEAM_GID = os.environ["TEAM_GID"]
cls.WORKSPACE_GID = os.environ["WORKSPACE_GID"]
configuration = asana.Configuration()
configuration.access_token = os.environ["PERSONAL_ACCESS_TOKEN"]
api_client = asana.ApiClient(configuration)
cls.api = ProjectsApi(api_client) # noqa: E501
# Create a global project for testing
try:
cls.project_name = "Project 1"
cls.project_notes = "Some description"
cls.project = cls.api.create_project(
{
"data": {
"name": cls.project_name,
"notes": cls.project_notes,
"team": cls.TEAM_GID
}
},
{}
)
except ApiException as e:
raise Exception(e)
@classmethod
def tearDownClass(cls):
try:
# Delete global project
cls.api.delete_project(cls.project["gid"])
except ApiException as e:
raise Exception(e)
def test_create_project(self):
"""Test case for create_project
Create a project # noqa: E501
"""
try:
# Create a project
project_name = "Project 2"
project_notes = "Some description"
project = self.api.create_project(
{
"data": {
"name": project_name,
"notes": project_notes,
"team": self.TEAM_GID
}
},
{}
)
# Check that the project was created
self.assertIsNotNone(project)
self.assertEqual(project["name"], project_name)
self.assertEqual(project["notes"], project_notes)
# Delete project
self.api.delete_project(project["gid"])
except ApiException as e:
raise Exception(e)
def test_delete_project(self):
"""Test case for delete_project
Delete a project # noqa: E501
"""
try:
# Create a project to delete
project_name = "Project 2"
project_notes = "Some description"
project = self.api.create_project(
{
"data": {
"name": project_name,
"notes": project_notes,
"team": self.TEAM_GID
}
},
{}
)
# Delete project
deleted_project = self.api.delete_project(project["gid"])
# Check that the project got deleted
self.assertEqual(deleted_project, {})
except ApiException as e:
raise Exception(e)
def test_get_project(self):
"""Test case for get_project
Get a project # noqa: E501
"""
try:
project = self.api.get_project(self.project["gid"], {})
# Check project response
self.assertIsNotNone(project)
self.assertFalse(project["archived"])
self.assertIsNone(project["color"])
self.assertFalse(project["completed"])
self.assertIsNone(project["completed_at"])
self.assertIsNotNone(project["created_at"])
self.assertIsNone(project["current_status"])
self.assertIsNone(project["current_status_update"])
self.assertTrue(project["custom_field_settings"].__class__ == list)
self.assertTrue(project["custom_fields"].__class__ == list)
self.assertEqual(project["default_access_level"], "editor")
self.assertEqual(project["default_view"], "list")
self.assertIsNone(project["due_date"])
self.assertIsNone(project["due_on"])
self.assertTrue(project["followers"].__class__ == list)
self.assertIsNotNone(project["gid"])
self.assertTrue(project["members"].__class__ == list)
self.assertEqual(project["minimum_access_level_for_customization"], "editor")
self.assertIsNotNone(project["modified_at"])
self.assertEqual(project["name"], self.project_name)
self.assertEqual(project["notes"], self.project_notes)
self.assertIsNotNone(project["owner"])
self.assertIsNotNone(project["permalink_url"])
self.assertTrue(project["public"])
self.assertEqual(project["resource_type"], 'project')
self.assertIsNone(project["start_on"])
self.assertIsNotNone(project["team"])
self.assertIsNotNone(project["workspace"])
except ApiException as e:
raise Exception(e)
def test_get_project_with_opt_fields(self):
"""Test case for get_project with opt_fields
Get a project with opt_fields # noqa: E501
"""
try:
project = self.api.get_project(
self.project["gid"],
{
'opt_fields': "name,notes"
}
)
# Check project response
self.assertIsNotNone(project)
self.assertIsNotNone(project["gid"])
self.assertEqual(project["name"], self.project_name)
self.assertEqual(project["notes"], self.project_notes)
except ApiException as e:
raise Exception(e)
def test_get_projects(self):
"""Test case for get_projects
Get multiple projects # noqa: E501
"""
try:
projects = self.api.get_projects(
{
'limit': 100,
'workspace': self.WORKSPACE_GID
}
)
# Check projects response
self.assertIsNotNone(projects)
for project in projects:
self.assertIsNotNone(project["gid"])
self.assertIsNotNone(project["name"])
self.assertEqual(project["resource_type"], "project")
except ApiException as e:
raise Exception(e)
def test_get_projects_with_opt_fields(self):
"""Test case for get_projects with opt_fields
Get multiple projects with opt_fields # noqa: E501
"""
try:
projects = self.api.get_projects(
{
'limit': 100,
'workspace': self.WORKSPACE_GID,
'opt_fields': "name, notes"
}
)
# Check projects response
self.assertIsNotNone(projects)
for project in projects:
self.assertIsNotNone(project["gid"])
self.assertIsNotNone(project["name"])
self.assertIsNotNone(project["notes"])
except ApiException as e:
raise Exception(e)
def test_update_project(self):
"""Test case for update_project
Update a project # noqa: E501
"""
try:
# Create a project to update
project_name = "Project 2"
project_notes = "Some description"
project = self.api.create_project(
{
"data": {
"name": project_name,
"notes": project_notes,
"team": self.TEAM_GID
}
},
{}
)
# Update project
updated_project_name = "Project 2 - Updated"
updated_project_description = "Some description updated"
project = self.api.update_project(
{
"data": {
"name": updated_project_name,
"notes": updated_project_description,
}
},
project["gid"],
{}
)
# Check that the project has been updated
self.assertIsNotNone(project)
self.assertEqual(project["name"], updated_project_name)
self.assertEqual(project["notes"], updated_project_description)
# Delete project
self.api.delete_project(project["gid"])
except ApiException as e:
raise Exception(e)
|
class TestProjectsApi(unittest.TestCase):
'''ProjectsApi unit test stubs'''
@classmethod
def setUpClass(cls):
pass
@classmethod
def tearDownClass(cls):
pass
def test_create_project(self):
'''Test case for create_project
Create a project # noqa: E501
'''
pass
def test_delete_project(self):
'''Test case for delete_project
Delete a project # noqa: E501
'''
pass
def test_get_project(self):
'''Test case for get_project
Get a project # noqa: E501
'''
pass
def test_get_project_with_opt_fields(self):
'''Test case for get_project with opt_fields
Get a project with opt_fields # noqa: E501
'''
pass
def test_get_projects(self):
'''Test case for get_projects
Get multiple projects # noqa: E501
'''
pass
def test_get_projects_with_opt_fields(self):
'''Test case for get_projects with opt_fields
Get multiple projects with opt_fields # noqa: E501
'''
pass
def test_update_project(self):
'''Test case for update_project
Update a project # noqa: E501
'''
pass
| 12 | 8 | 26 | 2 | 20 | 4 | 2 | 0.22 | 1 | 6 | 4 | 0 | 7 | 0 | 9 | 81 | 245 | 27 | 179 | 41 | 167 | 40 | 116 | 30 | 106 | 3 | 2 | 2 | 20 |
7,478 |
Asana/python-asana
|
Asana_python-asana/build_tests/test_tasks_api.py
|
build_tests.test_tasks_api.TestTasksApi
|
class TestTasksApi(unittest.TestCase):
"""TasksApi unit test stubs"""
@classmethod
def setUpClass(cls):
load_dotenv()
# Load environment variables
cls.TEXT_CUSTOM_FIELD_GID = os.environ["TEXT_CUSTOM_FIELD_GID"]
cls.USER_GID = os.environ["USER_GID"]
cls.WORKSPACE_GID = os.environ["WORKSPACE_GID"]
configuration = asana.Configuration()
configuration.access_token = os.environ["PERSONAL_ACCESS_TOKEN"]
api_client = asana.ApiClient(configuration)
cls.api = TasksApi(api_client) # noqa: E501
# Create a global task used for testing
try:
cls.task_name = "Task 1"
cls.task_notes = "Some description"
cls.task = cls.api.create_task(
{
"data": {
"assignee": cls.USER_GID,
"name": cls.task_name,
"notes": cls.task_notes,
"workspace": cls.WORKSPACE_GID,
}
},
{}
)
except ApiException as e:
raise Exception(e)
@classmethod
def tearDownClass(cls):
try:
# Delete global task
cls.api.delete_task(cls.task["gid"])
except ApiException as e:
raise Exception(e)
def test_create_task(self):
"""Test case for create_task
Create a task # noqa: E501
"""
try:
# Create a task
task_name = "Task 2"
task_notes = "Some description"
task = self.api.create_task(
{
"data": {
"name": task_name,
"notes": task_notes,
"workspace": self.WORKSPACE_GID,
}
},
{}
)
# Check that the task was created
self.assertIsNotNone(task)
self.assertEqual(task["name"], task_name)
self.assertEqual(task["notes"], task_notes)
# Delete task
self.api.delete_task(task["gid"])
except ApiException as e:
raise Exception(e)
def test_delete_task(self):
"""Test case for delete_task
Delete a task # noqa: E501
"""
try:
# Create a task to delete
task_name = "Task 2"
task_notes = "Some description"
task = self.api.create_task(
{
"data": {
"name": task_name,
"notes": task_notes,
"workspace": self.WORKSPACE_GID,
}
},
{}
)
# Delete task
deleted_task = self.api.delete_task(task["gid"])
# Check that the task got deleted
self.assertEqual(deleted_task, {})
except ApiException as e:
raise Exception(e)
def test_get_task(self):
"""Test case for get_task
Get a task # noqa: E501
"""
try:
# Get a task
task = self.api.get_task(self.task["gid"], {})
# Check task response
self.assertIsNotNone(task)
self.assertEqual(task["name"], self.task_name)
self.assertEqual(task["notes"], self.task_notes)
self.assertEqual(task["resource_subtype"], "default_task")
self.assertIsNone(task["actual_time_minutes"])
self.assertEqual(task["assignee"]["gid"], self.USER_GID)
self.assertIsNotNone(task["assignee_status"])
self.assertEqual(task["completed"], False)
self.assertIsNone(task["completed_at"])
self.assertTrue(task["custom_fields"].__class__ == list)
self.assertIsNone(task["due_at"])
self.assertIsNone(task["due_on"])
self.assertTrue(task["followers"].__class__ == list)
self.assertFalse(task["hearted"])
self.assertTrue(task["hearts"].__class__ == list)
self.assertFalse(task["liked"])
self.assertTrue(task["likes"].__class__ == list)
self.assertTrue(task["memberships"].__class__ == list)
self.assertIsNotNone(task["modified_at"])
self.assertEqual(task["num_hearts"], 0)
self.assertEqual(task["num_likes"], 0)
self.assertIsNone(task["parent"])
self.assertIsNotNone(task["permalink_url"])
self.assertTrue(task["projects"].__class__ == list)
self.assertEqual(task["resource_type"], "task")
self.assertIsNone(task["start_at"])
self.assertIsNone(task["start_on"])
self.assertTrue(task["tags"].__class__ == list)
self.assertTrue(task["workspace"].__class__ == dict)
except ApiException as e:
raise Exception(e)
def test_get_task_with_opt_fields(self):
"""Test case for get_task with opt_fields
Get a task with opt_fields # noqa: E501
"""
try:
# Get a task
task = self.api.get_task(self.task["gid"], {'opt_fields': "name,notes"})
# Check task response
self.assertIsNotNone(task)
self.assertEqual(task["name"], self.task_name)
self.assertEqual(task["notes"], self.task_notes)
except ApiException as e:
raise Exception(e)
def test_get_tasks(self):
"""Test case for get_tasks
Get multiple tasks # noqa: E501
"""
try:
# Get multiple tasks
tasks = self.api.get_tasks({
'assignee': self.USER_GID,
'workspace': self.WORKSPACE_GID,
})
for task in tasks:
self.assertIsNotNone(task["gid"])
self.assertIsNotNone(task["name"])
self.assertIsNotNone(task["resource_type"])
self.assertIsNotNone(task["resource_subtype"])
except ApiException as e:
raise Exception(e)
def test_get_tasks_with_opt_fields(self):
"""Test case for get_tasks with opt_fields
Get multiple tasks with opt_fields # noqa: E501
"""
try:
# Get multiple tasks
tasks = self.api.get_tasks({
'limit': 100,
'assignee': self.USER_GID,
'workspace': self.WORKSPACE_GID,
'opt_fields': "actual_time_minutes,approval_status,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_hearts,num_likes,num_subtasks,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name,resource_type",
})
for task in tasks:
self.assertIsNotNone(task)
if self.task_name in task["name"]:
self.assertEqual(task["name"], self.task_name)
self.assertEqual(task["notes"], self.task_notes)
self.assertEqual(task["resource_subtype"], "default_task")
self.assertIsNone(task["actual_time_minutes"])
self.assertEqual(task["assignee"]["gid"], self.USER_GID)
self.assertIsNotNone(task["assignee_status"])
self.assertEqual(task["completed"], False)
self.assertIsNone(task["completed_at"])
self.assertTrue(task["custom_fields"].__class__ == list)
self.assertIsNone(task["due_at"])
self.assertIsNone(task["due_on"])
self.assertTrue(task["followers"].__class__ == list)
self.assertFalse(task["hearted"])
self.assertTrue(task["hearts"].__class__ == list)
self.assertFalse(task["liked"])
self.assertTrue(task["likes"].__class__ == list)
self.assertTrue(task["memberships"].__class__ == list)
self.assertIsNotNone(task["modified_at"])
self.assertEqual(task["num_hearts"], 0)
self.assertEqual(task["num_likes"], 0)
self.assertIsNone(task["parent"])
self.assertIsNotNone(task["permalink_url"])
self.assertTrue(task["projects"].__class__ == list)
self.assertEqual(task["resource_type"], "task")
self.assertIsNone(task["start_at"])
self.assertIsNone(task["start_on"])
self.assertTrue(task["tags"].__class__ == list)
self.assertTrue(task["workspace"].__class__ == dict)
except ApiException as e:
raise Exception(e)
def test_search_tasks_for_workspace(self):
"""Test case for search_tasks_for_workspace
Search tasks in a workspace # noqa: E501
"""
try:
search_text = "task" # Make sure this is lower case
opts = {
'text': search_text,
'completed': False,
'opt_fields': "name, notes"
}
tasks = self.api.search_tasks_for_workspace(self.WORKSPACE_GID, opts)
# Check that there are tasks returned
count = 0
for task in tasks:
count += 1
# Check that the results contain the search text
self.assertTrue(search_text in task["name"].lower() or search_text in task["notes"].lower())
# Check that there are results
self.assertIsNotNone(tasks)
# We know that there is at least one result for this search.
# Assert greater than or equal to because other tests or modifications might increase this search result.
self.assertGreaterEqual(count, 1)
# Delete task
self.api.delete_task(task["gid"])
except ApiException as e:
raise Exception(e)
def test_search_tasks_for_workspace_with_custom_field_parameter(self):
"""Test case for search_tasks_for_workspace with custom field parameter
Search tasks in a workspace with custom field parameter # noqa: E501
"""
try:
search_text = "custom_value" # Make sure this is lower case
opts = {
f'custom_fields.{self.TEXT_CUSTOM_FIELD_GID}.value': search_text,
'opt_fields': "custom_fields"
}
tasks = self.api.search_tasks_for_workspace(self.WORKSPACE_GID, opts)
# Check that the search result only returns tasks with the custom field value of search_text
for task in tasks:
for custom_field in task["custom_fields"]:
if custom_field["gid"] == self.TEXT_CUSTOM_FIELD_GID:
self.assertEqual(custom_field["text_value"].lower(), search_text)
except ApiException as e:
raise Exception(e)
def test_update_task(self):
"""Test case for update_task
Update a task # noqa: E501
"""
try:
# Create a task to update
task_name = "Task 2"
task_notes = "Some description"
task = self.api.create_task(
{
"data": {
"name": task_name,
"notes": task_notes,
"workspace": self.WORKSPACE_GID,
}
},
{}
)
# Update task
updated_task_name = "Task 2 - Updated"
updated_task_description = "Some description updated"
task = self.api.update_task(
{
"data": {
"name": updated_task_name,
"notes": updated_task_description,
}
},
task["gid"],
{}
)
# Check that the task has been updated
self.assertIsNotNone(task)
self.assertEqual(task["name"], updated_task_name)
self.assertEqual(task["notes"], updated_task_description)
# Delete task
self.api.delete_task(task["gid"])
except ApiException as e:
raise Exception(e)
|
class TestTasksApi(unittest.TestCase):
'''TasksApi unit test stubs'''
@classmethod
def setUpClass(cls):
pass
@classmethod
def tearDownClass(cls):
pass
def test_create_task(self):
'''Test case for create_task
Create a task # noqa: E501
'''
pass
def test_delete_task(self):
'''Test case for delete_task
Delete a task # noqa: E501
'''
pass
def test_get_task(self):
'''Test case for get_task
Get a task # noqa: E501
'''
pass
def test_get_task_with_opt_fields(self):
'''Test case for get_task with opt_fields
Get a task with opt_fields # noqa: E501
'''
pass
def test_get_tasks(self):
'''Test case for get_tasks
Get multiple tasks # noqa: E501
'''
pass
def test_get_tasks_with_opt_fields(self):
'''Test case for get_tasks with opt_fields
Get multiple tasks with opt_fields # noqa: E501
'''
pass
def test_search_tasks_for_workspace(self):
'''Test case for search_tasks_for_workspace
Search tasks in a workspace # noqa: E501
'''
pass
def test_search_tasks_for_workspace_with_custom_field_parameter(self):
'''Test case for search_tasks_for_workspace with custom field parameter
Search tasks in a workspace with custom field parameter # noqa: E501
'''
pass
def test_update_task(self):
'''Test case for update_task
Update a task # noqa: E501
'''
pass
| 14 | 10 | 27 | 2 | 21 | 5 | 3 | 0.25 | 1 | 7 | 4 | 0 | 9 | 1 | 11 | 83 | 315 | 30 | 231 | 56 | 217 | 57 | 168 | 42 | 156 | 5 | 2 | 4 | 29 |
7,479 |
Asana/python-asana
|
Asana_python-asana/asana/api/organization_exports_api.py
|
asana.api.organization_exports_api.OrganizationExportsApi
|
class OrganizationExportsApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def create_organization_export(self, body, opts, **kwargs): # noqa: E501
"""Create an organization export request # noqa: E501
This method creates a request to export an Organization. Asana will complete the export at some point after you create the request. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_organization_export(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The organization to export. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: OrganizationExportResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.create_organization_export_with_http_info(body, opts, **kwargs) # noqa: E501
else:
(data) = self.create_organization_export_with_http_info(body, opts, **kwargs) # noqa: E501
return data
def create_organization_export_with_http_info(self, body, opts, **kwargs): # noqa: E501
"""Create an organization export request # noqa: E501
This method creates a request to export an Organization. Asana will complete the export at some point after you create the request. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_organization_export_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The organization to export. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: OrganizationExportResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create_organization_export" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `create_organization_export`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/organization_exports', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/organization_exports', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/organization_exports', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_organization_export(self, organization_export_gid, opts, **kwargs): # noqa: E501
"""Get details on an org export request # noqa: E501
Returns details of a previously-requested Organization export. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_organization_export(organization_export_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str organization_export_gid: Globally unique identifier for the organization export. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: OrganizationExportResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_organization_export_with_http_info(organization_export_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_organization_export_with_http_info(organization_export_gid, opts, **kwargs) # noqa: E501
return data
def get_organization_export_with_http_info(self, organization_export_gid, opts, **kwargs): # noqa: E501
"""Get details on an org export request # noqa: E501
Returns details of a previously-requested Organization export. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_organization_export_with_http_info(organization_export_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str organization_export_gid: Globally unique identifier for the organization export. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: OrganizationExportResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_organization_export" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'organization_export_gid' is set
if (organization_export_gid is None):
raise ValueError("Missing the required parameter `organization_export_gid` when calling `get_organization_export`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['organization_export_gid'] = organization_export_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/organization_exports/{organization_export_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/organization_exports/{organization_export_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/organization_exports/{organization_export_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
class OrganizationExportsApi(object):
'''NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
'''
def __init__(self, api_client=None):
pass
def create_organization_export(self, body, opts, **kwargs):
'''Create an organization export request # noqa: E501
This method creates a request to export an Organization. Asana will complete the export at some point after you create the request. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_organization_export(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The organization to export. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: OrganizationExportResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def create_organization_export_with_http_info(self, body, opts, **kwargs):
'''Create an organization export request # noqa: E501
This method creates a request to export an Organization. Asana will complete the export at some point after you create the request. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_organization_export_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The organization to export. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: OrganizationExportResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_organization_export(self, organization_export_gid, opts, **kwargs):
'''Get details on an org export request # noqa: E501
Returns details of a previously-requested Organization export. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_organization_export(organization_export_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str organization_export_gid: Globally unique identifier for the organization export. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: OrganizationExportResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_organization_export_with_http_info(self, organization_export_gid, opts, **kwargs):
'''Get details on an org export request # noqa: E501
Returns details of a previously-requested Organization export. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_organization_export_with_http_info(organization_export_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str organization_export_gid: Globally unique identifier for the organization export. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: OrganizationExportResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
| 6 | 5 | 56 | 6 | 38 | 17 | 4 | 0.46 | 1 | 3 | 1 | 0 | 5 | 1 | 5 | 5 | 292 | 37 | 190 | 33 | 184 | 88 | 87 | 33 | 81 | 8 | 1 | 2 | 22 |
7,480 |
Asana/python-asana
|
Asana_python-asana/asana/api/time_tracking_entries_api.py
|
asana.api.time_tracking_entries_api.TimeTrackingEntriesApi
|
class TimeTrackingEntriesApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def create_time_tracking_entry(self, body, task_gid, opts, **kwargs): # noqa: E501
"""Create a time tracking entry # noqa: E501
Creates a time tracking entry on a given task. Returns the record of the newly created time tracking entry. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_time_tracking_entry(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the time tracking entry. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TimeTrackingEntryBaseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.create_time_tracking_entry_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.create_time_tracking_entry_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501
return data
def create_time_tracking_entry_with_http_info(self, body, task_gid, opts, **kwargs): # noqa: E501
"""Create a time tracking entry # noqa: E501
Creates a time tracking entry on a given task. Returns the record of the newly created time tracking entry. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_time_tracking_entry_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the time tracking entry. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TimeTrackingEntryBaseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create_time_tracking_entry" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `create_time_tracking_entry`") # noqa: E501
# verify the required parameter 'task_gid' is set
if (task_gid is None):
raise ValueError("Missing the required parameter `task_gid` when calling `create_time_tracking_entry`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_gid'] = task_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks/{task_gid}/time_tracking_entries', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/tasks/{task_gid}/time_tracking_entries', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/tasks/{task_gid}/time_tracking_entries', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def delete_time_tracking_entry(self, time_tracking_entry_gid, **kwargs): # noqa: E501
"""Delete a time tracking entry # noqa: E501
A specific, existing time tracking entry can be deleted by making a `DELETE` request on the URL for that time tracking entry. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_time_tracking_entry(time_tracking_entry_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str time_tracking_entry_gid: Globally unique identifier for the time tracking entry. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.delete_time_tracking_entry_with_http_info(time_tracking_entry_gid, **kwargs) # noqa: E501
else:
(data) = self.delete_time_tracking_entry_with_http_info(time_tracking_entry_gid, **kwargs) # noqa: E501
return data
def delete_time_tracking_entry_with_http_info(self, time_tracking_entry_gid, **kwargs): # noqa: E501
"""Delete a time tracking entry # noqa: E501
A specific, existing time tracking entry can be deleted by making a `DELETE` request on the URL for that time tracking entry. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_time_tracking_entry_with_http_info(time_tracking_entry_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str time_tracking_entry_gid: Globally unique identifier for the time tracking entry. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_time_tracking_entry" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'time_tracking_entry_gid' is set
if (time_tracking_entry_gid is None):
raise ValueError("Missing the required parameter `time_tracking_entry_gid` when calling `delete_time_tracking_entry`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['time_tracking_entry_gid'] = time_tracking_entry_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/time_tracking_entries/{time_tracking_entry_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/time_tracking_entries/{time_tracking_entry_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/time_tracking_entries/{time_tracking_entry_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_time_tracking_entries_for_task(self, task_gid, opts, **kwargs): # noqa: E501
"""Get time tracking entries for a task # noqa: E501
Returns time tracking entries for a given task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_time_tracking_entries_for_task(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TimeTrackingEntryCompactArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_time_tracking_entries_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_time_tracking_entries_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501
return data
def get_time_tracking_entries_for_task_with_http_info(self, task_gid, opts, **kwargs): # noqa: E501
"""Get time tracking entries for a task # noqa: E501
Returns time tracking entries for a given task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_time_tracking_entries_for_task_with_http_info(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TimeTrackingEntryCompactArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_time_tracking_entries_for_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'task_gid' is set
if (task_gid is None):
raise ValueError("Missing the required parameter `task_gid` when calling `get_time_tracking_entries_for_task`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_gid'] = task_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks/{task_gid}/time_tracking_entries', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/tasks/{task_gid}/time_tracking_entries',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/tasks/{task_gid}/time_tracking_entries', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_time_tracking_entry(self, time_tracking_entry_gid, opts, **kwargs): # noqa: E501
"""Get a time tracking entry # noqa: E501
Returns the complete time tracking entry record for a single time tracking entry. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_time_tracking_entry(time_tracking_entry_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str time_tracking_entry_gid: Globally unique identifier for the time tracking entry. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TimeTrackingEntryBaseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_time_tracking_entry_with_http_info(time_tracking_entry_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_time_tracking_entry_with_http_info(time_tracking_entry_gid, opts, **kwargs) # noqa: E501
return data
def get_time_tracking_entry_with_http_info(self, time_tracking_entry_gid, opts, **kwargs): # noqa: E501
"""Get a time tracking entry # noqa: E501
Returns the complete time tracking entry record for a single time tracking entry. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_time_tracking_entry_with_http_info(time_tracking_entry_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str time_tracking_entry_gid: Globally unique identifier for the time tracking entry. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TimeTrackingEntryBaseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_time_tracking_entry" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'time_tracking_entry_gid' is set
if (time_tracking_entry_gid is None):
raise ValueError("Missing the required parameter `time_tracking_entry_gid` when calling `get_time_tracking_entry`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['time_tracking_entry_gid'] = time_tracking_entry_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/time_tracking_entries/{time_tracking_entry_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/time_tracking_entries/{time_tracking_entry_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/time_tracking_entries/{time_tracking_entry_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def update_time_tracking_entry(self, body, time_tracking_entry_gid, opts, **kwargs): # noqa: E501
"""Update a time tracking entry # noqa: E501
A specific, existing time tracking entry can be updated by making a `PUT` request on the URL for that time tracking entry. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated time tracking entry record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_time_tracking_entry(body, time_tracking_entry_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The updated fields for the time tracking entry. (required)
:param str time_tracking_entry_gid: Globally unique identifier for the time tracking entry. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TimeTrackingEntryBaseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.update_time_tracking_entry_with_http_info(body, time_tracking_entry_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.update_time_tracking_entry_with_http_info(body, time_tracking_entry_gid, opts, **kwargs) # noqa: E501
return data
def update_time_tracking_entry_with_http_info(self, body, time_tracking_entry_gid, opts, **kwargs): # noqa: E501
"""Update a time tracking entry # noqa: E501
A specific, existing time tracking entry can be updated by making a `PUT` request on the URL for that time tracking entry. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated time tracking entry record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_time_tracking_entry_with_http_info(body, time_tracking_entry_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The updated fields for the time tracking entry. (required)
:param str time_tracking_entry_gid: Globally unique identifier for the time tracking entry. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TimeTrackingEntryBaseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method update_time_tracking_entry" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `update_time_tracking_entry`") # noqa: E501
# verify the required parameter 'time_tracking_entry_gid' is set
if (time_tracking_entry_gid is None):
raise ValueError("Missing the required parameter `time_tracking_entry_gid` when calling `update_time_tracking_entry`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['time_tracking_entry_gid'] = time_tracking_entry_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/time_tracking_entries/{time_tracking_entry_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/time_tracking_entries/{time_tracking_entry_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/time_tracking_entries/{time_tracking_entry_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
class TimeTrackingEntriesApi(object):
'''NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
'''
def __init__(self, api_client=None):
pass
def create_time_tracking_entry(self, body, task_gid, opts, **kwargs):
'''Create a time tracking entry # noqa: E501
Creates a time tracking entry on a given task. Returns the record of the newly created time tracking entry. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_time_tracking_entry(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the time tracking entry. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TimeTrackingEntryBaseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def create_time_tracking_entry_with_http_info(self, body, task_gid, opts, **kwargs):
'''Create a time tracking entry # noqa: E501
Creates a time tracking entry on a given task. Returns the record of the newly created time tracking entry. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_time_tracking_entry_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the time tracking entry. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TimeTrackingEntryBaseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def delete_time_tracking_entry(self, time_tracking_entry_gid, **kwargs):
'''Delete a time tracking entry # noqa: E501
A specific, existing time tracking entry can be deleted by making a `DELETE` request on the URL for that time tracking entry. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_time_tracking_entry(time_tracking_entry_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str time_tracking_entry_gid: Globally unique identifier for the time tracking entry. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def delete_time_tracking_entry_with_http_info(self, time_tracking_entry_gid, **kwargs):
'''Delete a time tracking entry # noqa: E501
A specific, existing time tracking entry can be deleted by making a `DELETE` request on the URL for that time tracking entry. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_time_tracking_entry_with_http_info(time_tracking_entry_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str time_tracking_entry_gid: Globally unique identifier for the time tracking entry. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_time_tracking_entries_for_task(self, task_gid, opts, **kwargs):
'''Get time tracking entries for a task # noqa: E501
Returns time tracking entries for a given task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_time_tracking_entries_for_task(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TimeTrackingEntryCompactArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_time_tracking_entries_for_task_with_http_info(self, task_gid, opts, **kwargs):
'''Get time tracking entries for a task # noqa: E501
Returns time tracking entries for a given task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_time_tracking_entries_for_task_with_http_info(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TimeTrackingEntryCompactArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_time_tracking_entry(self, time_tracking_entry_gid, opts, **kwargs):
'''Get a time tracking entry # noqa: E501
Returns the complete time tracking entry record for a single time tracking entry. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_time_tracking_entry(time_tracking_entry_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str time_tracking_entry_gid: Globally unique identifier for the time tracking entry. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TimeTrackingEntryBaseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_time_tracking_entry_with_http_info(self, time_tracking_entry_gid, opts, **kwargs):
'''Get a time tracking entry # noqa: E501
Returns the complete time tracking entry record for a single time tracking entry. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_time_tracking_entry_with_http_info(time_tracking_entry_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str time_tracking_entry_gid: Globally unique identifier for the time tracking entry. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TimeTrackingEntryBaseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def update_time_tracking_entry(self, body, time_tracking_entry_gid, opts, **kwargs):
'''Update a time tracking entry # noqa: E501
A specific, existing time tracking entry can be updated by making a `PUT` request on the URL for that time tracking entry. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated time tracking entry record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_time_tracking_entry(body, time_tracking_entry_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The updated fields for the time tracking entry. (required)
:param str time_tracking_entry_gid: Globally unique identifier for the time tracking entry. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TimeTrackingEntryBaseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def update_time_tracking_entry_with_http_info(self, body, time_tracking_entry_gid, opts, **kwargs):
'''Update a time tracking entry # noqa: E501
A specific, existing time tracking entry can be updated by making a `PUT` request on the URL for that time tracking entry. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated time tracking entry record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_time_tracking_entry_with_http_info(body, time_tracking_entry_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The updated fields for the time tracking entry. (required)
:param str time_tracking_entry_gid: Globally unique identifier for the time tracking entry. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TimeTrackingEntryBaseData
If the method is called asynchronously,
returns the request thread.
'''
pass
| 12 | 11 | 65 | 7 | 43 | 20 | 5 | 0.47 | 1 | 4 | 2 | 0 | 11 | 1 | 11 | 11 | 728 | 89 | 475 | 77 | 463 | 224 | 213 | 77 | 201 | 9 | 1 | 2 | 52 |
7,481 |
Asana/python-asana
|
Asana_python-asana/asana/api/time_periods_api.py
|
asana.api.time_periods_api.TimePeriodsApi
|
class TimePeriodsApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def get_time_period(self, time_period_gid, opts, **kwargs): # noqa: E501
"""Get a time period # noqa: E501
Returns the full record for a single time period. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_time_period(time_period_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str time_period_gid: Globally unique identifier for the time period. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TimePeriodResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_time_period_with_http_info(time_period_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_time_period_with_http_info(time_period_gid, opts, **kwargs) # noqa: E501
return data
def get_time_period_with_http_info(self, time_period_gid, opts, **kwargs): # noqa: E501
"""Get a time period # noqa: E501
Returns the full record for a single time period. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_time_period_with_http_info(time_period_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str time_period_gid: Globally unique identifier for the time period. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TimePeriodResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_time_period" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'time_period_gid' is set
if (time_period_gid is None):
raise ValueError("Missing the required parameter `time_period_gid` when calling `get_time_period`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['time_period_gid'] = time_period_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/time_periods/{time_period_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/time_periods/{time_period_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/time_periods/{time_period_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_time_periods(self, workspace, opts, **kwargs): # noqa: E501
"""Get time periods # noqa: E501
Returns compact time period records. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_time_periods(workspace, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace: Globally unique identifier for the workspace. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param date start_on: ISO 8601 date string
:param date end_on: ISO 8601 date string
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TimePeriodResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_time_periods_with_http_info(workspace, opts, **kwargs) # noqa: E501
else:
(data) = self.get_time_periods_with_http_info(workspace, opts, **kwargs) # noqa: E501
return data
def get_time_periods_with_http_info(self, workspace, opts, **kwargs): # noqa: E501
"""Get time periods # noqa: E501
Returns compact time period records. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_time_periods_with_http_info(workspace, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace: Globally unique identifier for the workspace. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param date start_on: ISO 8601 date string
:param date end_on: ISO 8601 date string
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TimePeriodResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_time_periods" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workspace' is set
if (workspace is None):
raise ValueError("Missing the required parameter `workspace` when calling `get_time_periods`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = {}
query_params = opts
query_params['workspace'] = workspace
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/time_periods', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/time_periods',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/time_periods', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
class TimePeriodsApi(object):
'''NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
'''
def __init__(self, api_client=None):
pass
def get_time_period(self, time_period_gid, opts, **kwargs):
'''Get a time period # noqa: E501
Returns the full record for a single time period. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_time_period(time_period_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str time_period_gid: Globally unique identifier for the time period. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TimePeriodResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_time_period_with_http_info(self, time_period_gid, opts, **kwargs):
'''Get a time period # noqa: E501
Returns the full record for a single time period. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_time_period_with_http_info(time_period_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str time_period_gid: Globally unique identifier for the time period. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TimePeriodResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_time_periods(self, workspace, opts, **kwargs):
'''Get time periods # noqa: E501
Returns compact time period records. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_time_periods(workspace, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace: Globally unique identifier for the workspace. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param date start_on: ISO 8601 date string
:param date end_on: ISO 8601 date string
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TimePeriodResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_time_periods_with_http_info(self, workspace, opts, **kwargs):
'''Get time periods # noqa: E501
Returns compact time period records. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_time_periods_with_http_info(workspace, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace: Globally unique identifier for the workspace. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param date start_on: ISO 8601 date string
:param date end_on: ISO 8601 date string
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TimePeriodResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
| 6 | 5 | 58 | 6 | 38 | 18 | 4 | 0.48 | 1 | 4 | 2 | 0 | 5 | 1 | 5 | 5 | 300 | 36 | 192 | 32 | 186 | 92 | 85 | 32 | 79 | 8 | 1 | 2 | 20 |
7,482 |
Asana/python-asana
|
Asana_python-asana/test/test_project_memberships_api.py
|
test.test_project_memberships_api.TestProjectMembershipsApi
|
class TestProjectMembershipsApi(unittest.TestCase):
"""ProjectMembershipsApi unit test stubs"""
def setUp(self):
self.api = ProjectMembershipsApi() # noqa: E501
def tearDown(self):
pass
def test_get_project_membership(self):
"""Test case for get_project_membership
Get a project membership # noqa: E501
"""
pass
def test_get_project_memberships_for_project(self):
"""Test case for get_project_memberships_for_project
Get memberships from a project # noqa: E501
"""
pass
|
class TestProjectMembershipsApi(unittest.TestCase):
'''ProjectMembershipsApi unit test stubs'''
def setUp(self):
pass
def tearDown(self):
pass
def test_get_project_membership(self):
'''Test case for get_project_membership
Get a project membership # noqa: E501
'''
pass
def test_get_project_memberships_for_project(self):
'''Test case for get_project_memberships_for_project
Get memberships from a project # noqa: E501
'''
pass
| 5 | 3 | 4 | 1 | 2 | 2 | 1 | 0.89 | 1 | 1 | 1 | 0 | 4 | 1 | 4 | 76 | 22 | 6 | 9 | 6 | 4 | 8 | 9 | 6 | 4 | 1 | 2 | 0 | 4 |
7,483 |
Asana/python-asana
|
Asana_python-asana/test/test_project_statuses_api.py
|
test.test_project_statuses_api.TestProjectStatusesApi
|
class TestProjectStatusesApi(unittest.TestCase):
"""ProjectStatusesApi unit test stubs"""
def setUp(self):
self.api = ProjectStatusesApi() # noqa: E501
def tearDown(self):
pass
def test_create_project_status_for_project(self):
"""Test case for create_project_status_for_project
Create a project status # noqa: E501
"""
pass
def test_delete_project_status(self):
"""Test case for delete_project_status
Delete a project status # noqa: E501
"""
pass
def test_get_project_status(self):
"""Test case for get_project_status
Get a project status # noqa: E501
"""
pass
def test_get_project_statuses_for_project(self):
"""Test case for get_project_statuses_for_project
Get statuses from a project # noqa: E501
"""
pass
|
class TestProjectStatusesApi(unittest.TestCase):
'''ProjectStatusesApi unit test stubs'''
def setUp(self):
pass
def tearDown(self):
pass
def test_create_project_status_for_project(self):
'''Test case for create_project_status_for_project
Create a project status # noqa: E501
'''
pass
def test_delete_project_status(self):
'''Test case for delete_project_status
Delete a project status # noqa: E501
'''
pass
def test_get_project_status(self):
'''Test case for get_project_status
Get a project status # noqa: E501
'''
pass
def test_get_project_statuses_for_project(self):
'''Test case for get_project_statuses_for_project
Get statuses from a project # noqa: E501
'''
pass
| 7 | 5 | 5 | 1 | 2 | 2 | 1 | 1.08 | 1 | 1 | 1 | 0 | 6 | 1 | 6 | 78 | 36 | 10 | 13 | 8 | 6 | 14 | 13 | 8 | 6 | 1 | 2 | 0 | 6 |
7,484 |
Asana/python-asana
|
Asana_python-asana/asana/api/project_memberships_api.py
|
asana.api.project_memberships_api.ProjectMembershipsApi
|
class ProjectMembershipsApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def get_project_membership(self, project_membership_gid, opts, **kwargs): # noqa: E501
"""Get a project membership # noqa: E501
Returns the complete project record for a single project membership. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_membership(project_membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_membership_gid: (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectMembershipNormalResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_project_membership_with_http_info(project_membership_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_project_membership_with_http_info(project_membership_gid, opts, **kwargs) # noqa: E501
return data
def get_project_membership_with_http_info(self, project_membership_gid, opts, **kwargs): # noqa: E501
"""Get a project membership # noqa: E501
Returns the complete project record for a single project membership. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_membership_with_http_info(project_membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_membership_gid: (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectMembershipNormalResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_project_membership" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'project_membership_gid' is set
if (project_membership_gid is None):
raise ValueError("Missing the required parameter `project_membership_gid` when calling `get_project_membership`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_membership_gid'] = project_membership_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/project_memberships/{project_membership_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/project_memberships/{project_membership_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/project_memberships/{project_membership_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_project_memberships_for_project(self, project_gid, opts, **kwargs): # noqa: E501
"""Get memberships from a project # noqa: E501
Returns the compact project membership records for the project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_memberships_for_project(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectMembershipCompactArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_project_memberships_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_project_memberships_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501
return data
def get_project_memberships_for_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501
"""Get memberships from a project # noqa: E501
Returns the compact project membership records for the project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_memberships_for_project_with_http_info(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectMembershipCompactArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_project_memberships_for_project" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'project_gid' is set
if (project_gid is None):
raise ValueError("Missing the required parameter `project_gid` when calling `get_project_memberships_for_project`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_gid'] = project_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/projects/{project_gid}/project_memberships', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/projects/{project_gid}/project_memberships',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/projects/{project_gid}/project_memberships', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
class ProjectMembershipsApi(object):
'''NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
'''
def __init__(self, api_client=None):
pass
def get_project_membership(self, project_membership_gid, opts, **kwargs):
'''Get a project membership # noqa: E501
Returns the complete project record for a single project membership. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_membership(project_membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_membership_gid: (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectMembershipNormalResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_project_membership_with_http_info(self, project_membership_gid, opts, **kwargs):
'''Get a project membership # noqa: E501
Returns the complete project record for a single project membership. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_membership_with_http_info(project_membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_membership_gid: (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectMembershipNormalResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_project_memberships_for_project(self, project_gid, opts, **kwargs):
'''Get memberships from a project # noqa: E501
Returns the compact project membership records for the project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_memberships_for_project(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param str user: A string identifying a user. This can either be the string "me", an email, or the gid of a user.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectMembershipCompactArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_project_memberships_for_project_with_http_info(self, project_gid, opts, **kwargs):
'''Get memberships from a project # noqa: E501
Returns the compact project membership records for the project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_memberships_for_project_with_http_info(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param str user: A string identifying a user. This can either be the string "me", an email, or the gid of a user.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectMembershipCompactArray
If the method is called asynchronously,
returns the request thread.
'''
pass
| 6 | 5 | 57 | 6 | 38 | 17 | 4 | 0.47 | 1 | 4 | 2 | 0 | 5 | 1 | 5 | 5 | 298 | 36 | 192 | 32 | 186 | 91 | 85 | 32 | 79 | 8 | 1 | 2 | 20 |
7,485 |
Asana/python-asana
|
Asana_python-asana/asana/api/project_statuses_api.py
|
asana.api.project_statuses_api.ProjectStatusesApi
|
class ProjectStatusesApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def create_project_status_for_project(self, body, project_gid, opts, **kwargs): # noqa: E501
"""Create a project status # noqa: E501
*Deprecated: new integrations should prefer the `/status_updates` route.* Creates a new status update on the project. Returns the full record of the newly created project status update. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_project_status_for_project(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The project status to create. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectStatusResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.create_project_status_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.create_project_status_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501
return data
def create_project_status_for_project_with_http_info(self, body, project_gid, opts, **kwargs): # noqa: E501
"""Create a project status # noqa: E501
*Deprecated: new integrations should prefer the `/status_updates` route.* Creates a new status update on the project. Returns the full record of the newly created project status update. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_project_status_for_project_with_http_info(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The project status to create. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectStatusResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create_project_status_for_project" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `create_project_status_for_project`") # noqa: E501
# verify the required parameter 'project_gid' is set
if (project_gid is None):
raise ValueError("Missing the required parameter `project_gid` when calling `create_project_status_for_project`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_gid'] = project_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/projects/{project_gid}/project_statuses', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/projects/{project_gid}/project_statuses', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/projects/{project_gid}/project_statuses', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def delete_project_status(self, project_status_gid, **kwargs): # noqa: E501
"""Delete a project status # noqa: E501
*Deprecated: new integrations should prefer the `/status_updates/{status_gid}` route.* Deletes a specific, existing project status update. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_project_status(project_status_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_status_gid: The project status update to get. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.delete_project_status_with_http_info(project_status_gid, **kwargs) # noqa: E501
else:
(data) = self.delete_project_status_with_http_info(project_status_gid, **kwargs) # noqa: E501
return data
def delete_project_status_with_http_info(self, project_status_gid, **kwargs): # noqa: E501
"""Delete a project status # noqa: E501
*Deprecated: new integrations should prefer the `/status_updates/{status_gid}` route.* Deletes a specific, existing project status update. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_project_status_with_http_info(project_status_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_status_gid: The project status update to get. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_project_status" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'project_status_gid' is set
if (project_status_gid is None):
raise ValueError("Missing the required parameter `project_status_gid` when calling `delete_project_status`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_status_gid'] = project_status_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/project_statuses/{project_status_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/project_statuses/{project_status_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/project_statuses/{project_status_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_project_status(self, project_status_gid, opts, **kwargs): # noqa: E501
"""Get a project status # noqa: E501
*Deprecated: new integrations should prefer the `/status_updates/{status_gid}` route.* Returns the complete record for a single status update. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_status(project_status_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_status_gid: The project status update to get. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectStatusResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_project_status_with_http_info(project_status_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_project_status_with_http_info(project_status_gid, opts, **kwargs) # noqa: E501
return data
def get_project_status_with_http_info(self, project_status_gid, opts, **kwargs): # noqa: E501
"""Get a project status # noqa: E501
*Deprecated: new integrations should prefer the `/status_updates/{status_gid}` route.* Returns the complete record for a single status update. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_status_with_http_info(project_status_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_status_gid: The project status update to get. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectStatusResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_project_status" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'project_status_gid' is set
if (project_status_gid is None):
raise ValueError("Missing the required parameter `project_status_gid` when calling `get_project_status`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_status_gid'] = project_status_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/project_statuses/{project_status_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/project_statuses/{project_status_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/project_statuses/{project_status_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_project_statuses_for_project(self, project_gid, opts, **kwargs): # noqa: E501
"""Get statuses from a project # noqa: E501
*Deprecated: new integrations should prefer the `/status_updates` route.* Returns the compact project status update records for all updates on the project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_statuses_for_project(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectStatusResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_project_statuses_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_project_statuses_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501
return data
def get_project_statuses_for_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501
"""Get statuses from a project # noqa: E501
*Deprecated: new integrations should prefer the `/status_updates` route.* Returns the compact project status update records for all updates on the project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_statuses_for_project_with_http_info(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectStatusResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_project_statuses_for_project" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'project_gid' is set
if (project_gid is None):
raise ValueError("Missing the required parameter `project_gid` when calling `get_project_statuses_for_project`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_gid'] = project_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/projects/{project_gid}/project_statuses', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/projects/{project_gid}/project_statuses',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/projects/{project_gid}/project_statuses', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
class ProjectStatusesApi(object):
'''NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
'''
def __init__(self, api_client=None):
pass
def create_project_status_for_project(self, body, project_gid, opts, **kwargs):
'''Create a project status # noqa: E501
*Deprecated: new integrations should prefer the `/status_updates` route.* Creates a new status update on the project. Returns the full record of the newly created project status update. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_project_status_for_project(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The project status to create. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectStatusResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def create_project_status_for_project_with_http_info(self, body, project_gid, opts, **kwargs):
'''Create a project status # noqa: E501
*Deprecated: new integrations should prefer the `/status_updates` route.* Creates a new status update on the project. Returns the full record of the newly created project status update. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_project_status_for_project_with_http_info(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The project status to create. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectStatusResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def delete_project_status(self, project_status_gid, **kwargs):
'''Delete a project status # noqa: E501
*Deprecated: new integrations should prefer the `/status_updates/{status_gid}` route.* Deletes a specific, existing project status update. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_project_status(project_status_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_status_gid: The project status update to get. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def delete_project_status_with_http_info(self, project_status_gid, **kwargs):
'''Delete a project status # noqa: E501
*Deprecated: new integrations should prefer the `/status_updates/{status_gid}` route.* Deletes a specific, existing project status update. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_project_status_with_http_info(project_status_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_status_gid: The project status update to get. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_project_status(self, project_status_gid, opts, **kwargs):
'''Get a project status # noqa: E501
*Deprecated: new integrations should prefer the `/status_updates/{status_gid}` route.* Returns the complete record for a single status update. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_status(project_status_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_status_gid: The project status update to get. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectStatusResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_project_status_with_http_info(self, project_status_gid, opts, **kwargs):
'''Get a project status # noqa: E501
*Deprecated: new integrations should prefer the `/status_updates/{status_gid}` route.* Returns the complete record for a single status update. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_status_with_http_info(project_status_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_status_gid: The project status update to get. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectStatusResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_project_statuses_for_project(self, project_gid, opts, **kwargs):
'''Get statuses from a project # noqa: E501
*Deprecated: new integrations should prefer the `/status_updates` route.* Returns the compact project status update records for all updates on the project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_statuses_for_project(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectStatusResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_project_statuses_for_project_with_http_info(self, project_gid, opts, **kwargs):
'''Get statuses from a project # noqa: E501
*Deprecated: new integrations should prefer the `/status_updates` route.* Returns the compact project status update records for all updates on the project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_statuses_for_project_with_http_info(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectStatusResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
| 10 | 9 | 63 | 7 | 42 | 19 | 5 | 0.46 | 1 | 4 | 2 | 0 | 9 | 1 | 9 | 9 | 580 | 71 | 379 | 62 | 369 | 176 | 169 | 62 | 159 | 9 | 1 | 2 | 41 |
7,486 |
Asana/python-asana
|
Asana_python-asana/asana/api/project_templates_api.py
|
asana.api.project_templates_api.ProjectTemplatesApi
|
class ProjectTemplatesApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def delete_project_template(self, project_template_gid, **kwargs): # noqa: E501
"""Delete a project template # noqa: E501
A specific, existing project template can be deleted by making a DELETE request on the URL for that project template. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_project_template(project_template_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_template_gid: Globally unique identifier for the project template. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.delete_project_template_with_http_info(project_template_gid, **kwargs) # noqa: E501
else:
(data) = self.delete_project_template_with_http_info(project_template_gid, **kwargs) # noqa: E501
return data
def delete_project_template_with_http_info(self, project_template_gid, **kwargs): # noqa: E501
"""Delete a project template # noqa: E501
A specific, existing project template can be deleted by making a DELETE request on the URL for that project template. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_project_template_with_http_info(project_template_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_template_gid: Globally unique identifier for the project template. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_project_template" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'project_template_gid' is set
if (project_template_gid is None):
raise ValueError("Missing the required parameter `project_template_gid` when calling `delete_project_template`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_template_gid'] = project_template_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/project_templates/{project_template_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/project_templates/{project_template_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/project_templates/{project_template_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_project_template(self, project_template_gid, opts, **kwargs): # noqa: E501
"""Get a project template # noqa: E501
Returns the complete project template record for a single project template. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_template(project_template_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_template_gid: Globally unique identifier for the project template. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectTemplateResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_project_template_with_http_info(project_template_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_project_template_with_http_info(project_template_gid, opts, **kwargs) # noqa: E501
return data
def get_project_template_with_http_info(self, project_template_gid, opts, **kwargs): # noqa: E501
"""Get a project template # noqa: E501
Returns the complete project template record for a single project template. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_template_with_http_info(project_template_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_template_gid: Globally unique identifier for the project template. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectTemplateResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_project_template" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'project_template_gid' is set
if (project_template_gid is None):
raise ValueError("Missing the required parameter `project_template_gid` when calling `get_project_template`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_template_gid'] = project_template_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/project_templates/{project_template_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/project_templates/{project_template_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/project_templates/{project_template_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_project_templates(self, opts, **kwargs): # noqa: E501
"""Get multiple project templates # noqa: E501
Returns the compact project template records for all project templates in the given team or workspace. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_templates(async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace: The workspace to filter results on.
:param str team: The team to filter projects on.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectTemplateResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_project_templates_with_http_info(opts, **kwargs) # noqa: E501
else:
(data) = self.get_project_templates_with_http_info(opts, **kwargs) # noqa: E501
return data
def get_project_templates_with_http_info(self, opts, **kwargs): # noqa: E501
"""Get multiple project templates # noqa: E501
Returns the compact project template records for all project templates in the given team or workspace. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_templates_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace: The workspace to filter results on.
:param str team: The team to filter projects on.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectTemplateResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_project_templates" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/project_templates', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/project_templates',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/project_templates', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_project_templates_for_team(self, team_gid, opts, **kwargs): # noqa: E501
"""Get a team's project templates # noqa: E501
Returns the compact project template records for all project templates in the team. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_templates_for_team(team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str team_gid: Globally unique identifier for the team. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectTemplateResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_project_templates_for_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_project_templates_for_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501
return data
def get_project_templates_for_team_with_http_info(self, team_gid, opts, **kwargs): # noqa: E501
"""Get a team's project templates # noqa: E501
Returns the compact project template records for all project templates in the team. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_templates_for_team_with_http_info(team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str team_gid: Globally unique identifier for the team. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectTemplateResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_project_templates_for_team" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'team_gid' is set
if (team_gid is None):
raise ValueError("Missing the required parameter `team_gid` when calling `get_project_templates_for_team`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['team_gid'] = team_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/teams/{team_gid}/project_templates', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/teams/{team_gid}/project_templates',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/teams/{team_gid}/project_templates', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def instantiate_project(self, project_template_gid, opts, **kwargs): # noqa: E501
"""Instantiate a project from a project template # noqa: E501
Creates and returns a job that will asynchronously handle the project instantiation. To form this request, it is recommended to first make a request to [get a project template](/reference/getprojecttemplate). Then, from the response, copy the `gid` from the object in the `requested_dates` array. This `gid` should be used in `requested_dates` to instantiate a project. _Note: The body of this request will differ if your workspace is an organization. To determine if your workspace is an organization, use the [is_organization](/reference/workspaces) parameter._ # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.instantiate_project(project_template_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_template_gid: Globally unique identifier for the project template. (required)
:param dict body: Describes the inputs used for instantiating a project, such as the resulting project's name, which team it should be created in, and values for date variables.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: JobResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.instantiate_project_with_http_info(project_template_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.instantiate_project_with_http_info(project_template_gid, opts, **kwargs) # noqa: E501
return data
def instantiate_project_with_http_info(self, project_template_gid, opts, **kwargs): # noqa: E501
"""Instantiate a project from a project template # noqa: E501
Creates and returns a job that will asynchronously handle the project instantiation. To form this request, it is recommended to first make a request to [get a project template](/reference/getprojecttemplate). Then, from the response, copy the `gid` from the object in the `requested_dates` array. This `gid` should be used in `requested_dates` to instantiate a project. _Note: The body of this request will differ if your workspace is an organization. To determine if your workspace is an organization, use the [is_organization](/reference/workspaces) parameter._ # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.instantiate_project_with_http_info(project_template_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_template_gid: Globally unique identifier for the project template. (required)
:param dict body: Describes the inputs used for instantiating a project, such as the resulting project's name, which team it should be created in, and values for date variables.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: JobResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method instantiate_project" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'project_template_gid' is set
if (project_template_gid is None):
raise ValueError("Missing the required parameter `project_template_gid` when calling `instantiate_project`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_template_gid'] = project_template_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = opts['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/project_templates/{project_template_gid}/instantiateProject', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/project_templates/{project_template_gid}/instantiateProject', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/project_templates/{project_template_gid}/instantiateProject', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
class ProjectTemplatesApi(object):
'''NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
'''
def __init__(self, api_client=None):
pass
def delete_project_template(self, project_template_gid, **kwargs):
'''Delete a project template # noqa: E501
A specific, existing project template can be deleted by making a DELETE request on the URL for that project template. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_project_template(project_template_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_template_gid: Globally unique identifier for the project template. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def delete_project_template_with_http_info(self, project_template_gid, **kwargs):
'''Delete a project template # noqa: E501
A specific, existing project template can be deleted by making a DELETE request on the URL for that project template. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_project_template_with_http_info(project_template_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_template_gid: Globally unique identifier for the project template. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_project_template(self, project_template_gid, opts, **kwargs):
'''Get a project template # noqa: E501
Returns the complete project template record for a single project template. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_template(project_template_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_template_gid: Globally unique identifier for the project template. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectTemplateResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_project_template_with_http_info(self, project_template_gid, opts, **kwargs):
'''Get a project template # noqa: E501
Returns the complete project template record for a single project template. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_template_with_http_info(project_template_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_template_gid: Globally unique identifier for the project template. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectTemplateResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_project_templates(self, opts, **kwargs):
'''Get multiple project templates # noqa: E501
Returns the compact project template records for all project templates in the given team or workspace. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_templates(async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace: The workspace to filter results on.
:param str team: The team to filter projects on.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectTemplateResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_project_templates_with_http_info(self, opts, **kwargs):
'''Get multiple project templates # noqa: E501
Returns the compact project template records for all project templates in the given team or workspace. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_templates_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace: The workspace to filter results on.
:param str team: The team to filter projects on.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectTemplateResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_project_templates_for_team(self, team_gid, opts, **kwargs):
'''Get a team's project templates # noqa: E501
Returns the compact project template records for all project templates in the team. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_templates_for_team(team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str team_gid: Globally unique identifier for the team. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectTemplateResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_project_templates_for_team_with_http_info(self, team_gid, opts, **kwargs):
'''Get a team's project templates # noqa: E501
Returns the compact project template records for all project templates in the team. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_templates_for_team_with_http_info(team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str team_gid: Globally unique identifier for the team. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectTemplateResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def instantiate_project(self, project_template_gid, opts, **kwargs):
'''Instantiate a project from a project template # noqa: E501
Creates and returns a job that will asynchronously handle the project instantiation. To form this request, it is recommended to first make a request to [get a project template](/reference/getprojecttemplate). Then, from the response, copy the `gid` from the object in the `requested_dates` array. This `gid` should be used in `requested_dates` to instantiate a project. _Note: The body of this request will differ if your workspace is an organization. To determine if your workspace is an organization, use the [is_organization](/reference/workspaces) parameter._ # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.instantiate_project(project_template_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_template_gid: Globally unique identifier for the project template. (required)
:param dict body: Describes the inputs used for instantiating a project, such as the resulting project's name, which team it should be created in, and values for date variables.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: JobResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def instantiate_project_with_http_info(self, project_template_gid, opts, **kwargs):
'''Instantiate a project from a project template # noqa: E501
Creates and returns a job that will asynchronously handle the project instantiation. To form this request, it is recommended to first make a request to [get a project template](/reference/getprojecttemplate). Then, from the response, copy the `gid` from the object in the `requested_dates` array. This `gid` should be used in `requested_dates` to instantiate a project. _Note: The body of this request will differ if your workspace is an organization. To determine if your workspace is an organization, use the [is_organization](/reference/workspaces) parameter._ # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.instantiate_project_with_http_info(project_template_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_template_gid: Globally unique identifier for the project template. (required)
:param dict body: Describes the inputs used for instantiating a project, such as the resulting project's name, which team it should be created in, and values for date variables.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: JobResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
| 12 | 11 | 64 | 7 | 43 | 19 | 4 | 0.46 | 1 | 4 | 2 | 0 | 11 | 1 | 11 | 11 | 721 | 88 | 469 | 76 | 457 | 217 | 203 | 76 | 191 | 8 | 1 | 2 | 47 |
7,487 |
Asana/python-asana
|
Asana_python-asana/asana/api/projects_api.py
|
asana.api.projects_api.ProjectsApi
|
class ProjectsApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def add_custom_field_setting_for_project(self, body, project_gid, opts, **kwargs): # noqa: E501
"""Add a custom field to a project # noqa: E501
Custom fields are associated with projects by way of custom field settings. This method creates a setting for the project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_custom_field_setting_for_project(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the custom field setting. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: CustomFieldSettingResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.add_custom_field_setting_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.add_custom_field_setting_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501
return data
def add_custom_field_setting_for_project_with_http_info(self, body, project_gid, opts, **kwargs): # noqa: E501
"""Add a custom field to a project # noqa: E501
Custom fields are associated with projects by way of custom field settings. This method creates a setting for the project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_custom_field_setting_for_project_with_http_info(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the custom field setting. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: CustomFieldSettingResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method add_custom_field_setting_for_project" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `add_custom_field_setting_for_project`") # noqa: E501
# verify the required parameter 'project_gid' is set
if (project_gid is None):
raise ValueError("Missing the required parameter `project_gid` when calling `add_custom_field_setting_for_project`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_gid'] = project_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/projects/{project_gid}/addCustomFieldSetting', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/projects/{project_gid}/addCustomFieldSetting', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/projects/{project_gid}/addCustomFieldSetting', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def add_followers_for_project(self, body, project_gid, opts, **kwargs): # noqa: E501
"""Add followers to a project # noqa: E501
Adds the specified list of users as followers to the project. Followers are a subset of members who have opted in to receive \"tasks added\" notifications for a project. Therefore, if the users are not already members of the project, they will also become members as a result of this operation. Returns the updated project record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_followers_for_project(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the followers being added. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.add_followers_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.add_followers_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501
return data
def add_followers_for_project_with_http_info(self, body, project_gid, opts, **kwargs): # noqa: E501
"""Add followers to a project # noqa: E501
Adds the specified list of users as followers to the project. Followers are a subset of members who have opted in to receive \"tasks added\" notifications for a project. Therefore, if the users are not already members of the project, they will also become members as a result of this operation. Returns the updated project record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_followers_for_project_with_http_info(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the followers being added. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method add_followers_for_project" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `add_followers_for_project`") # noqa: E501
# verify the required parameter 'project_gid' is set
if (project_gid is None):
raise ValueError("Missing the required parameter `project_gid` when calling `add_followers_for_project`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_gid'] = project_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/projects/{project_gid}/addFollowers', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/projects/{project_gid}/addFollowers', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/projects/{project_gid}/addFollowers', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def add_members_for_project(self, body, project_gid, opts, **kwargs): # noqa: E501
"""Add users to a project # noqa: E501
Adds the specified list of users as members of the project. Note that a user being added as a member may also be added as a *follower* as a result of this operation. This is because the user's default notification settings (i.e., in the \"Notifications\" tab of \"My Profile Settings\") will override this endpoint's default behavior of setting \"Tasks added\" notifications to `false`. Returns the updated project record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_members_for_project(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the members being added. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.add_members_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.add_members_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501
return data
def add_members_for_project_with_http_info(self, body, project_gid, opts, **kwargs): # noqa: E501
"""Add users to a project # noqa: E501
Adds the specified list of users as members of the project. Note that a user being added as a member may also be added as a *follower* as a result of this operation. This is because the user's default notification settings (i.e., in the \"Notifications\" tab of \"My Profile Settings\") will override this endpoint's default behavior of setting \"Tasks added\" notifications to `false`. Returns the updated project record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_members_for_project_with_http_info(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the members being added. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method add_members_for_project" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `add_members_for_project`") # noqa: E501
# verify the required parameter 'project_gid' is set
if (project_gid is None):
raise ValueError("Missing the required parameter `project_gid` when calling `add_members_for_project`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_gid'] = project_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/projects/{project_gid}/addMembers', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/projects/{project_gid}/addMembers', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/projects/{project_gid}/addMembers', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def create_project(self, body, opts, **kwargs): # noqa: E501
"""Create a project # noqa: E501
Create a new project in a workspace or team. Every project is required to be created in a specific workspace or organization, and this cannot be changed once set. Note that you can use the `workspace` parameter regardless of whether or not it is an organization. If the workspace for your project is an organization, you must also supply a `team` to share the project with. Returns the full record of the newly created project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_project(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The project to create. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.create_project_with_http_info(body, opts, **kwargs) # noqa: E501
else:
(data) = self.create_project_with_http_info(body, opts, **kwargs) # noqa: E501
return data
def create_project_with_http_info(self, body, opts, **kwargs): # noqa: E501
"""Create a project # noqa: E501
Create a new project in a workspace or team. Every project is required to be created in a specific workspace or organization, and this cannot be changed once set. Note that you can use the `workspace` parameter regardless of whether or not it is an organization. If the workspace for your project is an organization, you must also supply a `team` to share the project with. Returns the full record of the newly created project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_project_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The project to create. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create_project" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `create_project`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/projects', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/projects', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/projects', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def create_project_for_team(self, body, team_gid, opts, **kwargs): # noqa: E501
"""Create a project in a team # noqa: E501
Creates a project shared with the given team. Returns the full record of the newly created project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_project_for_team(body, team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The new project to create. (required)
:param str team_gid: Globally unique identifier for the team. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.create_project_for_team_with_http_info(body, team_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.create_project_for_team_with_http_info(body, team_gid, opts, **kwargs) # noqa: E501
return data
def create_project_for_team_with_http_info(self, body, team_gid, opts, **kwargs): # noqa: E501
"""Create a project in a team # noqa: E501
Creates a project shared with the given team. Returns the full record of the newly created project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_project_for_team_with_http_info(body, team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The new project to create. (required)
:param str team_gid: Globally unique identifier for the team. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create_project_for_team" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `create_project_for_team`") # noqa: E501
# verify the required parameter 'team_gid' is set
if (team_gid is None):
raise ValueError("Missing the required parameter `team_gid` when calling `create_project_for_team`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['team_gid'] = team_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/teams/{team_gid}/projects', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/teams/{team_gid}/projects', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/teams/{team_gid}/projects', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def create_project_for_workspace(self, body, workspace_gid, opts, **kwargs): # noqa: E501
"""Create a project in a workspace # noqa: E501
Creates a project in the workspace. If the workspace for your project is an organization, you must also supply a team to share the project with. Returns the full record of the newly created project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_project_for_workspace(body, workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The new project to create. (required)
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.create_project_for_workspace_with_http_info(body, workspace_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.create_project_for_workspace_with_http_info(body, workspace_gid, opts, **kwargs) # noqa: E501
return data
def create_project_for_workspace_with_http_info(self, body, workspace_gid, opts, **kwargs): # noqa: E501
"""Create a project in a workspace # noqa: E501
Creates a project in the workspace. If the workspace for your project is an organization, you must also supply a team to share the project with. Returns the full record of the newly created project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_project_for_workspace_with_http_info(body, workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The new project to create. (required)
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create_project_for_workspace" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `create_project_for_workspace`") # noqa: E501
# verify the required parameter 'workspace_gid' is set
if (workspace_gid is None):
raise ValueError("Missing the required parameter `workspace_gid` when calling `create_project_for_workspace`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['workspace_gid'] = workspace_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/workspaces/{workspace_gid}/projects', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/workspaces/{workspace_gid}/projects', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/workspaces/{workspace_gid}/projects', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def delete_project(self, project_gid, **kwargs): # noqa: E501
"""Delete a project # noqa: E501
A specific, existing project can be deleted by making a DELETE request on the URL for that project. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_project(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.delete_project_with_http_info(project_gid, **kwargs) # noqa: E501
else:
(data) = self.delete_project_with_http_info(project_gid, **kwargs) # noqa: E501
return data
def delete_project_with_http_info(self, project_gid, **kwargs): # noqa: E501
"""Delete a project # noqa: E501
A specific, existing project can be deleted by making a DELETE request on the URL for that project. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_project_with_http_info(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_project" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'project_gid' is set
if (project_gid is None):
raise ValueError("Missing the required parameter `project_gid` when calling `delete_project`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_gid'] = project_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/projects/{project_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/projects/{project_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/projects/{project_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def duplicate_project(self, project_gid, opts, **kwargs): # noqa: E501
"""Duplicate a project # noqa: E501
Creates and returns a job that will asynchronously handle the duplication. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.duplicate_project(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param dict body: Describes the duplicate's name and the elements that will be duplicated.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: JobResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.duplicate_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.duplicate_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501
return data
def duplicate_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501
"""Duplicate a project # noqa: E501
Creates and returns a job that will asynchronously handle the duplication. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.duplicate_project_with_http_info(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param dict body: Describes the duplicate's name and the elements that will be duplicated.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: JobResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method duplicate_project" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'project_gid' is set
if (project_gid is None):
raise ValueError("Missing the required parameter `project_gid` when calling `duplicate_project`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_gid'] = project_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = opts['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/projects/{project_gid}/duplicate', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/projects/{project_gid}/duplicate', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/projects/{project_gid}/duplicate', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_project(self, project_gid, opts, **kwargs): # noqa: E501
"""Get a project # noqa: E501
Returns the complete project record for a single project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501
return data
def get_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501
"""Get a project # noqa: E501
Returns the complete project record for a single project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_with_http_info(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_project" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'project_gid' is set
if (project_gid is None):
raise ValueError("Missing the required parameter `project_gid` when calling `get_project`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_gid'] = project_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/projects/{project_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/projects/{project_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/projects/{project_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_projects(self, opts, **kwargs): # noqa: E501
"""Get multiple projects # noqa: E501
Returns the compact project records for some filtered set of projects. Use one or more of the parameters provided to filter the projects returned. *Note: This endpoint may timeout for large domains. Try filtering by team!* # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_projects(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param str workspace: The workspace or organization to filter projects on.
:param str team: The team to filter projects on.
:param bool archived: Only return projects whose `archived` field takes on the value of this parameter.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_projects_with_http_info(opts, **kwargs) # noqa: E501
else:
(data) = self.get_projects_with_http_info(opts, **kwargs) # noqa: E501
return data
def get_projects_with_http_info(self, opts, **kwargs): # noqa: E501
"""Get multiple projects # noqa: E501
Returns the compact project records for some filtered set of projects. Use one or more of the parameters provided to filter the projects returned. *Note: This endpoint may timeout for large domains. Try filtering by team!* # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_projects_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param str workspace: The workspace or organization to filter projects on.
:param str team: The team to filter projects on.
:param bool archived: Only return projects whose `archived` field takes on the value of this parameter.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_projects" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/projects', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/projects',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/projects', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_projects_for_task(self, task_gid, opts, **kwargs): # noqa: E501
"""Get projects a task is in # noqa: E501
Returns a compact representation of all of the projects the task is in. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_projects_for_task(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_projects_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_projects_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501
return data
def get_projects_for_task_with_http_info(self, task_gid, opts, **kwargs): # noqa: E501
"""Get projects a task is in # noqa: E501
Returns a compact representation of all of the projects the task is in. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_projects_for_task_with_http_info(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_projects_for_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'task_gid' is set
if (task_gid is None):
raise ValueError("Missing the required parameter `task_gid` when calling `get_projects_for_task`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_gid'] = task_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks/{task_gid}/projects', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/tasks/{task_gid}/projects',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/tasks/{task_gid}/projects', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_projects_for_team(self, team_gid, opts, **kwargs): # noqa: E501
"""Get a team's projects # noqa: E501
Returns the compact project records for all projects in the team. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_projects_for_team(team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str team_gid: Globally unique identifier for the team. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param bool archived: Only return projects whose `archived` field takes on the value of this parameter.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_projects_for_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_projects_for_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501
return data
def get_projects_for_team_with_http_info(self, team_gid, opts, **kwargs): # noqa: E501
"""Get a team's projects # noqa: E501
Returns the compact project records for all projects in the team. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_projects_for_team_with_http_info(team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str team_gid: Globally unique identifier for the team. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param bool archived: Only return projects whose `archived` field takes on the value of this parameter.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_projects_for_team" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'team_gid' is set
if (team_gid is None):
raise ValueError("Missing the required parameter `team_gid` when calling `get_projects_for_team`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['team_gid'] = team_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/teams/{team_gid}/projects', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/teams/{team_gid}/projects',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/teams/{team_gid}/projects', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_projects_for_workspace(self, workspace_gid, opts, **kwargs): # noqa: E501
"""Get all projects in a workspace # noqa: E501
Returns the compact project records for all projects in the workspace. *Note: This endpoint may timeout for large domains. Prefer the `/teams/{team_gid}/projects` endpoint.* # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_projects_for_workspace(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param bool archived: Only return projects whose `archived` field takes on the value of this parameter.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_projects_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_projects_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501
return data
def get_projects_for_workspace_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501
"""Get all projects in a workspace # noqa: E501
Returns the compact project records for all projects in the workspace. *Note: This endpoint may timeout for large domains. Prefer the `/teams/{team_gid}/projects` endpoint.* # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_projects_for_workspace_with_http_info(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param bool archived: Only return projects whose `archived` field takes on the value of this parameter.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_projects_for_workspace" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workspace_gid' is set
if (workspace_gid is None):
raise ValueError("Missing the required parameter `workspace_gid` when calling `get_projects_for_workspace`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['workspace_gid'] = workspace_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/workspaces/{workspace_gid}/projects', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/workspaces/{workspace_gid}/projects',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/workspaces/{workspace_gid}/projects', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_task_counts_for_project(self, project_gid, opts, **kwargs): # noqa: E501
"""Get task count of a project # noqa: E501
Get an object that holds task count fields. **All fields are excluded by default**. You must [opt in](/docs/inputoutput-options) using `opt_fields` to get any information from this endpoint. This endpoint has an additional [rate limit](/docs/rate-limits) and each field counts especially high against our [cost limits](/docs/rate-limits#cost-limits). Milestones are just tasks, so they are included in the `num_tasks`, `num_incomplete_tasks`, and `num_completed_tasks` counts. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_task_counts_for_project(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskCountResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_task_counts_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_task_counts_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501
return data
def get_task_counts_for_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501
"""Get task count of a project # noqa: E501
Get an object that holds task count fields. **All fields are excluded by default**. You must [opt in](/docs/inputoutput-options) using `opt_fields` to get any information from this endpoint. This endpoint has an additional [rate limit](/docs/rate-limits) and each field counts especially high against our [cost limits](/docs/rate-limits#cost-limits). Milestones are just tasks, so they are included in the `num_tasks`, `num_incomplete_tasks`, and `num_completed_tasks` counts. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_task_counts_for_project_with_http_info(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskCountResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_task_counts_for_project" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'project_gid' is set
if (project_gid is None):
raise ValueError("Missing the required parameter `project_gid` when calling `get_task_counts_for_project`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_gid'] = project_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/projects/{project_gid}/task_counts', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/projects/{project_gid}/task_counts', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/projects/{project_gid}/task_counts', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def project_save_as_template(self, body, project_gid, opts, **kwargs): # noqa: E501
"""Create a project template from a project # noqa: E501
Creates and returns a job that will asynchronously handle the project template creation. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.project_save_as_template(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Describes the inputs used for creating a project template, such as the resulting project template's name, which team it should be created in. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: JobResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.project_save_as_template_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.project_save_as_template_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501
return data
def project_save_as_template_with_http_info(self, body, project_gid, opts, **kwargs): # noqa: E501
"""Create a project template from a project # noqa: E501
Creates and returns a job that will asynchronously handle the project template creation. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.project_save_as_template_with_http_info(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Describes the inputs used for creating a project template, such as the resulting project template's name, which team it should be created in. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: JobResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method project_save_as_template" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `project_save_as_template`") # noqa: E501
# verify the required parameter 'project_gid' is set
if (project_gid is None):
raise ValueError("Missing the required parameter `project_gid` when calling `project_save_as_template`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_gid'] = project_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/projects/{project_gid}/saveAsTemplate', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/projects/{project_gid}/saveAsTemplate', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/projects/{project_gid}/saveAsTemplate', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def remove_custom_field_setting_for_project(self, body, project_gid, **kwargs): # noqa: E501
"""Remove a custom field from a project # noqa: E501
Removes a custom field setting from a project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_custom_field_setting_for_project(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the custom field setting being removed. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.remove_custom_field_setting_for_project_with_http_info(body, project_gid, **kwargs) # noqa: E501
else:
(data) = self.remove_custom_field_setting_for_project_with_http_info(body, project_gid, **kwargs) # noqa: E501
return data
def remove_custom_field_setting_for_project_with_http_info(self, body, project_gid, **kwargs): # noqa: E501
"""Remove a custom field from a project # noqa: E501
Removes a custom field setting from a project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_custom_field_setting_for_project_with_http_info(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the custom field setting being removed. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method remove_custom_field_setting_for_project" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `remove_custom_field_setting_for_project`") # noqa: E501
# verify the required parameter 'project_gid' is set
if (project_gid is None):
raise ValueError("Missing the required parameter `project_gid` when calling `remove_custom_field_setting_for_project`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_gid'] = project_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/projects/{project_gid}/removeCustomFieldSetting', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/projects/{project_gid}/removeCustomFieldSetting', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/projects/{project_gid}/removeCustomFieldSetting', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def remove_followers_for_project(self, body, project_gid, opts, **kwargs): # noqa: E501
"""Remove followers from a project # noqa: E501
Removes the specified list of users from following the project, this will not affect project membership status. Returns the updated project record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_followers_for_project(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the followers being removed. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.remove_followers_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.remove_followers_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501
return data
def remove_followers_for_project_with_http_info(self, body, project_gid, opts, **kwargs): # noqa: E501
"""Remove followers from a project # noqa: E501
Removes the specified list of users from following the project, this will not affect project membership status. Returns the updated project record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_followers_for_project_with_http_info(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the followers being removed. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method remove_followers_for_project" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `remove_followers_for_project`") # noqa: E501
# verify the required parameter 'project_gid' is set
if (project_gid is None):
raise ValueError("Missing the required parameter `project_gid` when calling `remove_followers_for_project`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_gid'] = project_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/projects/{project_gid}/removeFollowers', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/projects/{project_gid}/removeFollowers', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/projects/{project_gid}/removeFollowers', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def remove_members_for_project(self, body, project_gid, opts, **kwargs): # noqa: E501
"""Remove users from a project # noqa: E501
Removes the specified list of users from members of the project. Returns the updated project record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_members_for_project(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the members being removed. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.remove_members_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.remove_members_for_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501
return data
def remove_members_for_project_with_http_info(self, body, project_gid, opts, **kwargs): # noqa: E501
"""Remove users from a project # noqa: E501
Removes the specified list of users from members of the project. Returns the updated project record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_members_for_project_with_http_info(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the members being removed. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method remove_members_for_project" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `remove_members_for_project`") # noqa: E501
# verify the required parameter 'project_gid' is set
if (project_gid is None):
raise ValueError("Missing the required parameter `project_gid` when calling `remove_members_for_project`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_gid'] = project_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/projects/{project_gid}/removeMembers', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/projects/{project_gid}/removeMembers', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/projects/{project_gid}/removeMembers', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def update_project(self, body, project_gid, opts, **kwargs): # noqa: E501
"""Update a project # noqa: E501
A specific, existing project can be updated by making a PUT request on the URL for that project. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated project record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_project(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The updated fields for the project. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.update_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.update_project_with_http_info(body, project_gid, opts, **kwargs) # noqa: E501
return data
def update_project_with_http_info(self, body, project_gid, opts, **kwargs): # noqa: E501
"""Update a project # noqa: E501
A specific, existing project can be updated by making a PUT request on the URL for that project. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated project record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_project_with_http_info(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The updated fields for the project. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method update_project" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `update_project`") # noqa: E501
# verify the required parameter 'project_gid' is set
if (project_gid is None):
raise ValueError("Missing the required parameter `project_gid` when calling `update_project`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_gid'] = project_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/projects/{project_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/projects/{project_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/projects/{project_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
class ProjectsApi(object):
'''NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
'''
def __init__(self, api_client=None):
pass
def add_custom_field_setting_for_project(self, body, project_gid, opts, **kwargs):
'''Add a custom field to a project # noqa: E501
Custom fields are associated with projects by way of custom field settings. This method creates a setting for the project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_custom_field_setting_for_project(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the custom field setting. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: CustomFieldSettingResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def add_custom_field_setting_for_project_with_http_info(self, body, project_gid, opts, **kwargs):
'''Add a custom field to a project # noqa: E501
Custom fields are associated with projects by way of custom field settings. This method creates a setting for the project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_custom_field_setting_for_project_with_http_info(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the custom field setting. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: CustomFieldSettingResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def add_followers_for_project(self, body, project_gid, opts, **kwargs):
'''Add followers to a project # noqa: E501
Adds the specified list of users as followers to the project. Followers are a subset of members who have opted in to receive "tasks added" notifications for a project. Therefore, if the users are not already members of the project, they will also become members as a result of this operation. Returns the updated project record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_followers_for_project(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the followers being added. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def add_followers_for_project_with_http_info(self, body, project_gid, opts, **kwargs):
'''Add followers to a project # noqa: E501
Adds the specified list of users as followers to the project. Followers are a subset of members who have opted in to receive "tasks added" notifications for a project. Therefore, if the users are not already members of the project, they will also become members as a result of this operation. Returns the updated project record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_followers_for_project_with_http_info(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the followers being added. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def add_members_for_project(self, body, project_gid, opts, **kwargs):
'''Add users to a project # noqa: E501
Adds the specified list of users as members of the project. Note that a user being added as a member may also be added as a *follower* as a result of this operation. This is because the user's default notification settings (i.e., in the "Notifications" tab of "My Profile Settings") will override this endpoint's default behavior of setting "Tasks added" notifications to `false`. Returns the updated project record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_members_for_project(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the members being added. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def add_members_for_project_with_http_info(self, body, project_gid, opts, **kwargs):
'''Add users to a project # noqa: E501
Adds the specified list of users as members of the project. Note that a user being added as a member may also be added as a *follower* as a result of this operation. This is because the user's default notification settings (i.e., in the "Notifications" tab of "My Profile Settings") will override this endpoint's default behavior of setting "Tasks added" notifications to `false`. Returns the updated project record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_members_for_project_with_http_info(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the members being added. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def create_project(self, body, opts, **kwargs):
'''Create a project # noqa: E501
Create a new project in a workspace or team. Every project is required to be created in a specific workspace or organization, and this cannot be changed once set. Note that you can use the `workspace` parameter regardless of whether or not it is an organization. If the workspace for your project is an organization, you must also supply a `team` to share the project with. Returns the full record of the newly created project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_project(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The project to create. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def create_project_with_http_info(self, body, opts, **kwargs):
'''Create a project # noqa: E501
Create a new project in a workspace or team. Every project is required to be created in a specific workspace or organization, and this cannot be changed once set. Note that you can use the `workspace` parameter regardless of whether or not it is an organization. If the workspace for your project is an organization, you must also supply a `team` to share the project with. Returns the full record of the newly created project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_project_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The project to create. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def create_project_for_team(self, body, team_gid, opts, **kwargs):
'''Create a project in a team # noqa: E501
Creates a project shared with the given team. Returns the full record of the newly created project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_project_for_team(body, team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The new project to create. (required)
:param str team_gid: Globally unique identifier for the team. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def create_project_for_team_with_http_info(self, body, team_gid, opts, **kwargs):
'''Create a project in a team # noqa: E501
Creates a project shared with the given team. Returns the full record of the newly created project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_project_for_team_with_http_info(body, team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The new project to create. (required)
:param str team_gid: Globally unique identifier for the team. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def create_project_for_workspace(self, body, workspace_gid, opts, **kwargs):
'''Create a project in a workspace # noqa: E501
Creates a project in the workspace. If the workspace for your project is an organization, you must also supply a team to share the project with. Returns the full record of the newly created project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_project_for_workspace(body, workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The new project to create. (required)
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def create_project_for_workspace_with_http_info(self, body, workspace_gid, opts, **kwargs):
'''Create a project in a workspace # noqa: E501
Creates a project in the workspace. If the workspace for your project is an organization, you must also supply a team to share the project with. Returns the full record of the newly created project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_project_for_workspace_with_http_info(body, workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The new project to create. (required)
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def delete_project(self, project_gid, **kwargs):
'''Delete a project # noqa: E501
A specific, existing project can be deleted by making a DELETE request on the URL for that project. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_project(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def delete_project_with_http_info(self, project_gid, **kwargs):
'''Delete a project # noqa: E501
A specific, existing project can be deleted by making a DELETE request on the URL for that project. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_project_with_http_info(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def duplicate_project(self, project_gid, opts, **kwargs):
'''Duplicate a project # noqa: E501
Creates and returns a job that will asynchronously handle the duplication. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.duplicate_project(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param dict body: Describes the duplicate's name and the elements that will be duplicated.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: JobResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def duplicate_project_with_http_info(self, project_gid, opts, **kwargs):
'''Duplicate a project # noqa: E501
Creates and returns a job that will asynchronously handle the duplication. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.duplicate_project_with_http_info(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param dict body: Describes the duplicate's name and the elements that will be duplicated.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: JobResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_project(self, project_gid, opts, **kwargs):
'''Get a project # noqa: E501
Returns the complete project record for a single project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_project_with_http_info(self, project_gid, opts, **kwargs):
'''Get a project # noqa: E501
Returns the complete project record for a single project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_project_with_http_info(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_projects(self, opts, **kwargs):
'''Get multiple projects # noqa: E501
Returns the compact project records for some filtered set of projects. Use one or more of the parameters provided to filter the projects returned. *Note: This endpoint may timeout for large domains. Try filtering by team!* # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_projects(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param str workspace: The workspace or organization to filter projects on.
:param str team: The team to filter projects on.
:param bool archived: Only return projects whose `archived` field takes on the value of this parameter.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_projects_with_http_info(self, opts, **kwargs):
'''Get multiple projects # noqa: E501
Returns the compact project records for some filtered set of projects. Use one or more of the parameters provided to filter the projects returned. *Note: This endpoint may timeout for large domains. Try filtering by team!* # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_projects_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param str workspace: The workspace or organization to filter projects on.
:param str team: The team to filter projects on.
:param bool archived: Only return projects whose `archived` field takes on the value of this parameter.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_projects_for_task(self, task_gid, opts, **kwargs):
'''Get projects a task is in # noqa: E501
Returns a compact representation of all of the projects the task is in. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_projects_for_task(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_projects_for_task_with_http_info(self, task_gid, opts, **kwargs):
'''Get projects a task is in # noqa: E501
Returns a compact representation of all of the projects the task is in. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_projects_for_task_with_http_info(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_projects_for_team(self, team_gid, opts, **kwargs):
'''Get a team's projects # noqa: E501
Returns the compact project records for all projects in the team. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_projects_for_team(team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str team_gid: Globally unique identifier for the team. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param bool archived: Only return projects whose `archived` field takes on the value of this parameter.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_projects_for_team_with_http_info(self, team_gid, opts, **kwargs):
'''Get a team's projects # noqa: E501
Returns the compact project records for all projects in the team. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_projects_for_team_with_http_info(team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str team_gid: Globally unique identifier for the team. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param bool archived: Only return projects whose `archived` field takes on the value of this parameter.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_projects_for_workspace(self, workspace_gid, opts, **kwargs):
'''Get all projects in a workspace # noqa: E501
Returns the compact project records for all projects in the workspace. *Note: This endpoint may timeout for large domains. Prefer the `/teams/{team_gid}/projects` endpoint.* # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_projects_for_workspace(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param bool archived: Only return projects whose `archived` field takes on the value of this parameter.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_projects_for_workspace_with_http_info(self, workspace_gid, opts, **kwargs):
'''Get all projects in a workspace # noqa: E501
Returns the compact project records for all projects in the workspace. *Note: This endpoint may timeout for large domains. Prefer the `/teams/{team_gid}/projects` endpoint.* # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_projects_for_workspace_with_http_info(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param bool archived: Only return projects whose `archived` field takes on the value of this parameter.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_task_counts_for_project(self, project_gid, opts, **kwargs):
'''Get task count of a project # noqa: E501
Get an object that holds task count fields. **All fields are excluded by default**. You must [opt in](/docs/inputoutput-options) using `opt_fields` to get any information from this endpoint. This endpoint has an additional [rate limit](/docs/rate-limits) and each field counts especially high against our [cost limits](/docs/rate-limits#cost-limits). Milestones are just tasks, so they are included in the `num_tasks`, `num_incomplete_tasks`, and `num_completed_tasks` counts. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_task_counts_for_project(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskCountResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_task_counts_for_project_with_http_info(self, project_gid, opts, **kwargs):
'''Get task count of a project # noqa: E501
Get an object that holds task count fields. **All fields are excluded by default**. You must [opt in](/docs/inputoutput-options) using `opt_fields` to get any information from this endpoint. This endpoint has an additional [rate limit](/docs/rate-limits) and each field counts especially high against our [cost limits](/docs/rate-limits#cost-limits). Milestones are just tasks, so they are included in the `num_tasks`, `num_incomplete_tasks`, and `num_completed_tasks` counts. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_task_counts_for_project_with_http_info(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskCountResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def project_save_as_template(self, body, project_gid, opts, **kwargs):
'''Create a project template from a project # noqa: E501
Creates and returns a job that will asynchronously handle the project template creation. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.project_save_as_template(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Describes the inputs used for creating a project template, such as the resulting project template's name, which team it should be created in. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: JobResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def project_save_as_template_with_http_info(self, body, project_gid, opts, **kwargs):
'''Create a project template from a project # noqa: E501
Creates and returns a job that will asynchronously handle the project template creation. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.project_save_as_template_with_http_info(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Describes the inputs used for creating a project template, such as the resulting project template's name, which team it should be created in. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: JobResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def remove_custom_field_setting_for_project(self, body, project_gid, **kwargs):
'''Remove a custom field from a project # noqa: E501
Removes a custom field setting from a project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_custom_field_setting_for_project(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the custom field setting being removed. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def remove_custom_field_setting_for_project_with_http_info(self, body, project_gid, **kwargs):
'''Remove a custom field from a project # noqa: E501
Removes a custom field setting from a project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_custom_field_setting_for_project_with_http_info(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the custom field setting being removed. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def remove_followers_for_project(self, body, project_gid, opts, **kwargs):
'''Remove followers from a project # noqa: E501
Removes the specified list of users from following the project, this will not affect project membership status. Returns the updated project record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_followers_for_project(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the followers being removed. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def remove_followers_for_project_with_http_info(self, body, project_gid, opts, **kwargs):
'''Remove followers from a project # noqa: E501
Removes the specified list of users from following the project, this will not affect project membership status. Returns the updated project record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_followers_for_project_with_http_info(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the followers being removed. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def remove_members_for_project(self, body, project_gid, opts, **kwargs):
'''Remove users from a project # noqa: E501
Removes the specified list of users from members of the project. Returns the updated project record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_members_for_project(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the members being removed. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def remove_members_for_project_with_http_info(self, body, project_gid, opts, **kwargs):
'''Remove users from a project # noqa: E501
Removes the specified list of users from members of the project. Returns the updated project record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_members_for_project_with_http_info(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Information about the members being removed. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def update_project(self, body, project_gid, opts, **kwargs):
'''Update a project # noqa: E501
A specific, existing project can be updated by making a PUT request on the URL for that project. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated project record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_project(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The updated fields for the project. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def update_project_with_http_info(self, body, project_gid, opts, **kwargs):
'''Update a project # noqa: E501
A specific, existing project can be updated by making a PUT request on the URL for that project. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated project record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_project_with_http_info(body, project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The updated fields for the project. (required)
:param str project_gid: Globally unique identifier for the project. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: ProjectResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
| 40 | 39 | 70 | 8 | 46 | 22 | 5 | 0.48 | 1 | 4 | 2 | 0 | 39 | 1 | 39 | 39 | 2,777 | 337 | 1,803 | 284 | 1,763 | 873 | 802 | 284 | 762 | 9 | 1 | 2 | 193 |
7,488 |
Asana/python-asana
|
Asana_python-asana/asana/api/rules_api.py
|
asana.api.rules_api.RulesApi
|
class RulesApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def trigger_rule(self, body, rule_trigger_gid, **kwargs): # noqa: E501
"""Trigger a rule # noqa: E501
Trigger a rule which uses an [\"incoming web request\"](/docs/incoming-web-requests) trigger. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.trigger_rule(body, rule_trigger_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: A dictionary of variables accessible from within the rule. (required)
:param str rule_trigger_gid: The ID of the incoming web request trigger. This value is a path parameter that is automatically generated for the API endpoint. (required)
:return: RuleTriggerResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.trigger_rule_with_http_info(body, rule_trigger_gid, **kwargs) # noqa: E501
else:
(data) = self.trigger_rule_with_http_info(body, rule_trigger_gid, **kwargs) # noqa: E501
return data
def trigger_rule_with_http_info(self, body, rule_trigger_gid, **kwargs): # noqa: E501
"""Trigger a rule # noqa: E501
Trigger a rule which uses an [\"incoming web request\"](/docs/incoming-web-requests) trigger. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.trigger_rule_with_http_info(body, rule_trigger_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: A dictionary of variables accessible from within the rule. (required)
:param str rule_trigger_gid: The ID of the incoming web request trigger. This value is a path parameter that is automatically generated for the API endpoint. (required)
:return: RuleTriggerResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method trigger_rule" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `trigger_rule`") # noqa: E501
# verify the required parameter 'rule_trigger_gid' is set
if (rule_trigger_gid is None):
raise ValueError("Missing the required parameter `rule_trigger_gid` when calling `trigger_rule`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['rule_trigger_gid'] = rule_trigger_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/rule_triggers/{rule_trigger_gid}/run', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/rule_triggers/{rule_trigger_gid}/run', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/rule_triggers/{rule_trigger_gid}/run', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
class RulesApi(object):
'''NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
'''
def __init__(self, api_client=None):
pass
def trigger_rule(self, body, rule_trigger_gid, **kwargs):
'''Trigger a rule # noqa: E501
Trigger a rule which uses an ["incoming web request"](/docs/incoming-web-requests) trigger. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.trigger_rule(body, rule_trigger_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: A dictionary of variables accessible from within the rule. (required)
:param str rule_trigger_gid: The ID of the incoming web request trigger. This value is a path parameter that is automatically generated for the API endpoint. (required)
:return: RuleTriggerResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def trigger_rule_with_http_info(self, body, rule_trigger_gid, **kwargs):
'''Trigger a rule # noqa: E501
Trigger a rule which uses an ["incoming web request"](/docs/incoming-web-requests) trigger. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.trigger_rule_with_http_info(body, rule_trigger_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: A dictionary of variables accessible from within the rule. (required)
:param str rule_trigger_gid: The ID of the incoming web request trigger. This value is a path parameter that is automatically generated for the API endpoint. (required)
:return: RuleTriggerResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
| 4 | 3 | 49 | 5 | 33 | 15 | 4 | 0.5 | 1 | 3 | 1 | 0 | 3 | 1 | 3 | 3 | 156 | 20 | 100 | 18 | 96 | 50 | 48 | 18 | 44 | 9 | 1 | 2 | 13 |
7,489 |
Asana/python-asana
|
Asana_python-asana/asana/api/sections_api.py
|
asana.api.sections_api.SectionsApi
|
class SectionsApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def add_task_for_section(self, section_gid, opts, **kwargs): # noqa: E501
"""Add task to section # noqa: E501
Add a task to a specific, existing section. This will remove the task from other sections of the project. The task will be inserted at the top of a section unless an insert_before or insert_after parameter is declared. This does not work for separators (tasks with the resource_subtype of section). # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_task_for_section(section_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str section_gid: The globally unique identifier for the section. (required)
:param dict body: The task and optionally the insert location.
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.add_task_for_section_with_http_info(section_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.add_task_for_section_with_http_info(section_gid, opts, **kwargs) # noqa: E501
return data
def add_task_for_section_with_http_info(self, section_gid, opts, **kwargs): # noqa: E501
"""Add task to section # noqa: E501
Add a task to a specific, existing section. This will remove the task from other sections of the project. The task will be inserted at the top of a section unless an insert_before or insert_after parameter is declared. This does not work for separators (tasks with the resource_subtype of section). # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_task_for_section_with_http_info(section_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str section_gid: The globally unique identifier for the section. (required)
:param dict body: The task and optionally the insert location.
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method add_task_for_section" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'section_gid' is set
if (section_gid is None):
raise ValueError("Missing the required parameter `section_gid` when calling `add_task_for_section`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['section_gid'] = section_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = opts['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/sections/{section_gid}/addTask', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/sections/{section_gid}/addTask', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/sections/{section_gid}/addTask', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def create_section_for_project(self, project_gid, opts, **kwargs): # noqa: E501
"""Create a section in a project # noqa: E501
Creates a new section in a project. Returns the full record of the newly created section. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_section_for_project(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param dict body: The section to create.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: SectionResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.create_section_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.create_section_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501
return data
def create_section_for_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501
"""Create a section in a project # noqa: E501
Creates a new section in a project. Returns the full record of the newly created section. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_section_for_project_with_http_info(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param dict body: The section to create.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: SectionResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create_section_for_project" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'project_gid' is set
if (project_gid is None):
raise ValueError("Missing the required parameter `project_gid` when calling `create_section_for_project`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_gid'] = project_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = opts['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/projects/{project_gid}/sections', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/projects/{project_gid}/sections', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/projects/{project_gid}/sections', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def delete_section(self, section_gid, **kwargs): # noqa: E501
"""Delete a section # noqa: E501
A specific, existing section can be deleted by making a DELETE request on the URL for that section. Note that sections must be empty to be deleted. The last remaining section cannot be deleted. Returns an empty data block. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_section(section_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str section_gid: The globally unique identifier for the section. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.delete_section_with_http_info(section_gid, **kwargs) # noqa: E501
else:
(data) = self.delete_section_with_http_info(section_gid, **kwargs) # noqa: E501
return data
def delete_section_with_http_info(self, section_gid, **kwargs): # noqa: E501
"""Delete a section # noqa: E501
A specific, existing section can be deleted by making a DELETE request on the URL for that section. Note that sections must be empty to be deleted. The last remaining section cannot be deleted. Returns an empty data block. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_section_with_http_info(section_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str section_gid: The globally unique identifier for the section. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_section" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'section_gid' is set
if (section_gid is None):
raise ValueError("Missing the required parameter `section_gid` when calling `delete_section`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['section_gid'] = section_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/sections/{section_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/sections/{section_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/sections/{section_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_section(self, section_gid, opts, **kwargs): # noqa: E501
"""Get a section # noqa: E501
Returns the complete record for a single section. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_section(section_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str section_gid: The globally unique identifier for the section. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: SectionResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_section_with_http_info(section_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_section_with_http_info(section_gid, opts, **kwargs) # noqa: E501
return data
def get_section_with_http_info(self, section_gid, opts, **kwargs): # noqa: E501
"""Get a section # noqa: E501
Returns the complete record for a single section. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_section_with_http_info(section_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str section_gid: The globally unique identifier for the section. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: SectionResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_section" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'section_gid' is set
if (section_gid is None):
raise ValueError("Missing the required parameter `section_gid` when calling `get_section`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['section_gid'] = section_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/sections/{section_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/sections/{section_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/sections/{section_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_sections_for_project(self, project_gid, opts, **kwargs): # noqa: E501
"""Get sections in a project # noqa: E501
Returns the compact records for all sections in the specified project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_sections_for_project(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: SectionResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_sections_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_sections_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501
return data
def get_sections_for_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501
"""Get sections in a project # noqa: E501
Returns the compact records for all sections in the specified project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_sections_for_project_with_http_info(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: SectionResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_sections_for_project" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'project_gid' is set
if (project_gid is None):
raise ValueError("Missing the required parameter `project_gid` when calling `get_sections_for_project`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_gid'] = project_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/projects/{project_gid}/sections', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/projects/{project_gid}/sections',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/projects/{project_gid}/sections', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def insert_section_for_project(self, project_gid, opts, **kwargs): # noqa: E501
"""Move or Insert sections # noqa: E501
Move sections relative to each other. One of `before_section` or `after_section` is required. Sections cannot be moved between projects. Returns an empty data block. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.insert_section_for_project(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param dict body: The section's move action.
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.insert_section_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.insert_section_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501
return data
def insert_section_for_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501
"""Move or Insert sections # noqa: E501
Move sections relative to each other. One of `before_section` or `after_section` is required. Sections cannot be moved between projects. Returns an empty data block. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.insert_section_for_project_with_http_info(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param dict body: The section's move action.
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method insert_section_for_project" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'project_gid' is set
if (project_gid is None):
raise ValueError("Missing the required parameter `project_gid` when calling `insert_section_for_project`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_gid'] = project_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = opts['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/projects/{project_gid}/sections/insert', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/projects/{project_gid}/sections/insert', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/projects/{project_gid}/sections/insert', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def update_section(self, section_gid, opts, **kwargs): # noqa: E501
"""Update a section # noqa: E501
A specific, existing section can be updated by making a PUT request on the URL for that project. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. (note that at this time, the only field that can be updated is the `name` field.) When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated section record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_section(section_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str section_gid: The globally unique identifier for the section. (required)
:param dict body: The section to create.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: SectionResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.update_section_with_http_info(section_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.update_section_with_http_info(section_gid, opts, **kwargs) # noqa: E501
return data
def update_section_with_http_info(self, section_gid, opts, **kwargs): # noqa: E501
"""Update a section # noqa: E501
A specific, existing section can be updated by making a PUT request on the URL for that project. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. (note that at this time, the only field that can be updated is the `name` field.) When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated section record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_section_with_http_info(section_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str section_gid: The globally unique identifier for the section. (required)
:param dict body: The section to create.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: SectionResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method update_section" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'section_gid' is set
if (section_gid is None):
raise ValueError("Missing the required parameter `section_gid` when calling `update_section`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['section_gid'] = section_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = opts['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/sections/{section_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/sections/{section_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/sections/{section_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
class SectionsApi(object):
'''NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
'''
def __init__(self, api_client=None):
pass
def add_task_for_section(self, section_gid, opts, **kwargs):
'''Add task to section # noqa: E501
Add a task to a specific, existing section. This will remove the task from other sections of the project. The task will be inserted at the top of a section unless an insert_before or insert_after parameter is declared. This does not work for separators (tasks with the resource_subtype of section). # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_task_for_section(section_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str section_gid: The globally unique identifier for the section. (required)
:param dict body: The task and optionally the insert location.
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def add_task_for_section_with_http_info(self, section_gid, opts, **kwargs):
'''Add task to section # noqa: E501
Add a task to a specific, existing section. This will remove the task from other sections of the project. The task will be inserted at the top of a section unless an insert_before or insert_after parameter is declared. This does not work for separators (tasks with the resource_subtype of section). # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_task_for_section_with_http_info(section_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str section_gid: The globally unique identifier for the section. (required)
:param dict body: The task and optionally the insert location.
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def create_section_for_project(self, project_gid, opts, **kwargs):
'''Create a section in a project # noqa: E501
Creates a new section in a project. Returns the full record of the newly created section. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_section_for_project(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param dict body: The section to create.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: SectionResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def create_section_for_project_with_http_info(self, project_gid, opts, **kwargs):
'''Create a section in a project # noqa: E501
Creates a new section in a project. Returns the full record of the newly created section. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_section_for_project_with_http_info(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param dict body: The section to create.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: SectionResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def delete_section(self, section_gid, **kwargs):
'''Delete a section # noqa: E501
A specific, existing section can be deleted by making a DELETE request on the URL for that section. Note that sections must be empty to be deleted. The last remaining section cannot be deleted. Returns an empty data block. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_section(section_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str section_gid: The globally unique identifier for the section. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def delete_section_with_http_info(self, section_gid, **kwargs):
'''Delete a section # noqa: E501
A specific, existing section can be deleted by making a DELETE request on the URL for that section. Note that sections must be empty to be deleted. The last remaining section cannot be deleted. Returns an empty data block. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_section_with_http_info(section_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str section_gid: The globally unique identifier for the section. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_section(self, section_gid, opts, **kwargs):
'''Get a section # noqa: E501
Returns the complete record for a single section. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_section(section_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str section_gid: The globally unique identifier for the section. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: SectionResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_section_with_http_info(self, section_gid, opts, **kwargs):
'''Get a section # noqa: E501
Returns the complete record for a single section. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_section_with_http_info(section_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str section_gid: The globally unique identifier for the section. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: SectionResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_sections_for_project(self, project_gid, opts, **kwargs):
'''Get sections in a project # noqa: E501
Returns the compact records for all sections in the specified project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_sections_for_project(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: SectionResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_sections_for_project_with_http_info(self, project_gid, opts, **kwargs):
'''Get sections in a project # noqa: E501
Returns the compact records for all sections in the specified project. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_sections_for_project_with_http_info(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: SectionResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def insert_section_for_project(self, project_gid, opts, **kwargs):
'''Move or Insert sections # noqa: E501
Move sections relative to each other. One of `before_section` or `after_section` is required. Sections cannot be moved between projects. Returns an empty data block. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.insert_section_for_project(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param dict body: The section's move action.
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def insert_section_for_project_with_http_info(self, project_gid, opts, **kwargs):
'''Move or Insert sections # noqa: E501
Move sections relative to each other. One of `before_section` or `after_section` is required. Sections cannot be moved between projects. Returns an empty data block. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.insert_section_for_project_with_http_info(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param dict body: The section's move action.
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def update_section(self, section_gid, opts, **kwargs):
'''Update a section # noqa: E501
A specific, existing section can be updated by making a PUT request on the URL for that project. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. (note that at this time, the only field that can be updated is the `name` field.) When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated section record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_section(section_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str section_gid: The globally unique identifier for the section. (required)
:param dict body: The section to create.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: SectionResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def update_section_with_http_info(self, section_gid, opts, **kwargs):
'''Update a section # noqa: E501
A specific, existing section can be updated by making a PUT request on the URL for that project. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. (note that at this time, the only field that can be updated is the `name` field.) When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated section record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_section_with_http_info(section_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str section_gid: The globally unique identifier for the section. (required)
:param dict body: The section to create.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: SectionResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
| 16 | 15 | 66 | 7 | 44 | 20 | 5 | 0.47 | 1 | 4 | 2 | 0 | 15 | 1 | 15 | 15 | 1,008 | 125 | 659 | 107 | 643 | 308 | 293 | 107 | 277 | 8 | 1 | 2 | 70 |
7,490 |
Asana/python-asana
|
Asana_python-asana/asana/api/status_updates_api.py
|
asana.api.status_updates_api.StatusUpdatesApi
|
class StatusUpdatesApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def create_status_for_object(self, body, opts, **kwargs): # noqa: E501
"""Create a status update # noqa: E501
Creates a new status update on an object. Returns the full record of the newly created status update. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_status_for_object(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The status update to create. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StatusUpdateResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.create_status_for_object_with_http_info(body, opts, **kwargs) # noqa: E501
else:
(data) = self.create_status_for_object_with_http_info(body, opts, **kwargs) # noqa: E501
return data
def create_status_for_object_with_http_info(self, body, opts, **kwargs): # noqa: E501
"""Create a status update # noqa: E501
Creates a new status update on an object. Returns the full record of the newly created status update. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_status_for_object_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The status update to create. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StatusUpdateResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create_status_for_object" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `create_status_for_object`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/status_updates', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/status_updates', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/status_updates', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def delete_status(self, status_update_gid, **kwargs): # noqa: E501
"""Delete a status update # noqa: E501
Deletes a specific, existing status update. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_status(status_update_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str status_update_gid: The status update to get. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.delete_status_with_http_info(status_update_gid, **kwargs) # noqa: E501
else:
(data) = self.delete_status_with_http_info(status_update_gid, **kwargs) # noqa: E501
return data
def delete_status_with_http_info(self, status_update_gid, **kwargs): # noqa: E501
"""Delete a status update # noqa: E501
Deletes a specific, existing status update. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_status_with_http_info(status_update_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str status_update_gid: The status update to get. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_status" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'status_update_gid' is set
if (status_update_gid is None):
raise ValueError("Missing the required parameter `status_update_gid` when calling `delete_status`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['status_update_gid'] = status_update_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/status_updates/{status_update_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/status_updates/{status_update_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/status_updates/{status_update_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_status(self, status_update_gid, opts, **kwargs): # noqa: E501
"""Get a status update # noqa: E501
Returns the complete record for a single status update. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_status(status_update_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str status_update_gid: The status update to get. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StatusUpdateResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_status_with_http_info(status_update_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_status_with_http_info(status_update_gid, opts, **kwargs) # noqa: E501
return data
def get_status_with_http_info(self, status_update_gid, opts, **kwargs): # noqa: E501
"""Get a status update # noqa: E501
Returns the complete record for a single status update. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_status_with_http_info(status_update_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str status_update_gid: The status update to get. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StatusUpdateResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_status" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'status_update_gid' is set
if (status_update_gid is None):
raise ValueError("Missing the required parameter `status_update_gid` when calling `get_status`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['status_update_gid'] = status_update_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/status_updates/{status_update_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/status_updates/{status_update_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/status_updates/{status_update_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_statuses_for_object(self, parent, opts, **kwargs): # noqa: E501
"""Get status updates from an object # noqa: E501
Returns the compact status update records for all updates on the object. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_statuses_for_object(parent, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str parent: Globally unique identifier for object to fetch statuses from. Must be a GID for a project, portfolio, or goal. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param datetime created_since: Only return statuses that have been created since the given time.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StatusUpdateResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_statuses_for_object_with_http_info(parent, opts, **kwargs) # noqa: E501
else:
(data) = self.get_statuses_for_object_with_http_info(parent, opts, **kwargs) # noqa: E501
return data
def get_statuses_for_object_with_http_info(self, parent, opts, **kwargs): # noqa: E501
"""Get status updates from an object # noqa: E501
Returns the compact status update records for all updates on the object. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_statuses_for_object_with_http_info(parent, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str parent: Globally unique identifier for object to fetch statuses from. Must be a GID for a project, portfolio, or goal. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param datetime created_since: Only return statuses that have been created since the given time.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StatusUpdateResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_statuses_for_object" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'parent' is set
if (parent is None):
raise ValueError("Missing the required parameter `parent` when calling `get_statuses_for_object`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = {}
query_params = opts
query_params['parent'] = parent
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/status_updates', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/status_updates',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/status_updates', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
class StatusUpdatesApi(object):
'''NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
'''
def __init__(self, api_client=None):
pass
def create_status_for_object(self, body, opts, **kwargs):
'''Create a status update # noqa: E501
Creates a new status update on an object. Returns the full record of the newly created status update. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_status_for_object(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The status update to create. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StatusUpdateResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def create_status_for_object_with_http_info(self, body, opts, **kwargs):
'''Create a status update # noqa: E501
Creates a new status update on an object. Returns the full record of the newly created status update. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_status_for_object_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The status update to create. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StatusUpdateResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def delete_status(self, status_update_gid, **kwargs):
'''Delete a status update # noqa: E501
Deletes a specific, existing status update. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_status(status_update_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str status_update_gid: The status update to get. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def delete_status_with_http_info(self, status_update_gid, **kwargs):
'''Delete a status update # noqa: E501
Deletes a specific, existing status update. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_status_with_http_info(status_update_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str status_update_gid: The status update to get. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_status(self, status_update_gid, opts, **kwargs):
'''Get a status update # noqa: E501
Returns the complete record for a single status update. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_status(status_update_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str status_update_gid: The status update to get. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StatusUpdateResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_status_with_http_info(self, status_update_gid, opts, **kwargs):
'''Get a status update # noqa: E501
Returns the complete record for a single status update. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_status_with_http_info(status_update_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str status_update_gid: The status update to get. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StatusUpdateResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_statuses_for_object(self, parent, opts, **kwargs):
'''Get status updates from an object # noqa: E501
Returns the compact status update records for all updates on the object. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_statuses_for_object(parent, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str parent: Globally unique identifier for object to fetch statuses from. Must be a GID for a project, portfolio, or goal. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param datetime created_since: Only return statuses that have been created since the given time.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StatusUpdateResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_statuses_for_object_with_http_info(self, parent, opts, **kwargs):
'''Get status updates from an object # noqa: E501
Returns the compact status update records for all updates on the object. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_statuses_for_object_with_http_info(parent, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str parent: Globally unique identifier for object to fetch statuses from. Must be a GID for a project, portfolio, or goal. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param datetime created_since: Only return statuses that have been created since the given time.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StatusUpdateResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
| 10 | 9 | 63 | 7 | 42 | 19 | 4 | 0.47 | 1 | 4 | 2 | 0 | 9 | 1 | 9 | 9 | 580 | 71 | 376 | 62 | 366 | 176 | 166 | 62 | 156 | 8 | 1 | 2 | 40 |
7,491 |
Asana/python-asana
|
Asana_python-asana/asana/api/memberships_api.py
|
asana.api.memberships_api.MembershipsApi
|
class MembershipsApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def create_membership(self, opts, **kwargs): # noqa: E501
"""Create a membership # noqa: E501
Creates a new membership in a `goal`, `project`, `portfolio`, or `custom_field`. Teams or Users can be members of `goals` or `projects`. Portfolios and custom fields only support `users` as members. Returns the full record of the newly created membership. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_membership(async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The updated fields for the membership.
:return: MembershipResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.create_membership_with_http_info(opts, **kwargs) # noqa: E501
else:
(data) = self.create_membership_with_http_info(opts, **kwargs) # noqa: E501
return data
def create_membership_with_http_info(self, opts, **kwargs): # noqa: E501
"""Create a membership # noqa: E501
Creates a new membership in a `goal`, `project`, `portfolio`, or `custom_field`. Teams or Users can be members of `goals` or `projects`. Portfolios and custom fields only support `users` as members. Returns the full record of the newly created membership. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_membership_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The updated fields for the membership.
:return: MembershipResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create_membership" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = opts['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/memberships', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/memberships', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/memberships', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def delete_membership(self, membership_gid, **kwargs): # noqa: E501
"""Delete a membership # noqa: E501
A specific, existing membership for a `goal`, `project`, `portfolio` or `custom_field` can be deleted by making a `DELETE` request on the URL for that membership. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_membership(membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str membership_gid: Globally unique identifier for the membership. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.delete_membership_with_http_info(membership_gid, **kwargs) # noqa: E501
else:
(data) = self.delete_membership_with_http_info(membership_gid, **kwargs) # noqa: E501
return data
def delete_membership_with_http_info(self, membership_gid, **kwargs): # noqa: E501
"""Delete a membership # noqa: E501
A specific, existing membership for a `goal`, `project`, `portfolio` or `custom_field` can be deleted by making a `DELETE` request on the URL for that membership. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_membership_with_http_info(membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str membership_gid: Globally unique identifier for the membership. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_membership" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'membership_gid' is set
if (membership_gid is None):
raise ValueError("Missing the required parameter `membership_gid` when calling `delete_membership`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['membership_gid'] = membership_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/memberships/{membership_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/memberships/{membership_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/memberships/{membership_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_membership(self, membership_gid, **kwargs): # noqa: E501
"""Get a membership # noqa: E501
Returns a `project_membership`, `goal_membership`, `portfolio_membership`, or `custom_field_membership` record for a membership id. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_membership(membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str membership_gid: Globally unique identifier for the membership. (required)
:return: MembershipResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_membership_with_http_info(membership_gid, **kwargs) # noqa: E501
else:
(data) = self.get_membership_with_http_info(membership_gid, **kwargs) # noqa: E501
return data
def get_membership_with_http_info(self, membership_gid, **kwargs): # noqa: E501
"""Get a membership # noqa: E501
Returns a `project_membership`, `goal_membership`, `portfolio_membership`, or `custom_field_membership` record for a membership id. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_membership_with_http_info(membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str membership_gid: Globally unique identifier for the membership. (required)
:return: MembershipResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_membership" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'membership_gid' is set
if (membership_gid is None):
raise ValueError("Missing the required parameter `membership_gid` when calling `get_membership`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['membership_gid'] = membership_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/memberships/{membership_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/memberships/{membership_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/memberships/{membership_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_memberships(self, opts, **kwargs): # noqa: E501
"""Get multiple memberships # noqa: E501
Returns compact `goal_membership`, `project_membership`, `portfolio_membership`, or `custom_field_membership` records. The possible types for `parent` in this request are `goal`, `project`, `portfolio`, or `custom_field`. An additional member (user GID or team GID) can be passed in to filter to a specific membership. Team as members are not supported for portfolios or custom fields yet. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_memberships(async_req=True)
>>> result = thread.get()
:param async_req bool
:param str parent: Globally unique identifier for `goal`, `project`, `portfolio`, or `custom_field`.
:param str member: Globally unique identifier for `team` or `user`.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: MembershipResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_memberships_with_http_info(opts, **kwargs) # noqa: E501
else:
(data) = self.get_memberships_with_http_info(opts, **kwargs) # noqa: E501
return data
def get_memberships_with_http_info(self, opts, **kwargs): # noqa: E501
"""Get multiple memberships # noqa: E501
Returns compact `goal_membership`, `project_membership`, `portfolio_membership`, or `custom_field_membership` records. The possible types for `parent` in this request are `goal`, `project`, `portfolio`, or `custom_field`. An additional member (user GID or team GID) can be passed in to filter to a specific membership. Team as members are not supported for portfolios or custom fields yet. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_memberships_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param str parent: Globally unique identifier for `goal`, `project`, `portfolio`, or `custom_field`.
:param str member: Globally unique identifier for `team` or `user`.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: MembershipResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_memberships" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/memberships', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/memberships',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/memberships', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def update_membership(self, body, membership_gid, **kwargs): # noqa: E501
"""Update a membership # noqa: E501
An existing membership can be updated by making a `PUT` request on the membership. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Memberships on `goals`, `projects`, `portfolios`, and `custom_fields` can be updated. Returns the full record of the updated membership. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_membership(body, membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The membership to update. (required)
:param str membership_gid: Globally unique identifier for the membership. (required)
:return: MembershipResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.update_membership_with_http_info(body, membership_gid, **kwargs) # noqa: E501
else:
(data) = self.update_membership_with_http_info(body, membership_gid, **kwargs) # noqa: E501
return data
def update_membership_with_http_info(self, body, membership_gid, **kwargs): # noqa: E501
"""Update a membership # noqa: E501
An existing membership can be updated by making a `PUT` request on the membership. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Memberships on `goals`, `projects`, `portfolios`, and `custom_fields` can be updated. Returns the full record of the updated membership. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_membership_with_http_info(body, membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The membership to update. (required)
:param str membership_gid: Globally unique identifier for the membership. (required)
:return: MembershipResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method update_membership" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `update_membership`") # noqa: E501
# verify the required parameter 'membership_gid' is set
if (membership_gid is None):
raise ValueError("Missing the required parameter `membership_gid` when calling `update_membership`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['membership_gid'] = membership_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/memberships/{membership_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/memberships/{membership_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/memberships/{membership_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
class MembershipsApi(object):
'''NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
'''
def __init__(self, api_client=None):
pass
def create_membership(self, opts, **kwargs):
'''Create a membership # noqa: E501
Creates a new membership in a `goal`, `project`, `portfolio`, or `custom_field`. Teams or Users can be members of `goals` or `projects`. Portfolios and custom fields only support `users` as members. Returns the full record of the newly created membership. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_membership(async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The updated fields for the membership.
:return: MembershipResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def create_membership_with_http_info(self, opts, **kwargs):
'''Create a membership # noqa: E501
Creates a new membership in a `goal`, `project`, `portfolio`, or `custom_field`. Teams or Users can be members of `goals` or `projects`. Portfolios and custom fields only support `users` as members. Returns the full record of the newly created membership. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_membership_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The updated fields for the membership.
:return: MembershipResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def delete_membership(self, membership_gid, **kwargs):
'''Delete a membership # noqa: E501
A specific, existing membership for a `goal`, `project`, `portfolio` or `custom_field` can be deleted by making a `DELETE` request on the URL for that membership. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_membership(membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str membership_gid: Globally unique identifier for the membership. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def delete_membership_with_http_info(self, membership_gid, **kwargs):
'''Delete a membership # noqa: E501
A specific, existing membership for a `goal`, `project`, `portfolio` or `custom_field` can be deleted by making a `DELETE` request on the URL for that membership. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_membership_with_http_info(membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str membership_gid: Globally unique identifier for the membership. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_membership(self, membership_gid, **kwargs):
'''Get a membership # noqa: E501
Returns a `project_membership`, `goal_membership`, `portfolio_membership`, or `custom_field_membership` record for a membership id. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_membership(membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str membership_gid: Globally unique identifier for the membership. (required)
:return: MembershipResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_membership_with_http_info(self, membership_gid, **kwargs):
'''Get a membership # noqa: E501
Returns a `project_membership`, `goal_membership`, `portfolio_membership`, or `custom_field_membership` record for a membership id. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_membership_with_http_info(membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str membership_gid: Globally unique identifier for the membership. (required)
:return: MembershipResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_memberships(self, opts, **kwargs):
'''Get multiple memberships # noqa: E501
Returns compact `goal_membership`, `project_membership`, `portfolio_membership`, or `custom_field_membership` records. The possible types for `parent` in this request are `goal`, `project`, `portfolio`, or `custom_field`. An additional member (user GID or team GID) can be passed in to filter to a specific membership. Team as members are not supported for portfolios or custom fields yet. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_memberships(async_req=True)
>>> result = thread.get()
:param async_req bool
:param str parent: Globally unique identifier for `goal`, `project`, `portfolio`, or `custom_field`.
:param str member: Globally unique identifier for `team` or `user`.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: MembershipResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_memberships_with_http_info(self, opts, **kwargs):
'''Get multiple memberships # noqa: E501
Returns compact `goal_membership`, `project_membership`, `portfolio_membership`, or `custom_field_membership` records. The possible types for `parent` in this request are `goal`, `project`, `portfolio`, or `custom_field`. An additional member (user GID or team GID) can be passed in to filter to a specific membership. Team as members are not supported for portfolios or custom fields yet. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_memberships_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param str parent: Globally unique identifier for `goal`, `project`, `portfolio`, or `custom_field`.
:param str member: Globally unique identifier for `team` or `user`.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: MembershipResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def update_membership(self, body, membership_gid, **kwargs):
'''Update a membership # noqa: E501
An existing membership can be updated by making a `PUT` request on the membership. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Memberships on `goals`, `projects`, `portfolios`, and `custom_fields` can be updated. Returns the full record of the updated membership. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_membership(body, membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The membership to update. (required)
:param str membership_gid: Globally unique identifier for the membership. (required)
:return: MembershipResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def update_membership_with_http_info(self, body, membership_gid, **kwargs):
'''Update a membership # noqa: E501
An existing membership can be updated by making a `PUT` request on the membership. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. Memberships on `goals`, `projects`, `portfolios`, and `custom_fields` can be updated. Returns the full record of the updated membership. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_membership_with_http_info(body, membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The membership to update. (required)
:param str membership_gid: Globally unique identifier for the membership. (required)
:return: MembershipResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
| 12 | 11 | 63 | 7 | 42 | 19 | 4 | 0.45 | 1 | 4 | 2 | 0 | 11 | 1 | 11 | 11 | 709 | 89 | 465 | 77 | 453 | 210 | 203 | 77 | 191 | 9 | 1 | 2 | 49 |
7,492 |
Asana/python-asana
|
Asana_python-asana/asana/api/stories_api.py
|
asana.api.stories_api.StoriesApi
|
class StoriesApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def create_story_for_task(self, body, task_gid, opts, **kwargs): # noqa: E501
"""Create a story on a task # noqa: E501
Adds a story to a task. This endpoint currently only allows for comment stories to be created. The comment will be authored by the currently authenticated user, and timestamped when the server receives the request. Returns the full record for the new story added to the task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_story_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The story to create. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StoryResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.create_story_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.create_story_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501
return data
def create_story_for_task_with_http_info(self, body, task_gid, opts, **kwargs): # noqa: E501
"""Create a story on a task # noqa: E501
Adds a story to a task. This endpoint currently only allows for comment stories to be created. The comment will be authored by the currently authenticated user, and timestamped when the server receives the request. Returns the full record for the new story added to the task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_story_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The story to create. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StoryResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create_story_for_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `create_story_for_task`") # noqa: E501
# verify the required parameter 'task_gid' is set
if (task_gid is None):
raise ValueError("Missing the required parameter `task_gid` when calling `create_story_for_task`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_gid'] = task_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks/{task_gid}/stories', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/tasks/{task_gid}/stories', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/tasks/{task_gid}/stories', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def delete_story(self, story_gid, **kwargs): # noqa: E501
"""Delete a story # noqa: E501
Deletes a story. A user can only delete stories they have created. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_story(story_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str story_gid: Globally unique identifier for the story. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.delete_story_with_http_info(story_gid, **kwargs) # noqa: E501
else:
(data) = self.delete_story_with_http_info(story_gid, **kwargs) # noqa: E501
return data
def delete_story_with_http_info(self, story_gid, **kwargs): # noqa: E501
"""Delete a story # noqa: E501
Deletes a story. A user can only delete stories they have created. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_story_with_http_info(story_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str story_gid: Globally unique identifier for the story. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_story" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'story_gid' is set
if (story_gid is None):
raise ValueError("Missing the required parameter `story_gid` when calling `delete_story`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['story_gid'] = story_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/stories/{story_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/stories/{story_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/stories/{story_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_stories_for_task(self, task_gid, opts, **kwargs): # noqa: E501
"""Get stories from a task # noqa: E501
Returns the compact records for all stories on the task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_stories_for_task(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StoryResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_stories_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_stories_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501
return data
def get_stories_for_task_with_http_info(self, task_gid, opts, **kwargs): # noqa: E501
"""Get stories from a task # noqa: E501
Returns the compact records for all stories on the task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_stories_for_task_with_http_info(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StoryResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_stories_for_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'task_gid' is set
if (task_gid is None):
raise ValueError("Missing the required parameter `task_gid` when calling `get_stories_for_task`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_gid'] = task_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks/{task_gid}/stories', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/tasks/{task_gid}/stories',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/tasks/{task_gid}/stories', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_story(self, story_gid, opts, **kwargs): # noqa: E501
"""Get a story # noqa: E501
Returns the full record for a single story. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_story(story_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str story_gid: Globally unique identifier for the story. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StoryResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_story_with_http_info(story_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_story_with_http_info(story_gid, opts, **kwargs) # noqa: E501
return data
def get_story_with_http_info(self, story_gid, opts, **kwargs): # noqa: E501
"""Get a story # noqa: E501
Returns the full record for a single story. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_story_with_http_info(story_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str story_gid: Globally unique identifier for the story. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StoryResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_story" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'story_gid' is set
if (story_gid is None):
raise ValueError("Missing the required parameter `story_gid` when calling `get_story`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['story_gid'] = story_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/stories/{story_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/stories/{story_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/stories/{story_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def update_story(self, body, story_gid, opts, **kwargs): # noqa: E501
"""Update a story # noqa: E501
Updates the story and returns the full record for the updated story. Only comment stories can have their text updated, and only comment stories and attachment stories can be pinned. Only one of `text` and `html_text` can be specified. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_story(body, story_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The comment story to update. (required)
:param str story_gid: Globally unique identifier for the story. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StoryResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.update_story_with_http_info(body, story_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.update_story_with_http_info(body, story_gid, opts, **kwargs) # noqa: E501
return data
def update_story_with_http_info(self, body, story_gid, opts, **kwargs): # noqa: E501
"""Update a story # noqa: E501
Updates the story and returns the full record for the updated story. Only comment stories can have their text updated, and only comment stories and attachment stories can be pinned. Only one of `text` and `html_text` can be specified. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_story_with_http_info(body, story_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The comment story to update. (required)
:param str story_gid: Globally unique identifier for the story. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StoryResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method update_story" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `update_story`") # noqa: E501
# verify the required parameter 'story_gid' is set
if (story_gid is None):
raise ValueError("Missing the required parameter `story_gid` when calling `update_story`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['story_gid'] = story_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/stories/{story_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/stories/{story_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/stories/{story_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
class StoriesApi(object):
'''NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
'''
def __init__(self, api_client=None):
pass
def create_story_for_task(self, body, task_gid, opts, **kwargs):
'''Create a story on a task # noqa: E501
Adds a story to a task. This endpoint currently only allows for comment stories to be created. The comment will be authored by the currently authenticated user, and timestamped when the server receives the request. Returns the full record for the new story added to the task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_story_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The story to create. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StoryResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def create_story_for_task_with_http_info(self, body, task_gid, opts, **kwargs):
'''Create a story on a task # noqa: E501
Adds a story to a task. This endpoint currently only allows for comment stories to be created. The comment will be authored by the currently authenticated user, and timestamped when the server receives the request. Returns the full record for the new story added to the task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_story_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The story to create. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StoryResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def delete_story(self, story_gid, **kwargs):
'''Delete a story # noqa: E501
Deletes a story. A user can only delete stories they have created. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_story(story_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str story_gid: Globally unique identifier for the story. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def delete_story_with_http_info(self, story_gid, **kwargs):
'''Delete a story # noqa: E501
Deletes a story. A user can only delete stories they have created. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_story_with_http_info(story_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str story_gid: Globally unique identifier for the story. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_stories_for_task(self, task_gid, opts, **kwargs):
'''Get stories from a task # noqa: E501
Returns the compact records for all stories on the task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_stories_for_task(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StoryResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_stories_for_task_with_http_info(self, task_gid, opts, **kwargs):
'''Get stories from a task # noqa: E501
Returns the compact records for all stories on the task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_stories_for_task_with_http_info(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StoryResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_story(self, story_gid, opts, **kwargs):
'''Get a story # noqa: E501
Returns the full record for a single story. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_story(story_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str story_gid: Globally unique identifier for the story. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StoryResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_story_with_http_info(self, story_gid, opts, **kwargs):
'''Get a story # noqa: E501
Returns the full record for a single story. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_story_with_http_info(story_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str story_gid: Globally unique identifier for the story. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StoryResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def update_story(self, body, story_gid, opts, **kwargs):
'''Update a story # noqa: E501
Updates the story and returns the full record for the updated story. Only comment stories can have their text updated, and only comment stories and attachment stories can be pinned. Only one of `text` and `html_text` can be specified. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_story(body, story_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The comment story to update. (required)
:param str story_gid: Globally unique identifier for the story. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StoryResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def update_story_with_http_info(self, body, story_gid, opts, **kwargs):
'''Update a story # noqa: E501
Updates the story and returns the full record for the updated story. Only comment stories can have their text updated, and only comment stories and attachment stories can be pinned. Only one of `text` and `html_text` can be specified. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_story_with_http_info(body, story_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The comment story to update. (required)
:param str story_gid: Globally unique identifier for the story. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: StoryResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
| 12 | 11 | 65 | 7 | 43 | 20 | 5 | 0.47 | 1 | 4 | 2 | 0 | 11 | 1 | 11 | 11 | 728 | 89 | 475 | 77 | 463 | 224 | 213 | 77 | 201 | 9 | 1 | 2 | 52 |
7,493 |
Asana/python-asana
|
Asana_python-asana/asana/api/task_templates_api.py
|
asana.api.task_templates_api.TaskTemplatesApi
|
class TaskTemplatesApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def delete_task_template(self, task_template_gid, **kwargs): # noqa: E501
"""Delete a task template # noqa: E501
A specific, existing task template can be deleted by making a DELETE request on the URL for that task template. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_task_template(task_template_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_template_gid: Globally unique identifier for the task template. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.delete_task_template_with_http_info(task_template_gid, **kwargs) # noqa: E501
else:
(data) = self.delete_task_template_with_http_info(task_template_gid, **kwargs) # noqa: E501
return data
def delete_task_template_with_http_info(self, task_template_gid, **kwargs): # noqa: E501
"""Delete a task template # noqa: E501
A specific, existing task template can be deleted by making a DELETE request on the URL for that task template. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_task_template_with_http_info(task_template_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_template_gid: Globally unique identifier for the task template. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_task_template" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'task_template_gid' is set
if (task_template_gid is None):
raise ValueError("Missing the required parameter `task_template_gid` when calling `delete_task_template`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_template_gid'] = task_template_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/task_templates/{task_template_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/task_templates/{task_template_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/task_templates/{task_template_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_task_template(self, task_template_gid, opts, **kwargs): # noqa: E501
"""Get a task template # noqa: E501
Returns the complete task template record for a single task template. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_task_template(task_template_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_template_gid: Globally unique identifier for the task template. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskTemplateResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_task_template_with_http_info(task_template_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_task_template_with_http_info(task_template_gid, opts, **kwargs) # noqa: E501
return data
def get_task_template_with_http_info(self, task_template_gid, opts, **kwargs): # noqa: E501
"""Get a task template # noqa: E501
Returns the complete task template record for a single task template. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_task_template_with_http_info(task_template_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_template_gid: Globally unique identifier for the task template. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskTemplateResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_task_template" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'task_template_gid' is set
if (task_template_gid is None):
raise ValueError("Missing the required parameter `task_template_gid` when calling `get_task_template`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_template_gid'] = task_template_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/task_templates/{task_template_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/task_templates/{task_template_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/task_templates/{task_template_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_task_templates(self, opts, **kwargs): # noqa: E501
"""Get multiple task templates # noqa: E501
Returns the compact task template records for some filtered set of task templates. You must specify a `project` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_task_templates(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param str project: The project to filter task templates on.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskTemplateResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_task_templates_with_http_info(opts, **kwargs) # noqa: E501
else:
(data) = self.get_task_templates_with_http_info(opts, **kwargs) # noqa: E501
return data
def get_task_templates_with_http_info(self, opts, **kwargs): # noqa: E501
"""Get multiple task templates # noqa: E501
Returns the compact task template records for some filtered set of task templates. You must specify a `project` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_task_templates_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param str project: The project to filter task templates on.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskTemplateResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_task_templates" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/task_templates', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/task_templates',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/task_templates', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def instantiate_task(self, task_template_gid, opts, **kwargs): # noqa: E501
"""Instantiate a task from a task template # noqa: E501
Creates and returns a job that will asynchronously handle the task instantiation. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.instantiate_task(task_template_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_template_gid: Globally unique identifier for the task template. (required)
:param dict body: Describes the inputs used for instantiating a task - the task's name.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: JobResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.instantiate_task_with_http_info(task_template_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.instantiate_task_with_http_info(task_template_gid, opts, **kwargs) # noqa: E501
return data
def instantiate_task_with_http_info(self, task_template_gid, opts, **kwargs): # noqa: E501
"""Instantiate a task from a task template # noqa: E501
Creates and returns a job that will asynchronously handle the task instantiation. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.instantiate_task_with_http_info(task_template_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_template_gid: Globally unique identifier for the task template. (required)
:param dict body: Describes the inputs used for instantiating a task - the task's name.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: JobResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method instantiate_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'task_template_gid' is set
if (task_template_gid is None):
raise ValueError("Missing the required parameter `task_template_gid` when calling `instantiate_task`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_template_gid'] = task_template_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = opts['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/task_templates/{task_template_gid}/instantiateTask', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/task_templates/{task_template_gid}/instantiateTask', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/task_templates/{task_template_gid}/instantiateTask', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
class TaskTemplatesApi(object):
'''NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
'''
def __init__(self, api_client=None):
pass
def delete_task_template(self, task_template_gid, **kwargs):
'''Delete a task template # noqa: E501
A specific, existing task template can be deleted by making a DELETE request on the URL for that task template. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_task_template(task_template_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_template_gid: Globally unique identifier for the task template. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def delete_task_template_with_http_info(self, task_template_gid, **kwargs):
'''Delete a task template # noqa: E501
A specific, existing task template can be deleted by making a DELETE request on the URL for that task template. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_task_template_with_http_info(task_template_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_template_gid: Globally unique identifier for the task template. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_task_template(self, task_template_gid, opts, **kwargs):
'''Get a task template # noqa: E501
Returns the complete task template record for a single task template. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_task_template(task_template_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_template_gid: Globally unique identifier for the task template. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskTemplateResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_task_template_with_http_info(self, task_template_gid, opts, **kwargs):
'''Get a task template # noqa: E501
Returns the complete task template record for a single task template. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_task_template_with_http_info(task_template_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_template_gid: Globally unique identifier for the task template. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskTemplateResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_task_templates(self, opts, **kwargs):
'''Get multiple task templates # noqa: E501
Returns the compact task template records for some filtered set of task templates. You must specify a `project` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_task_templates(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param str project: The project to filter task templates on.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskTemplateResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_task_templates_with_http_info(self, opts, **kwargs):
'''Get multiple task templates # noqa: E501
Returns the compact task template records for some filtered set of task templates. You must specify a `project` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_task_templates_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param str project: The project to filter task templates on.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskTemplateResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def instantiate_task(self, task_template_gid, opts, **kwargs):
'''Instantiate a task from a task template # noqa: E501
Creates and returns a job that will asynchronously handle the task instantiation. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.instantiate_task(task_template_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_template_gid: Globally unique identifier for the task template. (required)
:param dict body: Describes the inputs used for instantiating a task - the task's name.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: JobResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def instantiate_task_with_http_info(self, task_template_gid, opts, **kwargs):
'''Instantiate a task from a task template # noqa: E501
Creates and returns a job that will asynchronously handle the task instantiation. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.instantiate_task_with_http_info(task_template_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_template_gid: Globally unique identifier for the task template. (required)
:param dict body: Describes the inputs used for instantiating a task - the task's name.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: JobResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
| 10 | 9 | 62 | 7 | 41 | 19 | 4 | 0.46 | 1 | 4 | 2 | 0 | 9 | 1 | 9 | 9 | 573 | 71 | 374 | 62 | 364 | 171 | 164 | 62 | 154 | 8 | 1 | 2 | 39 |
7,494 |
Asana/python-asana
|
Asana_python-asana/asana/api/tasks_api.py
|
asana.api.tasks_api.TasksApi
|
class TasksApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def add_dependencies_for_task(self, body, task_gid, **kwargs): # noqa: E501
"""Set dependencies for a task # noqa: E501
Marks a set of tasks as dependencies of this task, if they are not already dependencies. *A task can have at most 30 dependents and dependencies combined*. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_dependencies_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The list of tasks to set as dependencies. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.add_dependencies_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501
else:
(data) = self.add_dependencies_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501
return data
def add_dependencies_for_task_with_http_info(self, body, task_gid, **kwargs): # noqa: E501
"""Set dependencies for a task # noqa: E501
Marks a set of tasks as dependencies of this task, if they are not already dependencies. *A task can have at most 30 dependents and dependencies combined*. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_dependencies_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The list of tasks to set as dependencies. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method add_dependencies_for_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `add_dependencies_for_task`") # noqa: E501
# verify the required parameter 'task_gid' is set
if (task_gid is None):
raise ValueError("Missing the required parameter `task_gid` when calling `add_dependencies_for_task`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_gid'] = task_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks/{task_gid}/addDependencies', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/tasks/{task_gid}/addDependencies', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/tasks/{task_gid}/addDependencies', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def add_dependents_for_task(self, body, task_gid, **kwargs): # noqa: E501
"""Set dependents for a task # noqa: E501
Marks a set of tasks as dependents of this task, if they are not already dependents. *A task can have at most 30 dependents and dependencies combined*. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_dependents_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The list of tasks to add as dependents. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.add_dependents_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501
else:
(data) = self.add_dependents_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501
return data
def add_dependents_for_task_with_http_info(self, body, task_gid, **kwargs): # noqa: E501
"""Set dependents for a task # noqa: E501
Marks a set of tasks as dependents of this task, if they are not already dependents. *A task can have at most 30 dependents and dependencies combined*. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_dependents_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The list of tasks to add as dependents. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method add_dependents_for_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `add_dependents_for_task`") # noqa: E501
# verify the required parameter 'task_gid' is set
if (task_gid is None):
raise ValueError("Missing the required parameter `task_gid` when calling `add_dependents_for_task`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_gid'] = task_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks/{task_gid}/addDependents', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/tasks/{task_gid}/addDependents', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/tasks/{task_gid}/addDependents', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def add_followers_for_task(self, body, task_gid, opts, **kwargs): # noqa: E501
"""Add followers to a task # noqa: E501
Adds followers to a task. Returns an empty data block. Each task can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated task record, described above. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_followers_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The followers to add to the task. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.add_followers_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.add_followers_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501
return data
def add_followers_for_task_with_http_info(self, body, task_gid, opts, **kwargs): # noqa: E501
"""Add followers to a task # noqa: E501
Adds followers to a task. Returns an empty data block. Each task can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated task record, described above. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_followers_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The followers to add to the task. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method add_followers_for_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `add_followers_for_task`") # noqa: E501
# verify the required parameter 'task_gid' is set
if (task_gid is None):
raise ValueError("Missing the required parameter `task_gid` when calling `add_followers_for_task`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_gid'] = task_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks/{task_gid}/addFollowers', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/tasks/{task_gid}/addFollowers', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/tasks/{task_gid}/addFollowers', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def add_project_for_task(self, body, task_gid, **kwargs): # noqa: E501
"""Add a project to a task # noqa: E501
Adds the task to the specified project, in the optional location specified. If no location arguments are given, the task will be added to the end of the project. `addProject` can also be used to reorder a task within a project or section that already contains it. At most one of `insert_before`, `insert_after`, or `section` should be specified. Inserting into a section in an non-order-dependent way can be done by specifying section, otherwise, to insert within a section in a particular place, specify `insert_before` or `insert_after` and a task within the section to anchor the position of this task. A task can have at most 20 projects multi-homed to it. Returns an empty data block. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_project_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The project to add the task to. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.add_project_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501
else:
(data) = self.add_project_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501
return data
def add_project_for_task_with_http_info(self, body, task_gid, **kwargs): # noqa: E501
"""Add a project to a task # noqa: E501
Adds the task to the specified project, in the optional location specified. If no location arguments are given, the task will be added to the end of the project. `addProject` can also be used to reorder a task within a project or section that already contains it. At most one of `insert_before`, `insert_after`, or `section` should be specified. Inserting into a section in an non-order-dependent way can be done by specifying section, otherwise, to insert within a section in a particular place, specify `insert_before` or `insert_after` and a task within the section to anchor the position of this task. A task can have at most 20 projects multi-homed to it. Returns an empty data block. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_project_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The project to add the task to. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method add_project_for_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `add_project_for_task`") # noqa: E501
# verify the required parameter 'task_gid' is set
if (task_gid is None):
raise ValueError("Missing the required parameter `task_gid` when calling `add_project_for_task`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_gid'] = task_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks/{task_gid}/addProject', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/tasks/{task_gid}/addProject', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/tasks/{task_gid}/addProject', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def add_tag_for_task(self, body, task_gid, **kwargs): # noqa: E501
"""Add a tag to a task # noqa: E501
Adds a tag to a task. Returns an empty data block. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_tag_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The tag to add to the task. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.add_tag_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501
else:
(data) = self.add_tag_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501
return data
def add_tag_for_task_with_http_info(self, body, task_gid, **kwargs): # noqa: E501
"""Add a tag to a task # noqa: E501
Adds a tag to a task. Returns an empty data block. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_tag_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The tag to add to the task. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method add_tag_for_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `add_tag_for_task`") # noqa: E501
# verify the required parameter 'task_gid' is set
if (task_gid is None):
raise ValueError("Missing the required parameter `task_gid` when calling `add_tag_for_task`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_gid'] = task_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks/{task_gid}/addTag', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/tasks/{task_gid}/addTag', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/tasks/{task_gid}/addTag', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def create_subtask_for_task(self, body, task_gid, opts, **kwargs): # noqa: E501
"""Create a subtask # noqa: E501
Creates a new subtask and adds it to the parent task. Returns the full record for the newly created subtask. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_subtask_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The new subtask to create. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.create_subtask_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.create_subtask_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501
return data
def create_subtask_for_task_with_http_info(self, body, task_gid, opts, **kwargs): # noqa: E501
"""Create a subtask # noqa: E501
Creates a new subtask and adds it to the parent task. Returns the full record for the newly created subtask. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_subtask_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The new subtask to create. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create_subtask_for_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `create_subtask_for_task`") # noqa: E501
# verify the required parameter 'task_gid' is set
if (task_gid is None):
raise ValueError("Missing the required parameter `task_gid` when calling `create_subtask_for_task`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_gid'] = task_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks/{task_gid}/subtasks', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/tasks/{task_gid}/subtasks', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/tasks/{task_gid}/subtasks', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def create_task(self, body, opts, **kwargs): # noqa: E501
"""Create a task # noqa: E501
Creating a new task is as easy as POSTing to the `/tasks` endpoint with a data block containing the fields you’d like to set on the task. Any unspecified fields will take on default values. Every task is required to be created in a specific workspace, and this workspace cannot be changed once set. The workspace need not be set explicitly if you specify `projects` or a `parent` task instead. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_task(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The task to create. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.create_task_with_http_info(body, opts, **kwargs) # noqa: E501
else:
(data) = self.create_task_with_http_info(body, opts, **kwargs) # noqa: E501
return data
def create_task_with_http_info(self, body, opts, **kwargs): # noqa: E501
"""Create a task # noqa: E501
Creating a new task is as easy as POSTing to the `/tasks` endpoint with a data block containing the fields you’d like to set on the task. Any unspecified fields will take on default values. Every task is required to be created in a specific workspace, and this workspace cannot be changed once set. The workspace need not be set explicitly if you specify `projects` or a `parent` task instead. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_task_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The task to create. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `create_task`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/tasks', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/tasks', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def delete_task(self, task_gid, **kwargs): # noqa: E501
"""Delete a task # noqa: E501
A specific, existing task can be deleted by making a DELETE request on the URL for that task. Deleted tasks go into the “trash” of the user making the delete request. Tasks can be recovered from the trash within a period of 30 days; afterward they are completely removed from the system. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_task(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.delete_task_with_http_info(task_gid, **kwargs) # noqa: E501
else:
(data) = self.delete_task_with_http_info(task_gid, **kwargs) # noqa: E501
return data
def delete_task_with_http_info(self, task_gid, **kwargs): # noqa: E501
"""Delete a task # noqa: E501
A specific, existing task can be deleted by making a DELETE request on the URL for that task. Deleted tasks go into the “trash” of the user making the delete request. Tasks can be recovered from the trash within a period of 30 days; afterward they are completely removed from the system. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_task_with_http_info(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'task_gid' is set
if (task_gid is None):
raise ValueError("Missing the required parameter `task_gid` when calling `delete_task`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_gid'] = task_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks/{task_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/tasks/{task_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/tasks/{task_gid}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def duplicate_task(self, body, task_gid, opts, **kwargs): # noqa: E501
"""Duplicate a task # noqa: E501
Creates and returns a job that will asynchronously handle the duplication. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.duplicate_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Describes the duplicate's name and the fields that will be duplicated. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: JobResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.duplicate_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.duplicate_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501
return data
def duplicate_task_with_http_info(self, body, task_gid, opts, **kwargs): # noqa: E501
"""Duplicate a task # noqa: E501
Creates and returns a job that will asynchronously handle the duplication. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.duplicate_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Describes the duplicate's name and the fields that will be duplicated. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: JobResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method duplicate_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `duplicate_task`") # noqa: E501
# verify the required parameter 'task_gid' is set
if (task_gid is None):
raise ValueError("Missing the required parameter `task_gid` when calling `duplicate_task`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_gid'] = task_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks/{task_gid}/duplicate', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/tasks/{task_gid}/duplicate', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/tasks/{task_gid}/duplicate', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_dependencies_for_task(self, task_gid, opts, **kwargs): # noqa: E501
"""Get dependencies from a task # noqa: E501
Returns the compact representations of all of the dependencies of a task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_dependencies_for_task(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_dependencies_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_dependencies_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501
return data
def get_dependencies_for_task_with_http_info(self, task_gid, opts, **kwargs): # noqa: E501
"""Get dependencies from a task # noqa: E501
Returns the compact representations of all of the dependencies of a task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_dependencies_for_task_with_http_info(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_dependencies_for_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'task_gid' is set
if (task_gid is None):
raise ValueError("Missing the required parameter `task_gid` when calling `get_dependencies_for_task`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_gid'] = task_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks/{task_gid}/dependencies', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/tasks/{task_gid}/dependencies',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/tasks/{task_gid}/dependencies', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_dependents_for_task(self, task_gid, opts, **kwargs): # noqa: E501
"""Get dependents from a task # noqa: E501
Returns the compact representations of all of the dependents of a task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_dependents_for_task(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_dependents_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_dependents_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501
return data
def get_dependents_for_task_with_http_info(self, task_gid, opts, **kwargs): # noqa: E501
"""Get dependents from a task # noqa: E501
Returns the compact representations of all of the dependents of a task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_dependents_for_task_with_http_info(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_dependents_for_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'task_gid' is set
if (task_gid is None):
raise ValueError("Missing the required parameter `task_gid` when calling `get_dependents_for_task`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_gid'] = task_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks/{task_gid}/dependents', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/tasks/{task_gid}/dependents',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/tasks/{task_gid}/dependents', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_subtasks_for_task(self, task_gid, opts, **kwargs): # noqa: E501
"""Get subtasks from a task # noqa: E501
Returns a compact representation of all of the subtasks of a task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_subtasks_for_task(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_subtasks_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_subtasks_for_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501
return data
def get_subtasks_for_task_with_http_info(self, task_gid, opts, **kwargs): # noqa: E501
"""Get subtasks from a task # noqa: E501
Returns a compact representation of all of the subtasks of a task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_subtasks_for_task_with_http_info(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_subtasks_for_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'task_gid' is set
if (task_gid is None):
raise ValueError("Missing the required parameter `task_gid` when calling `get_subtasks_for_task`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_gid'] = task_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks/{task_gid}/subtasks', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/tasks/{task_gid}/subtasks',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/tasks/{task_gid}/subtasks', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_task(self, task_gid, opts, **kwargs): # noqa: E501
"""Get a task # noqa: E501
Returns the complete task record for a single task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_task(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_task_with_http_info(task_gid, opts, **kwargs) # noqa: E501
return data
def get_task_with_http_info(self, task_gid, opts, **kwargs): # noqa: E501
"""Get a task # noqa: E501
Returns the complete task record for a single task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_task_with_http_info(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'task_gid' is set
if (task_gid is None):
raise ValueError("Missing the required parameter `task_gid` when calling `get_task`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_gid'] = task_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks/{task_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/tasks/{task_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/tasks/{task_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_task_for_custom_id(self, workspace_gid, custom_id, **kwargs): # noqa: E501
"""Get a task for a given custom ID # noqa: E501
Returns a task given a custom ID shortcode. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_task_for_custom_id(workspace_gid, custom_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param str custom_id: Generated custom ID for a task. (required)
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_task_for_custom_id_with_http_info(workspace_gid, custom_id, **kwargs) # noqa: E501
else:
(data) = self.get_task_for_custom_id_with_http_info(workspace_gid, custom_id, **kwargs) # noqa: E501
return data
def get_task_for_custom_id_with_http_info(self, workspace_gid, custom_id, **kwargs): # noqa: E501
"""Get a task for a given custom ID # noqa: E501
Returns a task given a custom ID shortcode. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_task_for_custom_id_with_http_info(workspace_gid, custom_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param str custom_id: Generated custom ID for a task. (required)
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_task_for_custom_id" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workspace_gid' is set
if (workspace_gid is None):
raise ValueError("Missing the required parameter `workspace_gid` when calling `get_task_for_custom_id`") # noqa: E501
# verify the required parameter 'custom_id' is set
if (custom_id is None):
raise ValueError("Missing the required parameter `custom_id` when calling `get_task_for_custom_id`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['workspace_gid'] = workspace_gid # noqa: E501
path_params['custom_id'] = custom_id # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/workspaces/{workspace_gid}/tasks/custom_id/{custom_id}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/workspaces/{workspace_gid}/tasks/custom_id/{custom_id}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/workspaces/{workspace_gid}/tasks/custom_id/{custom_id}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_tasks(self, opts, **kwargs): # noqa: E501
"""Get multiple tasks # noqa: E501
Returns the compact task records for some filtered set of tasks. Use one or more of the parameters provided to filter the tasks returned. You must specify a `project` or `tag` if you do not specify `assignee` and `workspace`. For more complex task retrieval, use [workspaces/{workspace_gid}/tasks/search](/reference/searchtasksforworkspace). # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_tasks(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param str assignee: The assignee to filter tasks on. If searching for unassigned tasks, assignee.any = null can be specified. *Note: If you specify `assignee`, you must also specify the `workspace` to filter on.*
:param str project: The project to filter tasks on.
:param str section: The section to filter tasks on.
:param str workspace: The workspace to filter tasks on. *Note: If you specify `workspace`, you must also specify the `assignee` to filter on.*
:param datetime completed_since: Only return tasks that are either incomplete or that have been completed since this time.
:param datetime modified_since: Only return tasks that have been modified since the given time. *Note: A task is considered “modified” if any of its properties change, or associations between it and other objects are modified (e.g. a task being added to a project). A task is not considered modified just because another object it is associated with (e.g. a subtask) is modified. Actions that count as modifying the task include assigning, renaming, completing, and adding stories.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_tasks_with_http_info(opts, **kwargs) # noqa: E501
else:
(data) = self.get_tasks_with_http_info(opts, **kwargs) # noqa: E501
return data
def get_tasks_with_http_info(self, opts, **kwargs): # noqa: E501
"""Get multiple tasks # noqa: E501
Returns the compact task records for some filtered set of tasks. Use one or more of the parameters provided to filter the tasks returned. You must specify a `project` or `tag` if you do not specify `assignee` and `workspace`. For more complex task retrieval, use [workspaces/{workspace_gid}/tasks/search](/reference/searchtasksforworkspace). # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_tasks_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param str assignee: The assignee to filter tasks on. If searching for unassigned tasks, assignee.any = null can be specified. *Note: If you specify `assignee`, you must also specify the `workspace` to filter on.*
:param str project: The project to filter tasks on.
:param str section: The section to filter tasks on.
:param str workspace: The workspace to filter tasks on. *Note: If you specify `workspace`, you must also specify the `assignee` to filter on.*
:param datetime completed_since: Only return tasks that are either incomplete or that have been completed since this time.
:param datetime modified_since: Only return tasks that have been modified since the given time. *Note: A task is considered “modified” if any of its properties change, or associations between it and other objects are modified (e.g. a task being added to a project). A task is not considered modified just because another object it is associated with (e.g. a subtask) is modified. Actions that count as modifying the task include assigning, renaming, completing, and adding stories.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_tasks" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/tasks',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/tasks', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_tasks_for_project(self, project_gid, opts, **kwargs): # noqa: E501
"""Get tasks from a project # noqa: E501
Returns the compact task records for all tasks within the given project, ordered by their priority within the project. Tasks can exist in more than one project at a time. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_tasks_for_project(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param str completed_since: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_tasks_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_tasks_for_project_with_http_info(project_gid, opts, **kwargs) # noqa: E501
return data
def get_tasks_for_project_with_http_info(self, project_gid, opts, **kwargs): # noqa: E501
"""Get tasks from a project # noqa: E501
Returns the compact task records for all tasks within the given project, ordered by their priority within the project. Tasks can exist in more than one project at a time. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_tasks_for_project_with_http_info(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param str completed_since: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_tasks_for_project" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'project_gid' is set
if (project_gid is None):
raise ValueError("Missing the required parameter `project_gid` when calling `get_tasks_for_project`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['project_gid'] = project_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/projects/{project_gid}/tasks', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/projects/{project_gid}/tasks',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/projects/{project_gid}/tasks', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_tasks_for_section(self, section_gid, opts, **kwargs): # noqa: E501
"""Get tasks from a section # noqa: E501
*Board view only*: Returns the compact section records for all tasks within the given section. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_tasks_for_section(section_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str section_gid: The globally unique identifier for the section. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param str completed_since: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_tasks_for_section_with_http_info(section_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_tasks_for_section_with_http_info(section_gid, opts, **kwargs) # noqa: E501
return data
def get_tasks_for_section_with_http_info(self, section_gid, opts, **kwargs): # noqa: E501
"""Get tasks from a section # noqa: E501
*Board view only*: Returns the compact section records for all tasks within the given section. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_tasks_for_section_with_http_info(section_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str section_gid: The globally unique identifier for the section. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param str completed_since: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_tasks_for_section" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'section_gid' is set
if (section_gid is None):
raise ValueError("Missing the required parameter `section_gid` when calling `get_tasks_for_section`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['section_gid'] = section_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/sections/{section_gid}/tasks', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/sections/{section_gid}/tasks',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/sections/{section_gid}/tasks', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_tasks_for_tag(self, tag_gid, opts, **kwargs): # noqa: E501
"""Get tasks from a tag # noqa: E501
Returns the compact task records for all tasks with the given tag. Tasks can have more than one tag at a time. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_tasks_for_tag(tag_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str tag_gid: Globally unique identifier for the tag. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_tasks_for_tag_with_http_info(tag_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_tasks_for_tag_with_http_info(tag_gid, opts, **kwargs) # noqa: E501
return data
def get_tasks_for_tag_with_http_info(self, tag_gid, opts, **kwargs): # noqa: E501
"""Get tasks from a tag # noqa: E501
Returns the compact task records for all tasks with the given tag. Tasks can have more than one tag at a time. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_tasks_for_tag_with_http_info(tag_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str tag_gid: Globally unique identifier for the tag. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_tasks_for_tag" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'tag_gid' is set
if (tag_gid is None):
raise ValueError("Missing the required parameter `tag_gid` when calling `get_tasks_for_tag`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['tag_gid'] = tag_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tags/{tag_gid}/tasks', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/tags/{tag_gid}/tasks',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/tags/{tag_gid}/tasks', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_tasks_for_user_task_list(self, user_task_list_gid, opts, **kwargs): # noqa: E501
"""Get tasks from a user task list # noqa: E501
Returns the compact list of tasks in a user’s My Tasks list. *Note: Access control is enforced for this endpoint as with all Asana API endpoints, meaning a user’s private tasks will be filtered out if the API-authenticated user does not have access to them.* *Note: Both complete and incomplete tasks are returned by default unless they are filtered out (for example, setting `completed_since=now` will return only incomplete tasks, which is the default view for “My Tasks” in Asana.)* # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_tasks_for_user_task_list(user_task_list_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_task_list_gid: Globally unique identifier for the user task list. (required)
:param str completed_since: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_tasks_for_user_task_list_with_http_info(user_task_list_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_tasks_for_user_task_list_with_http_info(user_task_list_gid, opts, **kwargs) # noqa: E501
return data
def get_tasks_for_user_task_list_with_http_info(self, user_task_list_gid, opts, **kwargs): # noqa: E501
"""Get tasks from a user task list # noqa: E501
Returns the compact list of tasks in a user’s My Tasks list. *Note: Access control is enforced for this endpoint as with all Asana API endpoints, meaning a user’s private tasks will be filtered out if the API-authenticated user does not have access to them.* *Note: Both complete and incomplete tasks are returned by default unless they are filtered out (for example, setting `completed_since=now` will return only incomplete tasks, which is the default view for “My Tasks” in Asana.)* # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_tasks_for_user_task_list_with_http_info(user_task_list_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_task_list_gid: Globally unique identifier for the user task list. (required)
:param str completed_since: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_tasks_for_user_task_list" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'user_task_list_gid' is set
if (user_task_list_gid is None):
raise ValueError("Missing the required parameter `user_task_list_gid` when calling `get_tasks_for_user_task_list`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['user_task_list_gid'] = user_task_list_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/user_task_lists/{user_task_list_gid}/tasks', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/user_task_lists/{user_task_list_gid}/tasks',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/user_task_lists/{user_task_list_gid}/tasks', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def remove_dependencies_for_task(self, body, task_gid, **kwargs): # noqa: E501
"""Unlink dependencies from a task # noqa: E501
Unlinks a set of dependencies from this task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_dependencies_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The list of tasks to unlink as dependencies. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.remove_dependencies_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501
else:
(data) = self.remove_dependencies_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501
return data
def remove_dependencies_for_task_with_http_info(self, body, task_gid, **kwargs): # noqa: E501
"""Unlink dependencies from a task # noqa: E501
Unlinks a set of dependencies from this task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_dependencies_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The list of tasks to unlink as dependencies. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method remove_dependencies_for_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `remove_dependencies_for_task`") # noqa: E501
# verify the required parameter 'task_gid' is set
if (task_gid is None):
raise ValueError("Missing the required parameter `task_gid` when calling `remove_dependencies_for_task`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_gid'] = task_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks/{task_gid}/removeDependencies', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/tasks/{task_gid}/removeDependencies', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/tasks/{task_gid}/removeDependencies', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def remove_dependents_for_task(self, body, task_gid, **kwargs): # noqa: E501
"""Unlink dependents from a task # noqa: E501
Unlinks a set of dependents from this task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_dependents_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The list of tasks to remove as dependents. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.remove_dependents_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501
else:
(data) = self.remove_dependents_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501
return data
def remove_dependents_for_task_with_http_info(self, body, task_gid, **kwargs): # noqa: E501
"""Unlink dependents from a task # noqa: E501
Unlinks a set of dependents from this task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_dependents_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The list of tasks to remove as dependents. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method remove_dependents_for_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `remove_dependents_for_task`") # noqa: E501
# verify the required parameter 'task_gid' is set
if (task_gid is None):
raise ValueError("Missing the required parameter `task_gid` when calling `remove_dependents_for_task`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_gid'] = task_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks/{task_gid}/removeDependents', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/tasks/{task_gid}/removeDependents', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/tasks/{task_gid}/removeDependents', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def remove_follower_for_task(self, body, task_gid, opts, **kwargs): # noqa: E501
"""Remove followers from a task # noqa: E501
Removes each of the specified followers from the task if they are following. Returns the complete, updated record for the affected task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_follower_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The followers to remove from the task. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.remove_follower_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.remove_follower_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501
return data
def remove_follower_for_task_with_http_info(self, body, task_gid, opts, **kwargs): # noqa: E501
"""Remove followers from a task # noqa: E501
Removes each of the specified followers from the task if they are following. Returns the complete, updated record for the affected task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_follower_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The followers to remove from the task. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method remove_follower_for_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `remove_follower_for_task`") # noqa: E501
# verify the required parameter 'task_gid' is set
if (task_gid is None):
raise ValueError("Missing the required parameter `task_gid` when calling `remove_follower_for_task`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_gid'] = task_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks/{task_gid}/removeFollowers', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/tasks/{task_gid}/removeFollowers', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/tasks/{task_gid}/removeFollowers', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def remove_project_for_task(self, body, task_gid, **kwargs): # noqa: E501
"""Remove a project from a task # noqa: E501
Removes the task from the specified project. The task will still exist in the system, but it will not be in the project anymore. Returns an empty data block. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_project_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The project to remove the task from. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.remove_project_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501
else:
(data) = self.remove_project_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501
return data
def remove_project_for_task_with_http_info(self, body, task_gid, **kwargs): # noqa: E501
"""Remove a project from a task # noqa: E501
Removes the task from the specified project. The task will still exist in the system, but it will not be in the project anymore. Returns an empty data block. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_project_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The project to remove the task from. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method remove_project_for_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `remove_project_for_task`") # noqa: E501
# verify the required parameter 'task_gid' is set
if (task_gid is None):
raise ValueError("Missing the required parameter `task_gid` when calling `remove_project_for_task`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_gid'] = task_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks/{task_gid}/removeProject', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/tasks/{task_gid}/removeProject', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/tasks/{task_gid}/removeProject', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def remove_tag_for_task(self, body, task_gid, **kwargs): # noqa: E501
"""Remove a tag from a task # noqa: E501
Removes a tag from a task. Returns an empty data block. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_tag_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The tag to remove from the task. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.remove_tag_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501
else:
(data) = self.remove_tag_for_task_with_http_info(body, task_gid, **kwargs) # noqa: E501
return data
def remove_tag_for_task_with_http_info(self, body, task_gid, **kwargs): # noqa: E501
"""Remove a tag from a task # noqa: E501
Removes a tag from a task. Returns an empty data block. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_tag_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The tag to remove from the task. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method remove_tag_for_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `remove_tag_for_task`") # noqa: E501
# verify the required parameter 'task_gid' is set
if (task_gid is None):
raise ValueError("Missing the required parameter `task_gid` when calling `remove_tag_for_task`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_gid'] = task_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks/{task_gid}/removeTag', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/tasks/{task_gid}/removeTag', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/tasks/{task_gid}/removeTag', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def search_tasks_for_workspace(self, workspace_gid, opts, **kwargs): # noqa: E501
"""Search tasks in a workspace # noqa: E501
To mirror the functionality of the Asana web app's advanced search feature, the Asana API has a task search endpoint that allows you to build complex filters to find and retrieve the exact data you need. #### Premium access Like the Asana web product's advance search feature, this search endpoint will only be available to premium Asana users. A user is premium if any of the following is true: - The workspace in which the search is being performed is a premium workspace - The user is a member of a premium team inside the workspace Even if a user is only a member of a premium team inside a non-premium workspace, search will allow them to find data anywhere in the workspace, not just inside the premium team. Making a search request using credentials of a non-premium user will result in a `402 Payment Required` error. #### Pagination Search results are not stable; repeating the same query multiple times may return the data in a different order, even if the data do not change. Because of this, the traditional [pagination](https://developers.asana.com/docs/#pagination) available elsewhere in the Asana API is not available here. However, you can paginate manually by sorting the search results by their creation time and then modifying each subsequent query to exclude data you have already seen. Page sizes are limited to a maximum of 100 items, and can be specified by the `limit` query parameter. #### Eventual consistency Changes in Asana (regardless of whether they’re made though the web product or the API) are forwarded to our search infrastructure to be indexed. This process can take between 10 and 60 seconds to complete under normal operation, and longer during some production incidents. Making a change to a task that would alter its presence in a particular search query will not be reflected immediately. This is also true of the advanced search feature in the web product. #### Rate limits You may receive a `429 Too Many Requests` response if you hit any of our [rate limits](https://developers.asana.com/docs/#rate-limits). #### Custom field parameters | Parameter name | Custom field type | Accepted type | |---|---|---| | custom_fields.{gid}.is_set | All | Boolean | | custom_fields.{gid}.value | Text | String | | custom_fields.{gid}.value | Number | Number | | custom_fields.{gid}.value | Enum | Enum option ID | | custom_fields.{gid}.starts_with | Text only | String | | custom_fields.{gid}.ends_with | Text only | String | | custom_fields.{gid}.contains | Text only | String | | custom_fields.{gid}.less_than | Number only | Number | | custom_fields.{gid}.greater_than | Number only | Number | For example, if the gid of the custom field is 12345, these query parameter to find tasks where it is set would be `custom_fields.12345.is_set=true`. To match an exact value for an enum custom field, use the gid of the desired enum option and not the name of the enum option: `custom_fields.12345.value=67890`. **Not Supported**: searching for multiple exact matches of a custom field, searching for multi-enum custom field *Note: If you specify `projects.any` and `sections.any`, you will receive tasks for the project **and** tasks for the section. If you're looking for only tasks in a section, omit the `projects.any` from the request.* # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.search_tasks_for_workspace(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param str text: Performs full-text search on both task name and description
:param str resource_subtype: Filters results by the task's resource_subtype
:param str assignee.any: Comma-separated list of user identifiers
:param str assignee.not: Comma-separated list of user identifiers
:param str portfolios.any: Comma-separated list of portfolio IDs
:param str projects.any: Comma-separated list of project IDs
:param str projects.not: Comma-separated list of project IDs
:param str projects.all: Comma-separated list of project IDs
:param str sections.any: Comma-separated list of section or column IDs
:param str sections.not: Comma-separated list of section or column IDs
:param str sections.all: Comma-separated list of section or column IDs
:param str tags.any: Comma-separated list of tag IDs
:param str tags.not: Comma-separated list of tag IDs
:param str tags.all: Comma-separated list of tag IDs
:param str teams.any: Comma-separated list of team IDs
:param str followers.any: Comma-separated list of user identifiers
:param str followers.not: Comma-separated list of user identifiers
:param str created_by.any: Comma-separated list of user identifiers
:param str created_by.not: Comma-separated list of user identifiers
:param str assigned_by.any: Comma-separated list of user identifiers
:param str assigned_by.not: Comma-separated list of user identifiers
:param str liked_by.not: Comma-separated list of user identifiers
:param str commented_on_by.not: Comma-separated list of user identifiers
:param date due_on.before: ISO 8601 date string
:param date due_on.after: ISO 8601 date string
:param date due_on: ISO 8601 date string or `null`
:param datetime due_at.before: ISO 8601 datetime string
:param datetime due_at.after: ISO 8601 datetime string
:param date start_on.before: ISO 8601 date string
:param date start_on.after: ISO 8601 date string
:param date start_on: ISO 8601 date string or `null`
:param date created_on.before: ISO 8601 date string
:param date created_on.after: ISO 8601 date string
:param date created_on: ISO 8601 date string or `null`
:param datetime created_at.before: ISO 8601 datetime string
:param datetime created_at.after: ISO 8601 datetime string
:param date completed_on.before: ISO 8601 date string
:param date completed_on.after: ISO 8601 date string
:param date completed_on: ISO 8601 date string or `null`
:param datetime completed_at.before: ISO 8601 datetime string
:param datetime completed_at.after: ISO 8601 datetime string
:param date modified_on.before: ISO 8601 date string
:param date modified_on.after: ISO 8601 date string
:param date modified_on: ISO 8601 date string or `null`
:param datetime modified_at.before: ISO 8601 datetime string
:param datetime modified_at.after: ISO 8601 datetime string
:param bool is_blocking: Filter to incomplete tasks with dependents
:param bool is_blocked: Filter to tasks with incomplete dependencies
:param bool has_attachment: Filter to tasks with attachments
:param bool completed: Filter to completed tasks
:param bool is_subtask: Filter to subtasks
:param str sort_by: One of `due_date`, `created_at`, `completed_at`, `likes`, or `modified_at`, defaults to `modified_at`
:param bool sort_ascending: Default `false`
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.search_tasks_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.search_tasks_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501
return data
def search_tasks_for_workspace_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501
"""Search tasks in a workspace # noqa: E501
To mirror the functionality of the Asana web app's advanced search feature, the Asana API has a task search endpoint that allows you to build complex filters to find and retrieve the exact data you need. #### Premium access Like the Asana web product's advance search feature, this search endpoint will only be available to premium Asana users. A user is premium if any of the following is true: - The workspace in which the search is being performed is a premium workspace - The user is a member of a premium team inside the workspace Even if a user is only a member of a premium team inside a non-premium workspace, search will allow them to find data anywhere in the workspace, not just inside the premium team. Making a search request using credentials of a non-premium user will result in a `402 Payment Required` error. #### Pagination Search results are not stable; repeating the same query multiple times may return the data in a different order, even if the data do not change. Because of this, the traditional [pagination](https://developers.asana.com/docs/#pagination) available elsewhere in the Asana API is not available here. However, you can paginate manually by sorting the search results by their creation time and then modifying each subsequent query to exclude data you have already seen. Page sizes are limited to a maximum of 100 items, and can be specified by the `limit` query parameter. #### Eventual consistency Changes in Asana (regardless of whether they’re made though the web product or the API) are forwarded to our search infrastructure to be indexed. This process can take between 10 and 60 seconds to complete under normal operation, and longer during some production incidents. Making a change to a task that would alter its presence in a particular search query will not be reflected immediately. This is also true of the advanced search feature in the web product. #### Rate limits You may receive a `429 Too Many Requests` response if you hit any of our [rate limits](https://developers.asana.com/docs/#rate-limits). #### Custom field parameters | Parameter name | Custom field type | Accepted type | |---|---|---| | custom_fields.{gid}.is_set | All | Boolean | | custom_fields.{gid}.value | Text | String | | custom_fields.{gid}.value | Number | Number | | custom_fields.{gid}.value | Enum | Enum option ID | | custom_fields.{gid}.starts_with | Text only | String | | custom_fields.{gid}.ends_with | Text only | String | | custom_fields.{gid}.contains | Text only | String | | custom_fields.{gid}.less_than | Number only | Number | | custom_fields.{gid}.greater_than | Number only | Number | For example, if the gid of the custom field is 12345, these query parameter to find tasks where it is set would be `custom_fields.12345.is_set=true`. To match an exact value for an enum custom field, use the gid of the desired enum option and not the name of the enum option: `custom_fields.12345.value=67890`. **Not Supported**: searching for multiple exact matches of a custom field, searching for multi-enum custom field *Note: If you specify `projects.any` and `sections.any`, you will receive tasks for the project **and** tasks for the section. If you're looking for only tasks in a section, omit the `projects.any` from the request.* # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.search_tasks_for_workspace_with_http_info(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param str text: Performs full-text search on both task name and description
:param str resource_subtype: Filters results by the task's resource_subtype
:param str assignee.any: Comma-separated list of user identifiers
:param str assignee.not: Comma-separated list of user identifiers
:param str portfolios.any: Comma-separated list of portfolio IDs
:param str projects.any: Comma-separated list of project IDs
:param str projects.not: Comma-separated list of project IDs
:param str projects.all: Comma-separated list of project IDs
:param str sections.any: Comma-separated list of section or column IDs
:param str sections.not: Comma-separated list of section or column IDs
:param str sections.all: Comma-separated list of section or column IDs
:param str tags.any: Comma-separated list of tag IDs
:param str tags.not: Comma-separated list of tag IDs
:param str tags.all: Comma-separated list of tag IDs
:param str teams.any: Comma-separated list of team IDs
:param str followers.any: Comma-separated list of user identifiers
:param str followers.not: Comma-separated list of user identifiers
:param str created_by.any: Comma-separated list of user identifiers
:param str created_by.not: Comma-separated list of user identifiers
:param str assigned_by.any: Comma-separated list of user identifiers
:param str assigned_by.not: Comma-separated list of user identifiers
:param str liked_by.not: Comma-separated list of user identifiers
:param str commented_on_by.not: Comma-separated list of user identifiers
:param date due_on.before: ISO 8601 date string
:param date due_on.after: ISO 8601 date string
:param date due_on: ISO 8601 date string or `null`
:param datetime due_at.before: ISO 8601 datetime string
:param datetime due_at.after: ISO 8601 datetime string
:param date start_on.before: ISO 8601 date string
:param date start_on.after: ISO 8601 date string
:param date start_on: ISO 8601 date string or `null`
:param date created_on.before: ISO 8601 date string
:param date created_on.after: ISO 8601 date string
:param date created_on: ISO 8601 date string or `null`
:param datetime created_at.before: ISO 8601 datetime string
:param datetime created_at.after: ISO 8601 datetime string
:param date completed_on.before: ISO 8601 date string
:param date completed_on.after: ISO 8601 date string
:param date completed_on: ISO 8601 date string or `null`
:param datetime completed_at.before: ISO 8601 datetime string
:param datetime completed_at.after: ISO 8601 datetime string
:param date modified_on.before: ISO 8601 date string
:param date modified_on.after: ISO 8601 date string
:param date modified_on: ISO 8601 date string or `null`
:param datetime modified_at.before: ISO 8601 datetime string
:param datetime modified_at.after: ISO 8601 datetime string
:param bool is_blocking: Filter to incomplete tasks with dependents
:param bool is_blocked: Filter to tasks with incomplete dependencies
:param bool has_attachment: Filter to tasks with attachments
:param bool completed: Filter to completed tasks
:param bool is_subtask: Filter to subtasks
:param str sort_by: One of `due_date`, `created_at`, `completed_at`, `likes`, or `modified_at`, defaults to `modified_at`
:param bool sort_ascending: Default `false`
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
matchSnakeCase = '^custom_fields_(.*?)_.*$'
custom_fields_query_param_keys = []
for key, val in six.iteritems(params['kwargs']):
# Do not throw an error if the user provides custom field query parameters
if (re.match(matchSnakeCase, key)):
custom_field_gid = re.search(matchSnakeCase, key).group(1)
custom_field_query_param_key = key.replace(f'custom_fields_{custom_field_gid}_', f'custom_fields.{custom_field_gid}.')
params[custom_field_query_param_key] = val
custom_fields_query_param_keys.append(custom_field_query_param_key)
continue
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method search_tasks_for_workspace" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workspace_gid' is set
if (workspace_gid is None):
raise ValueError("Missing the required parameter `workspace_gid` when calling `search_tasks_for_workspace`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['workspace_gid'] = workspace_gid # noqa: E501
query_params = {}
query_params = opts
# Checks if the user provided custom field query parameters and adds it to the request
for key in custom_fields_query_param_keys:
query_params[key] = params[key] # noqa: E501
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/workspaces/{workspace_gid}/tasks/search', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/workspaces/{workspace_gid}/tasks/search',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/workspaces/{workspace_gid}/tasks/search', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def set_parent_for_task(self, body, task_gid, opts, **kwargs): # noqa: E501
"""Set the parent of a task # noqa: E501
parent, or no parent task at all. Returns an empty data block. When using `insert_before` and `insert_after`, at most one of those two options can be specified, and they must already be subtasks of the parent. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.set_parent_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The new parent of the subtask. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.set_parent_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.set_parent_for_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501
return data
def set_parent_for_task_with_http_info(self, body, task_gid, opts, **kwargs): # noqa: E501
"""Set the parent of a task # noqa: E501
parent, or no parent task at all. Returns an empty data block. When using `insert_before` and `insert_after`, at most one of those two options can be specified, and they must already be subtasks of the parent. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.set_parent_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The new parent of the subtask. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method set_parent_for_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `set_parent_for_task`") # noqa: E501
# verify the required parameter 'task_gid' is set
if (task_gid is None):
raise ValueError("Missing the required parameter `task_gid` when calling `set_parent_for_task`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_gid'] = task_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks/{task_gid}/setParent', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/tasks/{task_gid}/setParent', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/tasks/{task_gid}/setParent', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def update_task(self, body, task_gid, opts, **kwargs): # noqa: E501
"""Update a task # noqa: E501
A specific, existing task can be updated by making a PUT request on the URL for that task. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated task record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The task to update. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.update_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.update_task_with_http_info(body, task_gid, opts, **kwargs) # noqa: E501
return data
def update_task_with_http_info(self, body, task_gid, opts, **kwargs): # noqa: E501
"""Update a task # noqa: E501
A specific, existing task can be updated by making a PUT request on the URL for that task. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated task record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The task to update. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method update_task" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `update_task`") # noqa: E501
# verify the required parameter 'task_gid' is set
if (task_gid is None):
raise ValueError("Missing the required parameter `task_gid` when calling `update_task`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['task_gid'] = task_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/tasks/{task_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/tasks/{task_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/tasks/{task_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
class TasksApi(object):
'''NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
'''
def __init__(self, api_client=None):
pass
def add_dependencies_for_task(self, body, task_gid, **kwargs):
'''Set dependencies for a task # noqa: E501
Marks a set of tasks as dependencies of this task, if they are not already dependencies. *A task can have at most 30 dependents and dependencies combined*. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_dependencies_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The list of tasks to set as dependencies. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def add_dependencies_for_task_with_http_info(self, body, task_gid, **kwargs):
'''Set dependencies for a task # noqa: E501
Marks a set of tasks as dependencies of this task, if they are not already dependencies. *A task can have at most 30 dependents and dependencies combined*. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_dependencies_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The list of tasks to set as dependencies. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def add_dependents_for_task(self, body, task_gid, **kwargs):
'''Set dependents for a task # noqa: E501
Marks a set of tasks as dependents of this task, if they are not already dependents. *A task can have at most 30 dependents and dependencies combined*. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_dependents_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The list of tasks to add as dependents. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def add_dependents_for_task_with_http_info(self, body, task_gid, **kwargs):
'''Set dependents for a task # noqa: E501
Marks a set of tasks as dependents of this task, if they are not already dependents. *A task can have at most 30 dependents and dependencies combined*. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_dependents_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The list of tasks to add as dependents. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def add_followers_for_task(self, body, task_gid, opts, **kwargs):
'''Add followers to a task # noqa: E501
Adds followers to a task. Returns an empty data block. Each task can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated task record, described above. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_followers_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The followers to add to the task. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def add_followers_for_task_with_http_info(self, body, task_gid, opts, **kwargs):
'''Add followers to a task # noqa: E501
Adds followers to a task. Returns an empty data block. Each task can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated task record, described above. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_followers_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The followers to add to the task. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def add_project_for_task(self, body, task_gid, **kwargs):
'''Add a project to a task # noqa: E501
Adds the task to the specified project, in the optional location specified. If no location arguments are given, the task will be added to the end of the project. `addProject` can also be used to reorder a task within a project or section that already contains it. At most one of `insert_before`, `insert_after`, or `section` should be specified. Inserting into a section in an non-order-dependent way can be done by specifying section, otherwise, to insert within a section in a particular place, specify `insert_before` or `insert_after` and a task within the section to anchor the position of this task. A task can have at most 20 projects multi-homed to it. Returns an empty data block. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_project_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The project to add the task to. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def add_project_for_task_with_http_info(self, body, task_gid, **kwargs):
'''Add a project to a task # noqa: E501
Adds the task to the specified project, in the optional location specified. If no location arguments are given, the task will be added to the end of the project. `addProject` can also be used to reorder a task within a project or section that already contains it. At most one of `insert_before`, `insert_after`, or `section` should be specified. Inserting into a section in an non-order-dependent way can be done by specifying section, otherwise, to insert within a section in a particular place, specify `insert_before` or `insert_after` and a task within the section to anchor the position of this task. A task can have at most 20 projects multi-homed to it. Returns an empty data block. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_project_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The project to add the task to. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def add_tag_for_task(self, body, task_gid, **kwargs):
'''Add a tag to a task # noqa: E501
Adds a tag to a task. Returns an empty data block. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_tag_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The tag to add to the task. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def add_tag_for_task_with_http_info(self, body, task_gid, **kwargs):
'''Add a tag to a task # noqa: E501
Adds a tag to a task. Returns an empty data block. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_tag_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The tag to add to the task. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def create_subtask_for_task(self, body, task_gid, opts, **kwargs):
'''Create a subtask # noqa: E501
Creates a new subtask and adds it to the parent task. Returns the full record for the newly created subtask. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_subtask_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The new subtask to create. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def create_subtask_for_task_with_http_info(self, body, task_gid, opts, **kwargs):
'''Create a subtask # noqa: E501
Creates a new subtask and adds it to the parent task. Returns the full record for the newly created subtask. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_subtask_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The new subtask to create. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def create_task(self, body, opts, **kwargs):
'''Create a task # noqa: E501
Creating a new task is as easy as POSTing to the `/tasks` endpoint with a data block containing the fields you’d like to set on the task. Any unspecified fields will take on default values. Every task is required to be created in a specific workspace, and this workspace cannot be changed once set. The workspace need not be set explicitly if you specify `projects` or a `parent` task instead. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_task(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The task to create. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def create_task_with_http_info(self, body, opts, **kwargs):
'''Create a task # noqa: E501
Creating a new task is as easy as POSTing to the `/tasks` endpoint with a data block containing the fields you’d like to set on the task. Any unspecified fields will take on default values. Every task is required to be created in a specific workspace, and this workspace cannot be changed once set. The workspace need not be set explicitly if you specify `projects` or a `parent` task instead. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_task_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The task to create. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def delete_task(self, task_gid, **kwargs):
'''Delete a task # noqa: E501
A specific, existing task can be deleted by making a DELETE request on the URL for that task. Deleted tasks go into the “trash” of the user making the delete request. Tasks can be recovered from the trash within a period of 30 days; afterward they are completely removed from the system. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_task(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def delete_task_with_http_info(self, task_gid, **kwargs):
'''Delete a task # noqa: E501
A specific, existing task can be deleted by making a DELETE request on the URL for that task. Deleted tasks go into the “trash” of the user making the delete request. Tasks can be recovered from the trash within a period of 30 days; afterward they are completely removed from the system. Returns an empty data record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_task_with_http_info(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def duplicate_task(self, body, task_gid, opts, **kwargs):
'''Duplicate a task # noqa: E501
Creates and returns a job that will asynchronously handle the duplication. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.duplicate_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Describes the duplicate's name and the fields that will be duplicated. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: JobResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def duplicate_task_with_http_info(self, body, task_gid, opts, **kwargs):
'''Duplicate a task # noqa: E501
Creates and returns a job that will asynchronously handle the duplication. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.duplicate_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: Describes the duplicate's name and the fields that will be duplicated. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: JobResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_dependencies_for_task(self, task_gid, opts, **kwargs):
'''Get dependencies from a task # noqa: E501
Returns the compact representations of all of the dependencies of a task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_dependencies_for_task(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_dependencies_for_task_with_http_info(self, task_gid, opts, **kwargs):
'''Get dependencies from a task # noqa: E501
Returns the compact representations of all of the dependencies of a task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_dependencies_for_task_with_http_info(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_dependents_for_task(self, task_gid, opts, **kwargs):
'''Get dependents from a task # noqa: E501
Returns the compact representations of all of the dependents of a task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_dependents_for_task(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_dependents_for_task_with_http_info(self, task_gid, opts, **kwargs):
'''Get dependents from a task # noqa: E501
Returns the compact representations of all of the dependents of a task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_dependents_for_task_with_http_info(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_subtasks_for_task(self, task_gid, opts, **kwargs):
'''Get subtasks from a task # noqa: E501
Returns a compact representation of all of the subtasks of a task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_subtasks_for_task(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_subtasks_for_task_with_http_info(self, task_gid, opts, **kwargs):
'''Get subtasks from a task # noqa: E501
Returns a compact representation of all of the subtasks of a task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_subtasks_for_task_with_http_info(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_task(self, task_gid, opts, **kwargs):
'''Get a task # noqa: E501
Returns the complete task record for a single task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_task(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_task_with_http_info(self, task_gid, opts, **kwargs):
'''Get a task # noqa: E501
Returns the complete task record for a single task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_task_with_http_info(task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_task_for_custom_id(self, workspace_gid, custom_id, **kwargs):
'''Get a task for a given custom ID # noqa: E501
Returns a task given a custom ID shortcode. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_task_for_custom_id(workspace_gid, custom_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param str custom_id: Generated custom ID for a task. (required)
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_task_for_custom_id_with_http_info(self, workspace_gid, custom_id, **kwargs):
'''Get a task for a given custom ID # noqa: E501
Returns a task given a custom ID shortcode. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_task_for_custom_id_with_http_info(workspace_gid, custom_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param str custom_id: Generated custom ID for a task. (required)
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_tasks(self, opts, **kwargs):
'''Get multiple tasks # noqa: E501
Returns the compact task records for some filtered set of tasks. Use one or more of the parameters provided to filter the tasks returned. You must specify a `project` or `tag` if you do not specify `assignee` and `workspace`. For more complex task retrieval, use [workspaces/{workspace_gid}/tasks/search](/reference/searchtasksforworkspace). # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_tasks(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param str assignee: The assignee to filter tasks on. If searching for unassigned tasks, assignee.any = null can be specified. *Note: If you specify `assignee`, you must also specify the `workspace` to filter on.*
:param str project: The project to filter tasks on.
:param str section: The section to filter tasks on.
:param str workspace: The workspace to filter tasks on. *Note: If you specify `workspace`, you must also specify the `assignee` to filter on.*
:param datetime completed_since: Only return tasks that are either incomplete or that have been completed since this time.
:param datetime modified_since: Only return tasks that have been modified since the given time. *Note: A task is considered “modified” if any of its properties change, or associations between it and other objects are modified (e.g. a task being added to a project). A task is not considered modified just because another object it is associated with (e.g. a subtask) is modified. Actions that count as modifying the task include assigning, renaming, completing, and adding stories.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_tasks_with_http_info(self, opts, **kwargs):
'''Get multiple tasks # noqa: E501
Returns the compact task records for some filtered set of tasks. Use one or more of the parameters provided to filter the tasks returned. You must specify a `project` or `tag` if you do not specify `assignee` and `workspace`. For more complex task retrieval, use [workspaces/{workspace_gid}/tasks/search](/reference/searchtasksforworkspace). # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_tasks_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param str assignee: The assignee to filter tasks on. If searching for unassigned tasks, assignee.any = null can be specified. *Note: If you specify `assignee`, you must also specify the `workspace` to filter on.*
:param str project: The project to filter tasks on.
:param str section: The section to filter tasks on.
:param str workspace: The workspace to filter tasks on. *Note: If you specify `workspace`, you must also specify the `assignee` to filter on.*
:param datetime completed_since: Only return tasks that are either incomplete or that have been completed since this time.
:param datetime modified_since: Only return tasks that have been modified since the given time. *Note: A task is considered “modified” if any of its properties change, or associations between it and other objects are modified (e.g. a task being added to a project). A task is not considered modified just because another object it is associated with (e.g. a subtask) is modified. Actions that count as modifying the task include assigning, renaming, completing, and adding stories.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_tasks_for_project(self, project_gid, opts, **kwargs):
'''Get tasks from a project # noqa: E501
Returns the compact task records for all tasks within the given project, ordered by their priority within the project. Tasks can exist in more than one project at a time. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_tasks_for_project(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param str completed_since: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_tasks_for_project_with_http_info(self, project_gid, opts, **kwargs):
'''Get tasks from a project # noqa: E501
Returns the compact task records for all tasks within the given project, ordered by their priority within the project. Tasks can exist in more than one project at a time. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_tasks_for_project_with_http_info(project_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str project_gid: Globally unique identifier for the project. (required)
:param str completed_since: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_tasks_for_section(self, section_gid, opts, **kwargs):
'''Get tasks from a section # noqa: E501
*Board view only*: Returns the compact section records for all tasks within the given section. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_tasks_for_section(section_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str section_gid: The globally unique identifier for the section. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param str completed_since: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_tasks_for_section_with_http_info(self, section_gid, opts, **kwargs):
'''Get tasks from a section # noqa: E501
*Board view only*: Returns the compact section records for all tasks within the given section. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_tasks_for_section_with_http_info(section_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str section_gid: The globally unique identifier for the section. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param str completed_since: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_tasks_for_tag(self, tag_gid, opts, **kwargs):
'''Get tasks from a tag # noqa: E501
Returns the compact task records for all tasks with the given tag. Tasks can have more than one tag at a time. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_tasks_for_tag(tag_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str tag_gid: Globally unique identifier for the tag. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_tasks_for_tag_with_http_info(self, tag_gid, opts, **kwargs):
'''Get tasks from a tag # noqa: E501
Returns the compact task records for all tasks with the given tag. Tasks can have more than one tag at a time. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_tasks_for_tag_with_http_info(tag_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str tag_gid: Globally unique identifier for the tag. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_tasks_for_user_task_list(self, user_task_list_gid, opts, **kwargs):
'''Get tasks from a user task list # noqa: E501
Returns the compact list of tasks in a user’s My Tasks list. *Note: Access control is enforced for this endpoint as with all Asana API endpoints, meaning a user’s private tasks will be filtered out if the API-authenticated user does not have access to them.* *Note: Both complete and incomplete tasks are returned by default unless they are filtered out (for example, setting `completed_since=now` will return only incomplete tasks, which is the default view for “My Tasks” in Asana.)* # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_tasks_for_user_task_list(user_task_list_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_task_list_gid: Globally unique identifier for the user task list. (required)
:param str completed_since: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_tasks_for_user_task_list_with_http_info(self, user_task_list_gid, opts, **kwargs):
'''Get tasks from a user task list # noqa: E501
Returns the compact list of tasks in a user’s My Tasks list. *Note: Access control is enforced for this endpoint as with all Asana API endpoints, meaning a user’s private tasks will be filtered out if the API-authenticated user does not have access to them.* *Note: Both complete and incomplete tasks are returned by default unless they are filtered out (for example, setting `completed_since=now` will return only incomplete tasks, which is the default view for “My Tasks” in Asana.)* # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_tasks_for_user_task_list_with_http_info(user_task_list_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_task_list_gid: Globally unique identifier for the user task list. (required)
:param str completed_since: Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*.
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def remove_dependencies_for_task(self, body, task_gid, **kwargs):
'''Unlink dependencies from a task # noqa: E501
Unlinks a set of dependencies from this task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_dependencies_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The list of tasks to unlink as dependencies. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def remove_dependencies_for_task_with_http_info(self, body, task_gid, **kwargs):
'''Unlink dependencies from a task # noqa: E501
Unlinks a set of dependencies from this task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_dependencies_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The list of tasks to unlink as dependencies. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def remove_dependents_for_task(self, body, task_gid, **kwargs):
'''Unlink dependents from a task # noqa: E501
Unlinks a set of dependents from this task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_dependents_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The list of tasks to remove as dependents. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def remove_dependents_for_task_with_http_info(self, body, task_gid, **kwargs):
'''Unlink dependents from a task # noqa: E501
Unlinks a set of dependents from this task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_dependents_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The list of tasks to remove as dependents. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def remove_follower_for_task(self, body, task_gid, opts, **kwargs):
'''Remove followers from a task # noqa: E501
Removes each of the specified followers from the task if they are following. Returns the complete, updated record for the affected task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_follower_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The followers to remove from the task. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def remove_follower_for_task_with_http_info(self, body, task_gid, opts, **kwargs):
'''Remove followers from a task # noqa: E501
Removes each of the specified followers from the task if they are following. Returns the complete, updated record for the affected task. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_follower_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The followers to remove from the task. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def remove_project_for_task(self, body, task_gid, **kwargs):
'''Remove a project from a task # noqa: E501
Removes the task from the specified project. The task will still exist in the system, but it will not be in the project anymore. Returns an empty data block. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_project_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The project to remove the task from. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def remove_project_for_task_with_http_info(self, body, task_gid, **kwargs):
'''Remove a project from a task # noqa: E501
Removes the task from the specified project. The task will still exist in the system, but it will not be in the project anymore. Returns an empty data block. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_project_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The project to remove the task from. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def remove_tag_for_task(self, body, task_gid, **kwargs):
'''Remove a tag from a task # noqa: E501
Removes a tag from a task. Returns an empty data block. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_tag_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The tag to remove from the task. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def remove_tag_for_task_with_http_info(self, body, task_gid, **kwargs):
'''Remove a tag from a task # noqa: E501
Removes a tag from a task. Returns an empty data block. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_tag_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The tag to remove from the task. (required)
:param str task_gid: The task to operate on. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def search_tasks_for_workspace(self, workspace_gid, opts, **kwargs):
'''Search tasks in a workspace # noqa: E501
To mirror the functionality of the Asana web app's advanced search feature, the Asana API has a task search endpoint that allows you to build complex filters to find and retrieve the exact data you need. #### Premium access Like the Asana web product's advance search feature, this search endpoint will only be available to premium Asana users. A user is premium if any of the following is true: - The workspace in which the search is being performed is a premium workspace - The user is a member of a premium team inside the workspace Even if a user is only a member of a premium team inside a non-premium workspace, search will allow them to find data anywhere in the workspace, not just inside the premium team. Making a search request using credentials of a non-premium user will result in a `402 Payment Required` error. #### Pagination Search results are not stable; repeating the same query multiple times may return the data in a different order, even if the data do not change. Because of this, the traditional [pagination](https://developers.asana.com/docs/#pagination) available elsewhere in the Asana API is not available here. However, you can paginate manually by sorting the search results by their creation time and then modifying each subsequent query to exclude data you have already seen. Page sizes are limited to a maximum of 100 items, and can be specified by the `limit` query parameter. #### Eventual consistency Changes in Asana (regardless of whether they’re made though the web product or the API) are forwarded to our search infrastructure to be indexed. This process can take between 10 and 60 seconds to complete under normal operation, and longer during some production incidents. Making a change to a task that would alter its presence in a particular search query will not be reflected immediately. This is also true of the advanced search feature in the web product. #### Rate limits You may receive a `429 Too Many Requests` response if you hit any of our [rate limits](https://developers.asana.com/docs/#rate-limits). #### Custom field parameters | Parameter name | Custom field type | Accepted type | |---|---|---| | custom_fields.{gid}.is_set | All | Boolean | | custom_fields.{gid}.value | Text | String | | custom_fields.{gid}.value | Number | Number | | custom_fields.{gid}.value | Enum | Enum option ID | | custom_fields.{gid}.starts_with | Text only | String | | custom_fields.{gid}.ends_with | Text only | String | | custom_fields.{gid}.contains | Text only | String | | custom_fields.{gid}.less_than | Number only | Number | | custom_fields.{gid}.greater_than | Number only | Number | For example, if the gid of the custom field is 12345, these query parameter to find tasks where it is set would be `custom_fields.12345.is_set=true`. To match an exact value for an enum custom field, use the gid of the desired enum option and not the name of the enum option: `custom_fields.12345.value=67890`. **Not Supported**: searching for multiple exact matches of a custom field, searching for multi-enum custom field *Note: If you specify `projects.any` and `sections.any`, you will receive tasks for the project **and** tasks for the section. If you're looking for only tasks in a section, omit the `projects.any` from the request.* # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.search_tasks_for_workspace(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param str text: Performs full-text search on both task name and description
:param str resource_subtype: Filters results by the task's resource_subtype
:param str assignee.any: Comma-separated list of user identifiers
:param str assignee.not: Comma-separated list of user identifiers
:param str portfolios.any: Comma-separated list of portfolio IDs
:param str projects.any: Comma-separated list of project IDs
:param str projects.not: Comma-separated list of project IDs
:param str projects.all: Comma-separated list of project IDs
:param str sections.any: Comma-separated list of section or column IDs
:param str sections.not: Comma-separated list of section or column IDs
:param str sections.all: Comma-separated list of section or column IDs
:param str tags.any: Comma-separated list of tag IDs
:param str tags.not: Comma-separated list of tag IDs
:param str tags.all: Comma-separated list of tag IDs
:param str teams.any: Comma-separated list of team IDs
:param str followers.any: Comma-separated list of user identifiers
:param str followers.not: Comma-separated list of user identifiers
:param str created_by.any: Comma-separated list of user identifiers
:param str created_by.not: Comma-separated list of user identifiers
:param str assigned_by.any: Comma-separated list of user identifiers
:param str assigned_by.not: Comma-separated list of user identifiers
:param str liked_by.not: Comma-separated list of user identifiers
:param str commented_on_by.not: Comma-separated list of user identifiers
:param date due_on.before: ISO 8601 date string
:param date due_on.after: ISO 8601 date string
:param date due_on: ISO 8601 date string or `null`
:param datetime due_at.before: ISO 8601 datetime string
:param datetime due_at.after: ISO 8601 datetime string
:param date start_on.before: ISO 8601 date string
:param date start_on.after: ISO 8601 date string
:param date start_on: ISO 8601 date string or `null`
:param date created_on.before: ISO 8601 date string
:param date created_on.after: ISO 8601 date string
:param date created_on: ISO 8601 date string or `null`
:param datetime created_at.before: ISO 8601 datetime string
:param datetime created_at.after: ISO 8601 datetime string
:param date completed_on.before: ISO 8601 date string
:param date completed_on.after: ISO 8601 date string
:param date completed_on: ISO 8601 date string or `null`
:param datetime completed_at.before: ISO 8601 datetime string
:param datetime completed_at.after: ISO 8601 datetime string
:param date modified_on.before: ISO 8601 date string
:param date modified_on.after: ISO 8601 date string
:param date modified_on: ISO 8601 date string or `null`
:param datetime modified_at.before: ISO 8601 datetime string
:param datetime modified_at.after: ISO 8601 datetime string
:param bool is_blocking: Filter to incomplete tasks with dependents
:param bool is_blocked: Filter to tasks with incomplete dependencies
:param bool has_attachment: Filter to tasks with attachments
:param bool completed: Filter to completed tasks
:param bool is_subtask: Filter to subtasks
:param str sort_by: One of `due_date`, `created_at`, `completed_at`, `likes`, or `modified_at`, defaults to `modified_at`
:param bool sort_ascending: Default `false`
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def search_tasks_for_workspace_with_http_info(self, workspace_gid, opts, **kwargs):
'''Search tasks in a workspace # noqa: E501
To mirror the functionality of the Asana web app's advanced search feature, the Asana API has a task search endpoint that allows you to build complex filters to find and retrieve the exact data you need. #### Premium access Like the Asana web product's advance search feature, this search endpoint will only be available to premium Asana users. A user is premium if any of the following is true: - The workspace in which the search is being performed is a premium workspace - The user is a member of a premium team inside the workspace Even if a user is only a member of a premium team inside a non-premium workspace, search will allow them to find data anywhere in the workspace, not just inside the premium team. Making a search request using credentials of a non-premium user will result in a `402 Payment Required` error. #### Pagination Search results are not stable; repeating the same query multiple times may return the data in a different order, even if the data do not change. Because of this, the traditional [pagination](https://developers.asana.com/docs/#pagination) available elsewhere in the Asana API is not available here. However, you can paginate manually by sorting the search results by their creation time and then modifying each subsequent query to exclude data you have already seen. Page sizes are limited to a maximum of 100 items, and can be specified by the `limit` query parameter. #### Eventual consistency Changes in Asana (regardless of whether they’re made though the web product or the API) are forwarded to our search infrastructure to be indexed. This process can take between 10 and 60 seconds to complete under normal operation, and longer during some production incidents. Making a change to a task that would alter its presence in a particular search query will not be reflected immediately. This is also true of the advanced search feature in the web product. #### Rate limits You may receive a `429 Too Many Requests` response if you hit any of our [rate limits](https://developers.asana.com/docs/#rate-limits). #### Custom field parameters | Parameter name | Custom field type | Accepted type | |---|---|---| | custom_fields.{gid}.is_set | All | Boolean | | custom_fields.{gid}.value | Text | String | | custom_fields.{gid}.value | Number | Number | | custom_fields.{gid}.value | Enum | Enum option ID | | custom_fields.{gid}.starts_with | Text only | String | | custom_fields.{gid}.ends_with | Text only | String | | custom_fields.{gid}.contains | Text only | String | | custom_fields.{gid}.less_than | Number only | Number | | custom_fields.{gid}.greater_than | Number only | Number | For example, if the gid of the custom field is 12345, these query parameter to find tasks where it is set would be `custom_fields.12345.is_set=true`. To match an exact value for an enum custom field, use the gid of the desired enum option and not the name of the enum option: `custom_fields.12345.value=67890`. **Not Supported**: searching for multiple exact matches of a custom field, searching for multi-enum custom field *Note: If you specify `projects.any` and `sections.any`, you will receive tasks for the project **and** tasks for the section. If you're looking for only tasks in a section, omit the `projects.any` from the request.* # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.search_tasks_for_workspace_with_http_info(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param str text: Performs full-text search on both task name and description
:param str resource_subtype: Filters results by the task's resource_subtype
:param str assignee.any: Comma-separated list of user identifiers
:param str assignee.not: Comma-separated list of user identifiers
:param str portfolios.any: Comma-separated list of portfolio IDs
:param str projects.any: Comma-separated list of project IDs
:param str projects.not: Comma-separated list of project IDs
:param str projects.all: Comma-separated list of project IDs
:param str sections.any: Comma-separated list of section or column IDs
:param str sections.not: Comma-separated list of section or column IDs
:param str sections.all: Comma-separated list of section or column IDs
:param str tags.any: Comma-separated list of tag IDs
:param str tags.not: Comma-separated list of tag IDs
:param str tags.all: Comma-separated list of tag IDs
:param str teams.any: Comma-separated list of team IDs
:param str followers.any: Comma-separated list of user identifiers
:param str followers.not: Comma-separated list of user identifiers
:param str created_by.any: Comma-separated list of user identifiers
:param str created_by.not: Comma-separated list of user identifiers
:param str assigned_by.any: Comma-separated list of user identifiers
:param str assigned_by.not: Comma-separated list of user identifiers
:param str liked_by.not: Comma-separated list of user identifiers
:param str commented_on_by.not: Comma-separated list of user identifiers
:param date due_on.before: ISO 8601 date string
:param date due_on.after: ISO 8601 date string
:param date due_on: ISO 8601 date string or `null`
:param datetime due_at.before: ISO 8601 datetime string
:param datetime due_at.after: ISO 8601 datetime string
:param date start_on.before: ISO 8601 date string
:param date start_on.after: ISO 8601 date string
:param date start_on: ISO 8601 date string or `null`
:param date created_on.before: ISO 8601 date string
:param date created_on.after: ISO 8601 date string
:param date created_on: ISO 8601 date string or `null`
:param datetime created_at.before: ISO 8601 datetime string
:param datetime created_at.after: ISO 8601 datetime string
:param date completed_on.before: ISO 8601 date string
:param date completed_on.after: ISO 8601 date string
:param date completed_on: ISO 8601 date string or `null`
:param datetime completed_at.before: ISO 8601 datetime string
:param datetime completed_at.after: ISO 8601 datetime string
:param date modified_on.before: ISO 8601 date string
:param date modified_on.after: ISO 8601 date string
:param date modified_on: ISO 8601 date string or `null`
:param datetime modified_at.before: ISO 8601 datetime string
:param datetime modified_at.after: ISO 8601 datetime string
:param bool is_blocking: Filter to incomplete tasks with dependents
:param bool is_blocked: Filter to tasks with incomplete dependencies
:param bool has_attachment: Filter to tasks with attachments
:param bool completed: Filter to completed tasks
:param bool is_subtask: Filter to subtasks
:param str sort_by: One of `due_date`, `created_at`, `completed_at`, `likes`, or `modified_at`, defaults to `modified_at`
:param bool sort_ascending: Default `false`
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def set_parent_for_task(self, body, task_gid, opts, **kwargs):
'''Set the parent of a task # noqa: E501
parent, or no parent task at all. Returns an empty data block. When using `insert_before` and `insert_after`, at most one of those two options can be specified, and they must already be subtasks of the parent. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.set_parent_for_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The new parent of the subtask. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def set_parent_for_task_with_http_info(self, body, task_gid, opts, **kwargs):
'''Set the parent of a task # noqa: E501
parent, or no parent task at all. Returns an empty data block. When using `insert_before` and `insert_after`, at most one of those two options can be specified, and they must already be subtasks of the parent. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.set_parent_for_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The new parent of the subtask. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def update_task(self, body, task_gid, opts, **kwargs):
'''Update a task # noqa: E501
A specific, existing task can be updated by making a PUT request on the URL for that task. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated task record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_task(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The task to update. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def update_task_with_http_info(self, body, task_gid, opts, **kwargs):
'''Update a task # noqa: E501
A specific, existing task can be updated by making a PUT request on the URL for that task. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged. When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task. Returns the complete updated task record. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_task_with_http_info(body, task_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The task to update. (required)
:param str task_gid: The task to operate on. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TaskResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
| 56 | 55 | 73 | 8 | 47 | 24 | 5 | 0.52 | 1 | 4 | 2 | 0 | 55 | 1 | 55 | 55 | 4,058 | 476 | 2,573 | 403 | 2,517 | 1,341 | 1,136 | 403 | 1,080 | 9 | 1 | 2 | 270 |
7,495 |
Asana/python-asana
|
Asana_python-asana/asana/api/team_memberships_api.py
|
asana.api.team_memberships_api.TeamMembershipsApi
|
class TeamMembershipsApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def get_team_membership(self, team_membership_gid, opts, **kwargs): # noqa: E501
"""Get a team membership # noqa: E501
Returns the complete team membership record for a single team membership. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_team_membership(team_membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str team_membership_gid: (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamMembershipResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_team_membership_with_http_info(team_membership_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_team_membership_with_http_info(team_membership_gid, opts, **kwargs) # noqa: E501
return data
def get_team_membership_with_http_info(self, team_membership_gid, opts, **kwargs): # noqa: E501
"""Get a team membership # noqa: E501
Returns the complete team membership record for a single team membership. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_team_membership_with_http_info(team_membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str team_membership_gid: (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamMembershipResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_team_membership" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'team_membership_gid' is set
if (team_membership_gid is None):
raise ValueError("Missing the required parameter `team_membership_gid` when calling `get_team_membership`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['team_membership_gid'] = team_membership_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/team_memberships/{team_membership_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/team_memberships/{team_membership_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/team_memberships/{team_membership_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_team_memberships(self, opts, **kwargs): # noqa: E501
"""Get team memberships # noqa: E501
Returns compact team membership records. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_team_memberships(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param str team: Globally unique identifier for the team.
:param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. This parameter must be used with the workspace parameter.
:param str workspace: Globally unique identifier for the workspace. This parameter must be used with the user parameter.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_team_memberships_with_http_info(opts, **kwargs) # noqa: E501
else:
(data) = self.get_team_memberships_with_http_info(opts, **kwargs) # noqa: E501
return data
def get_team_memberships_with_http_info(self, opts, **kwargs): # noqa: E501
"""Get team memberships # noqa: E501
Returns compact team membership records. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_team_memberships_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param str team: Globally unique identifier for the team.
:param str user: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. This parameter must be used with the workspace parameter.
:param str workspace: Globally unique identifier for the workspace. This parameter must be used with the user parameter.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_team_memberships" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/team_memberships', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/team_memberships',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/team_memberships', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_team_memberships_for_team(self, team_gid, opts, **kwargs): # noqa: E501
"""Get memberships from a team # noqa: E501
Returns the compact team memberships for the team. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_team_memberships_for_team(team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str team_gid: Globally unique identifier for the team. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_team_memberships_for_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_team_memberships_for_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501
return data
def get_team_memberships_for_team_with_http_info(self, team_gid, opts, **kwargs): # noqa: E501
"""Get memberships from a team # noqa: E501
Returns the compact team memberships for the team. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_team_memberships_for_team_with_http_info(team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str team_gid: Globally unique identifier for the team. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_team_memberships_for_team" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'team_gid' is set
if (team_gid is None):
raise ValueError("Missing the required parameter `team_gid` when calling `get_team_memberships_for_team`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['team_gid'] = team_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/teams/{team_gid}/team_memberships', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/teams/{team_gid}/team_memberships',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/teams/{team_gid}/team_memberships', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_team_memberships_for_user(self, user_gid, workspace, opts, **kwargs): # noqa: E501
"""Get memberships from a user # noqa: E501
Returns the compact team membership records for the user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_team_memberships_for_user(user_gid, workspace, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required)
:param str workspace: Globally unique identifier for the workspace. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_team_memberships_for_user_with_http_info(user_gid, workspace, opts, **kwargs) # noqa: E501
else:
(data) = self.get_team_memberships_for_user_with_http_info(user_gid, workspace, opts, **kwargs) # noqa: E501
return data
def get_team_memberships_for_user_with_http_info(self, user_gid, workspace, opts, **kwargs): # noqa: E501
"""Get memberships from a user # noqa: E501
Returns the compact team membership records for the user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_team_memberships_for_user_with_http_info(user_gid, workspace, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required)
:param str workspace: Globally unique identifier for the workspace. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_team_memberships_for_user" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'user_gid' is set
if (user_gid is None):
raise ValueError("Missing the required parameter `user_gid` when calling `get_team_memberships_for_user`") # noqa: E501
# verify the required parameter 'workspace' is set
if (workspace is None):
raise ValueError("Missing the required parameter `workspace` when calling `get_team_memberships_for_user`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['user_gid'] = user_gid # noqa: E501
query_params = {}
query_params = opts
query_params['workspace'] = workspace
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/users/{user_gid}/team_memberships', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/users/{user_gid}/team_memberships',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/users/{user_gid}/team_memberships', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
class TeamMembershipsApi(object):
'''NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
'''
def __init__(self, api_client=None):
pass
def get_team_membership(self, team_membership_gid, opts, **kwargs):
'''Get a team membership # noqa: E501
Returns the complete team membership record for a single team membership. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_team_membership(team_membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str team_membership_gid: (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamMembershipResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_team_membership_with_http_info(self, team_membership_gid, opts, **kwargs):
'''Get a team membership # noqa: E501
Returns the complete team membership record for a single team membership. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_team_membership_with_http_info(team_membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str team_membership_gid: (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamMembershipResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_team_memberships(self, opts, **kwargs):
'''Get team memberships # noqa: E501
Returns compact team membership records. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_team_memberships(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param str team: Globally unique identifier for the team.
:param str user: A string identifying a user. This can either be the string "me", an email, or the gid of a user. This parameter must be used with the workspace parameter.
:param str workspace: Globally unique identifier for the workspace. This parameter must be used with the user parameter.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_team_memberships_with_http_info(self, opts, **kwargs):
'''Get team memberships # noqa: E501
Returns compact team membership records. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_team_memberships_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param str team: Globally unique identifier for the team.
:param str user: A string identifying a user. This can either be the string "me", an email, or the gid of a user. This parameter must be used with the workspace parameter.
:param str workspace: Globally unique identifier for the workspace. This parameter must be used with the user parameter.
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_team_memberships_for_team(self, team_gid, opts, **kwargs):
'''Get memberships from a team # noqa: E501
Returns the compact team memberships for the team. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_team_memberships_for_team(team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str team_gid: Globally unique identifier for the team. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_team_memberships_for_team_with_http_info(self, team_gid, opts, **kwargs):
'''Get memberships from a team # noqa: E501
Returns the compact team memberships for the team. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_team_memberships_for_team_with_http_info(team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str team_gid: Globally unique identifier for the team. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_team_memberships_for_user(self, user_gid, workspace, opts, **kwargs):
'''Get memberships from a user # noqa: E501
Returns the compact team membership records for the user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_team_memberships_for_user(user_gid, workspace, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_gid: A string identifying a user. This can either be the string "me", an email, or the gid of a user. (required)
:param str workspace: Globally unique identifier for the workspace. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_team_memberships_for_user_with_http_info(self, user_gid, workspace, opts, **kwargs):
'''Get memberships from a user # noqa: E501
Returns the compact team membership records for the user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_team_memberships_for_user_with_http_info(user_gid, workspace, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_gid: A string identifying a user. This can either be the string "me", an email, or the gid of a user. (required)
:param str workspace: Globally unique identifier for the workspace. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamMembershipResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
| 10 | 9 | 64 | 7 | 42 | 20 | 4 | 0.48 | 1 | 4 | 2 | 0 | 9 | 1 | 9 | 9 | 594 | 70 | 382 | 60 | 372 | 182 | 163 | 60 | 153 | 8 | 1 | 2 | 36 |
7,496 |
Asana/python-asana
|
Asana_python-asana/asana/api/teams_api.py
|
asana.api.teams_api.TeamsApi
|
class TeamsApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def add_user_for_team(self, body, team_gid, opts, **kwargs): # noqa: E501
"""Add a user to a team # noqa: E501
The user making this call must be a member of the team in order to add others. The user being added must exist in the same organization as the team. Returns the complete team membership record for the newly added user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_user_for_team(body, team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The user to add to the team. (required)
:param str team_gid: Globally unique identifier for the team. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamMembershipResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.add_user_for_team_with_http_info(body, team_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.add_user_for_team_with_http_info(body, team_gid, opts, **kwargs) # noqa: E501
return data
def add_user_for_team_with_http_info(self, body, team_gid, opts, **kwargs): # noqa: E501
"""Add a user to a team # noqa: E501
The user making this call must be a member of the team in order to add others. The user being added must exist in the same organization as the team. Returns the complete team membership record for the newly added user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_user_for_team_with_http_info(body, team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The user to add to the team. (required)
:param str team_gid: Globally unique identifier for the team. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamMembershipResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method add_user_for_team" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `add_user_for_team`") # noqa: E501
# verify the required parameter 'team_gid' is set
if (team_gid is None):
raise ValueError("Missing the required parameter `team_gid` when calling `add_user_for_team`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['team_gid'] = team_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/teams/{team_gid}/addUser', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/teams/{team_gid}/addUser', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/teams/{team_gid}/addUser', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def create_team(self, body, opts, **kwargs): # noqa: E501
"""Create a team # noqa: E501
Creates a team within the current workspace. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_team(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The team to create. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.create_team_with_http_info(body, opts, **kwargs) # noqa: E501
else:
(data) = self.create_team_with_http_info(body, opts, **kwargs) # noqa: E501
return data
def create_team_with_http_info(self, body, opts, **kwargs): # noqa: E501
"""Create a team # noqa: E501
Creates a team within the current workspace. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_team_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The team to create. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create_team" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `create_team`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/teams', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/teams', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/teams', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_team(self, team_gid, opts, **kwargs): # noqa: E501
"""Get a team # noqa: E501
Returns the full record for a single team. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_team(team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str team_gid: Globally unique identifier for the team. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_team_with_http_info(team_gid, opts, **kwargs) # noqa: E501
return data
def get_team_with_http_info(self, team_gid, opts, **kwargs): # noqa: E501
"""Get a team # noqa: E501
Returns the full record for a single team. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_team_with_http_info(team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str team_gid: Globally unique identifier for the team. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_team" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'team_gid' is set
if (team_gid is None):
raise ValueError("Missing the required parameter `team_gid` when calling `get_team`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['team_gid'] = team_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/teams/{team_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/teams/{team_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/teams/{team_gid}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_teams_for_user(self, user_gid, organization, opts, **kwargs): # noqa: E501
"""Get teams for a user # noqa: E501
Returns the compact records for all teams to which the given user is assigned. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_teams_for_user(user_gid, organization, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required)
:param str organization: The workspace or organization to filter teams on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_teams_for_user_with_http_info(user_gid, organization, opts, **kwargs) # noqa: E501
else:
(data) = self.get_teams_for_user_with_http_info(user_gid, organization, opts, **kwargs) # noqa: E501
return data
def get_teams_for_user_with_http_info(self, user_gid, organization, opts, **kwargs): # noqa: E501
"""Get teams for a user # noqa: E501
Returns the compact records for all teams to which the given user is assigned. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_teams_for_user_with_http_info(user_gid, organization, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_gid: A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. (required)
:param str organization: The workspace or organization to filter teams on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_teams_for_user" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'user_gid' is set
if (user_gid is None):
raise ValueError("Missing the required parameter `user_gid` when calling `get_teams_for_user`") # noqa: E501
# verify the required parameter 'organization' is set
if (organization is None):
raise ValueError("Missing the required parameter `organization` when calling `get_teams_for_user`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['user_gid'] = user_gid # noqa: E501
query_params = {}
query_params = opts
query_params['organization'] = organization
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/users/{user_gid}/teams', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/users/{user_gid}/teams',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/users/{user_gid}/teams', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_teams_for_workspace(self, workspace_gid, opts, **kwargs): # noqa: E501
"""Get teams in a workspace # noqa: E501
Returns the compact records for all teams in the workspace visible to the authorized user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_teams_for_workspace(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamResponseArray
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.get_teams_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.get_teams_for_workspace_with_http_info(workspace_gid, opts, **kwargs) # noqa: E501
return data
def get_teams_for_workspace_with_http_info(self, workspace_gid, opts, **kwargs): # noqa: E501
"""Get teams in a workspace # noqa: E501
Returns the compact records for all teams in the workspace visible to the authorized user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_teams_for_workspace_with_http_info(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamResponseArray
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_teams_for_workspace" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'workspace_gid' is set
if (workspace_gid is None):
raise ValueError("Missing the required parameter `workspace_gid` when calling `get_teams_for_workspace`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['workspace_gid'] = workspace_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/workspaces/{workspace_gid}/teams', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/workspaces/{workspace_gid}/teams',
"method": 'GET',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"auth_settings": auth_settings,
"async_req": params.get('async_req'),
"_return_http_data_only": params.get('_return_http_data_only'),
"_preload_content": params.get('_preload_content', True),
"_request_timeout": params.get('_request_timeout'),
"collection_formats": collection_formats
},
**kwargs
).items()
else:
return self.api_client.call_api(
'/workspaces/{workspace_gid}/teams', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def remove_user_for_team(self, body, team_gid, **kwargs): # noqa: E501
"""Remove a user from a team # noqa: E501
The user making this call must be a member of the team in order to remove themselves or others. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_user_for_team(body, team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The user to remove from the team. (required)
:param str team_gid: Globally unique identifier for the team. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.remove_user_for_team_with_http_info(body, team_gid, **kwargs) # noqa: E501
else:
(data) = self.remove_user_for_team_with_http_info(body, team_gid, **kwargs) # noqa: E501
return data
def remove_user_for_team_with_http_info(self, body, team_gid, **kwargs): # noqa: E501
"""Remove a user from a team # noqa: E501
The user making this call must be a member of the team in order to remove themselves or others. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_user_for_team_with_http_info(body, team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The user to remove from the team. (required)
:param str team_gid: Globally unique identifier for the team. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method remove_user_for_team" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `remove_user_for_team`") # noqa: E501
# verify the required parameter 'team_gid' is set
if (team_gid is None):
raise ValueError("Missing the required parameter `team_gid` when calling `remove_user_for_team`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['team_gid'] = team_gid # noqa: E501
query_params = {}
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/teams/{team_gid}/removeUser', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/teams/{team_gid}/removeUser', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/teams/{team_gid}/removeUser', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def update_team(self, body, team_gid, opts, **kwargs): # noqa: E501
"""Update a team # noqa: E501
Updates a team within the current workspace. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_team(body, team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The team to update. (required)
:param str team_gid: Globally unique identifier for the team. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamResponseData
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
if kwargs.get('async_req'):
return self.update_team_with_http_info(body, team_gid, opts, **kwargs) # noqa: E501
else:
(data) = self.update_team_with_http_info(body, team_gid, opts, **kwargs) # noqa: E501
return data
def update_team_with_http_info(self, body, team_gid, opts, **kwargs): # noqa: E501
"""Update a team # noqa: E501
Updates a team within the current workspace. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_team_with_http_info(body, team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The team to update. (required)
:param str team_gid: Globally unique identifier for the team. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('async_req')
all_params.append('header_params')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('full_payload')
all_params.append('item_limit')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method update_team" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `update_team`") # noqa: E501
# verify the required parameter 'team_gid' is set
if (team_gid is None):
raise ValueError("Missing the required parameter `team_gid` when calling `update_team`") # noqa: E501
collection_formats = {}
path_params = {}
path_params['team_gid'] = team_gid # noqa: E501
query_params = {}
query_params = opts
header_params = kwargs.get("header_params", {})
form_params = []
local_var_files = {}
body_params = body
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json; charset=UTF-8']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json; charset=UTF-8']) # noqa: E501
# Authentication setting
auth_settings = ['personalAccessToken'] # noqa: E501
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/teams/{team_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/teams/{team_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/teams/{team_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
|
class TeamsApi(object):
'''NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
'''
def __init__(self, api_client=None):
pass
def add_user_for_team(self, body, team_gid, opts, **kwargs):
'''Add a user to a team # noqa: E501
The user making this call must be a member of the team in order to add others. The user being added must exist in the same organization as the team. Returns the complete team membership record for the newly added user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_user_for_team(body, team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The user to add to the team. (required)
:param str team_gid: Globally unique identifier for the team. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamMembershipResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def add_user_for_team_with_http_info(self, body, team_gid, opts, **kwargs):
'''Add a user to a team # noqa: E501
The user making this call must be a member of the team in order to add others. The user being added must exist in the same organization as the team. Returns the complete team membership record for the newly added user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_user_for_team_with_http_info(body, team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The user to add to the team. (required)
:param str team_gid: Globally unique identifier for the team. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamMembershipResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def create_team(self, body, opts, **kwargs):
'''Create a team # noqa: E501
Creates a team within the current workspace. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_team(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The team to create. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def create_team_with_http_info(self, body, opts, **kwargs):
'''Create a team # noqa: E501
Creates a team within the current workspace. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_team_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The team to create. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_team(self, team_gid, opts, **kwargs):
'''Get a team # noqa: E501
Returns the full record for a single team. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_team(team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str team_gid: Globally unique identifier for the team. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_team_with_http_info(self, team_gid, opts, **kwargs):
'''Get a team # noqa: E501
Returns the full record for a single team. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_team_with_http_info(team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str team_gid: Globally unique identifier for the team. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_teams_for_user(self, user_gid, organization, opts, **kwargs):
'''Get teams for a user # noqa: E501
Returns the compact records for all teams to which the given user is assigned. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_teams_for_user(user_gid, organization, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_gid: A string identifying a user. This can either be the string "me", an email, or the gid of a user. (required)
:param str organization: The workspace or organization to filter teams on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_teams_for_user_with_http_info(self, user_gid, organization, opts, **kwargs):
'''Get teams for a user # noqa: E501
Returns the compact records for all teams to which the given user is assigned. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_teams_for_user_with_http_info(user_gid, organization, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str user_gid: A string identifying a user. This can either be the string "me", an email, or the gid of a user. (required)
:param str organization: The workspace or organization to filter teams on. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_teams_for_workspace(self, workspace_gid, opts, **kwargs):
'''Get teams in a workspace # noqa: E501
Returns the compact records for all teams in the workspace visible to the authorized user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_teams_for_workspace(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def get_teams_for_workspace_with_http_info(self, workspace_gid, opts, **kwargs):
'''Get teams in a workspace # noqa: E501
Returns the compact records for all teams in the workspace visible to the authorized user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_teams_for_workspace_with_http_info(workspace_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str workspace_gid: Globally unique identifier for the workspace or organization. (required)
:param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
:param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamResponseArray
If the method is called asynchronously,
returns the request thread.
'''
pass
def remove_user_for_team(self, body, team_gid, **kwargs):
'''Remove a user from a team # noqa: E501
The user making this call must be a member of the team in order to remove themselves or others. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_user_for_team(body, team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The user to remove from the team. (required)
:param str team_gid: Globally unique identifier for the team. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def remove_user_for_team_with_http_info(self, body, team_gid, **kwargs):
'''Remove a user from a team # noqa: E501
The user making this call must be a member of the team in order to remove themselves or others. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.remove_user_for_team_with_http_info(body, team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The user to remove from the team. (required)
:param str team_gid: Globally unique identifier for the team. (required)
:return: EmptyResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def update_team(self, body, team_gid, opts, **kwargs):
'''Update a team # noqa: E501
Updates a team within the current workspace. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_team(body, team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The team to update. (required)
:param str team_gid: Globally unique identifier for the team. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
def update_team_with_http_info(self, body, team_gid, opts, **kwargs):
'''Update a team # noqa: E501
Updates a team within the current workspace. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_team_with_http_info(body, team_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The team to update. (required)
:param str team_gid: Globally unique identifier for the team. (required)
:param list[str] opt_fields: This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
:return: TeamResponseData
If the method is called asynchronously,
returns the request thread.
'''
pass
| 16 | 15 | 67 | 7 | 45 | 21 | 5 | 0.48 | 1 | 4 | 2 | 0 | 15 | 1 | 15 | 15 | 1,031 | 125 | 670 | 106 | 654 | 322 | 299 | 106 | 283 | 9 | 1 | 2 | 72 |
7,497 |
Asana/python-asana
|
Asana_python-asana/test/test_rules_api.py
|
test.test_rules_api.TestRulesApi
|
class TestRulesApi(unittest.TestCase):
"""RulesApi unit test stubs"""
def setUp(self):
self.api = RulesApi() # noqa: E501
def tearDown(self):
pass
def test_trigger_rule(self):
"""Test case for trigger_rule
Trigger a rule # noqa: E501
"""
pass
|
class TestRulesApi(unittest.TestCase):
'''RulesApi unit test stubs'''
def setUp(self):
pass
def tearDown(self):
pass
def test_trigger_rule(self):
'''Test case for trigger_rule
Trigger a rule # noqa: E501
'''
pass
| 4 | 2 | 3 | 0 | 2 | 1 | 1 | 0.71 | 1 | 1 | 1 | 0 | 3 | 1 | 3 | 75 | 15 | 4 | 7 | 5 | 3 | 5 | 7 | 5 | 3 | 1 | 2 | 0 | 3 |
7,498 |
Asana/python-asana
|
Asana_python-asana/test/test_projects_api.py
|
test.test_projects_api.TestProjectsApi
|
class TestProjectsApi(unittest.TestCase):
"""ProjectsApi unit test stubs"""
def setUp(self):
self.api = ProjectsApi() # noqa: E501
def tearDown(self):
pass
def test_add_custom_field_setting_for_project(self):
"""Test case for add_custom_field_setting_for_project
Add a custom field to a project # noqa: E501
"""
pass
def test_add_followers_for_project(self):
"""Test case for add_followers_for_project
Add followers to a project # noqa: E501
"""
pass
def test_add_members_for_project(self):
"""Test case for add_members_for_project
Add users to a project # noqa: E501
"""
pass
def test_create_project(self):
"""Test case for create_project
Create a project # noqa: E501
"""
pass
def test_create_project_for_team(self):
"""Test case for create_project_for_team
Create a project in a team # noqa: E501
"""
pass
def test_create_project_for_workspace(self):
"""Test case for create_project_for_workspace
Create a project in a workspace # noqa: E501
"""
pass
def test_delete_project(self):
"""Test case for delete_project
Delete a project # noqa: E501
"""
pass
def test_duplicate_project(self):
"""Test case for duplicate_project
Duplicate a project # noqa: E501
"""
pass
def test_get_project(self):
"""Test case for get_project
Get a project # noqa: E501
"""
pass
def test_get_projects(self):
"""Test case for get_projects
Get multiple projects # noqa: E501
"""
pass
def test_get_projects_for_task(self):
"""Test case for get_projects_for_task
Get projects a task is in # noqa: E501
"""
pass
def test_get_projects_for_team(self):
"""Test case for get_projects_for_team
Get a team's projects # noqa: E501
"""
pass
def test_get_projects_for_workspace(self):
"""Test case for get_projects_for_workspace
Get all projects in a workspace # noqa: E501
"""
pass
def test_get_task_counts_for_project(self):
"""Test case for get_task_counts_for_project
Get task count of a project # noqa: E501
"""
pass
def test_project_save_as_template(self):
"""Test case for project_save_as_template
Create a project template from a project # noqa: E501
"""
pass
def test_remove_custom_field_setting_for_project(self):
"""Test case for remove_custom_field_setting_for_project
Remove a custom field from a project # noqa: E501
"""
pass
def test_remove_followers_for_project(self):
"""Test case for remove_followers_for_project
Remove followers from a project # noqa: E501
"""
pass
def test_remove_members_for_project(self):
"""Test case for remove_members_for_project
Remove users from a project # noqa: E501
"""
pass
def test_update_project(self):
"""Test case for update_project
Update a project # noqa: E501
"""
pass
|
class TestProjectsApi(unittest.TestCase):
'''ProjectsApi unit test stubs'''
def setUp(self):
pass
def tearDown(self):
pass
def test_add_custom_field_setting_for_project(self):
'''Test case for add_custom_field_setting_for_project
Add a custom field to a project # noqa: E501
'''
pass
def test_add_followers_for_project(self):
'''Test case for add_followers_for_project
Add followers to a project # noqa: E501
'''
pass
def test_add_members_for_project(self):
'''Test case for add_members_for_project
Add users to a project # noqa: E501
'''
pass
def test_create_project(self):
'''Test case for create_project
Create a project # noqa: E501
'''
pass
def test_create_project_for_team(self):
'''Test case for create_project_for_team
Create a project in a team # noqa: E501
'''
pass
def test_create_project_for_workspace(self):
'''Test case for create_project_for_workspace
Create a project in a workspace # noqa: E501
'''
pass
def test_delete_project(self):
'''Test case for delete_project
Delete a project # noqa: E501
'''
pass
def test_duplicate_project(self):
'''Test case for duplicate_project
Duplicate a project # noqa: E501
'''
pass
def test_get_project(self):
'''Test case for get_project
Get a project # noqa: E501
'''
pass
def test_get_projects(self):
'''Test case for get_projects
Get multiple projects # noqa: E501
'''
pass
def test_get_projects_for_task(self):
'''Test case for get_projects_for_task
Get projects a task is in # noqa: E501
'''
pass
def test_get_projects_for_team(self):
'''Test case for get_projects_for_team
Get a team's projects # noqa: E501
'''
pass
def test_get_projects_for_workspace(self):
'''Test case for get_projects_for_workspace
Get all projects in a workspace # noqa: E501
'''
pass
def test_get_task_counts_for_project(self):
'''Test case for get_task_counts_for_project
Get task count of a project # noqa: E501
'''
pass
def test_project_save_as_template(self):
'''Test case for project_save_as_template
Create a project template from a project # noqa: E501
'''
pass
def test_remove_custom_field_setting_for_project(self):
'''Test case for remove_custom_field_setting_for_project
Remove a custom field from a project # noqa: E501
'''
pass
def test_remove_followers_for_project(self):
'''Test case for remove_followers_for_project
Remove followers from a project # noqa: E501
'''
pass
def test_remove_members_for_project(self):
'''Test case for remove_members_for_project
Remove users from a project # noqa: E501
'''
pass
def test_update_project(self):
'''Test case for update_project
Update a project # noqa: E501
'''
pass
| 22 | 20 | 6 | 1 | 2 | 3 | 1 | 1.37 | 1 | 1 | 1 | 0 | 21 | 1 | 21 | 93 | 141 | 40 | 43 | 23 | 21 | 59 | 43 | 23 | 21 | 1 | 2 | 0 | 21 |
7,499 |
Asana/python-asana
|
Asana_python-asana/test/test_project_templates_api.py
|
test.test_project_templates_api.TestProjectTemplatesApi
|
class TestProjectTemplatesApi(unittest.TestCase):
"""ProjectTemplatesApi unit test stubs"""
def setUp(self):
self.api = ProjectTemplatesApi() # noqa: E501
def tearDown(self):
pass
def test_delete_project_template(self):
"""Test case for delete_project_template
Delete a project template # noqa: E501
"""
pass
def test_get_project_template(self):
"""Test case for get_project_template
Get a project template # noqa: E501
"""
pass
def test_get_project_templates(self):
"""Test case for get_project_templates
Get multiple project templates # noqa: E501
"""
pass
def test_get_project_templates_for_team(self):
"""Test case for get_project_templates_for_team
Get a team's project templates # noqa: E501
"""
pass
def test_instantiate_project(self):
"""Test case for instantiate_project
Instantiate a project from a project template # noqa: E501
"""
pass
|
class TestProjectTemplatesApi(unittest.TestCase):
'''ProjectTemplatesApi unit test stubs'''
def setUp(self):
pass
def tearDown(self):
pass
def test_delete_project_template(self):
'''Test case for delete_project_template
Delete a project template # noqa: E501
'''
pass
def test_get_project_template(self):
'''Test case for get_project_template
Get a project template # noqa: E501
'''
pass
def test_get_project_templates(self):
'''Test case for get_project_templates
Get multiple project templates # noqa: E501
'''
pass
def test_get_project_templates_for_team(self):
'''Test case for get_project_templates_for_team
Get a team's project templates # noqa: E501
'''
pass
def test_instantiate_project(self):
'''Test case for instantiate_project
Instantiate a project from a project template # noqa: E501
'''
pass
| 8 | 6 | 5 | 1 | 2 | 2 | 1 | 1.13 | 1 | 1 | 1 | 0 | 7 | 1 | 7 | 79 | 43 | 12 | 15 | 9 | 7 | 17 | 15 | 9 | 7 | 1 | 2 | 0 | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.