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

Implementation of the Location API.

def calendar(self, begin=None, until=None): View Source

    28    def calendar(self, begin=None, until=None):
    29        """
    30        Get the location's calendar.
    31        `uuId`: The location `uuId`
    32        `begin`: Start date in `yyyy-MM-dd` format
    33        `until`: End date in `yyyy-MM-dd` format
    34        """
    35        if begin:
    36            begin = datetime.strptime(begin, "%Y-%m-%d").date()
    37        if until:
    38            until = datetime.strptime(until, "%Y-%m-%d").date()
    39
    40        url = "/api/location/{}/calendar?".format(self["uuId"])
    41        params = []
    42        params.append("begin={}".format(begin)) if begin else None
    43        params.append("until={}".format(until)) if until else None
    44        url += "&".join(params)
    45
    46        cals = api.get(url)
    47        cals = [projectal.Calendar(c) for c in cals]
    48        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