def delete_thread(self, user_id, thread_id): url = "{host}/{api}/{user_id}/threads/{id}".format(host=self.host, api=self.api, user_id=user_id, id=thread_id) req = HttpLib(url=url) req.auth_to_google(client=client, scope=scope_mail) req.send_delete() return req.response
def delete_calendar(self, calendar_id): """ Deletes a secondary calendar. Use calendars.clear for clearing all events on primary calendars. :param calendar_id :return response """ log_info("Delete calendar with id={id}".format(id=calendar_id)) http = HttpLib(url=self.host + '/{calendar_id}'.format(calendar_id=calendar_id)) http.auth_to_google(client=client, scope=scope_calendar) http.send_delete() return http.response
def delete_send_as(self, user_id, send_as_email): """ Gets the specified send-as alias Args: user_id (str): user id send_as_email (str): The send-as alias to be retrieved. Returns: response (requests.Response) """ url = self.__get_send_as_url(user_id)+"/{send_as_email}".format(send_as_email=send_as_email) api = HttpLib(url=url, header=self.header) api.auth_to_google(client=client, scope=scope_mail) api.send_delete() return api.response
def calendar_list_delete(self, calendar_id): """ Deletes calendar list with id calendar_id. :param calendar_id<str> :return: response """ log_info("Send delete request\nCalendarID = [{calendar_id}]".format( calendar_id=calendar_id)) url = "{url}/{calendar_id}".format(url=self.url, calendar_id=calendar_id) http = HttpLib(url=url) http.auth_to_google(client=client, scope=scope_calendar) http.send_delete() return http.response
def delete_event( self, calendar_id, event_id, client_id=client, send_notifications="False", ): url = "{host}/{api}/calendars/{calendar_id}/events/{event_id}".\ format(host=self.host, api=self.api, calendar_id=calendar_id, event_id=event_id) params = {"sendNotifications": send_notifications} req = HttpLib(url, params=params) req.auth_to_google(client=client_id, scope=scope_calendar) req.send_delete() return req.response
def delete(self, user_id, message_id): """ Immediately and permanently deletes the specified message. This operation cannot be undone. :param message_id: the ID of the message to delete. :param user_id: the user's email address :return: response (requests.Response) """ api = HttpLib(url="{host}/{api}/{user_id}/messages/{message_id}". format(host=self.host, api=self.api, user_id=user_id, message_id=message_id)) api.auth_to_google(client=client, scope=scope_mail) api.send_delete() return api.response
def filters_delete(self, user_id, filter_id): """ Deletes a filter :param user_id: User's email address. The special value "me" can be used to indicate the authenticated user. :param filter_id: The server assigned ID of the filter :return: response """ log_info("Send delete request\nUserID = [{user_id}]" "\nFilterID = [{filter_id}]".format(user_id=user_id, filter_id=filter_id)) url = "{host}/{api}/{user_id}/settings/filters/{filter_id}".format(host=self.host, api=self.api, user_id=user_id, filter_id=filter_id) api = HttpLib(url=url) api.auth_to_google(client=client, scope=scope_gmail_settings_filters) api.send_delete() return api.response
def delete_draft(self, user_id, draft_message_id): """ Args: user_id (str): user id draft_message_id (str): draft message id in the draft Returns: api.response (requests.Response): response from the server """ url = self.__get_message_url(user_id=user_id, draft_message_id=draft_message_id) api = HttpLib(url=url, header=self.header) api.auth_to_google(client=client, scope=scope_mail) api.send_delete() return api.response
def delete(self, rule_id): """ Метод отпрвляет DELETE запрос для удаления правила применяемого к календарю Returns: response (requests.Response): ответ от сервера """ http = HttpLib( url="{host}/{api}/calendars/{calendar_id}/acl/{rule_id}".format( host=self.host, api=self.api, calendar_id=self.calendar_id, rule_id=rule_id)) http.auth_to_google(client=client, scope=scope_calendar) http.send_delete() return http.response
def delete(self, label_id, user_id): """ Immediately and permanently deletes the specified label and removes it from any messages and threads that it is applied to. :param label_id: :param user_id: The user's email address. :return: response """ log_info("[Users.labels]: Delete the label with id={label_id}".format( label_id=label_id)) url = '{host}/{api}/{user_id}/labels/{label_id}'.format( host=self.host, api=self.api, user_id=user_id, label_id=label_id) http = HttpLib(url=url) http.auth_to_google(client=client, scope=scope_labels) http.send_delete() log_info('[Users.labels]: DELETE response: {status_code}'.format( status_code=http.get_response_status_code(http.response))) return http.response