Exemplo n.º 1
0
    def __init__(self, key, token, board_id):
        self._session = requests.Session()
        self._session.params = {'key': key, 'token': token}

        board_id = self._get_real_board_id(board_id)

        self.labels = LabelCollection(self._session, _utils.urljoin(
            self.base_url, '/1/boards/%s/labels/' % board_id), board_id)
        self.lists = ListCollection(self._session, _utils.urljoin(
            self.base_url, '/1/boards/%s/lists/' % board_id), board_id)
        self.cards = CardCollection(self._session, _utils.urljoin(
            self.base_url, '/1/boards/%s/cards/' % board_id), board_id)
Exemplo n.º 2
0
 def delete(self):
     logger.info('deleting label %r', self.name)
     self._session.delete(_utils.urljoin(self.base_url, self.id))
Exemplo n.º 3
0
 def add_label(self, label):
     url = _utils.urljoin(self.base_url, self.id, 'idLabels')
     if label.id not in self.label_ids:
         resp = self._session.post(url, data=dict(value=label.id))
         resp.raise_for_status()
Exemplo n.º 4
0
 def label_ids(self):
     url = _utils.urljoin(self.base_url, self.id, 'idLabels')
     resp = self._session.get(url)
     resp.raise_for_status()
     return resp.json()
Exemplo n.º 5
0
 def move_card(self, card, card_list):
     logger.info('moving %r to %r', card, card_list)
     if card.idList != card_list.id:
         url = _utils.urljoin(CardEntity.base_url, card.id, 'idList')
         self._session.put(url, data=dict(value=card_list.id))
Exemplo n.º 6
0
 def add(self, name):
     url = _utils.urljoin(self._base_url, '/1/lists')
     data = dict(name=name, idBoard=self._board_id)
     resp = self._session.post(url, data=data)
     resp.raise_for_status()
     return self._add_entity(self.entity_class(resp.json()))
Exemplo n.º 7
0
 def add(self, name, color):
     url = _utils.urljoin(self._base_url, '/1/labels')
     data = dict(name=name, color=color, idBoard=self._board_id)
     resp = self._session.post(url, data=data)
     resp.raise_for_status()
     return self._add_entity(LabelEntity(resp.json()))