projectal.entities.location API documentation

# projectal.entities.location

View Source

     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

class Location(projectal.entity.Entity, projectal.linkers.CompanyLinker, projectal.linkers.CustomerLinker, projectal.linkers.ProjectLinker, projectal.linkers.StaffLinker, projectal.linkers.NoteLinker, projectal.linkers.CalendarLinker, projectal.linkers.TagLinker): View Source

     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): View Source

    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

##### Inherited Members

projectal.entity.Entity
  get
  update
  delete
  history
  create
  save
  clone
  list
  match
  match_startswith
  match_endswith
  match_one
  match_startswith_one
  match_endswith_one
  search
  query
  profile_get
  profile_set
  changes
  set_readonly
  get_link_definitions
  entity_name
projectal.linkers.CompanyLinker
  link_company
  unlink_company
projectal.linkers.CustomerLinker
  link_customer
  unlink_customer
projectal.linkers.ProjectLinker
  link_project
  unlink_project
projectal.linkers.StaffLinker
  link_staff
  relink_staff
  unlink_staff
projectal.linkers.TagLinker
  link_tag
  unlink_tag
builtins.dict
  setdefault
  pop
  popitem
  keys
  items
  values
  fromkeys
  clear
  copy