completeDocAssignment method

  1. @override
Future<RequestResponse<bool?>> completeDocAssignment({
  1. String? doctype,
  2. String? docName,
  3. String? assignedTo,
})
override

Sets the assignment to Status.Cancelled which means that the task is assigned.

Implementation

@override
Future<RequestResponse<bool?>> completeDocAssignment(
    {String? doctype, String? docName, String? assignedTo}) async {
  EmptyDoctypeError.verify(doctype);
  EmptyDocNameError.verify(docName);
  final args = CompleteDocAssignmentParams(
    doctype: doctype,
    name: docName,
    assignedTo: assignedTo,
  )..cmd = 'frappe.desk.form.assign_to.remove';

  final response = await Request.initiateRequest(
      url: config.hostUrl,
      method: HttpMethod.POST,
      contentType: ContentTypeLiterals.APPLICATION_JSON,
      data: args.toJson());
  if (response.isSuccess) {
    return RequestResponse.success(true, rawResponse: response.rawResponse);
  } else {
    return RequestResponse.fail(
        handleError('complete_doc_assignment', response.error));
  }
}