projectal.entities.location

 1from datetime import datetime
 2
 3import projectal
 4from projectal.entity import Entity
 5from projectal.linkers import *
 6
 7
 8class Location(Entity, CompanyLinker, CustomerLinker, ProjectLinker, StaffLinker,
 9               NoteLinker, CalendarLinker, TagLinker):
10    """
11    Implementation of the [Location](https://projectal.com/docs/latest/#tag/Location) API.
12    """
13    _path = 'location'
14    _name = 'location'
15    _links = [NoteLinker, CalendarLinker, TagLinker]
16    _links_reverse = [CompanyLinker, CustomerLinker, ProjectLinker, StaffLinker]
17
18    def calendar(self, begin=None, until=None):
19        """
20        Get the location's calendar.
21        `uuId`: The location `uuId`
22        `begin`: Start date in `yyyy-MM-dd` format
23        `until`: End date in `yyyy-MM-dd` format
24        """
25        if begin:
26            begin = datetime.strptime(begin, '%Y-%m-%d').date()
27        if until:
28            until = datetime.strptime(until, '%Y-%m-%d').date()
29
30        url = '/api/location/{}/calendar?'.format(self['uuId'])
31        params = []
32        params.append('begin={}'.format(begin)) if begin else None
33        params.append('until={}'.format(until)) if until else None
34        url += '&'.join(params)
35
36        cals = api.get(url)
37        cals = [projectal.Calendar(c) for c in cals]
38        return cals
 9class Location(Entity, CompanyLinker, CustomerLinker, ProjectLinker, StaffLinker,
10               NoteLinker, CalendarLinker, TagLinker):
11    """
12    Implementation of the [Location](https://projectal.com/docs/latest/#tag/Location) API.
13    """
14    _path = 'location'
15    _name = 'location'
16    _links = [NoteLinker, CalendarLinker, TagLinker]
17    _links_reverse = [CompanyLinker, CustomerLinker, ProjectLinker, StaffLinker]
18
19    def calendar(self, begin=None, until=None):
20        """
21        Get the location's calendar.
22        `uuId`: The location `uuId`
23        `begin`: Start date in `yyyy-MM-dd` format
24        `until`: End date in `yyyy-MM-dd` format
25        """
26        if begin:
27            begin = datetime.strptime(begin, '%Y-%m-%d').date()
28        if until:
29            until = datetime.strptime(until, '%Y-%m-%d').date()
30
31        url = '/api/location/{}/calendar?'.format(self['uuId'])
32        params = []
33        params.append('begin={}'.format(begin)) if begin else None
34        params.append('until={}'.format(until)) if until else None
35        url += '&'.join(params)
36
37        cals = api.get(url)
38        cals = [projectal.Calendar(c) for c in cals]
39        return cals

Implementation of the Location API.

def calendar(self, begin=None, until=None):
19    def calendar(self, begin=None, until=None):
20        """
21        Get the location's calendar.
22        `uuId`: The location `uuId`
23        `begin`: Start date in `yyyy-MM-dd` format
24        `until`: End date in `yyyy-MM-dd` format
25        """
26        if begin:
27            begin = datetime.strptime(begin, '%Y-%m-%d').date()
28        if until:
29            until = datetime.strptime(until, '%Y-%m-%d').date()
30
31        url = '/api/location/{}/calendar?'.format(self['uuId'])
32        params = []
33        params.append('begin={}'.format(begin)) if begin else None
34        params.append('until={}'.format(until)) if until else None
35        url += '&'.join(params)
36
37        cals = api.get(url)
38        cals = [projectal.Calendar(c) for c in cals]
39        return cals

Get the location's calendar. uuId: The location uuId begin: Start date in yyyy-MM-dd format until: End date in yyyy-MM-dd format