Coverage Summary for Class: UsersApi (com.github.malyshevhen.api)
Class |
Class, %
|
Method, %
|
Branch, %
|
Line, %
|
UsersApi |
0%
(0/1)
|
0%
(0/17)
|
0%
(0/28)
|
0%
(0/45)
|
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.0.1).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.github.malyshevhen.api;
import com.github.malyshevhen.dto.Phone;
import com.github.malyshevhen.dto.UpdateEmailForm;
import com.github.malyshevhen.dto.UserInfo;
import com.github.malyshevhen.dto.UserRegistrationForm;
import com.github.malyshevhen.dto.UserUpdateForm;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile;
import jakarta.validation.Valid;
import jakarta.validation.constraints.*;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import jakarta.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2024-04-30T13:08:47.886427131+03:00[Europe/Kyiv]")
@Validated
public interface UsersApi {
default Optional<NativeWebRequest> getRequest() {
return Optional.empty();
}
/**
* DELETE /users/{id} : Delete a specific user by ID
* This endpoint allows you to delete a specific user by ID
*
* @param id Users ID (required)
* @return OK. User successfully deleted. (status code 204)
* or Bad request. Invalid image name or ID parameter (status code 400)
* or Not found. (status code 404)
* or Internal server error. Please try again later (status code 500)
*/
@RequestMapping(
method = RequestMethod.DELETE,
value = "/users/{id}",
produces = { "application/json" }
)
default ResponseEntity<Void> deleteById(
@Min(1L) @PathVariable("id") Long id
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* DELETE /users/{id}/address : Delete a specific users address.
* This endpoint allows you to delete a specific users address.
*
* @param id Users ID (required)
* @return No Content. Users address successfully deleted. (status code 204)
* or Bad request. Invalid image name or ID parameter (status code 400)
* or Not found. (status code 404)
* or Internal server error. Please try again later (status code 500)
*/
@RequestMapping(
method = RequestMethod.DELETE,
value = "/users/{id}/address",
produces = { "application/json" }
)
default ResponseEntity<Void> deleteUserAddress(
@Min(1L) @PathVariable("id") Long id
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* GET /users : Retrieve a specific page of users
* This endpoint allows you to retrieve a specific page of users with customizable pagination settings using the query parameters. The available parameters are: - `page` (integer): The page number to retrieve (starting from 1). - `size` (integer): The number of users per page. - `sort` (string): Sort the results by the specified field name and direction ('asc' for ascending, 'desc' for descending). If direction is not provided, 'asc' will be used by default.
*
* @param pageable Pagination settings (optional)
* @param dateRange Date range filter for users created at or between the specified birth dates. (optional)
* @return OK. Successful retrieval of users page. (status code 200)
* or Bad request. Invalid image name or ID parameter (status code 400)
* or Internal server error. Please try again later (status code 500)
*/
@RequestMapping(
method = RequestMethod.GET,
value = "/users",
produces = { "application/json" }
)
default ResponseEntity<org.springframework.data.domain.Page<com.github.malyshevhen.dto.UserInfo>> getAll(
@Valid org.springframework.data.domain.Pageable pageable,
@Valid com.github.malyshevhen.domain.dto.DateRange dateRange
) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"number\" : 2, \"last\" : true, \"size\" : 5, \"numberOfElements\" : 7, \"totalPages\" : 1, \"pageable\" : { \"size\" : 6, \"page\" : 0, \"sort\" : \"title,DESC\" }, \"content\" : [ { \"firstName\" : \"John\", \"lastName\" : \"Doe\", \"address\" : { \"country\" : \"Ukraine\", \"number\" : \"1-A\", \"city\" : \"Kyiv\", \"street\" : \"Khreschatyk\" }, \"phone\" : \"phone\", \"id\" : 1, \"birthDate\" : \"1989-08-14T00:00:00.000+00:00\", \"email\" : \"john@email.com\" }, { \"firstName\" : \"John\", \"lastName\" : \"Doe\", \"address\" : { \"country\" : \"Ukraine\", \"number\" : \"1-A\", \"city\" : \"Kyiv\", \"street\" : \"Khreschatyk\" }, \"phone\" : \"phone\", \"id\" : 1, \"birthDate\" : \"1989-08-14T00:00:00.000+00:00\", \"email\" : \"john@email.com\" } ], \"first\" : true, \"totalElements\" : 5, \"empty\" : true }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* GET /users/{id} : Retrieve a specific user by ID
* This endpoint allows you to retrieve a specific user by ID
*
* @param id Users ID (required)
* @return OK. User successfully retrieved. (status code 200)
* or Bad request. Invalid image name or ID parameter (status code 400)
* or Not found. (status code 404)
* or Internal server error. Please try again later (status code 500)
*/
@RequestMapping(
method = RequestMethod.GET,
value = "/users/{id}",
produces = { "application/json" }
)
default ResponseEntity<UserInfo> getById(
@Min(1L) @PathVariable("id") Long id
) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"firstName\" : \"John\", \"lastName\" : \"Doe\", \"address\" : { \"country\" : \"Ukraine\", \"number\" : \"1-A\", \"city\" : \"Kyiv\", \"street\" : \"Khreschatyk\" }, \"phone\" : \"phone\", \"id\" : 1, \"birthDate\" : \"1989-08-14T00:00:00.000+00:00\", \"email\" : \"john@email.com\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* POST /users : Create a new user.
* This endpoint allows you to register a new user.
*
* @param userRegistrationForm (required)
* @return Created. User created successfully (status code 201)
* or Bad request. Invalid image name or ID parameter (status code 400)
* or Internal server error. Please try again later (status code 500)
*/
@RequestMapping(
method = RequestMethod.POST,
value = "/users",
produces = { "application/json" },
consumes = { "application/json" }
)
default ResponseEntity<UserInfo> registerUser(
@Valid @RequestBody UserRegistrationForm userRegistrationForm
) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"firstName\" : \"John\", \"lastName\" : \"Doe\", \"address\" : { \"country\" : \"Ukraine\", \"number\" : \"1-A\", \"city\" : \"Kyiv\", \"street\" : \"Khreschatyk\" }, \"phone\" : \"phone\", \"id\" : 1, \"birthDate\" : \"1989-08-14T00:00:00.000+00:00\", \"email\" : \"john@email.com\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* PUT /users/{id} : Update a specific user by ID
* This endpoint allows you to update a specific user by ID
*
* @param id Users ID (required)
* @param userUpdateForm User form for update. (required)
* @return OK. User successfully updated. (status code 200)
* or Bad request. Invalid image name or ID parameter (status code 400)
* or Not found. (status code 404)
* or Internal server error. Please try again later (status code 500)
*/
@RequestMapping(
method = RequestMethod.PUT,
value = "/users/{id}",
produces = { "application/json" },
consumes = { "application/json" }
)
default ResponseEntity<UserInfo> updateById(
@Min(1L) @PathVariable("id") Long id,
@Valid @RequestBody UserUpdateForm userUpdateForm
) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"firstName\" : \"John\", \"lastName\" : \"Doe\", \"address\" : { \"country\" : \"Ukraine\", \"number\" : \"1-A\", \"city\" : \"Kyiv\", \"street\" : \"Khreschatyk\" }, \"phone\" : \"phone\", \"id\" : 1, \"birthDate\" : \"1989-08-14T00:00:00.000+00:00\", \"email\" : \"john@email.com\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* PATCH /users/{id}/address : Update a specific users address.
* This endpoint allows you to update a specific users address.
*
* @param id Users ID (required)
* @param comGithubMalyshevhenDomainModelsAddress (optional)
* @return OK. User successfully updated. (status code 200)
* or Bad request. Invalid image name or ID parameter (status code 400)
* or Not found. (status code 404)
* or Internal server error. Please try again later (status code 500)
*/
@RequestMapping(
method = RequestMethod.PATCH,
value = "/users/{id}/address",
produces = { "application/json" },
consumes = { "application/json" }
)
default ResponseEntity<UserInfo> updateUserAddress(
@Min(1L) @PathVariable("id") Long id,
@Valid @RequestBody(required = false) com.github.malyshevhen.domain.models.Address comGithubMalyshevhenDomainModelsAddress
) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"firstName\" : \"John\", \"lastName\" : \"Doe\", \"address\" : { \"country\" : \"Ukraine\", \"number\" : \"1-A\", \"city\" : \"Kyiv\", \"street\" : \"Khreschatyk\" }, \"phone\" : \"phone\", \"id\" : 1, \"birthDate\" : \"1989-08-14T00:00:00.000+00:00\", \"email\" : \"john@email.com\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* PATCH /users/{id}/email : Update a specific users email.
* This endpoint allows you to update a specific users email.
*
* @param id Users ID (required)
* @param updateEmailForm (optional)
* @return OK. User successfully updated. (status code 200)
* or Bad request. Invalid image name or ID parameter (status code 400)
* or Not found. (status code 404)
* or Internal server error. Please try again later (status code 500)
*/
@RequestMapping(
method = RequestMethod.PATCH,
value = "/users/{id}/email",
produces = { "application/json" },
consumes = { "application/json" }
)
default ResponseEntity<UserInfo> updateUserEmail(
@Min(1L) @PathVariable("id") Long id,
@Valid @RequestBody(required = false) UpdateEmailForm updateEmailForm
) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"firstName\" : \"John\", \"lastName\" : \"Doe\", \"address\" : { \"country\" : \"Ukraine\", \"number\" : \"1-A\", \"city\" : \"Kyiv\", \"street\" : \"Khreschatyk\" }, \"phone\" : \"phone\", \"id\" : 1, \"birthDate\" : \"1989-08-14T00:00:00.000+00:00\", \"email\" : \"john@email.com\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* PATCH /users/{id}/phone : Update a specific users phone number.
* This endpoint allows you to update a specific users phone number.
*
* @param id Users ID (required)
* @param phone (optional)
* @return OK. User successfully updated. (status code 200)
* or Bad request. Invalid image name or ID parameter (status code 400)
* or Not found. (status code 404)
* or Internal server error. Please try again later (status code 500)
*/
@RequestMapping(
method = RequestMethod.PATCH,
value = "/users/{id}/phone",
produces = { "application/json" },
consumes = { "application/json" }
)
default ResponseEntity<UserInfo> updateUserPhone(
@Min(1L) @PathVariable("id") Long id,
@Valid @RequestBody(required = false) Phone phone
) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"firstName\" : \"John\", \"lastName\" : \"Doe\", \"address\" : { \"country\" : \"Ukraine\", \"number\" : \"1-A\", \"city\" : \"Kyiv\", \"street\" : \"Khreschatyk\" }, \"phone\" : \"phone\", \"id\" : 1, \"birthDate\" : \"1989-08-14T00:00:00.000+00:00\", \"email\" : \"john@email.com\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
}