Code
stringlengths 103
85.9k
| Summary
sequencelengths 0
94
|
---|---|
Please provide a description of the function:def ticket_form_create(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/ticket_forms#create-ticket-forms"
api_path = "/api/v2/ticket_forms.json"
return self.call(api_path, method="POST", data=data, **kwargs) | [] |
Please provide a description of the function:def ticket_form_delete(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/ticket_forms#delete-ticket-form"
api_path = "/api/v2/ticket_forms/{id}.json"
api_path = api_path.format(id=id)
return self.call(api_path, method="DELETE", **kwargs) | [] |
Please provide a description of the function:def ticket_form_show(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/ticket_forms#show-ticket-form"
api_path = "/api/v2/ticket_forms/{id}.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def ticket_forms_reorder(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/ticket_forms#reorder-ticket-forms"
api_path = "/api/v2/ticket_forms/reorder.json"
return self.call(api_path, method="PUT", data=data, **kwargs) | [] |
Please provide a description of the function:def ticket_incidents(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/tickets#listing-ticket-incidents"
api_path = "/api/v2/tickets/{id}/incidents.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def ticket_macro_apply(self, ticket_id, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/macros#show-ticket-after-changes"
api_path = "/api/v2/tickets/{ticket_id}/macros/{id}/apply.json"
api_path = api_path.format(ticket_id=ticket_id, id=id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def ticket_metric_show(self, ticket_metric_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/ticket_metrics#show-ticket-metrics"
api_path = "/api/v2/ticket_metrics/{ticket_metric_id}.json"
api_path = api_path.format(ticket_metric_id=ticket_metric_id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def ticket_metrics(self, ticket_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/ticket_metrics#show-ticket-metrics"
api_path = "/api/v2/tickets/{ticket_id}/metrics.json"
api_path = api_path.format(ticket_id=ticket_id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def ticket_related(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/tickets#ticket-related-information"
api_path = "/api/v2/tickets/{id}/related.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def ticket_satisfaction_rating_create(self, ticket_id, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/satisfaction_ratings#create-a-satisfaction-rating"
api_path = "/api/v2/tickets/{ticket_id}/satisfaction_rating.json"
api_path = api_path.format(ticket_id=ticket_id)
return self.call(api_path, method="POST", data=data, **kwargs) | [] |
Please provide a description of the function:def ticket_show(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/tickets#show-ticket"
api_path = "/api/v2/tickets/{id}.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def ticket_skips(self, ticket_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/ticket_skips#list-skips-for-the-current-account"
api_path = "/api/v2/tickets/{ticket_id}/skips.json"
api_path = api_path.format(ticket_id=ticket_id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def ticket_tags(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/tags#show-tags"
api_path = "/api/v2/tickets/{id}/tags.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def ticket_tags_delete(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/tags#remove-tags"
api_path = "/api/v2/tickets/{id}/tags.json"
api_path = api_path.format(id=id)
return self.call(api_path, method="DELETE", **kwargs) | [] |
Please provide a description of the function:def tickets_create_many(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/tickets#create-many-tickets"
api_path = "/api/v2/tickets/create_many.json"
return self.call(api_path, method="POST", data=data, **kwargs) | [] |
Please provide a description of the function:def tickets_list(self, external_id=None, include=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/tickets#json-format"
api_path = "/api/v2/tickets.json"
api_query = {}
if "query" in kwargs.keys():
api_query.update(kwargs["query"])
del kwargs["query"]
if external_id:
api_query.update({
"external_id": external_id,
})
if include:
api_query.update({
"include": include,
})
return self.call(api_path, query=api_query, **kwargs) | [] |
Please provide a description of the function:def tickets_update_many(self, data, ids=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/tickets#update-many-tickets"
api_path = "/api/v2/tickets/update_many.json"
api_query = {}
if "query" in kwargs.keys():
api_query.update(kwargs["query"])
del kwargs["query"]
if ids:
api_query.update({
"ids": ids,
})
return self.call(api_path, query=api_query, method="PUT", data=data, **kwargs) | [] |
Please provide a description of the function:def trigger_create(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/chat/triggers#create-trigger"
api_path = "/api/v2/triggers"
return self.call(api_path, method="POST", data=data, **kwargs) | [] |
Please provide a description of the function:def trigger_delete_by_id(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/triggers#delete-trigger"
api_path = "/api/v2/triggers/{id}.json"
api_path = api_path.format(id=id)
return self.call(api_path, method="DELETE", **kwargs) | [] |
Please provide a description of the function:def trigger_delete_by_trigger_name(self, trigger_name, **kwargs):
"https://developer.zendesk.com/rest_api/docs/chat/triggers#delete-trigger"
api_path = "/api/v2/triggers/{trigger_name}"
api_path = api_path.format(trigger_name=trigger_name)
return self.call(api_path, method="DELETE", **kwargs) | [] |
Please provide a description of the function:def trigger_revision_show(self, trigger_id, revision_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/triggers#getting-revisions"
api_path = "/api/v2/triggers/{trigger_id}/revisions/{revision_id}.json"
api_path = api_path.format(trigger_id=trigger_id, revision_id=revision_id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def trigger_revisions(self, trigger_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/triggers#list-trigger-revisions"
api_path = "/api/v2/triggers/{trigger_id}/revisions.json"
api_path = api_path.format(trigger_id=trigger_id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def trigger_show_by_id(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/triggers#getting-triggers"
api_path = "/api/v2/triggers/{id}.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def trigger_show_by_trigger_name(self, trigger_name, **kwargs):
"https://developer.zendesk.com/rest_api/docs/chat/triggers#get-a-trigger"
api_path = "/api/v2/triggers/{trigger_name}"
api_path = api_path.format(trigger_name=trigger_name)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def trigger_update_by_id(self, id, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/triggers#update-trigger"
api_path = "/api/v2/triggers/{id}.json"
api_path = api_path.format(id=id)
return self.call(api_path, method="PUT", data=data, **kwargs) | [] |
Please provide a description of the function:def trigger_update_by_trigger_name(self, trigger_name, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/chat/triggers#update-trigger"
api_path = "/api/v2/triggers/{trigger_name}"
api_path = api_path.format(trigger_name=trigger_name)
return self.call(api_path, method="PUT", data=data, **kwargs) | [] |
Please provide a description of the function:def triggers_reorder(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/triggers#reorder-triggers"
api_path = "/api/v2/triggers/reorder.json"
return self.call(api_path, method="PUT", data=data, **kwargs) | [] |
Please provide a description of the function:def triggers_update_many(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/triggers#update-many-triggers"
api_path = "/api/v2/triggers/update_many.json"
return self.call(api_path, method="PUT", data=data, **kwargs) | [] |
Please provide a description of the function:def upload_create(self, data, filename=None, token=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/attachments#upload-files"
api_path = "/api/v2/uploads.json"
api_query = {}
if "query" in kwargs.keys():
api_query.update(kwargs["query"])
del kwargs["query"]
if filename:
api_query.update({
"filename": filename,
})
if token:
api_query.update({
"token": token,
})
return self.call(api_path, query=api_query, method="POST", data=data, **kwargs) | [] |
Please provide a description of the function:def upload_delete(self, token, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/attachments#delete-upload"
api_path = "/api/v2/uploads/{token}.json"
api_path = api_path.format(token=token)
return self.call(api_path, method="DELETE", **kwargs) | [] |
Please provide a description of the function:def user_compliance_deletion_statuses(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#show-compliance-deletion-statuses"
api_path = "/api/v2/users/{id}/compliance_deletion_statuses.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def user_create(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#create-user"
api_path = "/api/v2/users.json"
return self.call(api_path, method="POST", data=data, **kwargs) | [] |
Please provide a description of the function:def user_delete(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#delete-user"
api_path = "/api/v2/users/{id}.json"
api_path = api_path.format(id=id)
return self.call(api_path, method="DELETE", **kwargs) | [] |
Please provide a description of the function:def user_field_create(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/user_fields#create-user-fields"
api_path = "/api/v2/user_fields.json"
return self.call(api_path, method="POST", data=data, **kwargs) | [] |
Please provide a description of the function:def user_field_delete(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/user_fields#delete-user-field"
api_path = "/api/v2/user_fields/{id}.json"
api_path = api_path.format(id=id)
return self.call(api_path, method="DELETE", **kwargs) | [] |
Please provide a description of the function:def user_field_option_create(self, field_id, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/user_fields#create-or-update-a-user-field-option"
api_path = "/api/v2/user_fields/{field_id}/options.json"
api_path = api_path.format(field_id=field_id)
return self.call(api_path, method="POST", data=data, **kwargs) | [] |
Please provide a description of the function:def user_field_option_delete(self, field_id, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/user_fields#delete-user-field-option"
api_path = "/api/v2/user_fields/{field_id}/options/{id}.json"
api_path = api_path.format(field_id=field_id, id=id)
return self.call(api_path, method="DELETE", **kwargs) | [] |
Please provide a description of the function:def user_field_option_show(self, field_id, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/user_fields#show-a-user-field-option"
api_path = "/api/v2/user_fields/{field_id}/options/{id}.json"
api_path = api_path.format(field_id=field_id, id=id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def user_field_options(self, field_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/user_fields#list-user-field-options"
api_path = "/api/v2/user_fields/{field_id}/options.json"
api_path = api_path.format(field_id=field_id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def user_field_show(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/user_fields#show-user-field"
api_path = "/api/v2/user_fields/{id}.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def user_fields_reorder(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/user_fields#reorder-user-field"
api_path = "/api/v2/user_fields/reorder.json"
return self.call(api_path, method="PUT", data=data, **kwargs) | [] |
Please provide a description of the function:def user_group_membership_make_default(self, user_id, membership_id, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/group_memberships#set-membership-as-default"
api_path = "/api/v2/users/{user_id}/group_memberships/{membership_id}/make_default.json"
api_path = api_path.format(user_id=user_id, membership_id=membership_id)
return self.call(api_path, method="PUT", data=data, **kwargs) | [] |
Please provide a description of the function:def user_group_membership_show(self, user_id, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/group_memberships#show-membership"
api_path = "/api/v2/users/{user_id}/group_memberships/{id}.json"
api_path = api_path.format(user_id=user_id, id=id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def user_group_memberships(self, user_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/group_memberships#list-memberships"
api_path = "/api/v2/users/{user_id}/group_memberships.json"
api_path = api_path.format(user_id=user_id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def user_groups(self, user_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/groups#list-groups"
api_path = "/api/v2/users/{user_id}/groups.json"
api_path = api_path.format(user_id=user_id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def user_identities(self, user_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/user_identities#list-identities"
api_path = "/api/v2/users/{user_id}/identities.json"
api_path = api_path.format(user_id=user_id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def user_identity_delete(self, user_id, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/user_identities#delete-identity"
api_path = "/api/v2/users/{user_id}/identities/{id}.json"
api_path = api_path.format(user_id=user_id, id=id)
return self.call(api_path, method="DELETE", **kwargs) | [] |
Please provide a description of the function:def user_identity_make_primary(self, user_id, id, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/user_identities#make-identity-primary"
api_path = "/api/v2/users/{user_id}/identities/{id}/make_primary"
api_path = api_path.format(user_id=user_id, id=id)
return self.call(api_path, method="PUT", data=data, **kwargs) | [] |
Please provide a description of the function:def user_identity_show(self, user_id, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/user_identities#show-identity"
api_path = "/api/v2/users/{user_id}/identities/{id}.json"
api_path = api_path.format(user_id=user_id, id=id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def user_organization_membership_create(self, user_id, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/organization_memberships#create-membership"
api_path = "/api/v2/users/{user_id}/organization_memberships.json"
api_path = api_path.format(user_id=user_id)
return self.call(api_path, method="POST", data=data, **kwargs) | [] |
Please provide a description of the function:def user_organization_membership_make_default(self, id, membership_id, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/organization_memberships#set-membership-as-default"
api_path = "/api/v2/users/{id}/organization_memberships/{membership_id}/make_default.json"
api_path = api_path.format(id=id, membership_id=membership_id)
return self.call(api_path, method="PUT", data=data, **kwargs) | [] |
Please provide a description of the function:def user_organization_membership_show(self, user_id, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/organization_memberships#show-membership"
api_path = "/api/v2/users/{user_id}/organization_memberships/{id}.json"
api_path = api_path.format(user_id=user_id, id=id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def user_organization_memberships(self, user_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/organization_memberships#list-memberships"
api_path = "/api/v2/users/{user_id}/organization_memberships.json"
api_path = api_path.format(user_id=user_id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def user_organization_subscriptions(self, user_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/organization_subscriptions#list-organization-subscriptions"
api_path = "/api/v2/users/{user_id}/organization_subscriptions.json"
api_path = api_path.format(user_id=user_id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def user_organizations(self, user_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/organizations#list-organizations"
api_path = "/api/v2/users/{user_id}/organizations.json"
api_path = api_path.format(user_id=user_id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def user_password_requirements(self, user_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#get-a-list-of-password-requirements"
api_path = "/api/v2/users/{user_id}/password/requirements.json"
api_path = api_path.format(user_id=user_id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def user_related(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#user-related-information"
api_path = "/api/v2/users/{id}/related.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def user_requests(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/requests#list-requests"
api_path = "/api/v2/users/{id}/requests.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def user_session_show(self, user_id, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/sessions#show-session"
api_path = "/api/v2/users/{user_id}/sessions/{id}.json"
api_path = api_path.format(user_id=user_id, id=id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def user_sessions(self, user_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/sessions#list-sessions"
api_path = "/api/v2/users/{user_id}/sessions.json"
api_path = api_path.format(user_id=user_id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def user_sessions_delete(self, user_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/sessions#bulk-deleting-sessions"
api_path = "/api/v2/users/{user_id}/sessions.json"
api_path = api_path.format(user_id=user_id)
return self.call(api_path, method="DELETE", **kwargs) | [] |
Please provide a description of the function:def user_show(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#show-user"
api_path = "/api/v2/users/{id}.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def user_skips(self, user_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/ticket_skips#list-skips-for-the-current-account"
api_path = "/api/v2/users/{user_id}/skips.json"
api_path = api_path.format(user_id=user_id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def user_tags(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/tags#show-tags"
api_path = "/api/v2/users/{id}/tags.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def user_tags_delete(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/tags#remove-tags"
api_path = "/api/v2/users/{id}/tags.json"
api_path = api_path.format(id=id)
return self.call(api_path, method="DELETE", **kwargs) | [] |
Please provide a description of the function:def user_tickets_assigned(self, user_id, external_id=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/tickets#allowed-for"
api_path = "/api/v2/users/{user_id}/tickets/assigned.json"
api_path = api_path.format(user_id=user_id)
api_query = {}
if "query" in kwargs.keys():
api_query.update(kwargs["query"])
del kwargs["query"]
if external_id:
api_query.update({
"external_id": external_id,
})
return self.call(api_path, query=api_query, **kwargs) | [] |
Please provide a description of the function:def users_autocomplete(self, name=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#autocomplete-users"
api_path = "/api/v2/users/autocomplete.json"
api_query = {}
if "query" in kwargs.keys():
api_query.update(kwargs["query"])
del kwargs["query"]
if name:
api_query.update({
"name": name,
})
return self.call(api_path, query=api_query, **kwargs) | [] |
Please provide a description of the function:def users_create_many(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#create-many-users"
api_path = "/api/v2/users/create_many.json"
return self.call(api_path, method="POST", data=data, **kwargs) | [] |
Please provide a description of the function:def users_create_or_update(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#create-or-update-user"
api_path = "/api/v2/users/create_or_update.json"
return self.call(api_path, method="POST", data=data, **kwargs) | [] |
Please provide a description of the function:def users_create_or_update_many(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#create-or-update-many-users"
api_path = "/api/v2/users/create_or_update_many.json"
return self.call(api_path, method="POST", data=data, **kwargs) | [] |
Please provide a description of the function:def users_destroy_many(self, external_ids=None, ids=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#bulk-deleting-users"
api_path = "/api/v2/users/destroy_many.json"
api_query = {}
if "query" in kwargs.keys():
api_query.update(kwargs["query"])
del kwargs["query"]
if external_ids:
api_query.update({
"external_ids": external_ids,
})
if ids:
api_query.update({
"ids": ids,
})
return self.call(api_path, query=api_query, method="DELETE", **kwargs) | [] |
Please provide a description of the function:def users_list(self, permission_set=None, role=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#list-users"
api_path = "/api/v2/users.json"
api_query = {}
if "query" in kwargs.keys():
api_query.update(kwargs["query"])
del kwargs["query"]
if permission_set:
api_query.update({
"permission_set": permission_set,
})
if role:
api_query.update({
"role": role,
})
return self.call(api_path, query=api_query, **kwargs) | [] |
Please provide a description of the function:def users_me(self, include=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#show-the-currently-authenticated-user"
api_path = "/api/v2/users/me.json"
api_query = {}
if "query" in kwargs.keys():
api_query.update(kwargs["query"])
del kwargs["query"]
if include:
api_query.update({
"include": include,
})
return self.call(api_path, query=api_query, **kwargs) | [] |
Please provide a description of the function:def users_me_merge(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#merge-self-with-another-user"
api_path = "/api/v2/users/me/merge.json"
return self.call(api_path, method="PUT", data=data, **kwargs) | [] |
Please provide a description of the function:def users_request_create(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#request-user-create"
api_path = "/api/v2/users/request_create.json"
return self.call(api_path, method="POST", data=data, **kwargs) | [] |
Please provide a description of the function:def users_update_many(self, data, external_ids=None, ids=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/users#update-many-users"
api_path = "/api/v2/users/update_many.json"
api_query = {}
if "query" in kwargs.keys():
api_query.update(kwargs["query"])
del kwargs["query"]
if external_ids:
api_query.update({
"external_ids": external_ids,
})
if ids:
api_query.update({
"ids": ids,
})
return self.call(api_path, query=api_query, method="PUT", data=data, **kwargs) | [] |
Please provide a description of the function:def view_count(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#get-view-count"
api_path = "/api/v2/views/{id}/count.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def view_create(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#create-view"
api_path = "/api/v2/views.json"
return self.call(api_path, method="POST", data=data, **kwargs) | [] |
Please provide a description of the function:def view_delete(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#delete-view"
api_path = "/api/v2/views/{id}.json"
api_path = api_path.format(id=id)
return self.call(api_path, method="DELETE", **kwargs) | [] |
Please provide a description of the function:def view_execute(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#execute-view"
api_path = "/api/v2/views/{id}/execute.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def view_export(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#export-view"
api_path = "/api/v2/views/{id}/export.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def view_show(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#show-view"
api_path = "/api/v2/views/{id}.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def view_tickets(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#list-tickets-from-a-view"
api_path = "/api/v2/views/{id}/tickets.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def views_preview(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#previewing-views"
api_path = "/api/v2/views/preview.json"
return self.call(api_path, method="POST", data=data, **kwargs) | [] |
Please provide a description of the function:def views_preview_count(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#preview-count"
api_path = "/api/v2/views/preview/count.json"
return self.call(api_path, method="POST", data=data, **kwargs) | [] |
Please provide a description of the function:def views_show_many(self, ids=None, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#list-views-by-id"
api_path = "/api/v2/views/show_many.json"
api_query = {}
if "query" in kwargs.keys():
api_query.update(kwargs["query"])
del kwargs["query"]
if ids:
api_query.update({
"ids": ids,
})
return self.call(api_path, query=api_query, **kwargs) | [] |
Please provide a description of the function:def views_update_many(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/views#update-many-views"
api_path = "/api/v2/views/update_many.json"
return self.call(api_path, method="PUT", data=data, **kwargs) | [] |
Please provide a description of the function:def visitor_create(self, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/chat/visitors#create-visitor"
api_path = "/api/v2/visitors"
return self.call(api_path, method="POST", data=data, **kwargs) | [] |
Please provide a description of the function:def visitor_show(self, visitor_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/chat/visitors#get-a-visitor"
api_path = "/api/v2/visitors/{visitor_id}"
api_path = api_path.format(visitor_id=visitor_id)
return self.call(api_path, **kwargs) | [] |
Please provide a description of the function:def visitor_update(self, visitor_id, data, **kwargs):
"https://developer.zendesk.com/rest_api/docs/chat/visitors#update-visitor"
api_path = "/api/v2/visitors/{visitor_id}"
api_path = api_path.format(visitor_id=visitor_id)
return self.call(api_path, method="PUT", data=data, **kwargs) | [] |
Please provide a description of the function:def include_notify_js_variables(context):
ctx = {
'user': context['request'].user,
'update_notification': reverse('notifications:update'),
'mark_notification': reverse('notifications:mark'),
'mark_all_notification': reverse('notifications:mark_all'),
'delete_notification': reverse('notifications:delete'),
'nf_list_class_selector': notify_settings.NF_LIST_CLASS_SELECTOR,
'nf_class_selector': notify_settings.SINGLE_NF_CLASS_SELECTOR,
'nf_box_list_class_selector': notify_settings.NF_BOX_CLASS_SELECTOR,
'nf_box_class_selector': notify_settings.SINGLE_NF_BOX_CLASS_SELECTOR,
'nf_mark_selector': notify_settings.MARK_NF_CLASS_SELECTOR,
'nf_mark_all_selector': notify_settings.MARK_ALL_NF_CLASS_SELECTOR,
'nf_delete_selector': notify_settings.DELETE_NF_CLASS_SELECTOR,
'nf_read_class': notify_settings.READ_NF_CLASS,
'nf_unread_class': notify_settings.UNREAD_NF_CLASS,
'nf_update_time_interval': notify_settings.UPDATE_TIME_INTERVAL,
}
return ctx | [
"\n Inclusion template tag to include all JS variables required by the\n notify.js file on the HTML page around <script> tags.\n\n Example::\n {% include_notify_js_variables %}\n\n :return: Prepares context for rendering in the inclusion file.\n "
] |
Please provide a description of the function:def generate_html(self, notifications):
html_chunks = []
for nf in notifications:
extra = nf.as_json() if self.target == 'box' else {}
html = render_notification(nf, render_target=self.target, **extra)
html_chunks.append(html)
if not html_chunks:
html_chunks.append(_("<b>No notifications yet.</b>"))
html_string = '\n'.join(html_chunks)
return html_string | [
"\n Generates rendered HTML content using supplied notifications.\n :param notifications: Notification QuerySet Object\n :return: Rendered HTML.\n "
] |
Please provide a description of the function:def render(self, context):
notifications = self.obj.resolve(context)
return self.generate_html(notifications) | [
"\n Render method of the template tag, returns generated html content to\n the parent template where it was called.\n :param context: Template context.\n :return: Generated HTML content using notification queryset object.\n "
] |
Please provide a description of the function:def unread_all(self, user=None):
qs = self.read()
if user:
qs = qs.filter(recipient=user)
qs.update(read=False) | [
"\n Marks all notifications as unread for a user (if supplied)\n\n :param user: Notification recipient.\n\n :return: Updates QuerySet as unread.\n "
] |
Please provide a description of the function:def read_all(self, user=None):
qs = self.unread()
if user:
qs = qs.filter(recipient=user)
qs.update(read=True) | [
"\n Marks all notifications as read for a user (if supplied)\n\n :param user: Notification recipient.\n\n :return: Updates QuerySet as read.\n "
] |
Please provide a description of the function:def delete_all(self, user=None):
qs = self.active()
if user:
qs = qs.filter(recipient=user)
soft_delete = getattr(settings, 'NOTIFY_SOFT_DELETE', True)
if soft_delete:
qs.update(deleted=True)
else:
qs.delete() | [
"\n Method to soft-delete all notifications of a User (if supplied)\n\n :param user: Notification recipient.\n\n :return: Updates QuerySet as soft-deleted.\n "
] |
Please provide a description of the function:def active_all(self, user=None):
qs = self.deleted()
if user:
qs = qs.filter(recipient=user)
qs.update(deleted=False) | [
"\n Method to soft-delete all notifications of a User (if supplied)\n\n :param user: Notification recipient.\n\n :return: Updates QuerySet as soft-deleted.\n "
] |
Please provide a description of the function:def prefetch_relations(weak_queryset):
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey
# reverse model's generic foreign keys into a dict:
# { 'field_name': generic.GenericForeignKey instance, ... }
gfks = {}
for name, gfk in weak_queryset.model.__dict__.items():
if not isinstance(gfk, GenericForeignKey):
continue
gfks[name] = gfk
data = {}
for weak_model in weak_queryset:
for gfk_name, gfk_field in gfks.items():
related_content_type_id = getattr(
weak_model,
gfk_field.model._meta.get_field(gfk_field.ct_field).get_attname())
if not related_content_type_id:
continue
related_content_type = ContentType.objects.get_for_id(related_content_type_id)
related_object_id = int(getattr(weak_model, gfk_field.fk_field))
if related_content_type not in data.keys():
data[related_content_type] = []
data[related_content_type].append(related_object_id)
for content_type, object_ids in data.items():
model_class = content_type.model_class()
models = prefetch_relations(model_class.objects.filter(pk__in=object_ids).select_related())
for model in models:
for weak_model in weak_queryset:
for gfk_name, gfk_field in gfks.items():
related_content_type_id = getattr(
weak_model,
gfk_field.model._meta.get_field(gfk_field.ct_field).get_attname())
if not related_content_type_id:
continue
related_content_type = ContentType.objects.get_for_id(related_content_type_id)
related_object_id = int(getattr(weak_model, gfk_field.fk_field))
if related_object_id != model.pk:
continue
if related_content_type != content_type:
continue
setattr(weak_model, gfk_name, model)
return weak_queryset | [
"\n FROM: https://djangosnippets.org/snippets/2492/\n\n Consider such a model class::\n\n class Action(models.Model):\n actor_content_type = models.ForeignKey(ContentType,related_name='actor')\n actor_object_id = models.PositiveIntegerField()\n actor = GenericForeignKey('actor_content_type','actor_object_id')\n\n And dataset::\n\n Action(actor=user1).save()\n Action(actor=user2).save()\n\n This will hit the user table once for each action::\n\n [a.actor for a in Action.objects.all()]\n\n Whereas this will hit the user table once::\n\n [a.actor for a in prefetch_relations(Action.objects.all())]\n\n Actually, the example above will hit the database N+1 times, where N is\n the number of actions. But with prefetch_relations(), the database will be\n hit N+1 times where N is the number of distinct content types.\n\n Note that prefetch_relations() is recursive.\n\n Here an example, making a list with prefetch_relations(), and then without\n prefetch_relations(). See the number of database hits after each test.\n\n In [1]: from django import db; from prefetch_relations import prefetch_relations\n\n In [2]: db.reset_queries()\n\n In [3]: x = [(a.actor, a.action_object, a.target) for a in prefetch_relations(Action.objects.all().order_by('-pk'))]\n\n In [4]: print len(db.connection.queries)\n 34\n\n In [5]: db.reset_queries()\n\n In [6]: print len(db.connection.queries)\n 0\n\n In [7]: x = [(a.actor, a.action_object, a.target) for a in Action.objects.all().order_by('-pk')]\n\n In [8]: print len(db.connection.queries)\n 396\n "
] |
Please provide a description of the function:def notification_redirect(request, ctx):
if request.is_ajax():
return JsonResponse(ctx)
else:
next_page = request.POST.get('next', reverse('notifications:all'))
if not ctx['success']:
return HttpResponseBadRequest(ctx['msg'])
if is_safe_url(next_page):
return HttpResponseRedirect(next_page)
else:
return HttpResponseRedirect(reverse('notifications:all')) | [
"\n Helper to handle HTTP response after an action is performed on notification\n\n :param request: HTTP request context of the notification\n\n :param ctx: context to be returned when a AJAX call is made.\n\n :returns: Either JSON for AJAX or redirects to the calculated next page.\n "
] |
Please provide a description of the function:def notifications(request):
notification_list = request.user.notifications.active().prefetch()
return render(request, 'notifications/all.html',
{'notifications': notification_list}) | [
"\n Returns a rendered page of all notifications for the logged-in user.\n Uses ``notification.nf_type`` as the template for individual notification.\n Each notification type is expected to have a render template\n at ``notifications/includes/NOTIFICATION_TYPE.html``.\n\n :param request: HTTP request context.\n\n :return: Rendered notification list page.\n "
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.