unAssignDoc method

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

Un-assigns a user from the doctype and docName.

Implementation

@override
Future<RequestResponse<bool?>> unAssignDoc(
    {String? doctype, String? docName, String? unAssignFrom}) async {
  await getFrappe().checkAppInstalled(features: ['unAssignDoc']);

  EmptyDoctypeError.verify(doctype);
  EmptyDocNameError.verify(docName);
  // FIXME possible to unassign same doc twice, should be validated
  final response = await Request.initiateRequest(
      url: config.hostUrl,
      method: HttpMethod.POST,
      contentType: ContentTypeLiterals.APPLICATION_JSON,
      data: <String, dynamic>{
        'cmd': 'renovation_core.utils.assign_doc.unAssignDocFromUser',
        'doctype': doctype,
        'docname': docName,
        'user': unAssignFrom
      });
  if (response.isSuccess) {
    return RequestResponse.success(true, rawResponse: response.rawResponse);
  } else {
    return RequestResponse.fail(handleError('unassign_doc', response.error));
  }
}