create method

  1. @override
FutureOr<Response> create(
  1. PgrServiceModel entity
)
override

The create method creates a new entity.

Implementation

@override
FutureOr<Response> create(PgrServiceModel entity) async {
  return executeFuture(
    future: () async {
      final response = await dio.post(
        createPath,
        options: Options(headers: {
          "content-type": 'application/json',
        }),
        data: PgrComplaintModel(
          service: entity,
          workflow: const PgrWorkflowModel(
            action: "CREATE",
            comments: "",
            assignees: [],
          ),
        ).toMap(),
      );

      return response;
    },
  );
}