MCPcopy Index your code
hub / github.com/O365/python-o365 / to_api_data

Method to_api_data

O365/tasks.py:110–140  ·  view source on GitHub ↗

Returns a dict to communicate with the server :param restrict_keys: a set of keys to restrict the returned data to :rtype: dict

(self, restrict_keys=None)

Source from the content-addressed store, hash-verified

108 return self.task_id == other.task_id
109
110 def to_api_data(self, restrict_keys=None):
111 """ Returns a dict to communicate with the server
112
113 :param restrict_keys: a set of keys to restrict the returned data to
114 :rtype: dict
115 """
116 cc = self._cc # alias
117
118 data = {
119 cc('subject'): self.__subject,
120 cc('body'): {
121 cc('contentType'): self.body_type,
122 cc('content'): self.__body},
123 }
124
125 if self.__is_completed:
126 data[cc('status')] = 'Completed'
127 else:
128 data[cc('status')] = 'NotStarted'
129
130 if self.__due:
131 data[cc('dueDateTime')] = self._build_date_time_time_zone(self.__due)
132
133 if self.__completed:
134 data[cc('completedDateTime')] = self._build_date_time_time_zone(self.__completed)
135
136 if restrict_keys:
137 for key in list(data.keys()):
138 if key not in restrict_keys:
139 del data[key]
140 return data
141
142 @property
143 def created(self):

Callers 2

saveMethod · 0.95
test_to_api_dataMethod · 0.45

Calls 1

Tested by 1

test_to_api_dataMethod · 0.36