Package com.dzidzi.api
Interface CourierApi
public interface CourierApi
CourierApi contains all the api operations handling
Courier in the DzidziApp.-
Method Summary
Modifier and TypeMethodDescriptionvoidchangeAvailability(boolean availability) Changes the couriers' availability.createCourier(AddCourierRequest addCourierRequest, String verificationCode) Adds/creates a new courier.voiddeactivateAccountByAdmin(UUID courierId) Deactivates courier account by the given courier ideditCourier(ChangeCourierRequest changeCourierRequest) Changes a field/all fields of an existing courier.Finds the list of courier byCourierStatus.ONLINE.findCourierById(UUID courierId) Finds a courier by the given id.findCouriers(FindCourierRequest findCourierRequest) The paged results of the provided request.findCourierVerificationCode(String verificationCode) Finds the courier by verification code.Gets the logged in courier details.voidremoveAccount(UUID courierId) Removes a courier account from the system by an admin.voiduploadAvatar(org.springframework.web.multipart.MultipartFile image)
-
Method Details
-
findCourierById
Finds a courier by the given id.- Parameters:
courierId- the id of the courier- Returns:
- the courier found
- Throws:
com.dzidzi.exception.EntityNotFoundException- when the courier is not found
-
createCourier
Adds/creates a new courier. To be able to create a new courier, credential is needed. SeeCredentialApi.addNewUserCredentialByAdmin(String, UserRole)on how to create credential.- Parameters:
addCourierRequest- theAddCourierRequestto create/add a new courierverificationCode- the verification code of the user- Returns:
- the courier created/added
-
editCourier
Changes a field/all fields of an existing courier.- Parameters:
changeCourierRequest- theChangeCourierRequestto change an existing courier- Returns:
- the updated courier
-
uploadAvatar
void uploadAvatar(org.springframework.web.multipart.MultipartFile image) -
findCourierByAvailability
Finds the list of courier byCourierStatus.ONLINE. online.- Returns:
- the list of couriers found
-
findCourierVerificationCode
Finds the courier by verification code.- Parameters:
verificationCode- the verification code of the courier- Returns:
- the courier found
-
getCurrentCourier
Courier getCurrentCourier()Gets the logged in courier details.- Returns:
- the logged in courier
-
findCouriers
The paged results of the provided request.- Parameters:
findCourierRequest- the requests used for filtering couriers- Returns:
- the
DzidziPaginationDTO
-
removeAccount
Removes a courier account from the system by an admin. -
changeAvailability
void changeAvailability(boolean availability) Changes the couriers' availability. If it's true, that means the courier is online otherwise offline.- Parameters:
availability- true/false
-
deactivateAccountByAdmin
Deactivates courier account by the given courier id- Parameters:
courierId- the courier id
-