Cases

class py42.clients.cases.CaseStatus

Bases: py42.choices.Choices

Constants available for setting the status of a case.

  • OPEN

  • CLOSED

class py42.clients.cases.CasesClient(cases_service, cases_file_event_service)

Bases: object

A client to expose cases API.

Rest documentation

create(name, subject=None, assignee=None, description=None, findings=None)

Creates a new case. Rest documentation

Parameters
  • name (str) – Name of the case.

  • subject (str, optional) – User UID of a subject of a case.

  • assignee (str, optional) – User UID of the assignee.

  • description (str, optional) – Description of the case

  • findings (str, optional) – Observations of the case.

Returns

py42.response.Py42Response

export_summary(case_number)

Provides case summary to download as a PDF file. Rest documentation

Parameters

case_number (int) – Case number of the case.

Returns

py42.response.Py42Response

property file_events

A collection of methods for managing file events associated with a given case.

Returns

py42.services.casesfileevents.CasesFileEventsService

get(case_number)

Retrieve case details by case number. Rest documentation

Parameters

case_number (int) – Case number of the case.

Returns

py42.response.Py42Response

get_all(name=None, status=None, min_create_time=None, max_create_time=None, min_update_time=None, max_update_time=None, subject=None, assignee=None, page_size=100, sort_direction='asc', sort_key='number', **kwargs)

Gets all cases. Rest documentation

Parameters
  • name (str, optional) – Filter results by case name, matches partial names. Defaults to None.

  • status (str, optional) – Filter results by case status. OPEN or CLOSED. Defaults to None. Constants available at py42.constants.CaseStatus.

  • min_create_time (str or int or float or datetime, optional) – Filter results by case creation time, start time. str format %Y-%m-%d %H:%M:%S. Defaults to None.

  • max_create_time (str or int or float or datetime, optional) – Filter results by case creation time, end time. str format %Y-%m-%d %H:%M:%S. Defaults to None.

  • min_update_time (str or int or float or datetime, optional) – Filter results by last updated time, start time. str format %Y-%m-%d %H:%M:%S. Defaults to None.

  • max_update_time (str or int or float or datetime, optional) – Filter results by last updated time, end time. str format %Y-%m-%d %H:%M:%S. Defaults to None.

  • subject (str, optional) – Filter results based on User UID of a subject of a case. Defaults to None.

  • assignee (str, optional) – Filter results based on User UID of an assignee of a case. Defaults to None.

  • page_size (int, optional) – Number of results to return per page. Defaults to 100.

  • sort_direction (str, optional) – The direction on which to sort the response, based on the corresponding sort key. asc or desc. Defaults to asc.

  • sort_key (str, optional) – Values on which the response will be sorted. Defaults to “number”. Available options are name, number, createdAt, updatedAt, status, assigneeUsername, subjectUsername.

Returns

An object that iterates over py42.response.Py42Response objects that each contain a page of cases.

Return type

generator

get_page(page_num, name=None, status=None, min_create_time=None, max_create_time=None, min_update_time=None, max_update_time=None, subject=None, assignee=None, page_size=100, sort_direction='asc', sort_key='number', **kwargs)

Gets individual page of cases. Rest documentation

Parameters
  • page_num (int) – The page number to request.

  • name (str, optional) – Filter results by case name, matches partial names. Defaults to None.

  • status (str, optional) – Filter results by case status. OPEN or CLOSED. Defaults to None. Constants available at py42.constants.CaseStatus.

  • min_create_time (str or int or float or datetime, optional) – Filter results by case creation time, start time. str format %Y-%m-%d %H:%M:%S. Defaults to None.

  • max_create_time (str or int or float or datetime, optional) – Filter results by case creation time, end time. str format %Y-%m-%d %H:%M:%S. Defaults to None.

  • min_update_time (str or int or float or datetime, optional) – Filter results by last updated time, start time. str format %Y-%m-%d %H:%M:%S. Defaults to None.

  • max_update_time (str or int or float or datetime, optional) – Filter results by last updated time, end time. str format %Y-%m-%d %H:%M:%S. Defaults to None.

  • subject (str, optional) – Filter results based on User UID of a subject of a case. Defaults to None.

  • assignee (str, optional) – Filter results based on User UID of an assignee of a case. Defaults to None.

  • page_size (int, optional) – Number of results to return per page. Defaults to 100.

  • sort_direction (str, optional) – The direction on which to sort the response, based on the corresponding sort key. asc or desc. Defaults to asc.

  • sort_key (str, optional) – Values on which the response will be sorted. Defaults to “number”. Available options are name, number, createdAt, updatedAt, status, assigneeUsername, subjectUsername.

Returns

py42.response.Py42Response

update(case_number, name=None, subject=None, assignee=None, description=None, findings=None, status=None)

Updates case details for the given case number. Rest documentation

Parameters
  • case_number (int) – Case number of the case.

  • name (str, optional) – Name of the case. Defaults to None.

  • subject (str, optional) – A subject of the case. Defaults to None.

  • assignee (str, optional) – User UID of the assignee. Defaults to None.

  • description (str, optional) – Description of the case. Defaults to None.

  • findings (str, optional) – Notes on the case. Defaults to None.

  • status (str, optional) – Status of the case. OPEN or CLOSED. Defaults to None. Constants available at py42.constants.CaseStatus.

Returns

py42.response.Py42Response

Cases File Events

class py42.services.casesfileevents.CasesFileEventsService(connection)

Bases: py42.services.BaseService

add(case_number, event_id)

Adds an event to the case.

Parameters
  • case_number (int) – Case number of the case.

  • event_id (str) – Event id to add to the case.

Returns

py42.response.Py42Response

delete(case_number, event_id)

Deletes an event from the case.

Parameters
  • case_number (int) – Case number of the case.

  • event_id (str) – Event id to remove from case.

Returns

py42.response.Py42Response

get(case_number, event_id)

Gets information of a specified event from the case.

Parameters
  • case_number (int) – Case number of the case.

  • event_id (str) – Event id to fetch from the case.

Returns

py42.response.Py42Response

get_all(case_number)

Gets all events associated with the given case.

Parameters

case_number (int) – Case number of the case.

Returns

py42.response.Py42Response