forked from loafle/openapi-generator-original
Upgrade sttp generator to sttp3 (#11260)
Remove CIRCE_VERSION from generator because it is taken in as a transitive dependency of ` "com.softwaremill.sttp.client3" %% "json4s" % "3.3.18"` Co-authored-by: boris <borissmidt@hotmail.com>
This commit is contained in:
parent
b6c445cdc3
commit
ff30df92f8
@ -44,17 +44,16 @@ import static org.openapitools.codegen.utils.StringUtils.camelize;
|
|||||||
|
|
||||||
public class ScalaSttpClientCodegen extends AbstractScalaCodegen implements CodegenConfig {
|
public class ScalaSttpClientCodegen extends AbstractScalaCodegen implements CodegenConfig {
|
||||||
private static final StringProperty STTP_CLIENT_VERSION = new StringProperty("sttpClientVersion", "The version of " +
|
private static final StringProperty STTP_CLIENT_VERSION = new StringProperty("sttpClientVersion", "The version of " +
|
||||||
"sttp client", "2.2.9");
|
"sttp client", "3.3.18");
|
||||||
private static final BooleanProperty USE_SEPARATE_ERROR_CHANNEL = new BooleanProperty("separateErrorChannel",
|
private static final BooleanProperty USE_SEPARATE_ERROR_CHANNEL = new BooleanProperty("separateErrorChannel",
|
||||||
"Whether to return response as " +
|
"Whether to return response as " +
|
||||||
"F[Either[ResponseError[ErrorType], ReturnType]]] or to flatten " +
|
"F[Either[ResponseError[ErrorType], ReturnType]]] or to flatten " +
|
||||||
"response's error raising them through enclosing monad (F[ReturnType]).", true);
|
"response's error raising them through enclosing monad (F[ReturnType]).", true);
|
||||||
private static final StringProperty JODA_TIME_VERSION = new StringProperty("jodaTimeVersion", "The version of " +
|
private static final StringProperty JODA_TIME_VERSION = new StringProperty("jodaTimeVersion", "The version of " +
|
||||||
"joda-time library", "2.10.10");
|
"joda-time library", "2.10.13");
|
||||||
private static final StringProperty JSON4S_VERSION = new StringProperty("json4sVersion", "The version of json4s " +
|
private static final StringProperty JSON4S_VERSION = new StringProperty("json4sVersion", "The version of json4s " +
|
||||||
"library", "3.6.11");
|
"library", "3.6.11");
|
||||||
private static final StringProperty CIRCE_VERSION = new StringProperty("circeVersion", "The version of circe " +
|
|
||||||
"library", "0.13.0");
|
|
||||||
private static final JsonLibraryProperty JSON_LIBRARY_PROPERTY = new JsonLibraryProperty();
|
private static final JsonLibraryProperty JSON_LIBRARY_PROPERTY = new JsonLibraryProperty();
|
||||||
|
|
||||||
public static final String DEFAULT_PACKAGE_NAME = "org.openapitools.client";
|
public static final String DEFAULT_PACKAGE_NAME = "org.openapitools.client";
|
||||||
@ -62,7 +61,7 @@ public class ScalaSttpClientCodegen extends AbstractScalaCodegen implements Code
|
|||||||
|
|
||||||
private static final List<Property<?>> properties = Arrays.asList(
|
private static final List<Property<?>> properties = Arrays.asList(
|
||||||
STTP_CLIENT_VERSION, USE_SEPARATE_ERROR_CHANNEL, JODA_TIME_VERSION,
|
STTP_CLIENT_VERSION, USE_SEPARATE_ERROR_CHANNEL, JODA_TIME_VERSION,
|
||||||
JSON4S_VERSION, CIRCE_VERSION, JSON_LIBRARY_PROPERTY, PACKAGE_PROPERTY);
|
JSON4S_VERSION, JSON_LIBRARY_PROPERTY, PACKAGE_PROPERTY);
|
||||||
|
|
||||||
private final Logger LOGGER = LoggerFactory.getLogger(ScalaSttpClientCodegen.class);
|
private final Logger LOGGER = LoggerFactory.getLogger(ScalaSttpClientCodegen.class);
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ package {{package}}
|
|||||||
import {{import}}
|
import {{import}}
|
||||||
{{/imports}}
|
{{/imports}}
|
||||||
import {{invokerPackage}}.JsonSupport._
|
import {{invokerPackage}}.JsonSupport._
|
||||||
import sttp.client._
|
import sttp.client3._
|
||||||
import sttp.model.Method
|
import sttp.model.Method
|
||||||
|
|
||||||
{{#operations}}
|
{{#operations}}
|
||||||
@ -20,7 +20,7 @@ class {{classname}}(baseUrl: String) {
|
|||||||
{{#javadocRenderer}}
|
{{#javadocRenderer}}
|
||||||
{{>javadoc}}
|
{{>javadoc}}
|
||||||
{{/javadocRenderer}}
|
{{/javadocRenderer}}
|
||||||
def {{operationId}}({{>methodParameters}}): Request[{{#separateErrorChannel}}Either[ResponseError[Exception], {{>operationReturnType}}]{{/separateErrorChannel}}{{^separateErrorChannel}}{{>operationReturnType}}{{/separateErrorChannel}}, Nothing] =
|
def {{operationId}}({{>methodParameters}}): Request[{{#separateErrorChannel}}Either[ResponseException[String, Exception], {{>operationReturnType}}]{{/separateErrorChannel}}{{^separateErrorChannel}}{{>operationReturnType}}{{/separateErrorChannel}}, Nothing] =
|
||||||
basicRequest
|
basicRequest
|
||||||
.method(Method.{{httpMethod.toUpperCase}}, uri"$baseUrl{{{path}}}{{#queryParams.0}}?{{#queryParams}}{{baseName}}=${ {{{paramName}}} }{{^-last}}&{{/-last}}{{/queryParams}}{{/queryParams.0}}{{#isApiKey}}{{#isKeyInQuery}}{{^queryParams.0}}?{{/queryParams.0}}{{#queryParams.0}}&{{/queryParams.0}}{{keyParamName}}=${apiKey.value}&{{/isKeyInQuery}}{{/isApiKey}}")
|
.method(Method.{{httpMethod.toUpperCase}}, uri"$baseUrl{{{path}}}{{#queryParams.0}}?{{#queryParams}}{{baseName}}=${ {{{paramName}}} }{{^-last}}&{{/-last}}{{/queryParams}}{{/queryParams.0}}{{#isApiKey}}{{#isKeyInQuery}}{{^queryParams.0}}?{{/queryParams.0}}{{#queryParams.0}}&{{/queryParams.0}}{{keyParamName}}=${apiKey.value}&{{/isKeyInQuery}}{{/isApiKey}}")
|
||||||
.contentType({{#consumes.0}}"{{{mediaType}}}"{{/consumes.0}}{{^consumes}}"application/json"{{/consumes}}){{#headerParams}}
|
.contentType({{#consumes.0}}"{{{mediaType}}}"{{/consumes.0}}{{^consumes}}"application/json"{{/consumes}}){{#headerParams}}
|
||||||
|
@ -6,19 +6,16 @@ scalaVersion := "2.13.5"
|
|||||||
crossScalaVersions := Seq(scalaVersion.value, "2.12.13")
|
crossScalaVersions := Seq(scalaVersion.value, "2.12.13")
|
||||||
|
|
||||||
libraryDependencies ++= Seq(
|
libraryDependencies ++= Seq(
|
||||||
"com.softwaremill.sttp.client" %% "core" % "{{sttpClientVersion}}",
|
"com.softwaremill.sttp.client3" %% "core" % "{{sttpClientVersion}}",
|
||||||
{{#joda}}
|
{{#joda}}
|
||||||
"joda-time" % "joda-time" % "{{jodaTimeVersion}}",
|
"joda-time" % "joda-time" % "{{jodaTimeVersion}}",
|
||||||
{{/joda}}
|
{{/joda}}
|
||||||
{{#json4s}}
|
{{#json4s}}
|
||||||
"com.softwaremill.sttp.client" %% "json4s" % "{{sttpClientVersion}}",
|
"com.softwaremill.sttp.client3" %% "json4s" % "{{sttpClientVersion}}",
|
||||||
"org.json4s" %% "json4s-jackson" % "{{json4sVersion}}"
|
"org.json4s" %% "json4s-jackson" % "{{json4sVersion}}"
|
||||||
{{/json4s}}
|
{{/json4s}}
|
||||||
{{#circe}}
|
{{#circe}}
|
||||||
"com.softwaremill.sttp.client" %% "circe" % "{{sttpClientVersion}}",
|
"com.softwaremill.sttp.client3" %% "circe" % "{{sttpClientVersion}}"
|
||||||
"io.circe" %% "circe-core" % "{{circeVersion}}",
|
|
||||||
"io.circe" %% "circe-generic" % "{{circeVersion}}",
|
|
||||||
"io.circe" %% "circe-parser" % "{{circeVersion}}"
|
|
||||||
{{/circe}}
|
{{/circe}}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import {{modelPackage}}._
|
|||||||
{{/models.0}}
|
{{/models.0}}
|
||||||
{{#json4s}}
|
{{#json4s}}
|
||||||
import org.json4s._
|
import org.json4s._
|
||||||
import sttp.client.json4s.SttpJson4sApi
|
import sttp.client3.json4s.SttpJson4sApi
|
||||||
import scala.reflect.ClassTag
|
import scala.reflect.ClassTag
|
||||||
|
|
||||||
object JsonSupport extends SttpJson4sApi {
|
object JsonSupport extends SttpJson4sApi {
|
||||||
@ -42,7 +42,7 @@ object JsonSupport extends SttpJson4sApi {
|
|||||||
{{#circe}}
|
{{#circe}}
|
||||||
import io.circe.{Decoder, Encoder}
|
import io.circe.{Decoder, Encoder}
|
||||||
import io.circe.generic.AutoDerivation
|
import io.circe.generic.AutoDerivation
|
||||||
import sttp.client.circe.SttpCirceApi
|
import sttp.client3.circe.SttpCirceApi
|
||||||
|
|
||||||
object JsonSupport extends SttpCirceApi with AutoDerivation with DateSerializers {
|
object JsonSupport extends SttpCirceApi with AutoDerivation with DateSerializers {
|
||||||
{{#models}}{{#model}}{{#hasEnums}}{{#vars}}{{#isEnum}}
|
{{#models}}{{#model}}{{#hasEnums}}{{#vars}}{{#isEnum}}
|
||||||
|
@ -1 +1 @@
|
|||||||
sbt.version=1.5.0
|
sbt.version=1.6.1
|
||||||
|
@ -6,8 +6,8 @@ scalaVersion := "2.13.5"
|
|||||||
crossScalaVersions := Seq(scalaVersion.value, "2.12.13")
|
crossScalaVersions := Seq(scalaVersion.value, "2.12.13")
|
||||||
|
|
||||||
libraryDependencies ++= Seq(
|
libraryDependencies ++= Seq(
|
||||||
"com.softwaremill.sttp.client" %% "core" % "2.2.9",
|
"com.softwaremill.sttp.client3" %% "core" % "3.3.18",
|
||||||
"com.softwaremill.sttp.client" %% "json4s" % "2.2.9",
|
"com.softwaremill.sttp.client3" %% "json4s" % "3.3.18",
|
||||||
"org.json4s" %% "json4s-jackson" % "3.6.11"
|
"org.json4s" %% "json4s-jackson" % "3.6.11"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
sbt.version=1.5.0
|
sbt.version=1.6.1
|
||||||
|
@ -15,7 +15,7 @@ import org.openapitools.client.model.ApiResponse
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import org.openapitools.client.model.Pet
|
import org.openapitools.client.model.Pet
|
||||||
import org.openapitools.client.core.JsonSupport._
|
import org.openapitools.client.core.JsonSupport._
|
||||||
import sttp.client._
|
import sttp.client3._
|
||||||
import sttp.model.Method
|
import sttp.model.Method
|
||||||
|
|
||||||
object PetApi {
|
object PetApi {
|
||||||
@ -33,7 +33,7 @@ class PetApi(baseUrl: String) {
|
|||||||
* @param pet Pet object that needs to be added to the store
|
* @param pet Pet object that needs to be added to the store
|
||||||
*/
|
*/
|
||||||
def addPet(pet: Pet
|
def addPet(pet: Pet
|
||||||
): Request[Either[ResponseError[Exception], Pet], Nothing] =
|
): Request[Either[ResponseException[String, Exception], Pet], Nothing] =
|
||||||
basicRequest
|
basicRequest
|
||||||
.method(Method.POST, uri"$baseUrl/pet")
|
.method(Method.POST, uri"$baseUrl/pet")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
@ -48,7 +48,7 @@ class PetApi(baseUrl: String) {
|
|||||||
* @param apiKey
|
* @param apiKey
|
||||||
*/
|
*/
|
||||||
def deletePet(petId: Long, apiKey: Option[String] = None
|
def deletePet(petId: Long, apiKey: Option[String] = None
|
||||||
): Request[Either[ResponseError[Exception], Unit], Nothing] =
|
): Request[Either[ResponseException[String, Exception], Unit], Nothing] =
|
||||||
basicRequest
|
basicRequest
|
||||||
.method(Method.DELETE, uri"$baseUrl/pet/${petId}")
|
.method(Method.DELETE, uri"$baseUrl/pet/${petId}")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
@ -65,7 +65,7 @@ class PetApi(baseUrl: String) {
|
|||||||
* @param status Status values that need to be considered for filter
|
* @param status Status values that need to be considered for filter
|
||||||
*/
|
*/
|
||||||
def findPetsByStatus(status: Seq[String]
|
def findPetsByStatus(status: Seq[String]
|
||||||
): Request[Either[ResponseError[Exception], Seq[Pet]], Nothing] =
|
): Request[Either[ResponseException[String, Exception], Seq[Pet]], Nothing] =
|
||||||
basicRequest
|
basicRequest
|
||||||
.method(Method.GET, uri"$baseUrl/pet/findByStatus?status=${ status }")
|
.method(Method.GET, uri"$baseUrl/pet/findByStatus?status=${ status }")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
@ -81,7 +81,7 @@ class PetApi(baseUrl: String) {
|
|||||||
* @param tags Tags to filter by
|
* @param tags Tags to filter by
|
||||||
*/
|
*/
|
||||||
def findPetsByTags(tags: Seq[String]
|
def findPetsByTags(tags: Seq[String]
|
||||||
): Request[Either[ResponseError[Exception], Seq[Pet]], Nothing] =
|
): Request[Either[ResponseException[String, Exception], Seq[Pet]], Nothing] =
|
||||||
basicRequest
|
basicRequest
|
||||||
.method(Method.GET, uri"$baseUrl/pet/findByTags?tags=${ tags }")
|
.method(Method.GET, uri"$baseUrl/pet/findByTags?tags=${ tags }")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
@ -101,7 +101,7 @@ class PetApi(baseUrl: String) {
|
|||||||
* @param petId ID of pet to return
|
* @param petId ID of pet to return
|
||||||
*/
|
*/
|
||||||
def getPetById(apiKey: String)(petId: Long
|
def getPetById(apiKey: String)(petId: Long
|
||||||
): Request[Either[ResponseError[Exception], Pet], Nothing] =
|
): Request[Either[ResponseException[String, Exception], Pet], Nothing] =
|
||||||
basicRequest
|
basicRequest
|
||||||
.method(Method.GET, uri"$baseUrl/pet/${petId}")
|
.method(Method.GET, uri"$baseUrl/pet/${petId}")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
@ -118,7 +118,7 @@ class PetApi(baseUrl: String) {
|
|||||||
* @param pet Pet object that needs to be added to the store
|
* @param pet Pet object that needs to be added to the store
|
||||||
*/
|
*/
|
||||||
def updatePet(pet: Pet
|
def updatePet(pet: Pet
|
||||||
): Request[Either[ResponseError[Exception], Pet], Nothing] =
|
): Request[Either[ResponseException[String, Exception], Pet], Nothing] =
|
||||||
basicRequest
|
basicRequest
|
||||||
.method(Method.PUT, uri"$baseUrl/pet")
|
.method(Method.PUT, uri"$baseUrl/pet")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
@ -134,7 +134,7 @@ class PetApi(baseUrl: String) {
|
|||||||
* @param status Updated status of the pet
|
* @param status Updated status of the pet
|
||||||
*/
|
*/
|
||||||
def updatePetWithForm(petId: Long, name: Option[String] = None, status: Option[String] = None
|
def updatePetWithForm(petId: Long, name: Option[String] = None, status: Option[String] = None
|
||||||
): Request[Either[ResponseError[Exception], Unit], Nothing] =
|
): Request[Either[ResponseException[String, Exception], Unit], Nothing] =
|
||||||
basicRequest
|
basicRequest
|
||||||
.method(Method.POST, uri"$baseUrl/pet/${petId}")
|
.method(Method.POST, uri"$baseUrl/pet/${petId}")
|
||||||
.contentType("application/x-www-form-urlencoded")
|
.contentType("application/x-www-form-urlencoded")
|
||||||
@ -153,7 +153,7 @@ class PetApi(baseUrl: String) {
|
|||||||
* @param file file to upload
|
* @param file file to upload
|
||||||
*/
|
*/
|
||||||
def uploadFile(petId: Long, additionalMetadata: Option[String] = None, file: Option[File] = None
|
def uploadFile(petId: Long, additionalMetadata: Option[String] = None, file: Option[File] = None
|
||||||
): Request[Either[ResponseError[Exception], ApiResponse], Nothing] =
|
): Request[Either[ResponseException[String, Exception], ApiResponse], Nothing] =
|
||||||
basicRequest
|
basicRequest
|
||||||
.method(Method.POST, uri"$baseUrl/pet/${petId}/uploadImage")
|
.method(Method.POST, uri"$baseUrl/pet/${petId}/uploadImage")
|
||||||
.contentType("multipart/form-data")
|
.contentType("multipart/form-data")
|
||||||
|
@ -13,7 +13,7 @@ package org.openapitools.client.api
|
|||||||
|
|
||||||
import org.openapitools.client.model.Order
|
import org.openapitools.client.model.Order
|
||||||
import org.openapitools.client.core.JsonSupport._
|
import org.openapitools.client.core.JsonSupport._
|
||||||
import sttp.client._
|
import sttp.client3._
|
||||||
import sttp.model.Method
|
import sttp.model.Method
|
||||||
|
|
||||||
object StoreApi {
|
object StoreApi {
|
||||||
@ -33,7 +33,7 @@ class StoreApi(baseUrl: String) {
|
|||||||
* @param orderId ID of the order that needs to be deleted
|
* @param orderId ID of the order that needs to be deleted
|
||||||
*/
|
*/
|
||||||
def deleteOrder(orderId: String
|
def deleteOrder(orderId: String
|
||||||
): Request[Either[ResponseError[Exception], Unit], Nothing] =
|
): Request[Either[ResponseException[String, Exception], Unit], Nothing] =
|
||||||
basicRequest
|
basicRequest
|
||||||
.method(Method.DELETE, uri"$baseUrl/store/order/${orderId}")
|
.method(Method.DELETE, uri"$baseUrl/store/order/${orderId}")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
@ -49,7 +49,7 @@ class StoreApi(baseUrl: String) {
|
|||||||
* api_key (apiKey)
|
* api_key (apiKey)
|
||||||
*/
|
*/
|
||||||
def getInventory(apiKey: String)(
|
def getInventory(apiKey: String)(
|
||||||
): Request[Either[ResponseError[Exception], Map[String, Int]], Nothing] =
|
): Request[Either[ResponseException[String, Exception], Map[String, Int]], Nothing] =
|
||||||
basicRequest
|
basicRequest
|
||||||
.method(Method.GET, uri"$baseUrl/store/inventory")
|
.method(Method.GET, uri"$baseUrl/store/inventory")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
@ -67,7 +67,7 @@ class StoreApi(baseUrl: String) {
|
|||||||
* @param orderId ID of pet that needs to be fetched
|
* @param orderId ID of pet that needs to be fetched
|
||||||
*/
|
*/
|
||||||
def getOrderById(orderId: Long
|
def getOrderById(orderId: Long
|
||||||
): Request[Either[ResponseError[Exception], Order], Nothing] =
|
): Request[Either[ResponseException[String, Exception], Order], Nothing] =
|
||||||
basicRequest
|
basicRequest
|
||||||
.method(Method.GET, uri"$baseUrl/store/order/${orderId}")
|
.method(Method.GET, uri"$baseUrl/store/order/${orderId}")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
@ -81,7 +81,7 @@ class StoreApi(baseUrl: String) {
|
|||||||
* @param order order placed for purchasing the pet
|
* @param order order placed for purchasing the pet
|
||||||
*/
|
*/
|
||||||
def placeOrder(order: Order
|
def placeOrder(order: Order
|
||||||
): Request[Either[ResponseError[Exception], Order], Nothing] =
|
): Request[Either[ResponseException[String, Exception], Order], Nothing] =
|
||||||
basicRequest
|
basicRequest
|
||||||
.method(Method.POST, uri"$baseUrl/store/order")
|
.method(Method.POST, uri"$baseUrl/store/order")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
|
@ -14,7 +14,7 @@ package org.openapitools.client.api
|
|||||||
import java.time.OffsetDateTime
|
import java.time.OffsetDateTime
|
||||||
import org.openapitools.client.model.User
|
import org.openapitools.client.model.User
|
||||||
import org.openapitools.client.core.JsonSupport._
|
import org.openapitools.client.core.JsonSupport._
|
||||||
import sttp.client._
|
import sttp.client3._
|
||||||
import sttp.model.Method
|
import sttp.model.Method
|
||||||
|
|
||||||
object UserApi {
|
object UserApi {
|
||||||
@ -36,7 +36,7 @@ class UserApi(baseUrl: String) {
|
|||||||
* @param user Created user object
|
* @param user Created user object
|
||||||
*/
|
*/
|
||||||
def createUser(apiKey: String)(user: User
|
def createUser(apiKey: String)(user: User
|
||||||
): Request[Either[ResponseError[Exception], Unit], Nothing] =
|
): Request[Either[ResponseException[String, Exception], Unit], Nothing] =
|
||||||
basicRequest
|
basicRequest
|
||||||
.method(Method.POST, uri"$baseUrl/user")
|
.method(Method.POST, uri"$baseUrl/user")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
@ -54,7 +54,7 @@ class UserApi(baseUrl: String) {
|
|||||||
* @param user List of user object
|
* @param user List of user object
|
||||||
*/
|
*/
|
||||||
def createUsersWithArrayInput(apiKey: String)(user: Seq[User]
|
def createUsersWithArrayInput(apiKey: String)(user: Seq[User]
|
||||||
): Request[Either[ResponseError[Exception], Unit], Nothing] =
|
): Request[Either[ResponseException[String, Exception], Unit], Nothing] =
|
||||||
basicRequest
|
basicRequest
|
||||||
.method(Method.POST, uri"$baseUrl/user/createWithArray")
|
.method(Method.POST, uri"$baseUrl/user/createWithArray")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
@ -72,7 +72,7 @@ class UserApi(baseUrl: String) {
|
|||||||
* @param user List of user object
|
* @param user List of user object
|
||||||
*/
|
*/
|
||||||
def createUsersWithListInput(apiKey: String)(user: Seq[User]
|
def createUsersWithListInput(apiKey: String)(user: Seq[User]
|
||||||
): Request[Either[ResponseError[Exception], Unit], Nothing] =
|
): Request[Either[ResponseException[String, Exception], Unit], Nothing] =
|
||||||
basicRequest
|
basicRequest
|
||||||
.method(Method.POST, uri"$baseUrl/user/createWithList")
|
.method(Method.POST, uri"$baseUrl/user/createWithList")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
@ -93,7 +93,7 @@ class UserApi(baseUrl: String) {
|
|||||||
* @param username The name that needs to be deleted
|
* @param username The name that needs to be deleted
|
||||||
*/
|
*/
|
||||||
def deleteUser(apiKey: String)(username: String
|
def deleteUser(apiKey: String)(username: String
|
||||||
): Request[Either[ResponseError[Exception], Unit], Nothing] =
|
): Request[Either[ResponseException[String, Exception], Unit], Nothing] =
|
||||||
basicRequest
|
basicRequest
|
||||||
.method(Method.DELETE, uri"$baseUrl/user/${username}")
|
.method(Method.DELETE, uri"$baseUrl/user/${username}")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
@ -109,7 +109,7 @@ class UserApi(baseUrl: String) {
|
|||||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||||
*/
|
*/
|
||||||
def getUserByName(username: String
|
def getUserByName(username: String
|
||||||
): Request[Either[ResponseError[Exception], User], Nothing] =
|
): Request[Either[ResponseException[String, Exception], User], Nothing] =
|
||||||
basicRequest
|
basicRequest
|
||||||
.method(Method.GET, uri"$baseUrl/user/${username}")
|
.method(Method.GET, uri"$baseUrl/user/${username}")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
@ -128,7 +128,7 @@ class UserApi(baseUrl: String) {
|
|||||||
* @param password The password for login in clear text
|
* @param password The password for login in clear text
|
||||||
*/
|
*/
|
||||||
def loginUser(username: String, password: String
|
def loginUser(username: String, password: String
|
||||||
): Request[Either[ResponseError[Exception], String], Nothing] =
|
): Request[Either[ResponseException[String, Exception], String], Nothing] =
|
||||||
basicRequest
|
basicRequest
|
||||||
.method(Method.GET, uri"$baseUrl/user/login?username=${ username }&password=${ password }")
|
.method(Method.GET, uri"$baseUrl/user/login?username=${ username }&password=${ password }")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
@ -142,7 +142,7 @@ class UserApi(baseUrl: String) {
|
|||||||
* api_key (apiKey)
|
* api_key (apiKey)
|
||||||
*/
|
*/
|
||||||
def logoutUser(apiKey: String)(
|
def logoutUser(apiKey: String)(
|
||||||
): Request[Either[ResponseError[Exception], Unit], Nothing] =
|
): Request[Either[ResponseException[String, Exception], Unit], Nothing] =
|
||||||
basicRequest
|
basicRequest
|
||||||
.method(Method.GET, uri"$baseUrl/user/logout")
|
.method(Method.GET, uri"$baseUrl/user/logout")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
@ -163,7 +163,7 @@ class UserApi(baseUrl: String) {
|
|||||||
* @param user Updated user object
|
* @param user Updated user object
|
||||||
*/
|
*/
|
||||||
def updateUser(apiKey: String)(username: String, user: User
|
def updateUser(apiKey: String)(username: String, user: User
|
||||||
): Request[Either[ResponseError[Exception], Unit], Nothing] =
|
): Request[Either[ResponseException[String, Exception], Unit], Nothing] =
|
||||||
basicRequest
|
basicRequest
|
||||||
.method(Method.PUT, uri"$baseUrl/user/${username}")
|
.method(Method.PUT, uri"$baseUrl/user/${username}")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
|
@ -13,7 +13,7 @@ package org.openapitools.client.core
|
|||||||
|
|
||||||
import org.openapitools.client.model._
|
import org.openapitools.client.model._
|
||||||
import org.json4s._
|
import org.json4s._
|
||||||
import sttp.client.json4s.SttpJson4sApi
|
import sttp.client3.json4s.SttpJson4sApi
|
||||||
import scala.reflect.ClassTag
|
import scala.reflect.ClassTag
|
||||||
|
|
||||||
object JsonSupport extends SttpJson4sApi {
|
object JsonSupport extends SttpJson4sApi {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user