diff --git a/bin/haskell-http-client-petstore.sh b/bin/haskell-http-client-petstore.sh index ac21b66a745..f128afe3f60 100755 --- a/bin/haskell-http-client-petstore.sh +++ b/bin/haskell-http-client-petstore.sh @@ -28,4 +28,5 @@ fi export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" ags="$@ generate -t modules/swagger-codegen/src/main/resources/haskell-http-client -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l haskell-http-client -o samples/client/petstore/haskell-http-client" +echo "java ${JAVA_OPTS} -jar ${executable} ${ags}" java $JAVA_OPTS -jar $executable $ags diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/HaskellHttpClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/HaskellHttpClientCodegen.java index 5f57e100c50..a7cc41fd230 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/HaskellHttpClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/HaskellHttpClientCodegen.java @@ -42,7 +42,6 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC protected String artifactId = "swagger-haskell-http-client"; protected String artifactVersion = "1.0.0"; - protected String defaultDateTimeFormat = "%Y-%m-%dT%H:%M:%S%Q%z"; protected String defaultDateFormat = "%Y-%m-%d"; // CLI @@ -54,6 +53,7 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC public static final String GENERATE_LENSES = "generateLenses"; public static final String GENERATE_MODEL_CONSTRUCTORS = "generateModelConstructors"; public static final String MODEL_DERIVING = "modelDeriving"; + public static final String STRICT_FIELDS = "strictFields"; // protected String MODEL_IMPORTS = "modelImports"; // protected String MODEL_EXTENSIONS = "modelExtensions"; @@ -182,21 +182,22 @@ public HaskellHttpClientCodegen() { importMapping.clear(); importMapping.put("Map", "qualified Data.Map as Map"); - cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC)); - cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC)); + cliOptions.add(CliOption.newString(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC)); + cliOptions.add(CliOption.newString(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC)); - cliOptions.add(new CliOption(ALLOW_FROMJSON_NULLS, "allow JSON Null during model decoding from JSON").defaultValue(Boolean.TRUE.toString())); - cliOptions.add(new CliOption(ALLOW_TOJSON_NULLS, "allow emitting JSON Null during model encoding to JSON").defaultValue(Boolean.FALSE.toString())); - cliOptions.add(new CliOption(GENERATE_LENSES, "Generate Lens optics for Models").defaultValue(Boolean.TRUE.toString())); - cliOptions.add(new CliOption(GENERATE_MODEL_CONSTRUCTORS, "Generate smart constructors (only supply required fields) for models").defaultValue(Boolean.TRUE.toString())); - cliOptions.add(new CliOption(GENERATE_FORM_URLENCODED_INSTANCES, "Generate FromForm/ToForm instances for models that are used by operations that produce or consume application/x-www-form-urlencoded").defaultValue(Boolean.TRUE.toString())); + cliOptions.add(CliOption.newBoolean(ALLOW_FROMJSON_NULLS, "allow JSON Null during model decoding from JSON").defaultValue(Boolean.TRUE.toString())); + cliOptions.add(CliOption.newBoolean(ALLOW_TOJSON_NULLS, "allow emitting JSON Null during model encoding to JSON").defaultValue(Boolean.FALSE.toString())); + cliOptions.add(CliOption.newBoolean(GENERATE_LENSES, "Generate Lens optics for Models").defaultValue(Boolean.TRUE.toString())); + cliOptions.add(CliOption.newBoolean(GENERATE_MODEL_CONSTRUCTORS, "Generate smart constructors (only supply required fields) for models").defaultValue(Boolean.TRUE.toString())); + cliOptions.add(CliOption.newBoolean(GENERATE_FORM_URLENCODED_INSTANCES, "Generate FromForm/ToForm instances for models that are used by operations that produce or consume application/x-www-form-urlencoded").defaultValue(Boolean.TRUE.toString())); - cliOptions.add(new CliOption(MODEL_DERIVING, "Additional classes to include in the deriving() clause of Models")); + cliOptions.add(CliOption.newString(MODEL_DERIVING, "Additional classes to include in the deriving() clause of Models")); + cliOptions.add(CliOption.newBoolean(STRICT_FIELDS, "Add strictness annotations to all model fields").defaultValue((Boolean.FALSE.toString()))); - cliOptions.add(new CliOption(DATETIME_FORMAT, "format string used to parse/render a datetime").defaultValue(defaultDateTimeFormat)); - cliOptions.add(new CliOption(DATE_FORMAT, "format string used to parse/render a date").defaultValue(defaultDateFormat)); + cliOptions.add(CliOption.newString(DATETIME_FORMAT, "format string used to parse/render a datetime")); + cliOptions.add(CliOption.newString(DATE_FORMAT, "format string used to parse/render a date").defaultValue(defaultDateFormat)); - cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "hides the timestamp when files were generated").defaultValue(Boolean.TRUE.toString())); + cliOptions.add(CliOption.newBoolean(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "hides the timestamp when files were generated").defaultValue(Boolean.TRUE.toString())); // cliOptions.add(new CliOption(MODEL_IMPORTS, "Additional imports in the Models file")); // cliOptions.add(new CliOption(MODEL_EXTENSIONS, "Additional extensions in the Models file")); @@ -241,12 +242,16 @@ public void setDateTimeFormat(String value) { public void setDateFormat(String value) { if (StringUtils.isBlank(value)) { - additionalProperties.put(DATE_FORMAT, defaultDateFormat); + additionalProperties.remove(DATE_FORMAT); } else { additionalProperties.put(DATE_FORMAT, value); } } + public void setStrictFields(Boolean value) { + additionalProperties.put("x-strictFields", value); + } + @Override public void processOpts() { super.processOpts(); @@ -296,13 +301,19 @@ public void processOpts() { if (additionalProperties.containsKey(DATETIME_FORMAT)) { setDateTimeFormat(additionalProperties.get(DATETIME_FORMAT).toString()); } else { - setDateTimeFormat(null); + setDateTimeFormat(null); // default should be null } if (additionalProperties.containsKey(DATE_FORMAT)) { setDateFormat(additionalProperties.get(DATE_FORMAT).toString()); } else { - setDateFormat(null); + setDateFormat(defaultDateFormat); + } + + if (additionalProperties.containsKey(STRICT_FIELDS)) { + setStrictFields(convertPropertyToBoolean(STRICT_FIELDS)); + } else { + setStrictFields(false); } } diff --git a/modules/swagger-codegen/src/main/resources/haskell-http-client/API.mustache b/modules/swagger-codegen/src/main/resources/haskell-http-client/API.mustache index 7b9745acb06..30c23fc0c37 100644 --- a/modules/swagger-codegen/src/main/resources/haskell-http-client/API.mustache +++ b/modules/swagger-codegen/src/main/resources/haskell-http-client/API.mustache @@ -11,13 +11,15 @@ Module : {{title}}.API {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE InstanceSigs #-} -{-# OPTIONS_GHC -fno-warn-unused-binds -fno-warn-unused-imports #-} +{-# LANGUAGE NamedFieldPuns #-} +{-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-unused-binds -fno-warn-unused-imports #-} module {{title}}.API where import {{title}}.Model as M import {{title}}.MimeTypes +import {{title}}.Lens import qualified Data.Aeson as A import Data.Aeson (Value) @@ -52,6 +54,8 @@ import qualified Data.Text.Lazy.Encoding as TL import qualified GHC.Base as P (Alternative) import qualified Control.Arrow as P (left) +import qualified Lens.Micro as L + import Data.Monoid ((<>)) import Data.Function ((&)) import Data.Set (Set) @@ -144,11 +148,26 @@ newtype {{{vendorExtensions.x-paramNameType}}} = {{{vendorExtensions.x-paramName -- | Represents a request. The "req" type variable is the request type. The "res" type variable is the response type. data {{requestType}} req contentType res = {{requestType}} { rMethod :: NH.Method -- ^ Method of {{requestType}} - , urlPath :: [BCL.ByteString] -- ^ Endpoint of {{requestType}} - , params :: Params -- ^ params of {{requestType}} + , rUrlPath :: [BCL.ByteString] -- ^ Endpoint of {{requestType}} + , rParams :: Params -- ^ params of {{requestType}} } deriving (P.Show) +-- | 'rMethod' Lens +rMethodL :: Lens_' ({{requestType}} req contentType res) NH.Method +rMethodL f {{requestType}}{..} = (\rMethod -> {{requestType}} { rMethod, ..} ) <$> f rMethod +{-# INLINE rMethodL #-} + +-- | 'rUrlPath' Lens +rUrlPathL :: Lens_' ({{requestType}} req contentType res) [BCL.ByteString] +rUrlPathL f {{requestType}}{..} = (\rUrlPath -> {{requestType}} { rUrlPath, ..} ) <$> f rUrlPath +{-# INLINE rUrlPathL #-} + +-- | 'rParams' Lens +rParamsL :: Lens_' ({{requestType}} req contentType res) Params +rParamsL f {{requestType}}{..} = (\rParams -> {{requestType}} { rParams, ..} ) <$> f rParams +{-# INLINE rParamsL #-} + -- | Request Params data Params = Params { paramsQuery :: NH.Query @@ -157,6 +176,21 @@ data Params = Params } deriving (P.Show) +-- | 'paramsQuery' Lens +paramsQueryL :: Lens_' Params NH.Query +paramsQueryL f Params{..} = (\paramsQuery -> Params { paramsQuery, ..} ) <$> f paramsQuery +{-# INLINE paramsQueryL #-} + +-- | 'paramsHeaders' Lens +paramsHeadersL :: Lens_' Params NH.RequestHeaders +paramsHeadersL f Params{..} = (\paramsHeaders -> Params { paramsHeaders, ..} ) <$> f paramsHeaders +{-# INLINE paramsHeadersL #-} + +-- | 'paramsBody' Lens +paramsBodyL :: Lens_' Params ParamBody +paramsBodyL f Params{..} = (\paramsBody -> Params { paramsBody, ..} ) <$> f paramsBody +{-# INLINE paramsBodyL #-} + -- | Request Body data ParamBody = ParamBodyNone @@ -177,15 +211,18 @@ _mkParams :: Params _mkParams = Params [] [] ParamBodyNone setHeader :: {{requestType}} req contentType res -> [NH.Header] -> {{requestType}} req contentType res -setHeader req header = - let _params = params (req `removeHeader` P.fmap P.fst header) - in req { params = _params { paramsHeaders = header P.++ paramsHeaders _params } } +setHeader req header = + req `removeHeader` P.fmap P.fst header & + L.over (rParamsL . paramsHeadersL) (header P.++) removeHeader :: {{requestType}} req contentType res -> [NH.HeaderName] -> {{requestType}} req contentType res -removeHeader req header = - let _params = params req - in req { params = _params { paramsHeaders = [h | h <- paramsHeaders _params, cifst h `P.notElem` P.fmap CI.mk header] } } - where cifst = CI.mk . P.fst +removeHeader req header = + req & + L.over + (rParamsL . paramsHeadersL) + (P.filter (\h -> cifst h `P.notElem` P.fmap CI.mk header)) + where + cifst = CI.mk . P.fst _setContentTypeHeader :: forall req contentType res. MimeType contentType => {{requestType}} req contentType res -> {{requestType}} req contentType res @@ -202,35 +239,34 @@ _setAcceptHeader req accept = _setQuery :: {{requestType}} req contentType res -> [NH.QueryItem] -> {{requestType}} req contentType res _setQuery req query = - let _params = params req - in req { params = _params { paramsQuery = query P.++ [q | q <- paramsQuery _params, cifst q `P.notElem` P.fmap cifst query] } } - where cifst = CI.mk . P.fst + req & + L.over + (rParamsL . paramsQueryL) + ((query P.++) . P.filter (\q -> cifst q `P.notElem` P.fmap cifst query)) + where + cifst = CI.mk . P.fst _addForm :: {{requestType}} req contentType res -> WH.Form -> {{requestType}} req contentType res _addForm req newform = - let _params = params req - form = case paramsBody _params of + let form = case paramsBody (rParams req) of ParamBodyFormUrlEncoded _form -> _form _ -> mempty - in req { params = _params { paramsBody = ParamBodyFormUrlEncoded (newform <> form) } } + in req & L.set (rParamsL . paramsBodyL) (ParamBodyFormUrlEncoded (newform <> form)) _addMultiFormPart :: {{requestType}} req contentType res -> NH.Part -> {{requestType}} req contentType res _addMultiFormPart req newpart = - let _params = params req - parts = case paramsBody _params of + let parts = case paramsBody (rParams req) of ParamBodyMultipartFormData _parts -> _parts _ -> [] - in req { params = _params { paramsBody = ParamBodyMultipartFormData (newpart : parts) } } + in req & L.set (rParamsL . paramsBodyL) (ParamBodyMultipartFormData (newpart : parts)) _setBodyBS :: {{requestType}} req contentType res -> B.ByteString -> {{requestType}} req contentType res _setBodyBS req body = - let _params = params req - in req { params = _params { paramsBody = ParamBodyB body } } + req & L.set (rParamsL . paramsBodyL) (ParamBodyB body) _setBodyLBS :: {{requestType}} req contentType res -> BL.ByteString -> {{requestType}} req contentType res _setBodyLBS req body = - let _params = params req - in req { params = _params { paramsBody = ParamBodyBL body } } + req & L.set (rParamsL . paramsBodyL) (ParamBodyBL body) -- ** Params Utils diff --git a/modules/swagger-codegen/src/main/resources/haskell-http-client/Client.mustache b/modules/swagger-codegen/src/main/resources/haskell-http-client/Client.mustache index d044001284e..f23f0ebf1dd 100644 --- a/modules/swagger-codegen/src/main/resources/haskell-http-client/Client.mustache +++ b/modules/swagger-codegen/src/main/resources/haskell-http-client/Client.mustache @@ -225,15 +225,15 @@ _toInitRequest -> accept -- ^ "accept" 'MimeType' -> IO (InitRequest req contentType res accept) -- ^ initialized request _toInitRequest config req0 accept = do - parsedReq <- NH.parseRequest $ BCL.unpack $ BCL.append (configHost config) (BCL.concat (urlPath req0)) + parsedReq <- NH.parseRequest $ BCL.unpack $ BCL.append (configHost config) (BCL.concat (rUrlPath req0)) let req1 = _setAcceptHeader req0 accept & _setContentTypeHeader - reqHeaders = ("User-Agent", WH.toHeader (configUserAgent config)) : paramsHeaders (params req1) - reqQuery = NH.renderQuery True (paramsQuery (params req1)) + reqHeaders = ("User-Agent", WH.toHeader (configUserAgent config)) : paramsHeaders (rParams req1) + reqQuery = NH.renderQuery True (paramsQuery (rParams req1)) pReq = parsedReq { NH.method = (rMethod req1) , NH.requestHeaders = reqHeaders , NH.queryString = reqQuery } - outReq <- case paramsBody (params req1) of + outReq <- case paramsBody (rParams req1) of ParamBodyNone -> pure (pReq { NH.requestBody = mempty }) ParamBodyB bs -> pure (pReq { NH.requestBody = NH.RequestBodyBS bs }) ParamBodyBL bl -> pure (pReq { NH.requestBody = NH.RequestBodyLBS bl }) diff --git a/modules/swagger-codegen/src/main/resources/haskell-http-client/Model.mustache b/modules/swagger-codegen/src/main/resources/haskell-http-client/Model.mustache index 8bac6084805..17b1b55827f 100644 --- a/modules/swagger-codegen/src/main/resources/haskell-http-client/Model.mustache +++ b/modules/swagger-codegen/src/main/resources/haskell-http-client/Model.mustache @@ -2,7 +2,6 @@ Module : {{title}}.Model -} -{-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveGeneric #-} @@ -58,7 +57,7 @@ import qualified Prelude as P -- {{{.}}}{{/description}} {{^vendorExtensions.x-customNewtype}} data {{classname}} = {{classname}} - { {{#vars}}{{name}} :: {{^required}}Maybe {{/required}}{{datatype}} -- ^ {{#required}}/Required/ {{/required}}{{#readOnly}}/ReadOnly/ {{/readOnly}}"{{baseName}}"{{#description}} - {{description}}{{/description}}{{#hasMore}} + { {{#vars}}{{name}} :: {{#x-strictFields}}!({{/x-strictFields}}{{^required}}Maybe {{/required}}{{datatype}}{{#x-strictFields}}){{/x-strictFields}} -- ^ {{#required}}/Required/ {{/required}}{{#readOnly}}/ReadOnly/ {{/readOnly}}"{{baseName}}"{{#description}} - {{description}}{{/description}}{{#hasMore}} , {{/hasMore}}{{/vars}} } deriving (P.Show,P.Eq,P.Typeable{{#modelDeriving}},{{modelDeriving}}{{/modelDeriving}}) diff --git a/modules/swagger-codegen/src/main/resources/haskell-http-client/README.mustache b/modules/swagger-codegen/src/main/resources/haskell-http-client/README.mustache index 4a32daa917c..028941e3ae7 100644 --- a/modules/swagger-codegen/src/main/resources/haskell-http-client/README.mustache +++ b/modules/swagger-codegen/src/main/resources/haskell-http-client/README.mustache @@ -50,17 +50,20 @@ haskell-http-client - use `setHeader` to add any required headers to requests +* Model Inheritance + * Default Parameter Values * Enum Parameters + This is beta software; other cases may not be supported. -### Codegen "config option" parameters +### Codegen "additional properties" parameters These options allow some customization of the code generation process. -**haskell-http-client specific options:** +**haskell-http-client additional properties:** | OPTION | DESCRIPTION | DEFAULT | ACTUAL | | ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------- | @@ -72,15 +75,23 @@ These options allow some customization of the code generation process. | generateLenses | Generate Lens optics for Models | true | {{{generateLenses}}} | | generateModelConstructors | Generate smart constructors (only supply required fields) for models | true | {{{generateModelConstructors}}} | | modelDeriving | Additional classes to include in the deriving() clause of Models | | {{{modelDeriving}}} | +| strictFields | Add strictness annotations to all model fields | false | {{{x-strictFields}}} | [1]: https://www.stackage.org/haddock/lts-9.0/iso8601-time-0.1.4/Data-Time-ISO8601.html#v:formatISO8601Millis +An example setting _strictFields_ and _dateTimeFormat_: + +``` +java -jar swagger-codegen-cli.jar generate -i petstore.yaml -l haskell-http-client -o output/haskell-http-client -DstrictFields=true -DdateTimeFormat="%Y-%m-%dT%H:%M:%S%Q%z" +``` + View the full list of Codegen "config option" parameters with the command: ``` -java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar config-help -l haskell-http-client +java -jar swagger-codegen-cli.jar config-help -l haskell-http-client ``` + ### Example SwaggerPetstore Haddock documentation An example of the generated haddock documentation targeting the server http://petstore.swagger.io/ (SwaggerPetstore) can be found [here][2] diff --git a/modules/swagger-codegen/src/main/resources/haskell-http-client/TopLevel.mustache b/modules/swagger-codegen/src/main/resources/haskell-http-client/TopLevel.mustache index 91e97ff9cd9..3cbf6cd3630 100644 --- a/modules/swagger-codegen/src/main/resources/haskell-http-client/TopLevel.mustache +++ b/modules/swagger-codegen/src/main/resources/haskell-http-client/TopLevel.mustache @@ -7,11 +7,11 @@ module {{title}} , module {{title}}.API , module {{title}}.Model , module {{title}}.MimeTypes - , {{#generateLenses}}module {{title}}.Lens{{/generateLenses}} + , module {{title}}.Lens ) where import {{title}}.API import {{title}}.Client import {{title}}.Model import {{title}}.MimeTypes -{{#generateLenses}}import {{title}}.Lens{{/generateLenses}} +import {{title}}.Lens diff --git a/modules/swagger-codegen/src/main/resources/haskell-http-client/haskell-http-client.cabal.mustache b/modules/swagger-codegen/src/main/resources/haskell-http-client/haskell-http-client.cabal.mustache index 5e5a6223507..0f1f9f28a6a 100644 --- a/modules/swagger-codegen/src/main/resources/haskell-http-client/haskell-http-client.cabal.mustache +++ b/modules/swagger-codegen/src/main/resources/haskell-http-client/haskell-http-client.cabal.mustache @@ -57,13 +57,14 @@ library , monad-logger >=0.3 && <0.4 , safe-exceptions <0.2 , case-insensitive + , microlens >= 0.4.3 && <0.5 exposed-modules: {{title}} {{title}}.API {{title}}.Client {{title}}.Model {{title}}.MimeTypes - {{#generateLenses}}{{title}}.Lens{{/generateLenses}} + {{title}}.Lens other-modules: Paths_{{pathsName}} default-language: Haskell2010 diff --git a/modules/swagger-codegen/src/main/resources/haskell-http-client/package.mustache b/modules/swagger-codegen/src/main/resources/haskell-http-client/package.mustache index c0747d40afd..23b18b7c6ce 100644 --- a/modules/swagger-codegen/src/main/resources/haskell-http-client/package.mustache +++ b/modules/swagger-codegen/src/main/resources/haskell-http-client/package.mustache @@ -36,16 +36,18 @@ dependencies: - transformers >=0.4.0.0 - mtl >=2.2.1 - unordered-containers +ghc-options: -Wall library: source-dirs: lib - ghc-options: -Wall + ghc-options: + {{#x-strictFields}}- -funbox-strict-fields{{/x-strictFields}} exposed-modules: - {{title}} - {{title}}.API - {{title}}.Client - {{title}}.Model - {{title}}.MimeTypes - {{#generateLenses}}- {{title}}.Lens{{/generateLenses}} + - {{title}}.Lens dependencies: - aeson >=1.0 && <2.0 - bytestring >=0.10.0 && <0.11 @@ -65,6 +67,7 @@ library: - monad-logger >=0.3 && <0.4 - safe-exceptions <0.2 - case-insensitive + - microlens >= 0.4.3 && <0.5 tests: tests: main: Test.hs diff --git a/modules/swagger-codegen/src/main/resources/haskell-http-client/tests/Instances.mustache b/modules/swagger-codegen/src/main/resources/haskell-http-client/tests/Instances.mustache index 51de32c1727..5057ecb312a 100644 --- a/modules/swagger-codegen/src/main/resources/haskell-http-client/tests/Instances.mustache +++ b/modules/swagger-codegen/src/main/resources/haskell-http-client/tests/Instances.mustache @@ -1,3 +1,5 @@ +{-# OPTIONS_GHC -fno-warn-unused-imports #-} + module Instances where import Data.Text (Text, pack) diff --git a/modules/swagger-codegen/src/main/resources/haskell-http-client/tests/PropMime.mustache b/modules/swagger-codegen/src/main/resources/haskell-http-client/tests/PropMime.mustache index 763ceed8935..f672a4d3adf 100644 --- a/modules/swagger-codegen/src/main/resources/haskell-http-client/tests/PropMime.mustache +++ b/modules/swagger-codegen/src/main/resources/haskell-http-client/tests/PropMime.mustache @@ -1,6 +1,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ConstraintKinds #-} +{-# OPTIONS_GHC -fno-warn-unused-imports #-} module PropMime where diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/haskellhttpclient/HaskellHttpClientOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/haskellhttpclient/HaskellHttpClientOptionsTest.java index b63a4bf4888..98d583fbd11 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/haskellhttpclient/HaskellHttpClientOptionsTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/haskellhttpclient/HaskellHttpClientOptionsTest.java @@ -47,6 +47,8 @@ protected void setExpectations() { times = 1; clientCodegen.setDateFormat(HaskellHttpClientOptionsProvider.DATE_FORMAT); times = 1; + clientCodegen.setStrictFields(Boolean.valueOf(HaskellHttpClientOptionsProvider.STRICT_FIELDS)); + times = 1; }}; } diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/HaskellHttpClientOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/HaskellHttpClientOptionsProvider.java index 8e589ac13a4..d124c66ff54 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/HaskellHttpClientOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/HaskellHttpClientOptionsProvider.java @@ -19,6 +19,7 @@ public class HaskellHttpClientOptionsProvider implements OptionsProvider { public static final String DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S%Q%z"; public static final String DATE_FORMAT = "%Y-%m-%d"; public static final String MODEL_DERIVING = ""; + public static final String STRICT_FIELDS = "false"; public static final String GENERATE_FORM_URLENCODED_INSTANCES = "true"; public static final String GENERATE_LENSES = "true"; public static final String GENERATE_MODEL_CONSTRUCTORS = "true"; @@ -46,6 +47,7 @@ public Map createOptions() { .put(HaskellHttpClientCodegen.GENERATE_FORM_URLENCODED_INSTANCES, GENERATE_FORM_URLENCODED_INSTANCES) .put(HaskellHttpClientCodegen.GENERATE_LENSES, GENERATE_LENSES) .put(HaskellHttpClientCodegen.GENERATE_MODEL_CONSTRUCTORS, GENERATE_MODEL_CONSTRUCTORS) + .put(HaskellHttpClientCodegen.STRICT_FIELDS, STRICT_FIELDS) .build(); } diff --git a/samples/client/petstore/haskell-http-client/CONTRIBUTING.md b/samples/client/petstore/haskell-http-client/CONTRIBUTING.md new file mode 100644 index 00000000000..91fbe58305b --- /dev/null +++ b/samples/client/petstore/haskell-http-client/CONTRIBUTING.md @@ -0,0 +1,28 @@ +### Rebuild jar + +``` + (cd ../../../..; mvn package); +``` + +### Regenerate Template + +1. Run the shell script `haskell-http-client-petstore.sh` to update the Petstore sample + +```bash + (cd ../../../..; ./bin/haskell-http-client-petstore.sh); +``` + +### Typecheck, Build and run Unit tests + +2. Check that the following commands complete build without any errors + +```bash + (stack clean && stack haddock && stack test); + (cd ./example-app; stack clean && stack build); + (cd ./tests-integration; stack clean && stack build --no-run-tests); +``` + +### Integration Tests + +3. run the integration tests as described in `./tests-integration/README.md` + diff --git a/samples/client/petstore/haskell-http-client/README.md b/samples/client/petstore/haskell-http-client/README.md index 817c834271d..35ac99a323a 100644 --- a/samples/client/petstore/haskell-http-client/README.md +++ b/samples/client/petstore/haskell-http-client/README.md @@ -50,17 +50,20 @@ haskell-http-client - use `setHeader` to add any required headers to requests +* Model Inheritance + * Default Parameter Values * Enum Parameters + This is beta software; other cases may not be supported. -### Codegen "config option" parameters +### Codegen "additional properties" parameters These options allow some customization of the code generation process. -**haskell-http-client specific options:** +**haskell-http-client additional properties:** | OPTION | DESCRIPTION | DEFAULT | ACTUAL | | ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------- | @@ -72,15 +75,23 @@ These options allow some customization of the code generation process. | generateLenses | Generate Lens optics for Models | true | true | | generateModelConstructors | Generate smart constructors (only supply required fields) for models | true | true | | modelDeriving | Additional classes to include in the deriving() clause of Models | | | +| strictFields | Add strictness annotations to all model fields | false | false | [1]: https://www.stackage.org/haddock/lts-9.0/iso8601-time-0.1.4/Data-Time-ISO8601.html#v:formatISO8601Millis +An example setting _strictFields_ and _dateTimeFormat_: + +``` +java -jar swagger-codegen-cli.jar generate -i petstore.yaml -l haskell-http-client -o output/haskell-http-client -DstrictFields=true -DdateTimeFormat="%Y-%m-%dT%H:%M:%S%Q%z" +``` + View the full list of Codegen "config option" parameters with the command: ``` -java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar config-help -l haskell-http-client +java -jar swagger-codegen-cli.jar config-help -l haskell-http-client ``` + ### Example SwaggerPetstore Haddock documentation An example of the generated haddock documentation targeting the server http://petstore.swagger.io/ (SwaggerPetstore) can be found [here][2] diff --git a/samples/client/petstore/haskell-http-client/docs/SwaggerPetstore-API.html b/samples/client/petstore/haskell-http-client/docs/SwaggerPetstore-API.html index 2dab043222b..c19843f7d57 100644 --- a/samples/client/petstore/haskell-http-client/docs/SwaggerPetstore-API.html +++ b/samples/client/petstore/haskell-http-client/docs/SwaggerPetstore-API.html @@ -1,4 +1,4 @@ SwaggerPetstore.API

swagger-petstore-0.1.0.0: Auto-generated swagger-petstore API Client

Safe HaskellNone
LanguageHaskell2010

SwaggerPetstore.API

Description

 

Synopsis

Operations

Pet

addPet

addPet Source #

Arguments

:: (Consumes AddPet contentType, MimeRender contentType Pet) 
=> contentType

request content-type (MimeType)

-> Pet

"body" - Pet object that needs to be added to the store

-> SwaggerPetstoreRequest AddPet contentType res 
POST /pet

Add a new pet to the store

AuthMethod: petstore_auth

Note: Has Produces instances, but no response schema

data AddPet Source #

Instances

Produces AddPet MimeXML Source #
application/xml
Produces AddPet MimeJSON Source #
application/json
Consumes AddPet MimeXML Source #
application/xml
Consumes AddPet MimeJSON Source #
application/json
HasBodyParam AddPet Pet Source #

Body Param "body" - Pet object that needs to be added to the store

Methods

setBodyParam :: (Consumes AddPet contentType, MimeRender contentType Pet) => SwaggerPetstoreRequest AddPet contentType res -> Pet -> SwaggerPetstoreRequest AddPet contentType res Source #

deletePet

deletePet Source #

Arguments

:: Integer

"petId" - Pet id to delete

-> SwaggerPetstoreRequest DeletePet MimeNoContent res 
DELETE /pet/{petId}

Deletes a pet

AuthMethod: petstore_auth

Note: Has Produces instances, but no response schema

findPetsByStatus

findPetsByStatus Source #

Arguments

:: [Text]

"status" - Status values that need to be considered for filter

-> SwaggerPetstoreRequest FindPetsByStatus MimeNoContent [Pet] 
GET /pet/findByStatus

Finds Pets by status

Multiple status values can be provided with comma separated strings

AuthMethod: petstore_auth

findPetsByTags

findPetsByTags Source #

Arguments

:: [Text]

"tags" - Tags to filter by

-> SwaggerPetstoreRequest FindPetsByTags MimeNoContent [Pet] 

Deprecated:

GET /pet/findByTags

Finds Pets by tags

Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.

AuthMethod: petstore_auth

getPetById

getPetById Source #

Arguments

:: Integer

"petId" - ID of pet to return

-> SwaggerPetstoreRequest GetPetById MimeNoContent Pet 
GET /pet/{petId}

Find pet by ID

Returns a single pet

AuthMethod: api_key

data GetPetById Source #

Instances

updatePet

updatePet Source #

Arguments

:: (Consumes UpdatePet contentType, MimeRender contentType Pet) 
=> contentType

request content-type (MimeType)

-> Pet

"body" - Pet object that needs to be added to the store

-> SwaggerPetstoreRequest UpdatePet contentType res 
PUT /pet

Update an existing pet

AuthMethod: petstore_auth

Note: Has Produces instances, but no response schema

data UpdatePet Source #

Instances

Produces UpdatePet MimeXML Source #
application/xml
Produces UpdatePet MimeJSON Source #
application/json
Consumes UpdatePet MimeXML Source #
application/xml
Consumes UpdatePet MimeJSON Source #
application/json
HasBodyParam UpdatePet Pet Source #

Body Param "body" - Pet object that needs to be added to the store

Methods

setBodyParam :: (Consumes UpdatePet contentType, MimeRender contentType Pet) => SwaggerPetstoreRequest UpdatePet contentType res -> Pet -> SwaggerPetstoreRequest UpdatePet contentType res Source #

updatePetWithForm

updatePetWithForm Source #

Arguments

:: Consumes UpdatePetWithForm contentType 
=> contentType

request content-type (MimeType)

-> Integer

"petId" - ID of pet that needs to be updated

-> SwaggerPetstoreRequest UpdatePetWithForm contentType res 
POST /pet/{petId}

Updates a pet in the store with form data

AuthMethod: petstore_auth

Note: Has Produces instances, but no response schema

uploadFile

uploadFile Source #

Arguments

:: Consumes UploadFile contentType 
=> contentType

request content-type (MimeType)

-> Integer

"petId" - ID of pet to update

-> SwaggerPetstoreRequest UploadFile contentType ApiResponse 
POST /pet/{petId}/uploadImage

uploads an image

AuthMethod: petstore_auth

data UploadFile Source #

Instances

Produces UploadFile MimeJSON Source #
application/json
Consumes UploadFile MimeMultipartFormData Source #
multipart/form-data
HasOptionalParam UploadFile File Source #

Optional Param "file" - file to upload

HasOptionalParam UploadFile AdditionalMetadata Source #

Optional Param "additionalMetadata" - Additional data to pass to server

Store

deleteOrder

deleteOrder Source #

Arguments

:: Text

"orderId" - ID of the order that needs to be deleted

-> SwaggerPetstoreRequest DeleteOrder MimeNoContent res 
DELETE /store/order/{orderId}

Delete purchase order by ID

For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors

Note: Has Produces instances, but no response schema

data DeleteOrder Source #

Instances

getInventory

getInventory :: SwaggerPetstoreRequest GetInventory MimeNoContent (Map String Int) Source #

GET /store/inventory

Returns pet inventories by status

Returns a map of status codes to quantities

AuthMethod: api_key

data GetInventory Source #

Instances

getOrderById

getOrderById Source #

Arguments

:: Integer

"orderId" - ID of pet that needs to be fetched

-> SwaggerPetstoreRequest GetOrderById MimeNoContent Order 
GET /store/order/{orderId}

Find purchase order by ID

For valid response try integer IDs with value 5 or 10. Other values will generated exceptions

placeOrder

placeOrder Source #

Arguments

:: (Consumes PlaceOrder contentType, MimeRender contentType Order) 
=> contentType

request content-type (MimeType)

-> Order

"body" - order placed for purchasing the pet

-> SwaggerPetstoreRequest PlaceOrder contentType Order 
POST /store/order

Place an order for a pet

data PlaceOrder Source #

Instances

Produces PlaceOrder MimeXML Source #
application/xml
Produces PlaceOrder MimeJSON Source #
application/json
HasBodyParam PlaceOrder Order Source #

Body Param "body" - order placed for purchasing the pet

Methods

setBodyParam :: (Consumes PlaceOrder contentType, MimeRender contentType Order) => SwaggerPetstoreRequest PlaceOrder contentType res -> Order -> SwaggerPetstoreRequest PlaceOrder contentType res Source #

User

createUser

createUser Source #

Arguments

:: (Consumes CreateUser contentType, MimeRender contentType User) 
=> contentType

request content-type (MimeType)

-> User

"body" - Created user object

-> SwaggerPetstoreRequest CreateUser contentType res 
POST /user

Create user

This can only be done by the logged in user.

Note: Has Produces instances, but no response schema

data CreateUser Source #

Instances

Produces CreateUser MimeXML Source #
application/xml
Produces CreateUser MimeJSON Source #
application/json
HasBodyParam CreateUser User Source #

Body Param "body" - Created user object

Methods

setBodyParam :: (Consumes CreateUser contentType, MimeRender contentType User) => SwaggerPetstoreRequest CreateUser contentType res -> User -> SwaggerPetstoreRequest CreateUser contentType res Source #

createUsersWithArrayInput

createUsersWithArrayInput Source #

Arguments

:: (Consumes CreateUsersWithArrayInput contentType, MimeRender contentType [User]) 
=> contentType

request content-type (MimeType)

-> [User]

"body" - List of user object

-> SwaggerPetstoreRequest CreateUsersWithArrayInput contentType res 
POST /user/createWithArray

Creates list of users with given input array

Note: Has Produces instances, but no response schema

createUsersWithListInput

createUsersWithListInput Source #

Arguments

:: (Consumes CreateUsersWithListInput contentType, MimeRender contentType [User]) 
=> contentType

request content-type (MimeType)

-> [User]

"body" - List of user object

-> SwaggerPetstoreRequest CreateUsersWithListInput contentType res 
POST /user/createWithList

Creates list of users with given input array

Note: Has Produces instances, but no response schema

deleteUser

deleteUser Source #

Arguments

:: Text

"username" - The name that needs to be deleted

-> SwaggerPetstoreRequest DeleteUser MimeNoContent res 
DELETE /user/{username}

Delete user

This can only be done by the logged in user.

Note: Has Produces instances, but no response schema

data DeleteUser Source #

Instances

getUserByName

getUserByName Source #

Arguments

:: Text

"username" - The name that needs to be fetched. Use user1 for testing.

-> SwaggerPetstoreRequest GetUserByName MimeNoContent User 
GET /user/{username}

Get user by user name

loginUser

loginUser Source #

Arguments

:: Text

"username" - The user name for login

-> Text

"password" - The password for login in clear text

-> SwaggerPetstoreRequest LoginUser MimeNoContent Text 
GET /user/login

Logs user into the system

data LoginUser Source #

Instances

logoutUser

logoutUser :: SwaggerPetstoreRequest LogoutUser MimeNoContent res Source #

GET /user/logout

Logs out current logged in user session

Note: Has Produces instances, but no response schema

data LogoutUser Source #

Instances

updateUser

updateUser Source #

Arguments

:: (Consumes UpdateUser contentType, MimeRender contentType User) 
=> contentType

request content-type (MimeType)

-> Text

"username" - name that need to be deleted

-> User

"body" - Updated user object

-> SwaggerPetstoreRequest UpdateUser contentType res 
PUT /user/{username}

Updated user

This can only be done by the logged in user.

Note: Has Produces instances, but no response schema

data UpdateUser Source #

Instances

Produces UpdateUser MimeXML Source #
application/xml
Produces UpdateUser MimeJSON Source #
application/json
HasBodyParam UpdateUser User Source #

Body Param "body" - Updated user object

Methods

setBodyParam :: (Consumes UpdateUser contentType, MimeRender contentType User) => SwaggerPetstoreRequest UpdateUser contentType res -> User -> SwaggerPetstoreRequest UpdateUser contentType res Source #

HasBodyParam

class HasBodyParam req param where Source #

Designates the body parameter of a request

Methods

setBodyParam :: forall contentType res. (Consumes req contentType, MimeRender contentType param) => SwaggerPetstoreRequest req contentType res -> param -> SwaggerPetstoreRequest req contentType res Source #

Instances

HasBodyParam UpdateUser User Source #

Body Param "body" - Updated user object

Methods

setBodyParam :: (Consumes UpdateUser contentType, MimeRender contentType User) => SwaggerPetstoreRequest UpdateUser contentType res -> User -> SwaggerPetstoreRequest UpdateUser contentType res Source #

HasBodyParam CreateUser User Source #

Body Param "body" - Created user object

Methods

setBodyParam :: (Consumes CreateUser contentType, MimeRender contentType User) => SwaggerPetstoreRequest CreateUser contentType res -> User -> SwaggerPetstoreRequest CreateUser contentType res Source #

HasBodyParam PlaceOrder Order Source #

Body Param "body" - order placed for purchasing the pet

Methods

setBodyParam :: (Consumes PlaceOrder contentType, MimeRender contentType Order) => SwaggerPetstoreRequest PlaceOrder contentType res -> Order -> SwaggerPetstoreRequest PlaceOrder contentType res Source #

HasBodyParam UpdatePet Pet Source #

Body Param "body" - Pet object that needs to be added to the store

Methods

setBodyParam :: (Consumes UpdatePet contentType, MimeRender contentType Pet) => SwaggerPetstoreRequest UpdatePet contentType res -> Pet -> SwaggerPetstoreRequest UpdatePet contentType res Source #

HasBodyParam AddPet Pet Source #

Body Param "body" - Pet object that needs to be added to the store

Methods

setBodyParam :: (Consumes AddPet contentType, MimeRender contentType Pet) => SwaggerPetstoreRequest AddPet contentType res -> Pet -> SwaggerPetstoreRequest AddPet contentType res Source #

HasBodyParam CreateUsersWithListInput [User] Source #

Body Param "body" - List of user object

HasBodyParam CreateUsersWithArrayInput [User] Source #

Body Param "body" - List of user object

HasOptionalParam

class HasOptionalParam req param where Source #

Designates the optional parameters of a request

Minimal complete definition

applyOptionalParam | (-&-)

Methods

applyOptionalParam :: SwaggerPetstoreRequest req contentType res -> param -> SwaggerPetstoreRequest req contentType res Source #

Apply an optional parameter to a request

(-&-) :: SwaggerPetstoreRequest req contentType res -> param -> SwaggerPetstoreRequest req contentType res infixl 2 Source #

infix operator / alias for addOptionalParam

Instances

HasOptionalParam UploadFile File Source #

Optional Param "file" - file to upload

HasOptionalParam UploadFile AdditionalMetadata Source #

Optional Param "additionalMetadata" - Additional data to pass to server

HasOptionalParam UpdatePetWithForm Status Source #

Optional Param "status" - Updated status of the pet

HasOptionalParam UpdatePetWithForm Name Source #

Optional Param "name" - Updated name of the pet

HasOptionalParam DeletePet ApiUnderscorekey Source # 

Optional Request Parameter Types

newtype Name Source #

Constructors

Name 

Fields

Instances

newtype Status Source #

Constructors

Status 

Fields

newtype File Source #

Constructors

File 

Fields

Instances

Eq File Source # 

Methods

(==) :: File -> File -> Bool #

(/=) :: File -> File -> Bool #

Show File Source # 

Methods

showsPrec :: Int -> File -> ShowS #

show :: File -> String #

showList :: [File] -> ShowS #

HasOptionalParam UploadFile File Source #

Optional Param "file" - file to upload

SwaggerPetstoreRequest

data SwaggerPetstoreRequest req contentType res Source #

Represents a request. The "req" type variable is the request type. The "res" type variable is the response type.

Constructors

SwaggerPetstoreRequest 

Fields

Instances

Show (SwaggerPetstoreRequest req contentType res) Source # 

Methods

showsPrec :: Int -> SwaggerPetstoreRequest req contentType res -> ShowS #

show :: SwaggerPetstoreRequest req contentType res -> String #

showList :: [SwaggerPetstoreRequest req contentType res] -> ShowS #

data Params Source #

Request Params

Instances

SwaggerPetstoreRequest Utils

_mkRequest Source #

Arguments

:: Method

Method

-> [ByteString]

Endpoint

-> SwaggerPetstoreRequest req contentType res

req: Request Type, res: Response Type

setHeader :: SwaggerPetstoreRequest req contentType res -> [Header] -> SwaggerPetstoreRequest req contentType res Source #

removeHeader :: SwaggerPetstoreRequest req contentType res -> [HeaderName] -> SwaggerPetstoreRequest req contentType res Source #

_setContentTypeHeader :: forall req contentType res. MimeType contentType => SwaggerPetstoreRequest req contentType res -> SwaggerPetstoreRequest req contentType res Source #

_setAcceptHeader :: forall req contentType res accept. MimeType accept => SwaggerPetstoreRequest req contentType res -> accept -> SwaggerPetstoreRequest req contentType res Source #

_setQuery :: SwaggerPetstoreRequest req contentType res -> [QueryItem] -> SwaggerPetstoreRequest req contentType res Source #

_addForm :: SwaggerPetstoreRequest req contentType res -> Form -> SwaggerPetstoreRequest req contentType res Source #

_addMultiFormPart :: SwaggerPetstoreRequest req contentType res -> Part -> SwaggerPetstoreRequest req contentType res Source #

_setBodyBS :: SwaggerPetstoreRequest req contentType res -> ByteString -> SwaggerPetstoreRequest req contentType res Source #

_setBodyLBS :: SwaggerPetstoreRequest req contentType res -> ByteString -> SwaggerPetstoreRequest req contentType res Source #

Params Utils

Swagger CollectionFormat Utils

data CollectionFormat Source #

Determines the format of the array if type array is used.

Constructors

CommaSeparated

CSV format for multiple parameters.

SpaceSeparated

Also called SSV

TabSeparated

Also called TSV

PipeSeparated

`value1|value2|value2`

MultiParamArray

Using multiple GET parameters, e.g. `foo=bar&foo=baz`. This is valid only for parameters in "query" (Query) or "formData" (Form)

_toColl :: Traversable f => CollectionFormat -> (f a -> [(b, ByteString)]) -> f [a] -> [(b, ByteString)] Source #

_toCollA :: (Traversable f, Traversable t, Alternative t) => CollectionFormat -> (f (t a) -> [(b, t ByteString)]) -> f (t [a]) -> [(b, t ByteString)] Source #

_toCollA' :: (Monoid c, Traversable f, Traversable t, Alternative t) => CollectionFormat -> (f (t a) -> [(b, t c)]) -> (Char -> c) -> f (t [a]) -> [(b, t c)] Source #

\ No newline at end of file +

swagger-petstore-0.1.0.0: Auto-generated swagger-petstore API Client

Safe HaskellNone
LanguageHaskell2010

SwaggerPetstore.API

Description

 

Synopsis

Operations

Pet

addPet

addPet Source #

Arguments

:: (Consumes AddPet contentType, MimeRender contentType Pet) 
=> contentType

request content-type (MimeType)

-> Pet

"body" - Pet object that needs to be added to the store

-> SwaggerPetstoreRequest AddPet contentType res 
POST /pet

Add a new pet to the store

AuthMethod: petstore_auth

Note: Has Produces instances, but no response schema

data AddPet Source #

Instances

Produces AddPet MimeXML Source #
application/xml
Produces AddPet MimeJSON Source #
application/json
Consumes AddPet MimeXML Source #
application/xml
Consumes AddPet MimeJSON Source #
application/json
HasBodyParam AddPet Pet Source #

Body Param "body" - Pet object that needs to be added to the store

Methods

setBodyParam :: (Consumes AddPet contentType, MimeRender contentType Pet) => SwaggerPetstoreRequest AddPet contentType res -> Pet -> SwaggerPetstoreRequest AddPet contentType res Source #

deletePet

deletePet Source #

Arguments

:: Integer

"petId" - Pet id to delete

-> SwaggerPetstoreRequest DeletePet MimeNoContent res 
DELETE /pet/{petId}

Deletes a pet

AuthMethod: petstore_auth

Note: Has Produces instances, but no response schema

findPetsByStatus

findPetsByStatus Source #

Arguments

:: [Text]

"status" - Status values that need to be considered for filter

-> SwaggerPetstoreRequest FindPetsByStatus MimeNoContent [Pet] 
GET /pet/findByStatus

Finds Pets by status

Multiple status values can be provided with comma separated strings

AuthMethod: petstore_auth

findPetsByTags

findPetsByTags Source #

Arguments

:: [Text]

"tags" - Tags to filter by

-> SwaggerPetstoreRequest FindPetsByTags MimeNoContent [Pet] 

Deprecated:

GET /pet/findByTags

Finds Pets by tags

Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.

AuthMethod: petstore_auth

getPetById

getPetById Source #

Arguments

:: Integer

"petId" - ID of pet to return

-> SwaggerPetstoreRequest GetPetById MimeNoContent Pet 
GET /pet/{petId}

Find pet by ID

Returns a single pet

AuthMethod: api_key

data GetPetById Source #

Instances

updatePet

updatePet Source #

Arguments

:: (Consumes UpdatePet contentType, MimeRender contentType Pet) 
=> contentType

request content-type (MimeType)

-> Pet

"body" - Pet object that needs to be added to the store

-> SwaggerPetstoreRequest UpdatePet contentType res 
PUT /pet

Update an existing pet

AuthMethod: petstore_auth

Note: Has Produces instances, but no response schema

data UpdatePet Source #

Instances

Produces UpdatePet MimeXML Source #
application/xml
Produces UpdatePet MimeJSON Source #
application/json
Consumes UpdatePet MimeXML Source #
application/xml
Consumes UpdatePet MimeJSON Source #
application/json
HasBodyParam UpdatePet Pet Source #

Body Param "body" - Pet object that needs to be added to the store

Methods

setBodyParam :: (Consumes UpdatePet contentType, MimeRender contentType Pet) => SwaggerPetstoreRequest UpdatePet contentType res -> Pet -> SwaggerPetstoreRequest UpdatePet contentType res Source #

updatePetWithForm

updatePetWithForm Source #

Arguments

:: Consumes UpdatePetWithForm contentType 
=> contentType

request content-type (MimeType)

-> Integer

"petId" - ID of pet that needs to be updated

-> SwaggerPetstoreRequest UpdatePetWithForm contentType res 
POST /pet/{petId}

Updates a pet in the store with form data

AuthMethod: petstore_auth

Note: Has Produces instances, but no response schema

uploadFile

uploadFile Source #

Arguments

:: Consumes UploadFile contentType 
=> contentType

request content-type (MimeType)

-> Integer

"petId" - ID of pet to update

-> SwaggerPetstoreRequest UploadFile contentType ApiResponse 
POST /pet/{petId}/uploadImage

uploads an image

AuthMethod: petstore_auth

data UploadFile Source #

Instances

Produces UploadFile MimeJSON Source #
application/json
Consumes UploadFile MimeMultipartFormData Source #
multipart/form-data
HasOptionalParam UploadFile File Source #

Optional Param "file" - file to upload

HasOptionalParam UploadFile AdditionalMetadata Source #

Optional Param "additionalMetadata" - Additional data to pass to server

Store

deleteOrder

deleteOrder Source #

Arguments

:: Text

"orderId" - ID of the order that needs to be deleted

-> SwaggerPetstoreRequest DeleteOrder MimeNoContent res 
DELETE /store/order/{orderId}

Delete purchase order by ID

For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors

Note: Has Produces instances, but no response schema

data DeleteOrder Source #

Instances

getInventory

getInventory :: SwaggerPetstoreRequest GetInventory MimeNoContent (Map String Int) Source #

GET /store/inventory

Returns pet inventories by status

Returns a map of status codes to quantities

AuthMethod: api_key

data GetInventory Source #

Instances

getOrderById

getOrderById Source #

Arguments

:: Integer

"orderId" - ID of pet that needs to be fetched

-> SwaggerPetstoreRequest GetOrderById MimeNoContent Order 
GET /store/order/{orderId}

Find purchase order by ID

For valid response try integer IDs with value 5 or 10. Other values will generated exceptions

placeOrder

placeOrder Source #

Arguments

:: (Consumes PlaceOrder contentType, MimeRender contentType Order) 
=> contentType

request content-type (MimeType)

-> Order

"body" - order placed for purchasing the pet

-> SwaggerPetstoreRequest PlaceOrder contentType Order 
POST /store/order

Place an order for a pet

data PlaceOrder Source #

Instances

Produces PlaceOrder MimeXML Source #
application/xml
Produces PlaceOrder MimeJSON Source #
application/json
HasBodyParam PlaceOrder Order Source #

Body Param "body" - order placed for purchasing the pet

Methods

setBodyParam :: (Consumes PlaceOrder contentType, MimeRender contentType Order) => SwaggerPetstoreRequest PlaceOrder contentType res -> Order -> SwaggerPetstoreRequest PlaceOrder contentType res Source #

User

createUser

createUser Source #

Arguments

:: (Consumes CreateUser contentType, MimeRender contentType User) 
=> contentType

request content-type (MimeType)

-> User

"body" - Created user object

-> SwaggerPetstoreRequest CreateUser contentType res 
POST /user

Create user

This can only be done by the logged in user.

Note: Has Produces instances, but no response schema

data CreateUser Source #

Instances

Produces CreateUser MimeXML Source #
application/xml
Produces CreateUser MimeJSON Source #
application/json
HasBodyParam CreateUser User Source #

Body Param "body" - Created user object

Methods

setBodyParam :: (Consumes CreateUser contentType, MimeRender contentType User) => SwaggerPetstoreRequest CreateUser contentType res -> User -> SwaggerPetstoreRequest CreateUser contentType res Source #

createUsersWithArrayInput

createUsersWithArrayInput Source #

Arguments

:: (Consumes CreateUsersWithArrayInput contentType, MimeRender contentType [User]) 
=> contentType

request content-type (MimeType)

-> [User]

"body" - List of user object

-> SwaggerPetstoreRequest CreateUsersWithArrayInput contentType res 
POST /user/createWithArray

Creates list of users with given input array

Note: Has Produces instances, but no response schema

createUsersWithListInput

createUsersWithListInput Source #

Arguments

:: (Consumes CreateUsersWithListInput contentType, MimeRender contentType [User]) 
=> contentType

request content-type (MimeType)

-> [User]

"body" - List of user object

-> SwaggerPetstoreRequest CreateUsersWithListInput contentType res 
POST /user/createWithList

Creates list of users with given input array

Note: Has Produces instances, but no response schema

deleteUser

deleteUser Source #

Arguments

:: Text

"username" - The name that needs to be deleted

-> SwaggerPetstoreRequest DeleteUser MimeNoContent res 
DELETE /user/{username}

Delete user

This can only be done by the logged in user.

Note: Has Produces instances, but no response schema

data DeleteUser Source #

Instances

getUserByName

getUserByName Source #

Arguments

:: Text

"username" - The name that needs to be fetched. Use user1 for testing.

-> SwaggerPetstoreRequest GetUserByName MimeNoContent User 
GET /user/{username}

Get user by user name

loginUser

loginUser Source #

Arguments

:: Text

"username" - The user name for login

-> Text

"password" - The password for login in clear text

-> SwaggerPetstoreRequest LoginUser MimeNoContent Text 
GET /user/login

Logs user into the system

data LoginUser Source #

Instances

logoutUser

logoutUser :: SwaggerPetstoreRequest LogoutUser MimeNoContent res Source #

GET /user/logout

Logs out current logged in user session

Note: Has Produces instances, but no response schema

data LogoutUser Source #

Instances

updateUser

updateUser Source #

Arguments

:: (Consumes UpdateUser contentType, MimeRender contentType User) 
=> contentType

request content-type (MimeType)

-> Text

"username" - name that need to be deleted

-> User

"body" - Updated user object

-> SwaggerPetstoreRequest UpdateUser contentType res 
PUT /user/{username}

Updated user

This can only be done by the logged in user.

Note: Has Produces instances, but no response schema

data UpdateUser Source #

Instances

Produces UpdateUser MimeXML Source #
application/xml
Produces UpdateUser MimeJSON Source #
application/json
HasBodyParam UpdateUser User Source #

Body Param "body" - Updated user object

Methods

setBodyParam :: (Consumes UpdateUser contentType, MimeRender contentType User) => SwaggerPetstoreRequest UpdateUser contentType res -> User -> SwaggerPetstoreRequest UpdateUser contentType res Source #

HasBodyParam

class HasBodyParam req param where Source #

Designates the body parameter of a request

Methods

setBodyParam :: forall contentType res. (Consumes req contentType, MimeRender contentType param) => SwaggerPetstoreRequest req contentType res -> param -> SwaggerPetstoreRequest req contentType res Source #

Instances

HasBodyParam UpdateUser User Source #

Body Param "body" - Updated user object

Methods

setBodyParam :: (Consumes UpdateUser contentType, MimeRender contentType User) => SwaggerPetstoreRequest UpdateUser contentType res -> User -> SwaggerPetstoreRequest UpdateUser contentType res Source #

HasBodyParam CreateUser User Source #

Body Param "body" - Created user object

Methods

setBodyParam :: (Consumes CreateUser contentType, MimeRender contentType User) => SwaggerPetstoreRequest CreateUser contentType res -> User -> SwaggerPetstoreRequest CreateUser contentType res Source #

HasBodyParam PlaceOrder Order Source #

Body Param "body" - order placed for purchasing the pet

Methods

setBodyParam :: (Consumes PlaceOrder contentType, MimeRender contentType Order) => SwaggerPetstoreRequest PlaceOrder contentType res -> Order -> SwaggerPetstoreRequest PlaceOrder contentType res Source #

HasBodyParam UpdatePet Pet Source #

Body Param "body" - Pet object that needs to be added to the store

Methods

setBodyParam :: (Consumes UpdatePet contentType, MimeRender contentType Pet) => SwaggerPetstoreRequest UpdatePet contentType res -> Pet -> SwaggerPetstoreRequest UpdatePet contentType res Source #

HasBodyParam AddPet Pet Source #

Body Param "body" - Pet object that needs to be added to the store

Methods

setBodyParam :: (Consumes AddPet contentType, MimeRender contentType Pet) => SwaggerPetstoreRequest AddPet contentType res -> Pet -> SwaggerPetstoreRequest AddPet contentType res Source #

HasBodyParam CreateUsersWithListInput [User] Source #

Body Param "body" - List of user object

HasBodyParam CreateUsersWithArrayInput [User] Source #

Body Param "body" - List of user object

HasOptionalParam

class HasOptionalParam req param where Source #

Designates the optional parameters of a request

Minimal complete definition

applyOptionalParam | (-&-)

Methods

applyOptionalParam :: SwaggerPetstoreRequest req contentType res -> param -> SwaggerPetstoreRequest req contentType res Source #

Apply an optional parameter to a request

(-&-) :: SwaggerPetstoreRequest req contentType res -> param -> SwaggerPetstoreRequest req contentType res infixl 2 Source #

infix operator / alias for addOptionalParam

Instances

HasOptionalParam UploadFile File Source #

Optional Param "file" - file to upload

HasOptionalParam UploadFile AdditionalMetadata Source #

Optional Param "additionalMetadata" - Additional data to pass to server

HasOptionalParam UpdatePetWithForm Status Source #

Optional Param "status" - Updated status of the pet

HasOptionalParam UpdatePetWithForm Name Source #

Optional Param "name" - Updated name of the pet

HasOptionalParam DeletePet ApiUnderscorekey Source # 

Optional Request Parameter Types

newtype Name Source #

Constructors

Name 

Fields

Instances

newtype Status Source #

Constructors

Status 

Fields

newtype File Source #

Constructors

File 

Fields

Instances

Eq File Source # 

Methods

(==) :: File -> File -> Bool #

(/=) :: File -> File -> Bool #

Show File Source # 

Methods

showsPrec :: Int -> File -> ShowS #

show :: File -> String #

showList :: [File] -> ShowS #

HasOptionalParam UploadFile File Source #

Optional Param "file" - file to upload

SwaggerPetstoreRequest

data SwaggerPetstoreRequest req contentType res Source #

Represents a request. The "req" type variable is the request type. The "res" type variable is the response type.

Constructors

SwaggerPetstoreRequest 

Fields

Instances

Show (SwaggerPetstoreRequest req contentType res) Source # 

Methods

showsPrec :: Int -> SwaggerPetstoreRequest req contentType res -> ShowS #

show :: SwaggerPetstoreRequest req contentType res -> String #

showList :: [SwaggerPetstoreRequest req contentType res] -> ShowS #

data Params Source #

Request Params

Instances

SwaggerPetstoreRequest Utils

_mkRequest Source #

Arguments

:: Method

Method

-> [ByteString]

Endpoint

-> SwaggerPetstoreRequest req contentType res

req: Request Type, res: Response Type

setHeader :: SwaggerPetstoreRequest req contentType res -> [Header] -> SwaggerPetstoreRequest req contentType res Source #

removeHeader :: SwaggerPetstoreRequest req contentType res -> [HeaderName] -> SwaggerPetstoreRequest req contentType res Source #

_setContentTypeHeader :: forall req contentType res. MimeType contentType => SwaggerPetstoreRequest req contentType res -> SwaggerPetstoreRequest req contentType res Source #

_setAcceptHeader :: forall req contentType res accept. MimeType accept => SwaggerPetstoreRequest req contentType res -> accept -> SwaggerPetstoreRequest req contentType res Source #

_setQuery :: SwaggerPetstoreRequest req contentType res -> [QueryItem] -> SwaggerPetstoreRequest req contentType res Source #

_addForm :: SwaggerPetstoreRequest req contentType res -> Form -> SwaggerPetstoreRequest req contentType res Source #

_addMultiFormPart :: SwaggerPetstoreRequest req contentType res -> Part -> SwaggerPetstoreRequest req contentType res Source #

_setBodyBS :: SwaggerPetstoreRequest req contentType res -> ByteString -> SwaggerPetstoreRequest req contentType res Source #

_setBodyLBS :: SwaggerPetstoreRequest req contentType res -> ByteString -> SwaggerPetstoreRequest req contentType res Source #

Params Utils

Swagger CollectionFormat Utils

data CollectionFormat Source #

Determines the format of the array if type array is used.

Constructors

CommaSeparated

CSV format for multiple parameters.

SpaceSeparated

Also called SSV

TabSeparated

Also called TSV

PipeSeparated

`value1|value2|value2`

MultiParamArray

Using multiple GET parameters, e.g. `foo=bar&foo=baz`. This is valid only for parameters in "query" (Query) or "formData" (Form)

_toColl :: Traversable f => CollectionFormat -> (f a -> [(b, ByteString)]) -> f [a] -> [(b, ByteString)] Source #

_toCollA :: (Traversable f, Traversable t, Alternative t) => CollectionFormat -> (f (t a) -> [(b, t ByteString)]) -> f (t [a]) -> [(b, t ByteString)] Source #

_toCollA' :: (Monoid c, Traversable f, Traversable t, Alternative t) => CollectionFormat -> (f (t a) -> [(b, t c)]) -> (Char -> c) -> f (t [a]) -> [(b, t c)] Source #

\ No newline at end of file diff --git a/samples/client/petstore/haskell-http-client/docs/SwaggerPetstore-MimeTypes.html b/samples/client/petstore/haskell-http-client/docs/SwaggerPetstore-MimeTypes.html index d34081fce73..58030dc136a 100644 --- a/samples/client/petstore/haskell-http-client/docs/SwaggerPetstore-MimeTypes.html +++ b/samples/client/petstore/haskell-http-client/docs/SwaggerPetstore-MimeTypes.html @@ -1,4 +1,4 @@ SwaggerPetstore.MimeTypes

swagger-petstore-0.1.0.0: Auto-generated swagger-petstore API Client

Safe HaskellNone
LanguageHaskell2010

SwaggerPetstore.MimeTypes

Description

 

Synopsis

Content Negotiation

Mime Types

data MimeJSON Source #

Constructors

MimeJSON 

Instances

MimeType MimeJSON Source #
application/json
Produces UpdateUser MimeJSON Source #
application/json
Produces LogoutUser MimeJSON Source #
application/json
Produces LoginUser MimeJSON Source #
application/json
Produces GetUserByName MimeJSON Source #
application/json
Produces DeleteUser MimeJSON Source #
application/json
Produces CreateUsersWithListInput MimeJSON Source #
application/json
Produces CreateUsersWithArrayInput MimeJSON Source #
application/json
Produces CreateUser MimeJSON Source #
application/json
Produces PlaceOrder MimeJSON Source #
application/json
Produces GetOrderById MimeJSON Source #
application/json
Produces GetInventory MimeJSON Source #
application/json
Produces DeleteOrder MimeJSON Source #
application/json
Produces UploadFile MimeJSON Source #
application/json
Produces UpdatePetWithForm MimeJSON Source #
application/json
Produces UpdatePet MimeJSON Source #
application/json
Produces GetPetById MimeJSON Source #
application/json
Produces FindPetsByTags MimeJSON Source #
application/json
Produces FindPetsByStatus MimeJSON Source #
application/json
Produces DeletePet MimeJSON Source #
application/json
Produces AddPet MimeJSON Source #
application/json
Consumes UpdatePet MimeJSON Source #
application/json
Consumes AddPet MimeJSON Source #
application/json
FromJSON a => MimeUnrender MimeJSON a Source #
A.eitherDecode
ToJSON a => MimeRender MimeJSON a Source #

encode

data MimePlainText Source #

Constructors

MimePlainText 

Instances

MimeType MimePlainText Source #
text/plain;charset=utf-8
MimeUnrender MimePlainText ByteString Source #
P.Right . P.id
MimeUnrender MimePlainText String Source #
P.Right . BCL.unpack
MimeUnrender MimePlainText Text Source #
P.left P.show . TL.decodeUtf8'
MimeRender MimePlainText ByteString Source #
P.id
MimeRender MimePlainText String Source #
BCL.pack
MimeRender MimePlainText Text Source #
BL.fromStrict . T.encodeUtf8

data MimeOctetStream Source #

Constructors

MimeOctetStream 

Instances

MimeType MimeOctetStream Source # 
MimeUnrender MimeOctetStream ByteString Source #
P.Right . P.id
MimeUnrender MimeOctetStream String Source #
P.Right . BCL.unpack
MimeUnrender MimeOctetStream Text Source #
P.left P.show . T.decodeUtf8' . BL.toStrict
MimeRender MimeOctetStream ByteString Source #
P.id
MimeRender MimeOctetStream String Source #
BCL.pack
MimeRender MimeOctetStream Text Source #
BL.fromStrict . T.encodeUtf8

MimeType Class

class Typeable mtype => MimeType mtype where Source #

Minimal complete definition

mimeType | mimeTypes

Instances

MimeType MimeNoContent Source # 
MimeType MimeOctetStream Source # 
MimeType MimeMultipartFormData Source #
multipart/form-data
MimeType MimeFormUrlEncoded Source #
application/x-www-form-urlencoded
MimeType MimePlainText Source #
text/plain;charset=utf-8
MimeType MimeXML Source #
application/xml
MimeType MimeJSON Source #
application/json

MimeType Instances

MimeRender Class

class MimeType mtype => MimeRender mtype x where Source #

Minimal complete definition

mimeRender

Methods

mimeRender :: Proxy mtype -> x -> ByteString Source #

mimeRender' :: mtype -> x -> ByteString Source #

Instances

MimeRender MimeNoContent NoContent Source #
P.Right . P.const NoContent
MimeRender MimeOctetStream ByteString Source #
P.id
MimeRender MimeOctetStream String Source #
BCL.pack
MimeRender MimeOctetStream Text Source #
BL.fromStrict . T.encodeUtf8
MimeRender MimeMultipartFormData ByteString Source #
P.id
MimeRender MimeMultipartFormData String Source #
BCL.pack
MimeRender MimeMultipartFormData Text Source #
BL.fromStrict . T.encodeUtf8
ToForm a => MimeRender MimeFormUrlEncoded a Source #
WH.urlEncodeAsForm
MimeRender MimePlainText ByteString Source #
P.id
MimeRender MimePlainText String Source #
BCL.pack
MimeRender MimePlainText Text Source #
BL.fromStrict . T.encodeUtf8
ToJSON a => MimeRender MimeJSON a Source #

encode

MimeRender Instances

MimeUnrender Class

class MimeType mtype => MimeUnrender mtype o where Source #

Minimal complete definition

mimeUnrender

Instances

MimeUnrender MimeNoContent NoContent Source #
P.Right . P.const NoContent
MimeUnrender MimeOctetStream ByteString Source #
P.Right . P.id
MimeUnrender MimeOctetStream String Source #
P.Right . BCL.unpack
MimeUnrender MimeOctetStream Text Source #
P.left P.show . T.decodeUtf8' . BL.toStrict
FromForm a => MimeUnrender MimeFormUrlEncoded a Source #
P.left T.unpack . WH.urlDecodeAsForm
MimeUnrender MimePlainText ByteString Source #
P.Right . P.id
MimeUnrender MimePlainText String Source #
P.Right . BCL.unpack
MimeUnrender MimePlainText Text Source #
P.left P.show . TL.decodeUtf8'
FromJSON a => MimeUnrender MimeJSON a Source #
A.eitherDecode

MimeUnrender Instances

Request Consumes

class MimeType mtype => Consumes req mtype Source #

Instances

Consumes UploadFile MimeMultipartFormData Source #
multipart/form-data
Consumes UpdatePetWithForm MimeFormUrlEncoded Source #
application/x-www-form-urlencoded
Consumes UpdatePet MimeXML Source #
application/xml
Consumes UpdatePet MimeJSON Source #
application/json
Consumes AddPet MimeXML Source #
application/xml
Consumes AddPet MimeJSON Source #
application/json

Request Produces

class MimeType mtype => Produces req mtype Source #

Instances

Produces UpdateUser MimeXML Source #
application/xml
Produces UpdateUser MimeJSON Source #
application/json
Produces LogoutUser MimeXML Source #
application/xml
Produces LogoutUser MimeJSON Source #
application/json
Produces LoginUser MimeXML Source #
application/xml
Produces LoginUser MimeJSON Source #
application/json
Produces GetUserByName MimeXML Source #
application/xml
Produces GetUserByName MimeJSON Source #
application/json
Produces DeleteUser MimeXML Source #
application/xml
Produces DeleteUser MimeJSON Source #
application/json
Produces CreateUsersWithListInput MimeXML Source #
application/xml
Produces CreateUsersWithListInput MimeJSON Source #
application/json
Produces CreateUsersWithArrayInput MimeXML Source #
application/xml
Produces CreateUsersWithArrayInput MimeJSON Source #
application/json
Produces CreateUser MimeXML Source #
application/xml
Produces CreateUser MimeJSON Source #
application/json
Produces PlaceOrder MimeXML Source #
application/xml
Produces PlaceOrder MimeJSON Source #
application/json
Produces GetOrderById MimeXML Source #
application/xml
Produces GetOrderById MimeJSON Source #
application/json
Produces GetInventory MimeJSON Source #
application/json
Produces DeleteOrder MimeXML Source #
application/xml
Produces DeleteOrder MimeJSON Source #
application/json
Produces UploadFile MimeJSON Source #
application/json
Produces UpdatePetWithForm MimeXML Source #
application/xml
Produces UpdatePetWithForm MimeJSON Source #
application/json
Produces UpdatePet MimeXML Source #
application/xml
Produces UpdatePet MimeJSON Source #
application/json
Produces GetPetById MimeXML Source #
application/xml
Produces GetPetById MimeJSON Source #
application/json
Produces FindPetsByTags MimeXML Source #
application/xml
Produces FindPetsByTags MimeJSON Source #
application/json
Produces FindPetsByStatus MimeXML Source #
application/xml
Produces FindPetsByStatus MimeJSON Source #
application/json
Produces DeletePet MimeXML Source #
application/xml
Produces DeletePet MimeJSON Source #
application/json
Produces AddPet MimeXML Source #
application/xml
Produces AddPet MimeJSON Source #
application/json
\ No newline at end of file +

swagger-petstore-0.1.0.0: Auto-generated swagger-petstore API Client

Safe HaskellNone
LanguageHaskell2010

SwaggerPetstore.MimeTypes

Description

 

Synopsis

Content Negotiation

Mime Types

data MimeJSON Source #

Constructors

MimeJSON 

Instances

MimeType MimeJSON Source #
application/json
Produces UpdateUser MimeJSON Source #
application/json
Produces LogoutUser MimeJSON Source #
application/json
Produces LoginUser MimeJSON Source #
application/json
Produces GetUserByName MimeJSON Source #
application/json
Produces DeleteUser MimeJSON Source #
application/json
Produces CreateUsersWithListInput MimeJSON Source #
application/json
Produces CreateUsersWithArrayInput MimeJSON Source #
application/json
Produces CreateUser MimeJSON Source #
application/json
Produces PlaceOrder MimeJSON Source #
application/json
Produces GetOrderById MimeJSON Source #
application/json
Produces GetInventory MimeJSON Source #
application/json
Produces DeleteOrder MimeJSON Source #
application/json
Produces UploadFile MimeJSON Source #
application/json
Produces UpdatePetWithForm MimeJSON Source #
application/json
Produces UpdatePet MimeJSON Source #
application/json
Produces GetPetById MimeJSON Source #
application/json
Produces FindPetsByTags MimeJSON Source #
application/json
Produces FindPetsByStatus MimeJSON Source #
application/json
Produces DeletePet MimeJSON Source #
application/json
Produces AddPet MimeJSON Source #
application/json
Consumes UpdatePet MimeJSON Source #
application/json
Consumes AddPet MimeJSON Source #
application/json
FromJSON a => MimeUnrender MimeJSON a Source #
A.eitherDecode
ToJSON a => MimeRender MimeJSON a Source #

encode

data MimePlainText Source #

Constructors

MimePlainText 

Instances

MimeType MimePlainText Source #
text/plain;charset=utf-8
MimeUnrender MimePlainText ByteString Source #
P.Right . P.id
MimeUnrender MimePlainText String Source #
P.Right . BCL.unpack
MimeUnrender MimePlainText Text Source #
P.left P.show . TL.decodeUtf8'
MimeRender MimePlainText ByteString Source #
P.id
MimeRender MimePlainText String Source #
BCL.pack
MimeRender MimePlainText Text Source #
BL.fromStrict . T.encodeUtf8

data MimeOctetStream Source #

Constructors

MimeOctetStream 

Instances

MimeType MimeOctetStream Source # 
MimeUnrender MimeOctetStream ByteString Source #
P.Right . P.id
MimeUnrender MimeOctetStream String Source #
P.Right . BCL.unpack
MimeUnrender MimeOctetStream Text Source #
P.left P.show . T.decodeUtf8' . BL.toStrict
MimeRender MimeOctetStream ByteString Source #
P.id
MimeRender MimeOctetStream String Source #
BCL.pack
MimeRender MimeOctetStream Text Source #
BL.fromStrict . T.encodeUtf8

MimeType Class

class Typeable mtype => MimeType mtype where Source #

Minimal complete definition

mimeType | mimeTypes

Instances

MimeType MimeNoContent Source # 
MimeType MimeOctetStream Source # 
MimeType MimeMultipartFormData Source #
multipart/form-data
MimeType MimeFormUrlEncoded Source #
application/x-www-form-urlencoded
MimeType MimePlainText Source #
text/plain;charset=utf-8
MimeType MimeXML Source #
application/xml
MimeType MimeJSON Source #
application/json

MimeType Instances

MimeRender Class

class MimeType mtype => MimeRender mtype x where Source #

Minimal complete definition

mimeRender

Methods

mimeRender :: Proxy mtype -> x -> ByteString Source #

mimeRender' :: mtype -> x -> ByteString Source #

Instances

MimeRender MimeNoContent NoContent Source #
P.Right . P.const NoContent
MimeRender MimeOctetStream ByteString Source #
P.id
MimeRender MimeOctetStream String Source #
BCL.pack
MimeRender MimeOctetStream Text Source #
BL.fromStrict . T.encodeUtf8
MimeRender MimeMultipartFormData ByteString Source #
P.id
MimeRender MimeMultipartFormData String Source #
BCL.pack
MimeRender MimeMultipartFormData Text Source #
BL.fromStrict . T.encodeUtf8
ToForm a => MimeRender MimeFormUrlEncoded a Source #
WH.urlEncodeAsForm
MimeRender MimePlainText ByteString Source #
P.id
MimeRender MimePlainText String Source #
BCL.pack
MimeRender MimePlainText Text Source #
BL.fromStrict . T.encodeUtf8
ToJSON a => MimeRender MimeJSON a Source #

encode

MimeRender Instances

MimeUnrender Class

class MimeType mtype => MimeUnrender mtype o where Source #

Minimal complete definition

mimeUnrender

Instances

MimeUnrender MimeNoContent NoContent Source #
P.Right . P.const NoContent
MimeUnrender MimeOctetStream ByteString Source #
P.Right . P.id
MimeUnrender MimeOctetStream String Source #
P.Right . BCL.unpack
MimeUnrender MimeOctetStream Text Source #
P.left P.show . T.decodeUtf8' . BL.toStrict
FromForm a => MimeUnrender MimeFormUrlEncoded a Source #
P.left T.unpack . WH.urlDecodeAsForm
MimeUnrender MimePlainText ByteString Source #
P.Right . P.id
MimeUnrender MimePlainText String Source #
P.Right . BCL.unpack
MimeUnrender MimePlainText Text Source #
P.left P.show . TL.decodeUtf8'
FromJSON a => MimeUnrender MimeJSON a Source #
A.eitherDecode

MimeUnrender Instances

Request Consumes

class MimeType mtype => Consumes req mtype Source #

Instances

Consumes UploadFile MimeMultipartFormData Source #
multipart/form-data
Consumes UpdatePetWithForm MimeFormUrlEncoded Source #
application/x-www-form-urlencoded
Consumes UpdatePet MimeXML Source #
application/xml
Consumes UpdatePet MimeJSON Source #
application/json
Consumes AddPet MimeXML Source #
application/xml
Consumes AddPet MimeJSON Source #
application/json

Request Produces

class MimeType mtype => Produces req mtype Source #

Instances

Produces UpdateUser MimeXML Source #
application/xml
Produces UpdateUser MimeJSON Source #
application/json
Produces LogoutUser MimeXML Source #
application/xml
Produces LogoutUser MimeJSON Source #
application/json
Produces LoginUser MimeXML Source #
application/xml
Produces LoginUser MimeJSON Source #
application/json
Produces GetUserByName MimeXML Source #
application/xml
Produces GetUserByName MimeJSON Source #
application/json
Produces DeleteUser MimeXML Source #
application/xml
Produces DeleteUser MimeJSON Source #
application/json
Produces CreateUsersWithListInput MimeXML Source #
application/xml
Produces CreateUsersWithListInput MimeJSON Source #
application/json
Produces CreateUsersWithArrayInput MimeXML Source #
application/xml
Produces CreateUsersWithArrayInput MimeJSON Source #
application/json
Produces CreateUser MimeXML Source #
application/xml
Produces CreateUser MimeJSON Source #
application/json
Produces PlaceOrder MimeXML Source #
application/xml
Produces PlaceOrder MimeJSON Source #
application/json
Produces GetOrderById MimeXML Source #
application/xml
Produces GetOrderById MimeJSON Source #
application/json
Produces GetInventory MimeJSON Source #
application/json
Produces DeleteOrder MimeXML Source #
application/xml
Produces DeleteOrder MimeJSON Source #
application/json
Produces UploadFile MimeJSON Source #
application/json
Produces UpdatePetWithForm MimeXML Source #
application/xml
Produces UpdatePetWithForm MimeJSON Source #
application/json
Produces UpdatePet MimeXML Source #
application/xml
Produces UpdatePet MimeJSON Source #
application/json
Produces GetPetById MimeXML Source #
application/xml
Produces GetPetById MimeJSON Source #
application/json
Produces FindPetsByTags MimeXML Source #
application/xml
Produces FindPetsByTags MimeJSON Source #
application/json
Produces FindPetsByStatus MimeXML Source #
application/xml
Produces FindPetsByStatus MimeJSON Source #
application/json
Produces DeletePet MimeXML Source #
application/xml
Produces DeletePet MimeJSON Source #
application/json
Produces AddPet MimeXML Source #
application/xml
Produces AddPet MimeJSON Source #
application/json
\ No newline at end of file diff --git a/samples/client/petstore/haskell-http-client/docs/SwaggerPetstore-Model.html b/samples/client/petstore/haskell-http-client/docs/SwaggerPetstore-Model.html index dc94e0e3b1d..e54d8c2a3d3 100644 --- a/samples/client/petstore/haskell-http-client/docs/SwaggerPetstore-Model.html +++ b/samples/client/petstore/haskell-http-client/docs/SwaggerPetstore-Model.html @@ -1,4 +1,4 @@ SwaggerPetstore.Model

swagger-petstore-0.1.0.0: Auto-generated swagger-petstore API Client

Safe HaskellNone
LanguageHaskell2010

SwaggerPetstore.Model

Description

 

Models

ApiResponse

mkApiResponse :: ApiResponse Source #

Construct a value of type ApiResponse (by applying it's required fields, if any)

Category

mkCategory :: Category Source #

Construct a value of type Category (by applying it's required fields, if any)

Order

data Order Source #

Pet Order

An order for a pets from the pet store

Constructors

Order 

Fields

Instances

Eq Order Source # 

Methods

(==) :: Order -> Order -> Bool #

(/=) :: Order -> Order -> Bool #

Show Order Source # 

Methods

showsPrec :: Int -> Order -> ShowS #

show :: Order -> String #

showList :: [Order] -> ShowS #

ToJSON Order Source # 
FromJSON Order Source # 
HasBodyParam PlaceOrder Order Source #

Body Param "body" - order placed for purchasing the pet

Methods

setBodyParam :: (Consumes PlaceOrder contentType, MimeRender contentType Order) => SwaggerPetstoreRequest PlaceOrder contentType res -> Order -> SwaggerPetstoreRequest PlaceOrder contentType res Source #

mkOrder :: Order Source #

Construct a value of type Order (by applying it's required fields, if any)

Pet

data Pet Source #

a Pet

A pet for sale in the pet store

Constructors

Pet 

Fields

Instances

Eq Pet Source # 

Methods

(==) :: Pet -> Pet -> Bool #

(/=) :: Pet -> Pet -> Bool #

Show Pet Source # 

Methods

showsPrec :: Int -> Pet -> ShowS #

show :: Pet -> String #

showList :: [Pet] -> ShowS #

ToJSON Pet Source # 
FromJSON Pet Source # 
HasBodyParam UpdatePet Pet Source #

Body Param "body" - Pet object that needs to be added to the store

Methods

setBodyParam :: (Consumes UpdatePet contentType, MimeRender contentType Pet) => SwaggerPetstoreRequest UpdatePet contentType res -> Pet -> SwaggerPetstoreRequest UpdatePet contentType res Source #

HasBodyParam AddPet Pet Source #

Body Param "body" - Pet object that needs to be added to the store

Methods

setBodyParam :: (Consumes AddPet contentType, MimeRender contentType Pet) => SwaggerPetstoreRequest AddPet contentType res -> Pet -> SwaggerPetstoreRequest AddPet contentType res Source #

mkPet Source #

Arguments

:: Text

petName

-> [Text]

petPhotoUrls

-> Pet 

Construct a value of type Pet (by applying it's required fields, if any)

Tag

data Tag Source #

Pet Tag

A tag for a pet

Constructors

Tag 

Fields

mkTag :: Tag Source #

Construct a value of type Tag (by applying it's required fields, if any)

User

data User Source #

a User

A User who is purchasing from the pet store

Constructors

User 

Fields

Instances

Eq User Source # 

Methods

(==) :: User -> User -> Bool #

(/=) :: User -> User -> Bool #

Show User Source # 

Methods

showsPrec :: Int -> User -> ShowS #

show :: User -> String #

showList :: [User] -> ShowS #

ToJSON User Source # 
FromJSON User Source # 
HasBodyParam UpdateUser User Source #

Body Param "body" - Updated user object

Methods

setBodyParam :: (Consumes UpdateUser contentType, MimeRender contentType User) => SwaggerPetstoreRequest UpdateUser contentType res -> User -> SwaggerPetstoreRequest UpdateUser contentType res Source #

HasBodyParam CreateUser User Source #

Body Param "body" - Created user object

Methods

setBodyParam :: (Consumes CreateUser contentType, MimeRender contentType User) => SwaggerPetstoreRequest CreateUser contentType res -> User -> SwaggerPetstoreRequest CreateUser contentType res Source #

HasBodyParam CreateUsersWithListInput [User] Source #

Body Param "body" - List of user object

HasBodyParam CreateUsersWithArrayInput [User] Source #

Body Param "body" - List of user object

mkUser :: User Source #

Construct a value of type User (by applying it's required fields, if any)

Utils

_omitNulls :: [(Text, Value)] -> Value Source #

Removes Null fields. (OpenAPI-Specification 2.0 does not allow Null in JSON)

_toFormItem :: (ToHttpApiData a, Functor f) => t -> f a -> f (t, [Text]) Source #

DateTime Formatting

_readDateTime :: (ParseTime t, Monad m, Alternative m) => String -> m t Source #

_parseISO8601

_showDateTime :: (t ~ UTCTime, FormatTime t) => t -> String Source #

TI.formatISO8601Millis

Date Formatting

_readDate :: (ParseTime t, Monad m) => String -> m t Source #

TI.parseTimeM True TI.defaultTimeLocale "%Y-%m-%d"

_showDate :: FormatTime t => t -> String Source #

TI.formatTime TI.defaultTimeLocale "%Y-%m-%d"
\ No newline at end of file +

swagger-petstore-0.1.0.0: Auto-generated swagger-petstore API Client

Safe HaskellNone
LanguageHaskell2010

SwaggerPetstore.Model

Description

 

Models

ApiResponse

mkApiResponse :: ApiResponse Source #

Construct a value of type ApiResponse (by applying it's required fields, if any)

Category

mkCategory :: Category Source #

Construct a value of type Category (by applying it's required fields, if any)

Order

data Order Source #

Pet Order

An order for a pets from the pet store

Constructors

Order 

Fields

Instances

Eq Order Source # 

Methods

(==) :: Order -> Order -> Bool #

(/=) :: Order -> Order -> Bool #

Show Order Source # 

Methods

showsPrec :: Int -> Order -> ShowS #

show :: Order -> String #

showList :: [Order] -> ShowS #

ToJSON Order Source # 
FromJSON Order Source # 
HasBodyParam PlaceOrder Order Source #

Body Param "body" - order placed for purchasing the pet

Methods

setBodyParam :: (Consumes PlaceOrder contentType, MimeRender contentType Order) => SwaggerPetstoreRequest PlaceOrder contentType res -> Order -> SwaggerPetstoreRequest PlaceOrder contentType res Source #

mkOrder :: Order Source #

Construct a value of type Order (by applying it's required fields, if any)

Pet

data Pet Source #

a Pet

A pet for sale in the pet store

Constructors

Pet 

Fields

Instances

Eq Pet Source # 

Methods

(==) :: Pet -> Pet -> Bool #

(/=) :: Pet -> Pet -> Bool #

Show Pet Source # 

Methods

showsPrec :: Int -> Pet -> ShowS #

show :: Pet -> String #

showList :: [Pet] -> ShowS #

ToJSON Pet Source # 
FromJSON Pet Source # 
HasBodyParam UpdatePet Pet Source #

Body Param "body" - Pet object that needs to be added to the store

Methods

setBodyParam :: (Consumes UpdatePet contentType, MimeRender contentType Pet) => SwaggerPetstoreRequest UpdatePet contentType res -> Pet -> SwaggerPetstoreRequest UpdatePet contentType res Source #

HasBodyParam AddPet Pet Source #

Body Param "body" - Pet object that needs to be added to the store

Methods

setBodyParam :: (Consumes AddPet contentType, MimeRender contentType Pet) => SwaggerPetstoreRequest AddPet contentType res -> Pet -> SwaggerPetstoreRequest AddPet contentType res Source #

mkPet Source #

Arguments

:: Text

petName

-> [Text]

petPhotoUrls

-> Pet 

Construct a value of type Pet (by applying it's required fields, if any)

Tag

data Tag Source #

Pet Tag

A tag for a pet

Constructors

Tag 

Fields

mkTag :: Tag Source #

Construct a value of type Tag (by applying it's required fields, if any)

User

data User Source #

a User

A User who is purchasing from the pet store

Constructors

User 

Fields

Instances

Eq User Source # 

Methods

(==) :: User -> User -> Bool #

(/=) :: User -> User -> Bool #

Show User Source # 

Methods

showsPrec :: Int -> User -> ShowS #

show :: User -> String #

showList :: [User] -> ShowS #

ToJSON User Source # 
FromJSON User Source # 
HasBodyParam UpdateUser User Source #

Body Param "body" - Updated user object

Methods

setBodyParam :: (Consumes UpdateUser contentType, MimeRender contentType User) => SwaggerPetstoreRequest UpdateUser contentType res -> User -> SwaggerPetstoreRequest UpdateUser contentType res Source #

HasBodyParam CreateUser User Source #

Body Param "body" - Created user object

Methods

setBodyParam :: (Consumes CreateUser contentType, MimeRender contentType User) => SwaggerPetstoreRequest CreateUser contentType res -> User -> SwaggerPetstoreRequest CreateUser contentType res Source #

HasBodyParam CreateUsersWithListInput [User] Source #

Body Param "body" - List of user object

HasBodyParam CreateUsersWithArrayInput [User] Source #

Body Param "body" - List of user object

mkUser :: User Source #

Construct a value of type User (by applying it's required fields, if any)

Utils

_omitNulls :: [(Text, Value)] -> Value Source #

Removes Null fields. (OpenAPI-Specification 2.0 does not allow Null in JSON)

_toFormItem :: (ToHttpApiData a, Functor f) => t -> f a -> f (t, [Text]) Source #

DateTime Formatting

_readDateTime :: (ParseTime t, Monad m, Alternative m) => String -> m t Source #

_parseISO8601

_showDateTime :: (t ~ UTCTime, FormatTime t) => t -> String Source #

TI.formatISO8601Millis

Date Formatting

_readDate :: (ParseTime t, Monad m) => String -> m t Source #

TI.parseTimeM True TI.defaultTimeLocale "%Y-%m-%d"

_showDate :: FormatTime t => t -> String Source #

TI.formatTime TI.defaultTimeLocale "%Y-%m-%d"
\ No newline at end of file diff --git a/samples/client/petstore/haskell-http-client/docs/doc-index-All.html b/samples/client/petstore/haskell-http-client/docs/doc-index-All.html index a0148f93dd7..32f2de0df2e 100644 --- a/samples/client/petstore/haskell-http-client/docs/doc-index-All.html +++ b/samples/client/petstore/haskell-http-client/docs/doc-index-All.html @@ -1,4 +1,4 @@ swagger-petstore-0.1.0.0: Auto-generated swagger-petstore API Client (Index)

swagger-petstore-0.1.0.0: Auto-generated swagger-petstore API Client

Index

-&-SwaggerPetstore.API, SwaggerPetstore
AdditionalMetadata 
1 (Type/Class)SwaggerPetstore.API, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.API, SwaggerPetstore
AddPetSwaggerPetstore.API, SwaggerPetstore
addPetSwaggerPetstore.API, SwaggerPetstore
ApiResponse 
1 (Type/Class)SwaggerPetstore.Model, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.Model, SwaggerPetstore
apiResponseCodeSwaggerPetstore.Model, SwaggerPetstore
apiResponseCodeLSwaggerPetstore.Lens, SwaggerPetstore
apiResponseMessageSwaggerPetstore.Model, SwaggerPetstore
apiResponseMessageLSwaggerPetstore.Lens, SwaggerPetstore
apiResponseTypeSwaggerPetstore.Model, SwaggerPetstore
apiResponseTypeLSwaggerPetstore.Lens, SwaggerPetstore
ApiUnderscorekey 
1 (Type/Class)SwaggerPetstore.API, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.API, SwaggerPetstore
applyOptionalParamSwaggerPetstore.API, SwaggerPetstore
Category 
1 (Type/Class)SwaggerPetstore.Model, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.Model, SwaggerPetstore
categoryIdSwaggerPetstore.Model, SwaggerPetstore
categoryIdLSwaggerPetstore.Lens, SwaggerPetstore
categoryNameSwaggerPetstore.Model, SwaggerPetstore
categoryNameLSwaggerPetstore.Lens, SwaggerPetstore
CollectionFormatSwaggerPetstore.API, SwaggerPetstore
CommaSeparatedSwaggerPetstore.API, SwaggerPetstore
configExecLoggingTSwaggerPetstore.Client, SwaggerPetstore
configHostSwaggerPetstore.Client, SwaggerPetstore
configLoggingFilterSwaggerPetstore.Client, SwaggerPetstore
configUserAgentSwaggerPetstore.Client, SwaggerPetstore
ConsumesSwaggerPetstore.MimeTypes, SwaggerPetstore
CreateUserSwaggerPetstore.API, SwaggerPetstore
createUserSwaggerPetstore.API, SwaggerPetstore
CreateUsersWithArrayInputSwaggerPetstore.API, SwaggerPetstore
createUsersWithArrayInputSwaggerPetstore.API, SwaggerPetstore
CreateUsersWithListInputSwaggerPetstore.API, SwaggerPetstore
createUsersWithListInputSwaggerPetstore.API, SwaggerPetstore
debugLevelFilterSwaggerPetstore.Client, SwaggerPetstore
DeleteOrderSwaggerPetstore.API, SwaggerPetstore
deleteOrderSwaggerPetstore.API, SwaggerPetstore
DeletePetSwaggerPetstore.API, SwaggerPetstore
deletePetSwaggerPetstore.API, SwaggerPetstore
DeleteUserSwaggerPetstore.API, SwaggerPetstore
deleteUserSwaggerPetstore.API, SwaggerPetstore
dispatchInitUnsafeSwaggerPetstore.Client, SwaggerPetstore
dispatchLbsSwaggerPetstore.Client, SwaggerPetstore
dispatchLbsUnsafeSwaggerPetstore.Client, SwaggerPetstore
dispatchMimeSwaggerPetstore.Client, SwaggerPetstore
dispatchMime'SwaggerPetstore.Client, SwaggerPetstore
errorLevelFilterSwaggerPetstore.Client, SwaggerPetstore
ExecLoggingTSwaggerPetstore.Client, SwaggerPetstore
File 
1 (Type/Class)SwaggerPetstore.API, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.API, SwaggerPetstore
FindPetsByStatusSwaggerPetstore.API, SwaggerPetstore
findPetsByStatusSwaggerPetstore.API, SwaggerPetstore
FindPetsByTagsSwaggerPetstore.API, SwaggerPetstore
findPetsByTagsSwaggerPetstore.API, SwaggerPetstore
GetInventorySwaggerPetstore.API, SwaggerPetstore
getInventorySwaggerPetstore.API, SwaggerPetstore
GetOrderByIdSwaggerPetstore.API, SwaggerPetstore
getOrderByIdSwaggerPetstore.API, SwaggerPetstore
GetPetByIdSwaggerPetstore.API, SwaggerPetstore
getPetByIdSwaggerPetstore.API, SwaggerPetstore
GetUserByNameSwaggerPetstore.API, SwaggerPetstore
getUserByNameSwaggerPetstore.API, SwaggerPetstore
HasBodyParamSwaggerPetstore.API, SwaggerPetstore
HasOptionalParamSwaggerPetstore.API, SwaggerPetstore
infoLevelFilterSwaggerPetstore.Client, SwaggerPetstore
InitRequest 
1 (Type/Class)SwaggerPetstore.Client, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.Client, SwaggerPetstore
Lens_SwaggerPetstore.Lens, SwaggerPetstore
Lens_'SwaggerPetstore.Lens, SwaggerPetstore
logExceptionsSwaggerPetstore.Client, SwaggerPetstore
LoginUserSwaggerPetstore.API, SwaggerPetstore
loginUserSwaggerPetstore.API, SwaggerPetstore
logNSTSwaggerPetstore.Client, SwaggerPetstore
LogoutUserSwaggerPetstore.API, SwaggerPetstore
logoutUserSwaggerPetstore.API, SwaggerPetstore
MimeError 
1 (Type/Class)SwaggerPetstore.Client, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.Client, SwaggerPetstore
mimeErrorSwaggerPetstore.Client, SwaggerPetstore
mimeErrorResponseSwaggerPetstore.Client, SwaggerPetstore
MimeFormUrlEncoded 
1 (Type/Class)SwaggerPetstore.MimeTypes, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.MimeTypes, SwaggerPetstore
MimeJSON 
1 (Type/Class)SwaggerPetstore.MimeTypes, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.MimeTypes, SwaggerPetstore
MimeMultipartFormData 
1 (Type/Class)SwaggerPetstore.MimeTypes, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.MimeTypes, SwaggerPetstore
MimeNoContent 
1 (Type/Class)SwaggerPetstore.MimeTypes, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.MimeTypes, SwaggerPetstore
MimeOctetStream 
1 (Type/Class)SwaggerPetstore.MimeTypes, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.MimeTypes, SwaggerPetstore
MimePlainText 
1 (Type/Class)SwaggerPetstore.MimeTypes, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.MimeTypes, SwaggerPetstore
MimeRenderSwaggerPetstore.MimeTypes, SwaggerPetstore
mimeRenderSwaggerPetstore.MimeTypes, SwaggerPetstore
mimeRender'SwaggerPetstore.MimeTypes, SwaggerPetstore
MimeResult 
1 (Type/Class)SwaggerPetstore.Client, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.Client, SwaggerPetstore
mimeResultSwaggerPetstore.Client, SwaggerPetstore
mimeResultResponseSwaggerPetstore.Client, SwaggerPetstore
MimeTypeSwaggerPetstore.MimeTypes, SwaggerPetstore
mimeTypeSwaggerPetstore.MimeTypes, SwaggerPetstore
mimeType'SwaggerPetstore.MimeTypes, SwaggerPetstore
mimeTypesSwaggerPetstore.MimeTypes, SwaggerPetstore
mimeTypes'SwaggerPetstore.MimeTypes, SwaggerPetstore
MimeUnrenderSwaggerPetstore.MimeTypes, SwaggerPetstore
mimeUnrenderSwaggerPetstore.MimeTypes, SwaggerPetstore
mimeUnrender'SwaggerPetstore.MimeTypes, SwaggerPetstore
MimeXML 
1 (Type/Class)SwaggerPetstore.MimeTypes, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.MimeTypes, SwaggerPetstore
minLevelFilterSwaggerPetstore.Client, SwaggerPetstore
mkApiResponseSwaggerPetstore.Model, SwaggerPetstore
mkCategorySwaggerPetstore.Model, SwaggerPetstore
mkOrderSwaggerPetstore.Model, SwaggerPetstore
mkPetSwaggerPetstore.Model, SwaggerPetstore
mkTagSwaggerPetstore.Model, SwaggerPetstore
mkUserSwaggerPetstore.Model, SwaggerPetstore
modifyInitRequestSwaggerPetstore.Client, SwaggerPetstore
modifyInitRequestMSwaggerPetstore.Client, SwaggerPetstore
MultiParamArraySwaggerPetstore.API, SwaggerPetstore
Name 
1 (Type/Class)SwaggerPetstore.API, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.API, SwaggerPetstore
newConfigSwaggerPetstore.Client, SwaggerPetstore
NoContent 
1 (Type/Class)SwaggerPetstore.MimeTypes, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.MimeTypes, SwaggerPetstore
nullLoggerSwaggerPetstore.Client, SwaggerPetstore
Order 
1 (Type/Class)SwaggerPetstore.Model, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.Model, SwaggerPetstore
orderCompleteSwaggerPetstore.Model, SwaggerPetstore
orderCompleteLSwaggerPetstore.Lens, SwaggerPetstore
orderIdSwaggerPetstore.Model, SwaggerPetstore
orderIdLSwaggerPetstore.Lens, SwaggerPetstore
orderPetIdSwaggerPetstore.Model, SwaggerPetstore
orderPetIdLSwaggerPetstore.Lens, SwaggerPetstore
orderQuantitySwaggerPetstore.Model, SwaggerPetstore
orderQuantityLSwaggerPetstore.Lens, SwaggerPetstore
orderShipDateSwaggerPetstore.Model, SwaggerPetstore
orderShipDateLSwaggerPetstore.Lens, SwaggerPetstore
orderStatusSwaggerPetstore.Model, SwaggerPetstore
orderStatusLSwaggerPetstore.Lens, SwaggerPetstore
ParamBodySwaggerPetstore.API, SwaggerPetstore
ParamBodyBSwaggerPetstore.API, SwaggerPetstore
ParamBodyBLSwaggerPetstore.API, SwaggerPetstore
ParamBodyFormUrlEncodedSwaggerPetstore.API, SwaggerPetstore
ParamBodyMultipartFormDataSwaggerPetstore.API, SwaggerPetstore
ParamBodyNoneSwaggerPetstore.API, SwaggerPetstore
Params 
1 (Type/Class)SwaggerPetstore.API, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.API, SwaggerPetstore
paramsSwaggerPetstore.API, SwaggerPetstore
paramsBodySwaggerPetstore.API, SwaggerPetstore
paramsHeadersSwaggerPetstore.API, SwaggerPetstore
paramsQuerySwaggerPetstore.API, SwaggerPetstore
Pet 
1 (Type/Class)SwaggerPetstore.Model, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.Model, SwaggerPetstore
petCategorySwaggerPetstore.Model, SwaggerPetstore
petCategoryLSwaggerPetstore.Lens, SwaggerPetstore
petIdSwaggerPetstore.Model, SwaggerPetstore
petIdLSwaggerPetstore.Lens, SwaggerPetstore
petNameSwaggerPetstore.Model, SwaggerPetstore
petNameLSwaggerPetstore.Lens, SwaggerPetstore
petPhotoUrlsSwaggerPetstore.Model, SwaggerPetstore
petPhotoUrlsLSwaggerPetstore.Lens, SwaggerPetstore
petStatusSwaggerPetstore.Model, SwaggerPetstore
petStatusLSwaggerPetstore.Lens, SwaggerPetstore
petTagsSwaggerPetstore.Model, SwaggerPetstore
petTagsLSwaggerPetstore.Lens, SwaggerPetstore
PipeSeparatedSwaggerPetstore.API, SwaggerPetstore
PlaceOrderSwaggerPetstore.API, SwaggerPetstore
placeOrderSwaggerPetstore.API, SwaggerPetstore
ProducesSwaggerPetstore.MimeTypes, SwaggerPetstore
removeHeaderSwaggerPetstore.API, SwaggerPetstore
rMethodSwaggerPetstore.API, SwaggerPetstore
runExceptionLoggingTSwaggerPetstore.Client, SwaggerPetstore
runLoggingTSwaggerPetstore.Client, SwaggerPetstore
runNullLoggingTSwaggerPetstore.Client, SwaggerPetstore
setBodyParamSwaggerPetstore.API, SwaggerPetstore
setHeaderSwaggerPetstore.API, SwaggerPetstore
SpaceSeparatedSwaggerPetstore.API, SwaggerPetstore
Status 
1 (Type/Class)SwaggerPetstore.API, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.API, SwaggerPetstore
SwaggerPetstoreConfig 
1 (Type/Class)SwaggerPetstore.Client, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.Client, SwaggerPetstore
SwaggerPetstoreRequest 
1 (Type/Class)SwaggerPetstore.API, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.API, SwaggerPetstore
TabSeparatedSwaggerPetstore.API, SwaggerPetstore
Tag 
1 (Type/Class)SwaggerPetstore.Model, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.Model, SwaggerPetstore
tagIdSwaggerPetstore.Model, SwaggerPetstore
tagIdLSwaggerPetstore.Lens, SwaggerPetstore
tagNameSwaggerPetstore.Model, SwaggerPetstore
tagNameLSwaggerPetstore.Lens, SwaggerPetstore
toFormSwaggerPetstore.API, SwaggerPetstore
toFormCollSwaggerPetstore.API, SwaggerPetstore
toHeaderSwaggerPetstore.API, SwaggerPetstore
toHeaderCollSwaggerPetstore.API, SwaggerPetstore
toPathSwaggerPetstore.API, SwaggerPetstore
toQuerySwaggerPetstore.API, SwaggerPetstore
toQueryCollSwaggerPetstore.API, SwaggerPetstore
unAdditionalMetadataSwaggerPetstore.API, SwaggerPetstore
unApiUnderscorekeySwaggerPetstore.API, SwaggerPetstore
unFileSwaggerPetstore.API, SwaggerPetstore
unInitRequestSwaggerPetstore.Client, SwaggerPetstore
unNameSwaggerPetstore.API, SwaggerPetstore
unStatusSwaggerPetstore.API, SwaggerPetstore
UpdatePetSwaggerPetstore.API, SwaggerPetstore
updatePetSwaggerPetstore.API, SwaggerPetstore
UpdatePetWithFormSwaggerPetstore.API, SwaggerPetstore
updatePetWithFormSwaggerPetstore.API, SwaggerPetstore
UpdateUserSwaggerPetstore.API, SwaggerPetstore
updateUserSwaggerPetstore.API, SwaggerPetstore
UploadFileSwaggerPetstore.API, SwaggerPetstore
uploadFileSwaggerPetstore.API, SwaggerPetstore
urlPathSwaggerPetstore.API, SwaggerPetstore
User 
1 (Type/Class)SwaggerPetstore.Model, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.Model, SwaggerPetstore
userEmailSwaggerPetstore.Model, SwaggerPetstore
userEmailLSwaggerPetstore.Lens, SwaggerPetstore
userFirstNameSwaggerPetstore.Model, SwaggerPetstore
userFirstNameLSwaggerPetstore.Lens, SwaggerPetstore
userIdSwaggerPetstore.Model, SwaggerPetstore
userIdLSwaggerPetstore.Lens, SwaggerPetstore
userLastNameSwaggerPetstore.Model, SwaggerPetstore
userLastNameLSwaggerPetstore.Lens, SwaggerPetstore
userPasswordSwaggerPetstore.Model, SwaggerPetstore
userPasswordLSwaggerPetstore.Lens, SwaggerPetstore
userPhoneSwaggerPetstore.Model, SwaggerPetstore
userPhoneLSwaggerPetstore.Lens, SwaggerPetstore
userUsernameSwaggerPetstore.Model, SwaggerPetstore
userUsernameLSwaggerPetstore.Lens, SwaggerPetstore
userUserStatusSwaggerPetstore.Model, SwaggerPetstore
userUserStatusLSwaggerPetstore.Lens, SwaggerPetstore
withNoLoggingSwaggerPetstore.Client, SwaggerPetstore
withStderrLoggingSwaggerPetstore.Client, SwaggerPetstore
withStdoutLoggingSwaggerPetstore.Client, SwaggerPetstore
_addFormSwaggerPetstore.API, SwaggerPetstore
_addMultiFormPartSwaggerPetstore.API, SwaggerPetstore
_emptyToNothingSwaggerPetstore.Model, SwaggerPetstore
_memptyToNothingSwaggerPetstore.Model, SwaggerPetstore
_mkParamsSwaggerPetstore.API, SwaggerPetstore
_mkRequestSwaggerPetstore.API, SwaggerPetstore
_omitNullsSwaggerPetstore.Model, SwaggerPetstore
_parseISO8601SwaggerPetstore.Model, SwaggerPetstore
_readDateSwaggerPetstore.Model, SwaggerPetstore
_readDateTimeSwaggerPetstore.Model, SwaggerPetstore
_setAcceptHeaderSwaggerPetstore.API, SwaggerPetstore
_setBodyBSSwaggerPetstore.API, SwaggerPetstore
_setBodyLBSSwaggerPetstore.API, SwaggerPetstore
_setContentTypeHeaderSwaggerPetstore.API, SwaggerPetstore
_setQuerySwaggerPetstore.API, SwaggerPetstore
_showDateSwaggerPetstore.Model, SwaggerPetstore
_showDateTimeSwaggerPetstore.Model, SwaggerPetstore
_toCollSwaggerPetstore.API, SwaggerPetstore
_toCollASwaggerPetstore.API, SwaggerPetstore
_toCollA'SwaggerPetstore.API, SwaggerPetstore
_toFormItemSwaggerPetstore.Model, SwaggerPetstore
_toInitRequestSwaggerPetstore.Client, SwaggerPetstore
\ No newline at end of file +

swagger-petstore-0.1.0.0: Auto-generated swagger-petstore API Client

Index

-&-SwaggerPetstore.API, SwaggerPetstore
AdditionalMetadata 
1 (Type/Class)SwaggerPetstore.API, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.API, SwaggerPetstore
AddPetSwaggerPetstore.API, SwaggerPetstore
addPetSwaggerPetstore.API, SwaggerPetstore
ApiResponse 
1 (Type/Class)SwaggerPetstore.Model, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.Model, SwaggerPetstore
apiResponseCodeSwaggerPetstore.Model, SwaggerPetstore
apiResponseCodeLSwaggerPetstore.Lens, SwaggerPetstore
apiResponseMessageSwaggerPetstore.Model, SwaggerPetstore
apiResponseMessageLSwaggerPetstore.Lens, SwaggerPetstore
apiResponseTypeSwaggerPetstore.Model, SwaggerPetstore
apiResponseTypeLSwaggerPetstore.Lens, SwaggerPetstore
ApiUnderscorekey 
1 (Type/Class)SwaggerPetstore.API, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.API, SwaggerPetstore
applyOptionalParamSwaggerPetstore.API, SwaggerPetstore
Category 
1 (Type/Class)SwaggerPetstore.Model, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.Model, SwaggerPetstore
categoryIdSwaggerPetstore.Model, SwaggerPetstore
categoryIdLSwaggerPetstore.Lens, SwaggerPetstore
categoryNameSwaggerPetstore.Model, SwaggerPetstore
categoryNameLSwaggerPetstore.Lens, SwaggerPetstore
CollectionFormatSwaggerPetstore.API, SwaggerPetstore
CommaSeparatedSwaggerPetstore.API, SwaggerPetstore
configExecLoggingTSwaggerPetstore.Client, SwaggerPetstore
configHostSwaggerPetstore.Client, SwaggerPetstore
configLoggingFilterSwaggerPetstore.Client, SwaggerPetstore
configUserAgentSwaggerPetstore.Client, SwaggerPetstore
ConsumesSwaggerPetstore.MimeTypes, SwaggerPetstore
CreateUserSwaggerPetstore.API, SwaggerPetstore
createUserSwaggerPetstore.API, SwaggerPetstore
CreateUsersWithArrayInputSwaggerPetstore.API, SwaggerPetstore
createUsersWithArrayInputSwaggerPetstore.API, SwaggerPetstore
CreateUsersWithListInputSwaggerPetstore.API, SwaggerPetstore
createUsersWithListInputSwaggerPetstore.API, SwaggerPetstore
debugLevelFilterSwaggerPetstore.Client, SwaggerPetstore
DeleteOrderSwaggerPetstore.API, SwaggerPetstore
deleteOrderSwaggerPetstore.API, SwaggerPetstore
DeletePetSwaggerPetstore.API, SwaggerPetstore
deletePetSwaggerPetstore.API, SwaggerPetstore
DeleteUserSwaggerPetstore.API, SwaggerPetstore
deleteUserSwaggerPetstore.API, SwaggerPetstore
dispatchInitUnsafeSwaggerPetstore.Client, SwaggerPetstore
dispatchLbsSwaggerPetstore.Client, SwaggerPetstore
dispatchLbsUnsafeSwaggerPetstore.Client, SwaggerPetstore
dispatchMimeSwaggerPetstore.Client, SwaggerPetstore
dispatchMime'SwaggerPetstore.Client, SwaggerPetstore
errorLevelFilterSwaggerPetstore.Client, SwaggerPetstore
ExecLoggingTSwaggerPetstore.Client, SwaggerPetstore
File 
1 (Type/Class)SwaggerPetstore.API, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.API, SwaggerPetstore
FindPetsByStatusSwaggerPetstore.API, SwaggerPetstore
findPetsByStatusSwaggerPetstore.API, SwaggerPetstore
FindPetsByTagsSwaggerPetstore.API, SwaggerPetstore
findPetsByTagsSwaggerPetstore.API, SwaggerPetstore
GetInventorySwaggerPetstore.API, SwaggerPetstore
getInventorySwaggerPetstore.API, SwaggerPetstore
GetOrderByIdSwaggerPetstore.API, SwaggerPetstore
getOrderByIdSwaggerPetstore.API, SwaggerPetstore
GetPetByIdSwaggerPetstore.API, SwaggerPetstore
getPetByIdSwaggerPetstore.API, SwaggerPetstore
GetUserByNameSwaggerPetstore.API, SwaggerPetstore
getUserByNameSwaggerPetstore.API, SwaggerPetstore
HasBodyParamSwaggerPetstore.API, SwaggerPetstore
HasOptionalParamSwaggerPetstore.API, SwaggerPetstore
infoLevelFilterSwaggerPetstore.Client, SwaggerPetstore
InitRequest 
1 (Type/Class)SwaggerPetstore.Client, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.Client, SwaggerPetstore
Lens_SwaggerPetstore.Lens, SwaggerPetstore
Lens_'SwaggerPetstore.Lens, SwaggerPetstore
logExceptionsSwaggerPetstore.Client, SwaggerPetstore
LoginUserSwaggerPetstore.API, SwaggerPetstore
loginUserSwaggerPetstore.API, SwaggerPetstore
logNSTSwaggerPetstore.Client, SwaggerPetstore
LogoutUserSwaggerPetstore.API, SwaggerPetstore
logoutUserSwaggerPetstore.API, SwaggerPetstore
MimeError 
1 (Type/Class)SwaggerPetstore.Client, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.Client, SwaggerPetstore
mimeErrorSwaggerPetstore.Client, SwaggerPetstore
mimeErrorResponseSwaggerPetstore.Client, SwaggerPetstore
MimeFormUrlEncoded 
1 (Type/Class)SwaggerPetstore.MimeTypes, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.MimeTypes, SwaggerPetstore
MimeJSON 
1 (Type/Class)SwaggerPetstore.MimeTypes, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.MimeTypes, SwaggerPetstore
MimeMultipartFormData 
1 (Type/Class)SwaggerPetstore.MimeTypes, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.MimeTypes, SwaggerPetstore
MimeNoContent 
1 (Type/Class)SwaggerPetstore.MimeTypes, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.MimeTypes, SwaggerPetstore
MimeOctetStream 
1 (Type/Class)SwaggerPetstore.MimeTypes, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.MimeTypes, SwaggerPetstore
MimePlainText 
1 (Type/Class)SwaggerPetstore.MimeTypes, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.MimeTypes, SwaggerPetstore
MimeRenderSwaggerPetstore.MimeTypes, SwaggerPetstore
mimeRenderSwaggerPetstore.MimeTypes, SwaggerPetstore
mimeRender'SwaggerPetstore.MimeTypes, SwaggerPetstore
MimeResult 
1 (Type/Class)SwaggerPetstore.Client, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.Client, SwaggerPetstore
mimeResultSwaggerPetstore.Client, SwaggerPetstore
mimeResultResponseSwaggerPetstore.Client, SwaggerPetstore
MimeTypeSwaggerPetstore.MimeTypes, SwaggerPetstore
mimeTypeSwaggerPetstore.MimeTypes, SwaggerPetstore
mimeType'SwaggerPetstore.MimeTypes, SwaggerPetstore
mimeTypesSwaggerPetstore.MimeTypes, SwaggerPetstore
mimeTypes'SwaggerPetstore.MimeTypes, SwaggerPetstore
MimeUnrenderSwaggerPetstore.MimeTypes, SwaggerPetstore
mimeUnrenderSwaggerPetstore.MimeTypes, SwaggerPetstore
mimeUnrender'SwaggerPetstore.MimeTypes, SwaggerPetstore
MimeXML 
1 (Type/Class)SwaggerPetstore.MimeTypes, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.MimeTypes, SwaggerPetstore
minLevelFilterSwaggerPetstore.Client, SwaggerPetstore
mkApiResponseSwaggerPetstore.Model, SwaggerPetstore
mkCategorySwaggerPetstore.Model, SwaggerPetstore
mkOrderSwaggerPetstore.Model, SwaggerPetstore
mkPetSwaggerPetstore.Model, SwaggerPetstore
mkTagSwaggerPetstore.Model, SwaggerPetstore
mkUserSwaggerPetstore.Model, SwaggerPetstore
modifyInitRequestSwaggerPetstore.Client, SwaggerPetstore
modifyInitRequestMSwaggerPetstore.Client, SwaggerPetstore
MultiParamArraySwaggerPetstore.API, SwaggerPetstore
Name 
1 (Type/Class)SwaggerPetstore.API, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.API, SwaggerPetstore
newConfigSwaggerPetstore.Client, SwaggerPetstore
NoContent 
1 (Type/Class)SwaggerPetstore.MimeTypes, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.MimeTypes, SwaggerPetstore
nullLoggerSwaggerPetstore.Client, SwaggerPetstore
Order 
1 (Type/Class)SwaggerPetstore.Model, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.Model, SwaggerPetstore
orderCompleteSwaggerPetstore.Model, SwaggerPetstore
orderCompleteLSwaggerPetstore.Lens, SwaggerPetstore
orderIdSwaggerPetstore.Model, SwaggerPetstore
orderIdLSwaggerPetstore.Lens, SwaggerPetstore
orderPetIdSwaggerPetstore.Model, SwaggerPetstore
orderPetIdLSwaggerPetstore.Lens, SwaggerPetstore
orderQuantitySwaggerPetstore.Model, SwaggerPetstore
orderQuantityLSwaggerPetstore.Lens, SwaggerPetstore
orderShipDateSwaggerPetstore.Model, SwaggerPetstore
orderShipDateLSwaggerPetstore.Lens, SwaggerPetstore
orderStatusSwaggerPetstore.Model, SwaggerPetstore
orderStatusLSwaggerPetstore.Lens, SwaggerPetstore
ParamBodySwaggerPetstore.API, SwaggerPetstore
ParamBodyBSwaggerPetstore.API, SwaggerPetstore
ParamBodyBLSwaggerPetstore.API, SwaggerPetstore
ParamBodyFormUrlEncodedSwaggerPetstore.API, SwaggerPetstore
ParamBodyMultipartFormDataSwaggerPetstore.API, SwaggerPetstore
ParamBodyNoneSwaggerPetstore.API, SwaggerPetstore
Params 
1 (Type/Class)SwaggerPetstore.API, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.API, SwaggerPetstore
paramsBodySwaggerPetstore.API, SwaggerPetstore
paramsBodyLSwaggerPetstore.API, SwaggerPetstore
paramsHeadersSwaggerPetstore.API, SwaggerPetstore
paramsHeadersLSwaggerPetstore.API, SwaggerPetstore
paramsQuerySwaggerPetstore.API, SwaggerPetstore
paramsQueryLSwaggerPetstore.API, SwaggerPetstore
Pet 
1 (Type/Class)SwaggerPetstore.Model, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.Model, SwaggerPetstore
petCategorySwaggerPetstore.Model, SwaggerPetstore
petCategoryLSwaggerPetstore.Lens, SwaggerPetstore
petIdSwaggerPetstore.Model, SwaggerPetstore
petIdLSwaggerPetstore.Lens, SwaggerPetstore
petNameSwaggerPetstore.Model, SwaggerPetstore
petNameLSwaggerPetstore.Lens, SwaggerPetstore
petPhotoUrlsSwaggerPetstore.Model, SwaggerPetstore
petPhotoUrlsLSwaggerPetstore.Lens, SwaggerPetstore
petStatusSwaggerPetstore.Model, SwaggerPetstore
petStatusLSwaggerPetstore.Lens, SwaggerPetstore
petTagsSwaggerPetstore.Model, SwaggerPetstore
petTagsLSwaggerPetstore.Lens, SwaggerPetstore
PipeSeparatedSwaggerPetstore.API, SwaggerPetstore
PlaceOrderSwaggerPetstore.API, SwaggerPetstore
placeOrderSwaggerPetstore.API, SwaggerPetstore
ProducesSwaggerPetstore.MimeTypes, SwaggerPetstore
removeHeaderSwaggerPetstore.API, SwaggerPetstore
rMethodSwaggerPetstore.API, SwaggerPetstore
rMethodLSwaggerPetstore.API, SwaggerPetstore
rParamsSwaggerPetstore.API, SwaggerPetstore
rParamsLSwaggerPetstore.API, SwaggerPetstore
runExceptionLoggingTSwaggerPetstore.Client, SwaggerPetstore
runLoggingTSwaggerPetstore.Client, SwaggerPetstore
runNullLoggingTSwaggerPetstore.Client, SwaggerPetstore
rUrlPathSwaggerPetstore.API, SwaggerPetstore
rUrlPathLSwaggerPetstore.API, SwaggerPetstore
setBodyParamSwaggerPetstore.API, SwaggerPetstore
setHeaderSwaggerPetstore.API, SwaggerPetstore
SpaceSeparatedSwaggerPetstore.API, SwaggerPetstore
Status 
1 (Type/Class)SwaggerPetstore.API, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.API, SwaggerPetstore
SwaggerPetstoreConfig 
1 (Type/Class)SwaggerPetstore.Client, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.Client, SwaggerPetstore
SwaggerPetstoreRequest 
1 (Type/Class)SwaggerPetstore.API, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.API, SwaggerPetstore
TabSeparatedSwaggerPetstore.API, SwaggerPetstore
Tag 
1 (Type/Class)SwaggerPetstore.Model, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.Model, SwaggerPetstore
tagIdSwaggerPetstore.Model, SwaggerPetstore
tagIdLSwaggerPetstore.Lens, SwaggerPetstore
tagNameSwaggerPetstore.Model, SwaggerPetstore
tagNameLSwaggerPetstore.Lens, SwaggerPetstore
toFormSwaggerPetstore.API, SwaggerPetstore
toFormCollSwaggerPetstore.API, SwaggerPetstore
toHeaderSwaggerPetstore.API, SwaggerPetstore
toHeaderCollSwaggerPetstore.API, SwaggerPetstore
toPathSwaggerPetstore.API, SwaggerPetstore
toQuerySwaggerPetstore.API, SwaggerPetstore
toQueryCollSwaggerPetstore.API, SwaggerPetstore
unAdditionalMetadataSwaggerPetstore.API, SwaggerPetstore
unApiUnderscorekeySwaggerPetstore.API, SwaggerPetstore
unFileSwaggerPetstore.API, SwaggerPetstore
unInitRequestSwaggerPetstore.Client, SwaggerPetstore
unNameSwaggerPetstore.API, SwaggerPetstore
unStatusSwaggerPetstore.API, SwaggerPetstore
UpdatePetSwaggerPetstore.API, SwaggerPetstore
updatePetSwaggerPetstore.API, SwaggerPetstore
UpdatePetWithFormSwaggerPetstore.API, SwaggerPetstore
updatePetWithFormSwaggerPetstore.API, SwaggerPetstore
UpdateUserSwaggerPetstore.API, SwaggerPetstore
updateUserSwaggerPetstore.API, SwaggerPetstore
UploadFileSwaggerPetstore.API, SwaggerPetstore
uploadFileSwaggerPetstore.API, SwaggerPetstore
User 
1 (Type/Class)SwaggerPetstore.Model, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.Model, SwaggerPetstore
userEmailSwaggerPetstore.Model, SwaggerPetstore
userEmailLSwaggerPetstore.Lens, SwaggerPetstore
userFirstNameSwaggerPetstore.Model, SwaggerPetstore
userFirstNameLSwaggerPetstore.Lens, SwaggerPetstore
userIdSwaggerPetstore.Model, SwaggerPetstore
userIdLSwaggerPetstore.Lens, SwaggerPetstore
userLastNameSwaggerPetstore.Model, SwaggerPetstore
userLastNameLSwaggerPetstore.Lens, SwaggerPetstore
userPasswordSwaggerPetstore.Model, SwaggerPetstore
userPasswordLSwaggerPetstore.Lens, SwaggerPetstore
userPhoneSwaggerPetstore.Model, SwaggerPetstore
userPhoneLSwaggerPetstore.Lens, SwaggerPetstore
userUsernameSwaggerPetstore.Model, SwaggerPetstore
userUsernameLSwaggerPetstore.Lens, SwaggerPetstore
userUserStatusSwaggerPetstore.Model, SwaggerPetstore
userUserStatusLSwaggerPetstore.Lens, SwaggerPetstore
withNoLoggingSwaggerPetstore.Client, SwaggerPetstore
withStderrLoggingSwaggerPetstore.Client, SwaggerPetstore
withStdoutLoggingSwaggerPetstore.Client, SwaggerPetstore
_addFormSwaggerPetstore.API, SwaggerPetstore
_addMultiFormPartSwaggerPetstore.API, SwaggerPetstore
_emptyToNothingSwaggerPetstore.Model, SwaggerPetstore
_memptyToNothingSwaggerPetstore.Model, SwaggerPetstore
_mkParamsSwaggerPetstore.API, SwaggerPetstore
_mkRequestSwaggerPetstore.API, SwaggerPetstore
_omitNullsSwaggerPetstore.Model, SwaggerPetstore
_parseISO8601SwaggerPetstore.Model, SwaggerPetstore
_readDateSwaggerPetstore.Model, SwaggerPetstore
_readDateTimeSwaggerPetstore.Model, SwaggerPetstore
_setAcceptHeaderSwaggerPetstore.API, SwaggerPetstore
_setBodyBSSwaggerPetstore.API, SwaggerPetstore
_setBodyLBSSwaggerPetstore.API, SwaggerPetstore
_setContentTypeHeaderSwaggerPetstore.API, SwaggerPetstore
_setQuerySwaggerPetstore.API, SwaggerPetstore
_showDateSwaggerPetstore.Model, SwaggerPetstore
_showDateTimeSwaggerPetstore.Model, SwaggerPetstore
_toCollSwaggerPetstore.API, SwaggerPetstore
_toCollASwaggerPetstore.API, SwaggerPetstore
_toCollA'SwaggerPetstore.API, SwaggerPetstore
_toFormItemSwaggerPetstore.Model, SwaggerPetstore
_toInitRequestSwaggerPetstore.Client, SwaggerPetstore
\ No newline at end of file diff --git a/samples/client/petstore/haskell-http-client/docs/doc-index-P.html b/samples/client/petstore/haskell-http-client/docs/doc-index-P.html index 39fc9910d83..49fe76696ca 100644 --- a/samples/client/petstore/haskell-http-client/docs/doc-index-P.html +++ b/samples/client/petstore/haskell-http-client/docs/doc-index-P.html @@ -1,4 +1,4 @@ swagger-petstore-0.1.0.0: Auto-generated swagger-petstore API Client (Index - P)

swagger-petstore-0.1.0.0: Auto-generated swagger-petstore API Client

Index - P

ParamBodySwaggerPetstore.API, SwaggerPetstore
ParamBodyBSwaggerPetstore.API, SwaggerPetstore
ParamBodyBLSwaggerPetstore.API, SwaggerPetstore
ParamBodyFormUrlEncodedSwaggerPetstore.API, SwaggerPetstore
ParamBodyMultipartFormDataSwaggerPetstore.API, SwaggerPetstore
ParamBodyNoneSwaggerPetstore.API, SwaggerPetstore
Params 
1 (Type/Class)SwaggerPetstore.API, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.API, SwaggerPetstore
paramsSwaggerPetstore.API, SwaggerPetstore
paramsBodySwaggerPetstore.API, SwaggerPetstore
paramsHeadersSwaggerPetstore.API, SwaggerPetstore
paramsQuerySwaggerPetstore.API, SwaggerPetstore
Pet 
1 (Type/Class)SwaggerPetstore.Model, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.Model, SwaggerPetstore
petCategorySwaggerPetstore.Model, SwaggerPetstore
petCategoryLSwaggerPetstore.Lens, SwaggerPetstore
petIdSwaggerPetstore.Model, SwaggerPetstore
petIdLSwaggerPetstore.Lens, SwaggerPetstore
petNameSwaggerPetstore.Model, SwaggerPetstore
petNameLSwaggerPetstore.Lens, SwaggerPetstore
petPhotoUrlsSwaggerPetstore.Model, SwaggerPetstore
petPhotoUrlsLSwaggerPetstore.Lens, SwaggerPetstore
petStatusSwaggerPetstore.Model, SwaggerPetstore
petStatusLSwaggerPetstore.Lens, SwaggerPetstore
petTagsSwaggerPetstore.Model, SwaggerPetstore
petTagsLSwaggerPetstore.Lens, SwaggerPetstore
PipeSeparatedSwaggerPetstore.API, SwaggerPetstore
PlaceOrderSwaggerPetstore.API, SwaggerPetstore
placeOrderSwaggerPetstore.API, SwaggerPetstore
ProducesSwaggerPetstore.MimeTypes, SwaggerPetstore
\ No newline at end of file +

swagger-petstore-0.1.0.0: Auto-generated swagger-petstore API Client

Index - P

ParamBodySwaggerPetstore.API, SwaggerPetstore
ParamBodyBSwaggerPetstore.API, SwaggerPetstore
ParamBodyBLSwaggerPetstore.API, SwaggerPetstore
ParamBodyFormUrlEncodedSwaggerPetstore.API, SwaggerPetstore
ParamBodyMultipartFormDataSwaggerPetstore.API, SwaggerPetstore
ParamBodyNoneSwaggerPetstore.API, SwaggerPetstore
Params 
1 (Type/Class)SwaggerPetstore.API, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.API, SwaggerPetstore
paramsBodySwaggerPetstore.API, SwaggerPetstore
paramsBodyLSwaggerPetstore.API, SwaggerPetstore
paramsHeadersSwaggerPetstore.API, SwaggerPetstore
paramsHeadersLSwaggerPetstore.API, SwaggerPetstore
paramsQuerySwaggerPetstore.API, SwaggerPetstore
paramsQueryLSwaggerPetstore.API, SwaggerPetstore
Pet 
1 (Type/Class)SwaggerPetstore.Model, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.Model, SwaggerPetstore
petCategorySwaggerPetstore.Model, SwaggerPetstore
petCategoryLSwaggerPetstore.Lens, SwaggerPetstore
petIdSwaggerPetstore.Model, SwaggerPetstore
petIdLSwaggerPetstore.Lens, SwaggerPetstore
petNameSwaggerPetstore.Model, SwaggerPetstore
petNameLSwaggerPetstore.Lens, SwaggerPetstore
petPhotoUrlsSwaggerPetstore.Model, SwaggerPetstore
petPhotoUrlsLSwaggerPetstore.Lens, SwaggerPetstore
petStatusSwaggerPetstore.Model, SwaggerPetstore
petStatusLSwaggerPetstore.Lens, SwaggerPetstore
petTagsSwaggerPetstore.Model, SwaggerPetstore
petTagsLSwaggerPetstore.Lens, SwaggerPetstore
PipeSeparatedSwaggerPetstore.API, SwaggerPetstore
PlaceOrderSwaggerPetstore.API, SwaggerPetstore
placeOrderSwaggerPetstore.API, SwaggerPetstore
ProducesSwaggerPetstore.MimeTypes, SwaggerPetstore
\ No newline at end of file diff --git a/samples/client/petstore/haskell-http-client/docs/doc-index-R.html b/samples/client/petstore/haskell-http-client/docs/doc-index-R.html index 68b8401467b..37efd6d0758 100644 --- a/samples/client/petstore/haskell-http-client/docs/doc-index-R.html +++ b/samples/client/petstore/haskell-http-client/docs/doc-index-R.html @@ -1,4 +1,4 @@ swagger-petstore-0.1.0.0: Auto-generated swagger-petstore API Client (Index - R)

swagger-petstore-0.1.0.0: Auto-generated swagger-petstore API Client

Index - R

removeHeaderSwaggerPetstore.API, SwaggerPetstore
rMethodSwaggerPetstore.API, SwaggerPetstore
runExceptionLoggingTSwaggerPetstore.Client, SwaggerPetstore
runLoggingTSwaggerPetstore.Client, SwaggerPetstore
runNullLoggingTSwaggerPetstore.Client, SwaggerPetstore
\ No newline at end of file +

swagger-petstore-0.1.0.0: Auto-generated swagger-petstore API Client

Index - R

removeHeaderSwaggerPetstore.API, SwaggerPetstore
rMethodSwaggerPetstore.API, SwaggerPetstore
rMethodLSwaggerPetstore.API, SwaggerPetstore
rParamsSwaggerPetstore.API, SwaggerPetstore
rParamsLSwaggerPetstore.API, SwaggerPetstore
runExceptionLoggingTSwaggerPetstore.Client, SwaggerPetstore
runLoggingTSwaggerPetstore.Client, SwaggerPetstore
runNullLoggingTSwaggerPetstore.Client, SwaggerPetstore
rUrlPathSwaggerPetstore.API, SwaggerPetstore
rUrlPathLSwaggerPetstore.API, SwaggerPetstore
\ No newline at end of file diff --git a/samples/client/petstore/haskell-http-client/docs/doc-index-U.html b/samples/client/petstore/haskell-http-client/docs/doc-index-U.html index 916d307b244..dd47647ad7d 100644 --- a/samples/client/petstore/haskell-http-client/docs/doc-index-U.html +++ b/samples/client/petstore/haskell-http-client/docs/doc-index-U.html @@ -1,4 +1,4 @@ swagger-petstore-0.1.0.0: Auto-generated swagger-petstore API Client (Index - U)

swagger-petstore-0.1.0.0: Auto-generated swagger-petstore API Client

Index - U

unAdditionalMetadataSwaggerPetstore.API, SwaggerPetstore
unApiUnderscorekeySwaggerPetstore.API, SwaggerPetstore
unFileSwaggerPetstore.API, SwaggerPetstore
unInitRequestSwaggerPetstore.Client, SwaggerPetstore
unNameSwaggerPetstore.API, SwaggerPetstore
unStatusSwaggerPetstore.API, SwaggerPetstore
UpdatePetSwaggerPetstore.API, SwaggerPetstore
updatePetSwaggerPetstore.API, SwaggerPetstore
UpdatePetWithFormSwaggerPetstore.API, SwaggerPetstore
updatePetWithFormSwaggerPetstore.API, SwaggerPetstore
UpdateUserSwaggerPetstore.API, SwaggerPetstore
updateUserSwaggerPetstore.API, SwaggerPetstore
UploadFileSwaggerPetstore.API, SwaggerPetstore
uploadFileSwaggerPetstore.API, SwaggerPetstore
urlPathSwaggerPetstore.API, SwaggerPetstore
User 
1 (Type/Class)SwaggerPetstore.Model, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.Model, SwaggerPetstore
userEmailSwaggerPetstore.Model, SwaggerPetstore
userEmailLSwaggerPetstore.Lens, SwaggerPetstore
userFirstNameSwaggerPetstore.Model, SwaggerPetstore
userFirstNameLSwaggerPetstore.Lens, SwaggerPetstore
userIdSwaggerPetstore.Model, SwaggerPetstore
userIdLSwaggerPetstore.Lens, SwaggerPetstore
userLastNameSwaggerPetstore.Model, SwaggerPetstore
userLastNameLSwaggerPetstore.Lens, SwaggerPetstore
userPasswordSwaggerPetstore.Model, SwaggerPetstore
userPasswordLSwaggerPetstore.Lens, SwaggerPetstore
userPhoneSwaggerPetstore.Model, SwaggerPetstore
userPhoneLSwaggerPetstore.Lens, SwaggerPetstore
userUsernameSwaggerPetstore.Model, SwaggerPetstore
userUsernameLSwaggerPetstore.Lens, SwaggerPetstore
userUserStatusSwaggerPetstore.Model, SwaggerPetstore
userUserStatusLSwaggerPetstore.Lens, SwaggerPetstore
\ No newline at end of file +

swagger-petstore-0.1.0.0: Auto-generated swagger-petstore API Client

Index - U

unAdditionalMetadataSwaggerPetstore.API, SwaggerPetstore
unApiUnderscorekeySwaggerPetstore.API, SwaggerPetstore
unFileSwaggerPetstore.API, SwaggerPetstore
unInitRequestSwaggerPetstore.Client, SwaggerPetstore
unNameSwaggerPetstore.API, SwaggerPetstore
unStatusSwaggerPetstore.API, SwaggerPetstore
UpdatePetSwaggerPetstore.API, SwaggerPetstore
updatePetSwaggerPetstore.API, SwaggerPetstore
UpdatePetWithFormSwaggerPetstore.API, SwaggerPetstore
updatePetWithFormSwaggerPetstore.API, SwaggerPetstore
UpdateUserSwaggerPetstore.API, SwaggerPetstore
updateUserSwaggerPetstore.API, SwaggerPetstore
UploadFileSwaggerPetstore.API, SwaggerPetstore
uploadFileSwaggerPetstore.API, SwaggerPetstore
User 
1 (Type/Class)SwaggerPetstore.Model, SwaggerPetstore
2 (Data Constructor)SwaggerPetstore.Model, SwaggerPetstore
userEmailSwaggerPetstore.Model, SwaggerPetstore
userEmailLSwaggerPetstore.Lens, SwaggerPetstore
userFirstNameSwaggerPetstore.Model, SwaggerPetstore
userFirstNameLSwaggerPetstore.Lens, SwaggerPetstore
userIdSwaggerPetstore.Model, SwaggerPetstore
userIdLSwaggerPetstore.Lens, SwaggerPetstore
userLastNameSwaggerPetstore.Model, SwaggerPetstore
userLastNameLSwaggerPetstore.Lens, SwaggerPetstore
userPasswordSwaggerPetstore.Model, SwaggerPetstore
userPasswordLSwaggerPetstore.Lens, SwaggerPetstore
userPhoneSwaggerPetstore.Model, SwaggerPetstore
userPhoneLSwaggerPetstore.Lens, SwaggerPetstore
userUsernameSwaggerPetstore.Model, SwaggerPetstore
userUsernameLSwaggerPetstore.Lens, SwaggerPetstore
userUserStatusSwaggerPetstore.Model, SwaggerPetstore
userUserStatusLSwaggerPetstore.Lens, SwaggerPetstore
\ No newline at end of file diff --git a/samples/client/petstore/haskell-http-client/docs/mini_SwaggerPetstore-API.html b/samples/client/petstore/haskell-http-client/docs/mini_SwaggerPetstore-API.html index a18ac070a29..53a2e86e806 100644 --- a/samples/client/petstore/haskell-http-client/docs/mini_SwaggerPetstore-API.html +++ b/samples/client/petstore/haskell-http-client/docs/mini_SwaggerPetstore-API.html @@ -1,4 +1,4 @@ SwaggerPetstore.API

SwaggerPetstore.API

Operations

Pet

addPet

data AddPet

deletePet

findPetsByStatus

findPetsByTags

getPetById

updatePet

updatePetWithForm

uploadFile

Store

deleteOrder

getInventory

getOrderById

placeOrder

User

createUser

createUsersWithArrayInput

createUsersWithListInput

deleteUser

getUserByName

loginUser

logoutUser

updateUser

HasBodyParam

class HasBodyParam req param

HasOptionalParam

class HasOptionalParam req param

Optional Request Parameter Types

data Name

data Status

data File

SwaggerPetstoreRequest

data SwaggerPetstoreRequest req contentType res

data Params

SwaggerPetstoreRequest Utils

Params Utils

Swagger CollectionFormat Utils

\ No newline at end of file +

SwaggerPetstore.API

Operations

Pet

addPet

data AddPet

deletePet

findPetsByStatus

findPetsByTags

getPetById

updatePet

updatePetWithForm

uploadFile

Store

deleteOrder

getInventory

getOrderById

placeOrder

User

createUser

createUsersWithArrayInput

createUsersWithListInput

deleteUser

getUserByName

loginUser

logoutUser

updateUser

HasBodyParam

class HasBodyParam req param

HasOptionalParam

class HasOptionalParam req param

Optional Request Parameter Types

data Name

data Status

data File

SwaggerPetstoreRequest

data SwaggerPetstoreRequest req contentType res

data Params

SwaggerPetstoreRequest Utils

Params Utils

Swagger CollectionFormat Utils

\ No newline at end of file diff --git a/samples/client/petstore/haskell-http-client/docs/src/Paths_swagger_petstore.html b/samples/client/petstore/haskell-http-client/docs/src/Paths_swagger_petstore.html index d6c2472e097..9f192a77a35 100644 --- a/samples/client/petstore/haskell-http-client/docs/src/Paths_swagger_petstore.html +++ b/samples/client/petstore/haskell-http-client/docs/src/Paths_swagger_petstore.html @@ -15,7 +15,7 @@ #if defined(VERSION_base) #if MIN_VERSION_base(4,0,0) -catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a +catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a #else catchIO :: IO a -> (Exception.Exception -> IO a) -> IO a #endif @@ -30,7 +30,7 @@ bindir, libdir, dynlibdir, datadir, libexecdir, sysconfdir :: FilePath bindir = "/home/jon/fs/git/swagger-codegen/samples/client/petstore/haskell-http-client/.stack-work/install/x86_64-linux-nopie/lts-9.0/8.0.2/bin" -libdir = "/home/jon/fs/git/swagger-codegen/samples/client/petstore/haskell-http-client/.stack-work/install/x86_64-linux-nopie/lts-9.0/8.0.2/lib/x86_64-linux-ghc-8.0.2/swagger-petstore-0.1.0.0-FhAGC7YzWguJAT2YJ3ggeI" +libdir = "/home/jon/fs/git/swagger-codegen/samples/client/petstore/haskell-http-client/.stack-work/install/x86_64-linux-nopie/lts-9.0/8.0.2/lib/x86_64-linux-ghc-8.0.2/swagger-petstore-0.1.0.0-CY2qj9sV8yi3N5R3aev4xa" dynlibdir = "/home/jon/fs/git/swagger-codegen/samples/client/petstore/haskell-http-client/.stack-work/install/x86_64-linux-nopie/lts-9.0/8.0.2/lib/x86_64-linux-ghc-8.0.2" datadir = "/home/jon/fs/git/swagger-codegen/samples/client/petstore/haskell-http-client/.stack-work/install/x86_64-linux-nopie/lts-9.0/8.0.2/share/x86_64-linux-ghc-8.0.2/swagger-petstore-0.1.0.0" libexecdir = "/home/jon/fs/git/swagger-codegen/samples/client/petstore/haskell-http-client/.stack-work/install/x86_64-linux-nopie/lts-9.0/8.0.2/libexec" @@ -45,7 +45,7 @@ getSysconfDir = catchIO (getEnv "swagger_petstore_sysconfdir") (\_ -> return sysconfdir) getDataFileName :: FilePath -> IO FilePath -getDataFileName name = do - dir <- getDataDir - return (dir ++ "/" ++ name) +getDataFileName name = do + dir <- getDataDir + return (dir ++ "/" ++ name) \ No newline at end of file diff --git a/samples/client/petstore/haskell-http-client/docs/src/SwaggerPetstore.API.html b/samples/client/petstore/haskell-http-client/docs/src/SwaggerPetstore.API.html index bd48b3f7366..2f8e8d83d05 100644 --- a/samples/client/petstore/haskell-http-client/docs/src/SwaggerPetstore.API.html +++ b/samples/client/petstore/haskell-http-client/docs/src/SwaggerPetstore.API.html @@ -11,821 +11,857 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE InstanceSigs #-} -{-# OPTIONS_GHC -fno-warn-unused-binds -fno-warn-unused-imports #-} - -module SwaggerPetstore.API where - +{-# LANGUAGE NamedFieldPuns #-} +{-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-unused-binds -fno-warn-unused-imports #-} + +module SwaggerPetstore.API where -import SwaggerPetstore.Model as M -import SwaggerPetstore.MimeTypes - -import qualified Data.Aeson as A -import Data.Aeson (Value) - -import qualified Data.Time as TI -import Data.Time (UTCTime) - -import qualified Data.ByteString as B -import qualified Data.ByteString.Lazy as BL -import Data.ByteString.Lazy (ByteString) -import qualified Data.ByteString.Builder as BB -import qualified Data.ByteString.Char8 as BC -import qualified Data.ByteString.Lazy.Char8 as BCL - -import qualified Network.HTTP.Client.MultipartFormData as NH -import qualified Network.HTTP.Media as ME -import qualified Network.HTTP.Types as NH - -import qualified Web.HttpApiData as WH -import qualified Web.FormUrlEncoded as WH - -import qualified Data.CaseInsensitive as CI -import qualified Data.Data as P (Typeable) -import qualified Data.Foldable as P -import qualified Data.Map as Map -import qualified Data.Maybe as P -import qualified Data.Proxy as P (Proxy(..)) -import qualified Data.Text as T -import qualified Data.Text.Encoding as T -import qualified Data.Text.Lazy as TL -import qualified Data.Text.Lazy.Encoding as TL -import qualified GHC.Base as P (Alternative) -import qualified Control.Arrow as P (left) - -import Data.Monoid ((<>)) -import Data.Function ((&)) -import Data.Set (Set) -import Data.Text (Text) -import GHC.Base ((<|>)) - -import Prelude ((==),(/=),($), (.),(<$>),(<*>),(>>=),Maybe(..),Bool(..),Char,Double,FilePath,Float,Int,Integer,String,fmap,undefined,mempty,maybe,pure,Monad,Applicative,Functor) -import qualified Prelude as P - --- * Operations - - --- ** Pet - --- *** addPet + +import SwaggerPetstore.Model as M +import SwaggerPetstore.MimeTypes +import SwaggerPetstore.Lens + +import qualified Data.Aeson as A +import Data.Aeson (Value) + +import qualified Data.Time as TI +import Data.Time (UTCTime) + +import qualified Data.ByteString as B +import qualified Data.ByteString.Lazy as BL +import Data.ByteString.Lazy (ByteString) +import qualified Data.ByteString.Builder as BB +import qualified Data.ByteString.Char8 as BC +import qualified Data.ByteString.Lazy.Char8 as BCL + +import qualified Network.HTTP.Client.MultipartFormData as NH +import qualified Network.HTTP.Media as ME +import qualified Network.HTTP.Types as NH + +import qualified Web.HttpApiData as WH +import qualified Web.FormUrlEncoded as WH + +import qualified Data.CaseInsensitive as CI +import qualified Data.Data as P (Typeable) +import qualified Data.Foldable as P +import qualified Data.Map as Map +import qualified Data.Maybe as P +import qualified Data.Proxy as P (Proxy(..)) +import qualified Data.Text as T +import qualified Data.Text.Encoding as T +import qualified Data.Text.Lazy as TL +import qualified Data.Text.Lazy.Encoding as TL +import qualified GHC.Base as P (Alternative) +import qualified Control.Arrow as P (left) + +import qualified Lens.Micro as L + +import Data.Monoid ((<>)) +import Data.Function ((&)) +import Data.Set (Set) +import Data.Text (Text) +import GHC.Base ((<|>)) + +import Prelude ((==),(/=),($), (.),(<$>),(<*>),(>>=),Maybe(..),Bool(..),Char,Double,FilePath,Float,Int,Integer,String,fmap,undefined,mempty,maybe,pure,Monad,Applicative,Functor) +import qualified Prelude as P + +-- * Operations + --- | @POST \/pet@ --- --- Add a new pet to the store --- --- +-- ** Pet + +-- *** addPet + +-- | @POST \/pet@ -- --- AuthMethod: petstore_auth +-- Add a new pet to the store -- --- Note: Has 'Produces' instances, but no response schema +-- -- -addPet - :: (Consumes AddPet contentType, MimeRender contentType Pet) - => contentType -- ^ request content-type ('MimeType') - -> Pet -- ^ "body" - Pet object that needs to be added to the store - -> SwaggerPetstoreRequest AddPet contentType res -addPet _ body = - _mkRequest "POST" ["/pet"] - `setBodyParam` body - -data AddPet - --- | /Body Param/ "body" - Pet object that needs to be added to the store -instance HasBodyParam AddPet Pet - --- | @application/json@ -instance Consumes AddPet MimeJSON --- | @application/xml@ -instance Consumes AddPet MimeXML - --- | @application/xml@ -instance Produces AddPet MimeXML --- | @application/json@ -instance Produces AddPet MimeJSON - - --- *** deletePet - --- | @DELETE \/pet\/{petId}@ --- --- Deletes a pet --- --- +-- AuthMethod: petstore_auth +-- +-- Note: Has 'Produces' instances, but no response schema +-- +addPet + :: (Consumes AddPet contentType, MimeRender contentType Pet) + => contentType -- ^ request content-type ('MimeType') + -> Pet -- ^ "body" - Pet object that needs to be added to the store + -> SwaggerPetstoreRequest AddPet contentType res +addPet _ body = + _mkRequest "POST" ["/pet"] + `setBodyParam` body + +data AddPet + +-- | /Body Param/ "body" - Pet object that needs to be added to the store +instance HasBodyParam AddPet Pet + +-- | @application/json@ +instance Consumes AddPet MimeJSON +-- | @application/xml@ +instance Consumes AddPet MimeXML + +-- | @application/xml@ +instance Produces AddPet MimeXML +-- | @application/json@ +instance Produces AddPet MimeJSON + + +-- *** deletePet + +-- | @DELETE \/pet\/{petId}@ -- --- AuthMethod: petstore_auth +-- Deletes a pet -- --- Note: Has 'Produces' instances, but no response schema +-- -- -deletePet - :: Integer -- ^ "petId" - Pet id to delete - -> SwaggerPetstoreRequest DeletePet MimeNoContent res -deletePet petId = - _mkRequest "DELETE" ["/pet/",toPath petId] - - -data DeletePet -instance HasOptionalParam DeletePet ApiUnderscorekey where - applyOptionalParam req (ApiUnderscorekey xs) = - req `setHeader` toHeader ("api_key", xs) --- | @application/xml@ -instance Produces DeletePet MimeXML --- | @application/json@ -instance Produces DeletePet MimeJSON - - --- *** findPetsByStatus - --- | @GET \/pet\/findByStatus@ --- --- Finds Pets by status --- --- Multiple status values can be provided with comma separated strings +-- AuthMethod: petstore_auth +-- +-- Note: Has 'Produces' instances, but no response schema +-- +deletePet + :: Integer -- ^ "petId" - Pet id to delete + -> SwaggerPetstoreRequest DeletePet MimeNoContent res +deletePet petId = + _mkRequest "DELETE" ["/pet/",toPath petId] + + +data DeletePet +instance HasOptionalParam DeletePet ApiUnderscorekey where + applyOptionalParam req (ApiUnderscorekey xs) = + req `setHeader` toHeader ("api_key", xs) +-- | @application/xml@ +instance Produces DeletePet MimeXML +-- | @application/json@ +instance Produces DeletePet MimeJSON + + +-- *** findPetsByStatus + +-- | @GET \/pet\/findByStatus@ -- --- AuthMethod: petstore_auth +-- Finds Pets by status -- -findPetsByStatus - :: [Text] -- ^ "status" - Status values that need to be considered for filter - -> SwaggerPetstoreRequest FindPetsByStatus MimeNoContent [Pet] -findPetsByStatus status = - _mkRequest "GET" ["/pet/findByStatus"] - `_setQuery` toQueryColl CommaSeparated ("status", Just status) - -data FindPetsByStatus --- | @application/xml@ -instance Produces FindPetsByStatus MimeXML --- | @application/json@ -instance Produces FindPetsByStatus MimeJSON - - --- *** findPetsByTags - --- | @GET \/pet\/findByTags@ --- --- Finds Pets by tags --- --- Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. +-- Multiple status values can be provided with comma separated strings +-- +-- AuthMethod: petstore_auth +-- +findPetsByStatus + :: [Text] -- ^ "status" - Status values that need to be considered for filter + -> SwaggerPetstoreRequest FindPetsByStatus MimeNoContent [Pet] +findPetsByStatus status = + _mkRequest "GET" ["/pet/findByStatus"] + `_setQuery` toQueryColl CommaSeparated ("status", Just status) + +data FindPetsByStatus +-- | @application/xml@ +instance Produces FindPetsByStatus MimeXML +-- | @application/json@ +instance Produces FindPetsByStatus MimeJSON + + +-- *** findPetsByTags + +-- | @GET \/pet\/findByTags@ -- --- AuthMethod: petstore_auth +-- Finds Pets by tags -- -findPetsByTags - :: [Text] -- ^ "tags" - Tags to filter by - -> SwaggerPetstoreRequest FindPetsByTags MimeNoContent [Pet] -findPetsByTags tags = - _mkRequest "GET" ["/pet/findByTags"] - `_setQuery` toQueryColl CommaSeparated ("tags", Just tags) - -{-# DEPRECATED findPetsByTags "" #-} - -data FindPetsByTags --- | @application/xml@ -instance Produces FindPetsByTags MimeXML --- | @application/json@ -instance Produces FindPetsByTags MimeJSON - - --- *** getPetById - --- | @GET \/pet\/{petId}@ --- --- Find pet by ID --- --- Returns a single pet +-- Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. +-- +-- AuthMethod: petstore_auth +-- +findPetsByTags + :: [Text] -- ^ "tags" - Tags to filter by + -> SwaggerPetstoreRequest FindPetsByTags MimeNoContent [Pet] +findPetsByTags tags = + _mkRequest "GET" ["/pet/findByTags"] + `_setQuery` toQueryColl CommaSeparated ("tags", Just tags) + +{-# DEPRECATED findPetsByTags "" #-} + +data FindPetsByTags +-- | @application/xml@ +instance Produces FindPetsByTags MimeXML +-- | @application/json@ +instance Produces FindPetsByTags MimeJSON + + +-- *** getPetById + +-- | @GET \/pet\/{petId}@ -- --- AuthMethod: api_key +-- Find pet by ID -- -getPetById - :: Integer -- ^ "petId" - ID of pet to return - -> SwaggerPetstoreRequest GetPetById MimeNoContent Pet -getPetById petId = - _mkRequest "GET" ["/pet/",toPath petId] - - -data GetPetById --- | @application/xml@ -instance Produces GetPetById MimeXML --- | @application/json@ -instance Produces GetPetById MimeJSON - - --- *** updatePet - --- | @PUT \/pet@ --- --- Update an existing pet --- --- +-- Returns a single pet +-- +-- AuthMethod: api_key +-- +getPetById + :: Integer -- ^ "petId" - ID of pet to return + -> SwaggerPetstoreRequest GetPetById MimeNoContent Pet +getPetById petId = + _mkRequest "GET" ["/pet/",toPath petId] + + +data GetPetById +-- | @application/xml@ +instance Produces GetPetById MimeXML +-- | @application/json@ +instance Produces GetPetById MimeJSON + + +-- *** updatePet + +-- | @PUT \/pet@ -- --- AuthMethod: petstore_auth +-- Update an existing pet -- --- Note: Has 'Produces' instances, but no response schema +-- -- -updatePet - :: (Consumes UpdatePet contentType, MimeRender contentType Pet) - => contentType -- ^ request content-type ('MimeType') - -> Pet -- ^ "body" - Pet object that needs to be added to the store - -> SwaggerPetstoreRequest UpdatePet contentType res -updatePet _ body = - _mkRequest "PUT" ["/pet"] - `setBodyParam` body - -data UpdatePet - --- | /Body Param/ "body" - Pet object that needs to be added to the store -instance HasBodyParam UpdatePet Pet - --- | @application/json@ -instance Consumes UpdatePet MimeJSON --- | @application/xml@ -instance Consumes UpdatePet MimeXML - --- | @application/xml@ -instance Produces UpdatePet MimeXML --- | @application/json@ -instance Produces UpdatePet MimeJSON - - --- *** updatePetWithForm - --- | @POST \/pet\/{petId}@ --- --- Updates a pet in the store with form data --- --- +-- AuthMethod: petstore_auth +-- +-- Note: Has 'Produces' instances, but no response schema +-- +updatePet + :: (Consumes UpdatePet contentType, MimeRender contentType Pet) + => contentType -- ^ request content-type ('MimeType') + -> Pet -- ^ "body" - Pet object that needs to be added to the store + -> SwaggerPetstoreRequest UpdatePet contentType res +updatePet _ body = + _mkRequest "PUT" ["/pet"] + `setBodyParam` body + +data UpdatePet + +-- | /Body Param/ "body" - Pet object that needs to be added to the store +instance HasBodyParam UpdatePet Pet + +-- | @application/json@ +instance Consumes UpdatePet MimeJSON +-- | @application/xml@ +instance Consumes UpdatePet MimeXML + +-- | @application/xml@ +instance Produces UpdatePet MimeXML +-- | @application/json@ +instance Produces UpdatePet MimeJSON + + +-- *** updatePetWithForm + +-- | @POST \/pet\/{petId}@ -- --- AuthMethod: petstore_auth +-- Updates a pet in the store with form data -- --- Note: Has 'Produces' instances, but no response schema +-- -- -updatePetWithForm - :: (Consumes UpdatePetWithForm contentType) - => contentType -- ^ request content-type ('MimeType') - -> Integer -- ^ "petId" - ID of pet that needs to be updated - -> SwaggerPetstoreRequest UpdatePetWithForm contentType res -updatePetWithForm _ petId = - _mkRequest "POST" ["/pet/",toPath petId] - - -data UpdatePetWithForm - --- | /Optional Param/ "name" - Updated name of the pet -instance HasOptionalParam UpdatePetWithForm Name where - applyOptionalParam req (Name xs) = - req `_addForm` toForm ("name", xs) - --- | /Optional Param/ "status" - Updated status of the pet -instance HasOptionalParam UpdatePetWithForm Status where - applyOptionalParam req (Status xs) = - req `_addForm` toForm ("status", xs) - --- | @application/x-www-form-urlencoded@ -instance Consumes UpdatePetWithForm MimeFormUrlEncoded - --- | @application/xml@ -instance Produces UpdatePetWithForm MimeXML --- | @application/json@ -instance Produces UpdatePetWithForm MimeJSON - - --- *** uploadFile - --- | @POST \/pet\/{petId}\/uploadImage@ --- --- uploads an image --- --- +-- AuthMethod: petstore_auth +-- +-- Note: Has 'Produces' instances, but no response schema +-- +updatePetWithForm + :: (Consumes UpdatePetWithForm contentType) + => contentType -- ^ request content-type ('MimeType') + -> Integer -- ^ "petId" - ID of pet that needs to be updated + -> SwaggerPetstoreRequest UpdatePetWithForm contentType res +updatePetWithForm _ petId = + _mkRequest "POST" ["/pet/",toPath petId] + + +data UpdatePetWithForm + +-- | /Optional Param/ "name" - Updated name of the pet +instance HasOptionalParam UpdatePetWithForm Name where + applyOptionalParam req (Name xs) = + req `_addForm` toForm ("name", xs) + +-- | /Optional Param/ "status" - Updated status of the pet +instance HasOptionalParam UpdatePetWithForm Status where + applyOptionalParam req (Status xs) = + req `_addForm` toForm ("status", xs) + +-- | @application/x-www-form-urlencoded@ +instance Consumes UpdatePetWithForm MimeFormUrlEncoded + +-- | @application/xml@ +instance Produces UpdatePetWithForm MimeXML +-- | @application/json@ +instance Produces UpdatePetWithForm MimeJSON + + +-- *** uploadFile + +-- | @POST \/pet\/{petId}\/uploadImage@ -- --- AuthMethod: petstore_auth +-- uploads an image -- -uploadFile - :: (Consumes UploadFile contentType) - => contentType -- ^ request content-type ('MimeType') - -> Integer -- ^ "petId" - ID of pet to update - -> SwaggerPetstoreRequest UploadFile contentType ApiResponse -uploadFile _ petId = - _mkRequest "POST" ["/pet/",toPath petId,"/uploadImage"] - - -data UploadFile - --- | /Optional Param/ "additionalMetadata" - Additional data to pass to server -instance HasOptionalParam UploadFile AdditionalMetadata where - applyOptionalParam req (AdditionalMetadata xs) = - req `_addMultiFormPart` NH.partLBS "additionalMetadata" (mimeRender' MimeMultipartFormData xs) - --- | /Optional Param/ "file" - file to upload -instance HasOptionalParam UploadFile File where - applyOptionalParam req (File xs) = - req `_addMultiFormPart` NH.partFileSource "file" xs - --- | @multipart/form-data@ -instance Consumes UploadFile MimeMultipartFormData - --- | @application/json@ -instance Produces UploadFile MimeJSON - +-- +-- +-- AuthMethod: petstore_auth +-- +uploadFile + :: (Consumes UploadFile contentType) + => contentType -- ^ request content-type ('MimeType') + -> Integer -- ^ "petId" - ID of pet to update + -> SwaggerPetstoreRequest UploadFile contentType ApiResponse +uploadFile _ petId = + _mkRequest "POST" ["/pet/",toPath petId,"/uploadImage"] + + +data UploadFile + +-- | /Optional Param/ "additionalMetadata" - Additional data to pass to server +instance HasOptionalParam UploadFile AdditionalMetadata where + applyOptionalParam req (AdditionalMetadata xs) = + req `_addMultiFormPart` NH.partLBS "additionalMetadata" (mimeRender' MimeMultipartFormData xs) + +-- | /Optional Param/ "file" - file to upload +instance HasOptionalParam UploadFile File where + applyOptionalParam req (File xs) = + req `_addMultiFormPart` NH.partFileSource "file" xs + +-- | @multipart/form-data@ +instance Consumes UploadFile MimeMultipartFormData --- ** Store - --- *** deleteOrder +-- | @application/json@ +instance Produces UploadFile MimeJSON + --- | @DELETE \/store\/order\/{orderId}@ --- --- Delete purchase order by ID --- --- For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors +-- ** Store + +-- *** deleteOrder + +-- | @DELETE \/store\/order\/{orderId}@ -- --- Note: Has 'Produces' instances, but no response schema +-- Delete purchase order by ID -- -deleteOrder - :: Text -- ^ "orderId" - ID of the order that needs to be deleted - -> SwaggerPetstoreRequest DeleteOrder MimeNoContent res -deleteOrder orderId = - _mkRequest "DELETE" ["/store/order/",toPath orderId] - - -data DeleteOrder --- | @application/xml@ -instance Produces DeleteOrder MimeXML --- | @application/json@ -instance Produces DeleteOrder MimeJSON - - --- *** getInventory - --- | @GET \/store\/inventory@ --- --- Returns pet inventories by status --- --- Returns a map of status codes to quantities +-- For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors +-- +-- Note: Has 'Produces' instances, but no response schema +-- +deleteOrder + :: Text -- ^ "orderId" - ID of the order that needs to be deleted + -> SwaggerPetstoreRequest DeleteOrder MimeNoContent res +deleteOrder orderId = + _mkRequest "DELETE" ["/store/order/",toPath orderId] + + +data DeleteOrder +-- | @application/xml@ +instance Produces DeleteOrder MimeXML +-- | @application/json@ +instance Produces DeleteOrder MimeJSON + + +-- *** getInventory + +-- | @GET \/store\/inventory@ -- --- AuthMethod: api_key +-- Returns pet inventories by status -- -getInventory - :: SwaggerPetstoreRequest GetInventory MimeNoContent (Map.Map String Int) -getInventory = - _mkRequest "GET" ["/store/inventory"] - -data GetInventory --- | @application/json@ -instance Produces GetInventory MimeJSON +-- Returns a map of status codes to quantities +-- +-- AuthMethod: api_key +-- +getInventory + :: SwaggerPetstoreRequest GetInventory MimeNoContent (Map.Map String Int) +getInventory = + _mkRequest "GET" ["/store/inventory"] - --- *** getOrderById - --- | @GET \/store\/order\/{orderId}@ --- --- Find purchase order by ID --- --- For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions +data GetInventory +-- | @application/json@ +instance Produces GetInventory MimeJSON + + +-- *** getOrderById + +-- | @GET \/store\/order\/{orderId}@ -- -getOrderById - :: Integer -- ^ "orderId" - ID of pet that needs to be fetched - -> SwaggerPetstoreRequest GetOrderById MimeNoContent Order -getOrderById orderId = - _mkRequest "GET" ["/store/order/",toPath orderId] - - -data GetOrderById --- | @application/xml@ -instance Produces GetOrderById MimeXML --- | @application/json@ -instance Produces GetOrderById MimeJSON - - --- *** placeOrder - --- | @POST \/store\/order@ --- --- Place an order for a pet --- --- +-- Find purchase order by ID +-- +-- For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions +-- +getOrderById + :: Integer -- ^ "orderId" - ID of pet that needs to be fetched + -> SwaggerPetstoreRequest GetOrderById MimeNoContent Order +getOrderById orderId = + _mkRequest "GET" ["/store/order/",toPath orderId] + + +data GetOrderById +-- | @application/xml@ +instance Produces GetOrderById MimeXML +-- | @application/json@ +instance Produces GetOrderById MimeJSON + + +-- *** placeOrder + +-- | @POST \/store\/order@ -- -placeOrder - :: (Consumes PlaceOrder contentType, MimeRender contentType Order) - => contentType -- ^ request content-type ('MimeType') - -> Order -- ^ "body" - order placed for purchasing the pet - -> SwaggerPetstoreRequest PlaceOrder contentType Order -placeOrder _ body = - _mkRequest "POST" ["/store/order"] - `setBodyParam` body - -data PlaceOrder - --- | /Body Param/ "body" - order placed for purchasing the pet -instance HasBodyParam PlaceOrder Order --- | @application/xml@ -instance Produces PlaceOrder MimeXML --- | @application/json@ -instance Produces PlaceOrder MimeJSON - - --- ** User - --- *** createUser +-- Place an order for a pet +-- +-- +-- +placeOrder + :: (Consumes PlaceOrder contentType, MimeRender contentType Order) + => contentType -- ^ request content-type ('MimeType') + -> Order -- ^ "body" - order placed for purchasing the pet + -> SwaggerPetstoreRequest PlaceOrder contentType Order +placeOrder _ body = + _mkRequest "POST" ["/store/order"] + `setBodyParam` body + +data PlaceOrder + +-- | /Body Param/ "body" - order placed for purchasing the pet +instance HasBodyParam PlaceOrder Order +-- | @application/xml@ +instance Produces PlaceOrder MimeXML +-- | @application/json@ +instance Produces PlaceOrder MimeJSON + --- | @POST \/user@ --- --- Create user --- --- This can only be done by the logged in user. +-- ** User + +-- *** createUser + +-- | @POST \/user@ -- --- Note: Has 'Produces' instances, but no response schema +-- Create user -- -createUser - :: (Consumes CreateUser contentType, MimeRender contentType User) - => contentType -- ^ request content-type ('MimeType') - -> User -- ^ "body" - Created user object - -> SwaggerPetstoreRequest CreateUser contentType res -createUser _ body = - _mkRequest "POST" ["/user"] - `setBodyParam` body - -data CreateUser - --- | /Body Param/ "body" - Created user object -instance HasBodyParam CreateUser User --- | @application/xml@ -instance Produces CreateUser MimeXML --- | @application/json@ -instance Produces CreateUser MimeJSON - - --- *** createUsersWithArrayInput - --- | @POST \/user\/createWithArray@ --- --- Creates list of users with given input array --- --- +-- This can only be done by the logged in user. +-- +-- Note: Has 'Produces' instances, but no response schema +-- +createUser + :: (Consumes CreateUser contentType, MimeRender contentType User) + => contentType -- ^ request content-type ('MimeType') + -> User -- ^ "body" - Created user object + -> SwaggerPetstoreRequest CreateUser contentType res +createUser _ body = + _mkRequest "POST" ["/user"] + `setBodyParam` body + +data CreateUser + +-- | /Body Param/ "body" - Created user object +instance HasBodyParam CreateUser User +-- | @application/xml@ +instance Produces CreateUser MimeXML +-- | @application/json@ +instance Produces CreateUser MimeJSON + + +-- *** createUsersWithArrayInput + +-- | @POST \/user\/createWithArray@ -- --- Note: Has 'Produces' instances, but no response schema +-- Creates list of users with given input array -- -createUsersWithArrayInput - :: (Consumes CreateUsersWithArrayInput contentType, MimeRender contentType [User]) - => contentType -- ^ request content-type ('MimeType') - -> [User] -- ^ "body" - List of user object - -> SwaggerPetstoreRequest CreateUsersWithArrayInput contentType res -createUsersWithArrayInput _ body = - _mkRequest "POST" ["/user/createWithArray"] - `setBodyParam` body - -data CreateUsersWithArrayInput - --- | /Body Param/ "body" - List of user object -instance HasBodyParam CreateUsersWithArrayInput [User] --- | @application/xml@ -instance Produces CreateUsersWithArrayInput MimeXML --- | @application/json@ -instance Produces CreateUsersWithArrayInput MimeJSON - - --- *** createUsersWithListInput - --- | @POST \/user\/createWithList@ --- --- Creates list of users with given input array --- --- +-- +-- +-- Note: Has 'Produces' instances, but no response schema +-- +createUsersWithArrayInput + :: (Consumes CreateUsersWithArrayInput contentType, MimeRender contentType [User]) + => contentType -- ^ request content-type ('MimeType') + -> [User] -- ^ "body" - List of user object + -> SwaggerPetstoreRequest CreateUsersWithArrayInput contentType res +createUsersWithArrayInput _ body = + _mkRequest "POST" ["/user/createWithArray"] + `setBodyParam` body + +data CreateUsersWithArrayInput + +-- | /Body Param/ "body" - List of user object +instance HasBodyParam CreateUsersWithArrayInput [User] +-- | @application/xml@ +instance Produces CreateUsersWithArrayInput MimeXML +-- | @application/json@ +instance Produces CreateUsersWithArrayInput MimeJSON + + +-- *** createUsersWithListInput + +-- | @POST \/user\/createWithList@ -- --- Note: Has 'Produces' instances, but no response schema +-- Creates list of users with given input array -- -createUsersWithListInput - :: (Consumes CreateUsersWithListInput contentType, MimeRender contentType [User]) - => contentType -- ^ request content-type ('MimeType') - -> [User] -- ^ "body" - List of user object - -> SwaggerPetstoreRequest CreateUsersWithListInput contentType res -createUsersWithListInput _ body = - _mkRequest "POST" ["/user/createWithList"] - `setBodyParam` body - -data CreateUsersWithListInput - --- | /Body Param/ "body" - List of user object -instance HasBodyParam CreateUsersWithListInput [User] --- | @application/xml@ -instance Produces CreateUsersWithListInput MimeXML --- | @application/json@ -instance Produces CreateUsersWithListInput MimeJSON - - --- *** deleteUser - --- | @DELETE \/user\/{username}@ --- --- Delete user --- --- This can only be done by the logged in user. +-- +-- +-- Note: Has 'Produces' instances, but no response schema +-- +createUsersWithListInput + :: (Consumes CreateUsersWithListInput contentType, MimeRender contentType [User]) + => contentType -- ^ request content-type ('MimeType') + -> [User] -- ^ "body" - List of user object + -> SwaggerPetstoreRequest CreateUsersWithListInput contentType res +createUsersWithListInput _ body = + _mkRequest "POST" ["/user/createWithList"] + `setBodyParam` body + +data CreateUsersWithListInput + +-- | /Body Param/ "body" - List of user object +instance HasBodyParam CreateUsersWithListInput [User] +-- | @application/xml@ +instance Produces CreateUsersWithListInput MimeXML +-- | @application/json@ +instance Produces CreateUsersWithListInput MimeJSON + + +-- *** deleteUser + +-- | @DELETE \/user\/{username}@ -- --- Note: Has 'Produces' instances, but no response schema +-- Delete user -- -deleteUser - :: Text -- ^ "username" - The name that needs to be deleted - -> SwaggerPetstoreRequest DeleteUser MimeNoContent res -deleteUser username = - _mkRequest "DELETE" ["/user/",toPath username] - - -data DeleteUser --- | @application/xml@ -instance Produces DeleteUser MimeXML --- | @application/json@ -instance Produces DeleteUser MimeJSON - - --- *** getUserByName - --- | @GET \/user\/{username}@ --- --- Get user by user name --- --- +-- This can only be done by the logged in user. +-- +-- Note: Has 'Produces' instances, but no response schema +-- +deleteUser + :: Text -- ^ "username" - The name that needs to be deleted + -> SwaggerPetstoreRequest DeleteUser MimeNoContent res +deleteUser username = + _mkRequest "DELETE" ["/user/",toPath username] + + +data DeleteUser +-- | @application/xml@ +instance Produces DeleteUser MimeXML +-- | @application/json@ +instance Produces DeleteUser MimeJSON + + +-- *** getUserByName + +-- | @GET \/user\/{username}@ -- -getUserByName - :: Text -- ^ "username" - The name that needs to be fetched. Use user1 for testing. - -> SwaggerPetstoreRequest GetUserByName MimeNoContent User -getUserByName username = - _mkRequest "GET" ["/user/",toPath username] - - -data GetUserByName --- | @application/xml@ -instance Produces GetUserByName MimeXML --- | @application/json@ -instance Produces GetUserByName MimeJSON - - --- *** loginUser - --- | @GET \/user\/login@ --- --- Logs user into the system --- --- +-- Get user by user name +-- +-- +-- +getUserByName + :: Text -- ^ "username" - The name that needs to be fetched. Use user1 for testing. + -> SwaggerPetstoreRequest GetUserByName MimeNoContent User +getUserByName username = + _mkRequest "GET" ["/user/",toPath username] + + +data GetUserByName +-- | @application/xml@ +instance Produces GetUserByName MimeXML +-- | @application/json@ +instance Produces GetUserByName MimeJSON + + +-- *** loginUser + +-- | @GET \/user\/login@ -- -loginUser - :: Text -- ^ "username" - The user name for login - -> Text -- ^ "password" - The password for login in clear text - -> SwaggerPetstoreRequest LoginUser MimeNoContent Text -loginUser username password = - _mkRequest "GET" ["/user/login"] - `_setQuery` toQuery ("username", Just username) - `_setQuery` toQuery ("password", Just password) - -data LoginUser --- | @application/xml@ -instance Produces LoginUser MimeXML --- | @application/json@ -instance Produces LoginUser MimeJSON - - --- *** logoutUser - --- | @GET \/user\/logout@ --- --- Logs out current logged in user session --- --- +-- Logs user into the system +-- +-- +-- +loginUser + :: Text -- ^ "username" - The user name for login + -> Text -- ^ "password" - The password for login in clear text + -> SwaggerPetstoreRequest LoginUser MimeNoContent Text +loginUser username password = + _mkRequest "GET" ["/user/login"] + `_setQuery` toQuery ("username", Just username) + `_setQuery` toQuery ("password", Just password) + +data LoginUser +-- | @application/xml@ +instance Produces LoginUser MimeXML +-- | @application/json@ +instance Produces LoginUser MimeJSON + + +-- *** logoutUser + +-- | @GET \/user\/logout@ -- --- Note: Has 'Produces' instances, but no response schema +-- Logs out current logged in user session -- -logoutUser - :: SwaggerPetstoreRequest LogoutUser MimeNoContent res -logoutUser = - _mkRequest "GET" ["/user/logout"] - -data LogoutUser --- | @application/xml@ -instance Produces LogoutUser MimeXML --- | @application/json@ -instance Produces LogoutUser MimeJSON - - --- *** updateUser - --- | @PUT \/user\/{username}@ --- --- Updated user --- --- This can only be done by the logged in user. +-- +-- +-- Note: Has 'Produces' instances, but no response schema +-- +logoutUser + :: SwaggerPetstoreRequest LogoutUser MimeNoContent res +logoutUser = + _mkRequest "GET" ["/user/logout"] + +data LogoutUser +-- | @application/xml@ +instance Produces LogoutUser MimeXML +-- | @application/json@ +instance Produces LogoutUser MimeJSON + + +-- *** updateUser + +-- | @PUT \/user\/{username}@ -- --- Note: Has 'Produces' instances, but no response schema +-- Updated user -- -updateUser - :: (Consumes UpdateUser contentType, MimeRender contentType User) - => contentType -- ^ request content-type ('MimeType') - -> Text -- ^ "username" - name that need to be deleted - -> User -- ^ "body" - Updated user object - -> SwaggerPetstoreRequest UpdateUser contentType res -updateUser _ username body = - _mkRequest "PUT" ["/user/",toPath username] - - `setBodyParam` body - -data UpdateUser - --- | /Body Param/ "body" - Updated user object -instance HasBodyParam UpdateUser User --- | @application/xml@ -instance Produces UpdateUser MimeXML --- | @application/json@ -instance Produces UpdateUser MimeJSON - - - --- * HasBodyParam +-- This can only be done by the logged in user. +-- +-- Note: Has 'Produces' instances, but no response schema +-- +updateUser + :: (Consumes UpdateUser contentType, MimeRender contentType User) + => contentType -- ^ request content-type ('MimeType') + -> Text -- ^ "username" - name that need to be deleted + -> User -- ^ "body" - Updated user object + -> SwaggerPetstoreRequest UpdateUser contentType res +updateUser _ username body = + _mkRequest "PUT" ["/user/",toPath username] + + `setBodyParam` body + +data UpdateUser + +-- | /Body Param/ "body" - Updated user object +instance HasBodyParam UpdateUser User +-- | @application/xml@ +instance Produces UpdateUser MimeXML +-- | @application/json@ +instance Produces UpdateUser MimeJSON --- | Designates the body parameter of a request -class HasBodyParam req param where - setBodyParam :: forall contentType res. (Consumes req contentType, MimeRender contentType param) => SwaggerPetstoreRequest req contentType res -> param -> SwaggerPetstoreRequest req contentType res - setBodyParam req xs = - req `_setBodyLBS` mimeRender (P.Proxy :: P.Proxy contentType) xs & _setContentTypeHeader - --- * HasOptionalParam - --- | Designates the optional parameters of a request -class HasOptionalParam req param where - {-# MINIMAL applyOptionalParam | (-&-) #-} + + +-- * HasBodyParam + +-- | Designates the body parameter of a request +class HasBodyParam req param where + setBodyParam :: forall contentType res. (Consumes req contentType, MimeRender contentType param) => SwaggerPetstoreRequest req contentType res -> param -> SwaggerPetstoreRequest req contentType res + setBodyParam req xs = + req `_setBodyLBS` mimeRender (P.Proxy :: P.Proxy contentType) xs & _setContentTypeHeader + +-- * HasOptionalParam - -- | Apply an optional parameter to a request - applyOptionalParam :: SwaggerPetstoreRequest req contentType res -> param -> SwaggerPetstoreRequest req contentType res - applyOptionalParam = (-&-) - {-# INLINE applyOptionalParam #-} - - -- | infix operator \/ alias for 'addOptionalParam' - (-&-) :: SwaggerPetstoreRequest req contentType res -> param -> SwaggerPetstoreRequest req contentType res - (-&-) = applyOptionalParam - {-# INLINE (-&-) #-} - -infixl 2 -&- - --- * Optional Request Parameter Types +-- | Designates the optional parameters of a request +class HasOptionalParam req param where + {-# MINIMAL applyOptionalParam | (-&-) #-} + + -- | Apply an optional parameter to a request + applyOptionalParam :: SwaggerPetstoreRequest req contentType res -> param -> SwaggerPetstoreRequest req contentType res + applyOptionalParam = (-&-) + {-# INLINE applyOptionalParam #-} + + -- | infix operator \/ alias for 'addOptionalParam' + (-&-) :: SwaggerPetstoreRequest req contentType res -> param -> SwaggerPetstoreRequest req contentType res + (-&-) = applyOptionalParam + {-# INLINE (-&-) #-} - -newtype ApiUnderscorekey = ApiUnderscorekey { unApiUnderscorekey :: Text } deriving (P.Eq, P.Show) - -newtype Name = Name { unName :: Text } deriving (P.Eq, P.Show) +infixl 2 -&- + +-- * Optional Request Parameter Types + -newtype Status = Status { unStatus :: Text } deriving (P.Eq, P.Show) +newtype ApiUnderscorekey = ApiUnderscorekey { unApiUnderscorekey :: Text } deriving (P.Eq, P.Show) -newtype AdditionalMetadata = AdditionalMetadata { unAdditionalMetadata :: Text } deriving (P.Eq, P.Show) +newtype Name = Name { unName :: Text } deriving (P.Eq, P.Show) -newtype File = File { unFile :: FilePath } deriving (P.Eq, P.Show) +newtype Status = Status { unStatus :: Text } deriving (P.Eq, P.Show) - --- * SwaggerPetstoreRequest - --- | Represents a request. The "req" type variable is the request type. The "res" type variable is the response type. -data SwaggerPetstoreRequest req contentType res = SwaggerPetstoreRequest - { rMethod :: NH.Method -- ^ Method of SwaggerPetstoreRequest - , urlPath :: [BCL.ByteString] -- ^ Endpoint of SwaggerPetstoreRequest - , params :: Params -- ^ params of SwaggerPetstoreRequest - } - deriving (P.Show) - --- | Request Params -data Params = Params - { paramsQuery :: NH.Query - , paramsHeaders :: NH.RequestHeaders - , paramsBody :: ParamBody - } - deriving (P.Show) - --- | Request Body -data ParamBody - = ParamBodyNone - | ParamBodyB B.ByteString - | ParamBodyBL BL.ByteString - | ParamBodyFormUrlEncoded WH.Form - | ParamBodyMultipartFormData [NH.Part] - deriving (P.Show) - --- ** SwaggerPetstoreRequest Utils +newtype AdditionalMetadata = AdditionalMetadata { unAdditionalMetadata :: Text } deriving (P.Eq, P.Show) + +newtype File = File { unFile :: FilePath } deriving (P.Eq, P.Show) + + +-- * SwaggerPetstoreRequest + +-- | Represents a request. The "req" type variable is the request type. The "res" type variable is the response type. +data SwaggerPetstoreRequest req contentType res = SwaggerPetstoreRequest + { rMethod :: NH.Method -- ^ Method of SwaggerPetstoreRequest + , rUrlPath :: [BCL.ByteString] -- ^ Endpoint of SwaggerPetstoreRequest + , rParams :: Params -- ^ params of SwaggerPetstoreRequest + } + deriving (P.Show) + +-- | 'rMethod' Lens +rMethodL :: Lens_' (SwaggerPetstoreRequest req contentType res) NH.Method +rMethodL f SwaggerPetstoreRequest{..} = (\rMethod -> SwaggerPetstoreRequest { rMethod, ..} ) <$> f rMethod +{-# INLINE rMethodL #-} + +-- | 'rUrlPath' Lens +rUrlPathL :: Lens_' (SwaggerPetstoreRequest req contentType res) [BCL.ByteString] +rUrlPathL f SwaggerPetstoreRequest{..} = (\rUrlPath -> SwaggerPetstoreRequest { rUrlPath, ..} ) <$> f rUrlPath +{-# INLINE rUrlPathL #-} + +-- | 'rParams' Lens +rParamsL :: Lens_' (SwaggerPetstoreRequest req contentType res) Params +rParamsL f SwaggerPetstoreRequest{..} = (\rParams -> SwaggerPetstoreRequest { rParams, ..} ) <$> f rParams +{-# INLINE rParamsL #-} -_mkRequest :: NH.Method -- ^ Method - -> [BCL.ByteString] -- ^ Endpoint - -> SwaggerPetstoreRequest req contentType res -- ^ req: Request Type, res: Response Type -_mkRequest m u = SwaggerPetstoreRequest m u _mkParams - -_mkParams :: Params -_mkParams = Params [] [] ParamBodyNone +-- | Request Params +data Params = Params + { paramsQuery :: NH.Query + , paramsHeaders :: NH.RequestHeaders + , paramsBody :: ParamBody + } + deriving (P.Show) -setHeader :: SwaggerPetstoreRequest req contentType res -> [NH.Header] -> SwaggerPetstoreRequest req contentType res -setHeader req header = - let _params = params (req `removeHeader` P.fmap P.fst header) - in req { params = _params { paramsHeaders = header P.++ paramsHeaders _params } } +-- | 'paramsQuery' Lens +paramsQueryL :: Lens_' Params NH.Query +paramsQueryL f Params{..} = (\paramsQuery -> Params { paramsQuery, ..} ) <$> f paramsQuery +{-# INLINE paramsQueryL #-} -removeHeader :: SwaggerPetstoreRequest req contentType res -> [NH.HeaderName] -> SwaggerPetstoreRequest req contentType res -removeHeader req header = - let _params = params req - in req { params = _params { paramsHeaders = [h | h <- paramsHeaders _params, cifst h `P.notElem` P.fmap CI.mk header] } } - where cifst = CI.mk . P.fst - - -_setContentTypeHeader :: forall req contentType res. MimeType contentType => SwaggerPetstoreRequest req contentType res -> SwaggerPetstoreRequest req contentType res -_setContentTypeHeader req = - case mimeType (P.Proxy :: P.Proxy contentType) of - Just m -> req `setHeader` [("content-type", BC.pack $ P.show m)] - Nothing -> req `removeHeader` ["content-type"] - -_setAcceptHeader :: forall req contentType res accept. MimeType accept => SwaggerPetstoreRequest req contentType res -> accept -> SwaggerPetstoreRequest req contentType res -_setAcceptHeader req accept = - case mimeType' accept of - Just m -> req `setHeader` [("accept", BC.pack $ P.show m)] - Nothing -> req `removeHeader` ["accept"] +-- | 'paramsHeaders' Lens +paramsHeadersL :: Lens_' Params NH.RequestHeaders +paramsHeadersL f Params{..} = (\paramsHeaders -> Params { paramsHeaders, ..} ) <$> f paramsHeaders +{-# INLINE paramsHeadersL #-} + +-- | 'paramsBody' Lens +paramsBodyL :: Lens_' Params ParamBody +paramsBodyL f Params{..} = (\paramsBody -> Params { paramsBody, ..} ) <$> f paramsBody +{-# INLINE paramsBodyL #-} + +-- | Request Body +data ParamBody + = ParamBodyNone + | ParamBodyB B.ByteString + | ParamBodyBL BL.ByteString + | ParamBodyFormUrlEncoded WH.Form + | ParamBodyMultipartFormData [NH.Part] + deriving (P.Show) -_setQuery :: SwaggerPetstoreRequest req contentType res -> [NH.QueryItem] -> SwaggerPetstoreRequest req contentType res -_setQuery req query = - let _params = params req - in req { params = _params { paramsQuery = query P.++ [q | q <- paramsQuery _params, cifst q `P.notElem` P.fmap cifst query] } } - where cifst = CI.mk . P.fst - -_addForm :: SwaggerPetstoreRequest req contentType res -> WH.Form -> SwaggerPetstoreRequest req contentType res -_addForm req newform = - let _params = params req - form = case paramsBody _params of - ParamBodyFormUrlEncoded _form -> _form - _ -> mempty - in req { params = _params { paramsBody = ParamBodyFormUrlEncoded (newform <> form) } } - -_addMultiFormPart :: SwaggerPetstoreRequest req contentType res -> NH.Part -> SwaggerPetstoreRequest req contentType res -_addMultiFormPart req newpart = - let _params = params req - parts = case paramsBody _params of - ParamBodyMultipartFormData _parts -> _parts - _ -> [] - in req { params = _params { paramsBody = ParamBodyMultipartFormData (newpart : parts) } } - -_setBodyBS :: SwaggerPetstoreRequest req contentType res -> B.ByteString -> SwaggerPetstoreRequest req contentType res -_setBodyBS req body = - let _params = params req - in req { params = _params { paramsBody = ParamBodyB body } } - -_setBodyLBS :: SwaggerPetstoreRequest req contentType res -> BL.ByteString -> SwaggerPetstoreRequest req contentType res -_setBodyLBS req body = - let _params = params req - in req { params = _params { paramsBody = ParamBodyBL body } } - - --- ** Params Utils - -toPath - :: WH.ToHttpApiData a - => a -> BCL.ByteString -toPath = BB.toLazyByteString . WH.toEncodedUrlPiece - -toHeader :: WH.ToHttpApiData a => (NH.HeaderName, a) -> [NH.Header] -toHeader x = [fmap WH.toHeader x] - -toForm :: WH.ToHttpApiData v => (BC.ByteString, v) -> WH.Form -toForm (k,v) = WH.toForm [(BC.unpack k,v)] +-- ** SwaggerPetstoreRequest Utils + +_mkRequest :: NH.Method -- ^ Method + -> [BCL.ByteString] -- ^ Endpoint + -> SwaggerPetstoreRequest req contentType res -- ^ req: Request Type, res: Response Type +_mkRequest m u = SwaggerPetstoreRequest m u _mkParams + +_mkParams :: Params +_mkParams = Params [] [] ParamBodyNone + +setHeader :: SwaggerPetstoreRequest req contentType res -> [NH.Header] -> SwaggerPetstoreRequest req contentType res +setHeader req header = + req `removeHeader` P.fmap P.fst header & + L.over (rParamsL . paramsHeadersL) (header P.++) + +removeHeader :: SwaggerPetstoreRequest req contentType res -> [NH.HeaderName] -> SwaggerPetstoreRequest req contentType res +removeHeader req header = + req & + L.over + (rParamsL . paramsHeadersL) + (P.filter (\h -> cifst h `P.notElem` P.fmap CI.mk header)) + where + cifst = CI.mk . P.fst + + +_setContentTypeHeader :: forall req contentType res. MimeType contentType => SwaggerPetstoreRequest req contentType res -> SwaggerPetstoreRequest req contentType res +_setContentTypeHeader req = + case mimeType (P.Proxy :: P.Proxy contentType) of + Just m -> req `setHeader` [("content-type", BC.pack $ P.show m)] + Nothing -> req `removeHeader` ["content-type"] + +_setAcceptHeader :: forall req contentType res accept. MimeType accept => SwaggerPetstoreRequest req contentType res -> accept -> SwaggerPetstoreRequest req contentType res +_setAcceptHeader req accept = + case mimeType' accept of + Just m -> req `setHeader` [("accept", BC.pack $ P.show m)] + Nothing -> req `removeHeader` ["accept"] + +_setQuery :: SwaggerPetstoreRequest req contentType res -> [NH.QueryItem] -> SwaggerPetstoreRequest req contentType res +_setQuery req query = + req & + L.over + (rParamsL . paramsQueryL) + ((query P.++) . P.filter (\q -> cifst q `P.notElem` P.fmap cifst query)) + where + cifst = CI.mk . P.fst -toQuery :: WH.ToHttpApiData a => (BC.ByteString, Maybe a) -> [NH.QueryItem] -toQuery x = [(fmap . fmap) toQueryParam x] - where toQueryParam = T.encodeUtf8 . WH.toQueryParam - --- *** Swagger `CollectionFormat` Utils - --- | Determines the format of the array if type array is used. -data CollectionFormat - = CommaSeparated -- ^ CSV format for multiple parameters. - | SpaceSeparated -- ^ Also called "SSV" - | TabSeparated -- ^ Also called "TSV" - | PipeSeparated -- ^ `value1|value2|value2` - | MultiParamArray -- ^ Using multiple GET parameters, e.g. `foo=bar&foo=baz`. This is valid only for parameters in "query" ('NH.Query') or "formData" ('WH.Form') +_addForm :: SwaggerPetstoreRequest req contentType res -> WH.Form -> SwaggerPetstoreRequest req contentType res +_addForm req newform = + let form = case paramsBody (rParams req) of + ParamBodyFormUrlEncoded _form -> _form + _ -> mempty + in req & L.set (rParamsL . paramsBodyL) (ParamBodyFormUrlEncoded (newform <> form)) + +_addMultiFormPart :: SwaggerPetstoreRequest req contentType res -> NH.Part -> SwaggerPetstoreRequest req contentType res +_addMultiFormPart req newpart = + let parts = case paramsBody (rParams req) of + ParamBodyMultipartFormData _parts -> _parts + _ -> [] + in req & L.set (rParamsL . paramsBodyL) (ParamBodyMultipartFormData (newpart : parts)) -toHeaderColl :: WH.ToHttpApiData a => CollectionFormat -> (NH.HeaderName, [a]) -> [NH.Header] -toHeaderColl c xs = _toColl c toHeader xs - -toFormColl :: WH.ToHttpApiData v => CollectionFormat -> (BC.ByteString, [v]) -> WH.Form -toFormColl c xs = WH.toForm $ fmap unpack $ _toColl c toHeader $ pack xs - where - pack (k,v) = (CI.mk k, v) - unpack (k,v) = (BC.unpack (CI.original k), BC.unpack v) +_setBodyBS :: SwaggerPetstoreRequest req contentType res -> B.ByteString -> SwaggerPetstoreRequest req contentType res +_setBodyBS req body = + req & L.set (rParamsL . paramsBodyL) (ParamBodyB body) + +_setBodyLBS :: SwaggerPetstoreRequest req contentType res -> BL.ByteString -> SwaggerPetstoreRequest req contentType res +_setBodyLBS req body = + req & L.set (rParamsL . paramsBodyL) (ParamBodyBL body) + -toQueryColl :: WH.ToHttpApiData a => CollectionFormat -> (BC.ByteString, Maybe [a]) -> NH.Query -toQueryColl c xs = _toCollA c toQuery xs - -_toColl :: P.Traversable f => CollectionFormat -> (f a -> [(b, BC.ByteString)]) -> f [a] -> [(b, BC.ByteString)] -_toColl c encode xs = fmap (fmap P.fromJust) (_toCollA' c fencode BC.singleton (fmap Just xs)) - where fencode = fmap (fmap Just) . encode . fmap P.fromJust - {-# INLINE fencode #-} - -_toCollA :: (P.Traversable f, P.Traversable t, P.Alternative t) => CollectionFormat -> (f (t a) -> [(b, t BC.ByteString)]) -> f (t [a]) -> [(b, t BC.ByteString)] -_toCollA c encode xs = _toCollA' c encode BC.singleton xs - -_toCollA' :: (P.Monoid c, P.Traversable f, P.Traversable t, P.Alternative t) => CollectionFormat -> (f (t a) -> [(b, t c)]) -> (Char -> c) -> f (t [a]) -> [(b, t c)] -_toCollA' c encode one xs = case c of - CommaSeparated -> go (one ',') - SpaceSeparated -> go (one ' ') - TabSeparated -> go (one '\t') - PipeSeparated -> go (one '|') - MultiParamArray -> expandList - where - go sep = - [P.foldl1 (\(sk, sv) (_, v) -> (sk, (combine sep <$> sv <*> v) <|> sv <|> v)) expandList] - combine sep x y = x <> sep <> y - expandList = (P.concatMap encode . (P.traverse . P.traverse) P.toList) xs - {-# INLINE go #-} - {-# INLINE expandList #-} - {-# INLINE combine #-} - - \ No newline at end of file +-- ** Params Utils + +toPath + :: WH.ToHttpApiData a + => a -> BCL.ByteString +toPath = BB.toLazyByteString . WH.toEncodedUrlPiece + +toHeader :: WH.ToHttpApiData a => (NH.HeaderName, a) -> [NH.Header] +toHeader x = [fmap WH.toHeader x] + +toForm :: WH.ToHttpApiData v => (BC.ByteString, v) -> WH.Form +toForm (k,v) = WH.toForm [(BC.unpack k,v)] + +toQuery :: WH.ToHttpApiData a => (BC.ByteString, Maybe a) -> [NH.QueryItem] +toQuery x = [(fmap . fmap) toQueryParam x] + where toQueryParam = T.encodeUtf8 . WH.toQueryParam + +-- *** Swagger `CollectionFormat` Utils + +-- | Determines the format of the array if type array is used. +data CollectionFormat + = CommaSeparated -- ^ CSV format for multiple parameters. + | SpaceSeparated -- ^ Also called "SSV" + | TabSeparated -- ^ Also called "TSV" + | PipeSeparated -- ^ `value1|value2|value2` + | MultiParamArray -- ^ Using multiple GET parameters, e.g. `foo=bar&foo=baz`. This is valid only for parameters in "query" ('NH.Query') or "formData" ('WH.Form') + +toHeaderColl :: WH.ToHttpApiData a => CollectionFormat -> (NH.HeaderName, [a]) -> [NH.Header] +toHeaderColl c xs = _toColl c toHeader xs + +toFormColl :: WH.ToHttpApiData v => CollectionFormat -> (BC.ByteString, [v]) -> WH.Form +toFormColl c xs = WH.toForm $ fmap unpack $ _toColl c toHeader $ pack xs + where + pack (k,v) = (CI.mk k, v) + unpack (k,v) = (BC.unpack (CI.original k), BC.unpack v) + +toQueryColl :: WH.ToHttpApiData a => CollectionFormat -> (BC.ByteString, Maybe [a]) -> NH.Query +toQueryColl c xs = _toCollA c toQuery xs + +_toColl :: P.Traversable f => CollectionFormat -> (f a -> [(b, BC.ByteString)]) -> f [a] -> [(b, BC.ByteString)] +_toColl c encode xs = fmap (fmap P.fromJust) (_toCollA' c fencode BC.singleton (fmap Just xs)) + where fencode = fmap (fmap Just) . encode . fmap P.fromJust + {-# INLINE fencode #-} + +_toCollA :: (P.Traversable f, P.Traversable t, P.Alternative t) => CollectionFormat -> (f (t a) -> [(b, t BC.ByteString)]) -> f (t [a]) -> [(b, t BC.ByteString)] +_toCollA c encode xs = _toCollA' c encode BC.singleton xs + +_toCollA' :: (P.Monoid c, P.Traversable f, P.Traversable t, P.Alternative t) => CollectionFormat -> (f (t a) -> [(b, t c)]) -> (Char -> c) -> f (t [a]) -> [(b, t c)] +_toCollA' c encode one xs = case c of + CommaSeparated -> go (one ',') + SpaceSeparated -> go (one ' ') + TabSeparated -> go (one '\t') + PipeSeparated -> go (one '|') + MultiParamArray -> expandList + where + go sep = + [P.foldl1 (\(sk, sv) (_, v) -> (sk, (combine sep <$> sv <*> v) <|> sv <|> v)) expandList] + combine sep x y = x <> sep <> y + expandList = (P.concatMap encode . (P.traverse . P.traverse) P.toList) xs + {-# INLINE go #-} + {-# INLINE expandList #-} + {-# INLINE combine #-} + + \ No newline at end of file diff --git a/samples/client/petstore/haskell-http-client/docs/src/SwaggerPetstore.Client.html b/samples/client/petstore/haskell-http-client/docs/src/SwaggerPetstore.Client.html index 27f9b2475b0..e8979eb697f 100644 --- a/samples/client/petstore/haskell-http-client/docs/src/SwaggerPetstore.Client.html +++ b/samples/client/petstore/haskell-http-client/docs/src/SwaggerPetstore.Client.html @@ -63,11 +63,11 @@ -- | display the config instance Show SwaggerPetstoreConfig where - show c = + show c = T.printf "{ configHost = %v, configUserAgent = %v, ..}" - (show (configHost c)) - (show (configUserAgent c)) + (show (configHost c)) + (show (configUserAgent c)) -- | constructs a default SwaggerPetstoreConfig -- @@ -93,15 +93,15 @@ -- | updates the config to use a MonadLogger instance which prints to stdout. withStdoutLogging :: SwaggerPetstoreConfig -> SwaggerPetstoreConfig -withStdoutLogging p = p { configExecLoggingT = LG.runStdoutLoggingT} +withStdoutLogging p = p { configExecLoggingT = LG.runStdoutLoggingT} -- | updates the config to use a MonadLogger instance which prints to stderr. withStderrLogging :: SwaggerPetstoreConfig -> SwaggerPetstoreConfig -withStderrLogging p = p { configExecLoggingT = LG.runStderrLoggingT} +withStderrLogging p = p { configExecLoggingT = LG.runStderrLoggingT} -- | updates the config to disable logging withNoLogging :: SwaggerPetstoreConfig -> SwaggerPetstoreConfig -withNoLogging p = p { configExecLoggingT = runNullLoggingT} +withNoLogging p = p { configExecLoggingT = runNullLoggingT} -- * Dispatch @@ -109,21 +109,21 @@ -- | send a request returning the raw http response dispatchLbs - :: (Produces req accept, MimeType contentType) + :: (Produces req accept, MimeType contentType) => NH.Manager -- ^ http-client Connection manager -> SwaggerPetstoreConfig -- ^ config - -> SwaggerPetstoreRequest req contentType res -- ^ request - -> accept -- ^ "accept" 'MimeType' + -> SwaggerPetstoreRequest req contentType res -- ^ request + -> accept -- ^ "accept" 'MimeType' -> IO (NH.Response BCL.ByteString) -- ^ response -dispatchLbs manager config request accept = do - initReq <- _toInitRequest config request accept - dispatchInitUnsafe manager config initReq +dispatchLbs manager config request accept = do + initReq <- _toInitRequest config request accept + dispatchInitUnsafe manager config initReq -- ** Mime -- | pair of decoded http body and http response -data MimeResult res = - MimeResult { mimeResult :: Either MimeError res -- ^ decoded http body +data MimeResult res = + MimeResult { mimeResult :: Either MimeError res -- ^ decoded http body , mimeResultResponse :: NH.Response BCL.ByteString -- ^ http response } deriving (Show, Functor, Foldable, Traversable) @@ -137,124 +137,124 @@ -- | send a request returning the 'MimeResult' dispatchMime - :: (Produces req accept, MimeUnrender accept res, MimeType contentType) + :: (Produces req accept, MimeUnrender accept res, MimeType contentType) => NH.Manager -- ^ http-client Connection manager -> SwaggerPetstoreConfig -- ^ config - -> SwaggerPetstoreRequest req contentType res -- ^ request - -> accept -- ^ "accept" 'MimeType' - -> IO (MimeResult res) -- ^ response -dispatchMime manager config request accept = do - httpResponse <- dispatchLbs manager config request accept - parsedResult <- - runExceptionLoggingT "Client" config $ - do case mimeUnrender' accept (NH.responseBody httpResponse) of - Left s -> do - logNST LG.LevelError "Client" (T.pack s) - pure (Left (MimeError s httpResponse)) - Right r -> pure (Right r) - return (MimeResult parsedResult httpResponse) + -> SwaggerPetstoreRequest req contentType res -- ^ request + -> accept -- ^ "accept" 'MimeType' + -> IO (MimeResult res) -- ^ response +dispatchMime manager config request accept = do + httpResponse <- dispatchLbs manager config request accept + parsedResult <- + runExceptionLoggingT "Client" config $ + do case mimeUnrender' accept (NH.responseBody httpResponse) of + Left s -> do + logNST LG.LevelError "Client" (T.pack s) + pure (Left (MimeError s httpResponse)) + Right r -> pure (Right r) + return (MimeResult parsedResult httpResponse) -- | like 'dispatchMime', but only returns the decoded http body dispatchMime' - :: (Produces req accept, MimeUnrender accept res, MimeType contentType) + :: (Produces req accept, MimeUnrender accept res, MimeType contentType) => NH.Manager -- ^ http-client Connection manager -> SwaggerPetstoreConfig -- ^ config - -> SwaggerPetstoreRequest req contentType res -- ^ request - -> accept -- ^ "accept" 'MimeType' - -> IO (Either MimeError res) -- ^ response -dispatchMime' manager config request accept = do - MimeResult parsedResult _ <- dispatchMime manager config request accept - return parsedResult + -> SwaggerPetstoreRequest req contentType res -- ^ request + -> accept -- ^ "accept" 'MimeType' + -> IO (Either MimeError res) -- ^ response +dispatchMime' manager config request accept = do + MimeResult parsedResult _ <- dispatchMime manager config request accept + return parsedResult -- ** Unsafe -- | like 'dispatchReqLbs', but does not validate the operation is a 'Producer' of the "accept" 'MimeType'. (Useful if the server's response is undocumented) dispatchLbsUnsafe - :: (MimeType accept, MimeType contentType) + :: (MimeType accept, MimeType contentType) => NH.Manager -- ^ http-client Connection manager -> SwaggerPetstoreConfig -- ^ config - -> SwaggerPetstoreRequest req contentType res -- ^ request - -> accept -- ^ "accept" 'MimeType' + -> SwaggerPetstoreRequest req contentType res -- ^ request + -> accept -- ^ "accept" 'MimeType' -> IO (NH.Response BCL.ByteString) -- ^ response -dispatchLbsUnsafe manager config request accept = do - initReq <- _toInitRequest config request accept - dispatchInitUnsafe manager config initReq +dispatchLbsUnsafe manager config request accept = do + initReq <- _toInitRequest config request accept + dispatchInitUnsafe manager config initReq -- | dispatch an InitRequest dispatchInitUnsafe :: NH.Manager -- ^ http-client Connection manager -> SwaggerPetstoreConfig -- ^ config - -> InitRequest req contentType res accept -- ^ init request + -> InitRequest req contentType res accept -- ^ init request -> IO (NH.Response BCL.ByteString) -- ^ response -dispatchInitUnsafe manager config (InitRequest req) = do - runExceptionLoggingT logSrc config $ - do logNST LG.LevelInfo logSrc requestLogMsg - logNST LG.LevelDebug logSrc requestDbgLogMsg - res <- P.liftIO $ NH.httpLbs req manager - logNST LG.LevelInfo logSrc (responseLogMsg res) - logNST LG.LevelDebug logSrc ((T.pack . show) res) - return res +dispatchInitUnsafe manager config (InitRequest req) = do + runExceptionLoggingT logSrc config $ + do logNST LG.LevelInfo logSrc requestLogMsg + logNST LG.LevelDebug logSrc requestDbgLogMsg + res <- P.liftIO $ NH.httpLbs req manager + logNST LG.LevelInfo logSrc (responseLogMsg res) + logNST LG.LevelDebug logSrc ((T.pack . show) res) + return res where - logSrc = "Client" - endpoint = + logSrc = "Client" + endpoint = T.pack $ BC.unpack $ - NH.method req <> " " <> NH.host req <> NH.path req <> NH.queryString req - requestLogMsg = "REQ:" <> endpoint - requestDbgLogMsg = - "Headers=" <> (T.pack . show) (NH.requestHeaders req) <> " Body=" <> - (case NH.requestBody req of - NH.RequestBodyLBS xs -> T.decodeUtf8 (BL.toStrict xs) + NH.method req <> " " <> NH.host req <> NH.path req <> NH.queryString req + requestLogMsg = "REQ:" <> endpoint + requestDbgLogMsg = + "Headers=" <> (T.pack . show) (NH.requestHeaders req) <> " Body=" <> + (case NH.requestBody req of + NH.RequestBodyLBS xs -> T.decodeUtf8 (BL.toStrict xs) _ -> "<RequestBody>") - responseStatusCode = (T.pack . show) . NH.statusCode . NH.responseStatus - responseLogMsg res = - "RES:statusCode=" <> responseStatusCode res <> " (" <> endpoint <> ")" + responseStatusCode = (T.pack . show) . NH.statusCode . NH.responseStatus + responseLogMsg res = + "RES:statusCode=" <> responseStatusCode res <> " (" <> endpoint <> ")" -- * InitRequest -- | wraps an http-client 'Request' with request/response type parameters -newtype InitRequest req contentType res accept = InitRequest +newtype InitRequest req contentType res accept = InitRequest { unInitRequest :: NH.Request } deriving (Show) -- | Build an http-client 'Request' record from the supplied config and request _toInitRequest - :: (MimeType accept, MimeType contentType) + :: (MimeType accept, MimeType contentType) => SwaggerPetstoreConfig -- ^ config - -> SwaggerPetstoreRequest req contentType res -- ^ request - -> accept -- ^ "accept" 'MimeType' - -> IO (InitRequest req contentType res accept) -- ^ initialized request -_toInitRequest config req0 accept = do - parsedReq <- NH.parseRequest $ BCL.unpack $ BCL.append (configHost config) (BCL.concat (urlPath req0)) - let req1 = _setAcceptHeader req0 accept & _setContentTypeHeader - reqHeaders = ("User-Agent", WH.toHeader (configUserAgent config)) : paramsHeaders (params req1) - reqQuery = NH.renderQuery True (paramsQuery (params req1)) - pReq = parsedReq { NH.method = (rMethod req1) - , NH.requestHeaders = reqHeaders - , NH.queryString = reqQuery + -> SwaggerPetstoreRequest req contentType res -- ^ request + -> accept -- ^ "accept" 'MimeType' + -> IO (InitRequest req contentType res accept) -- ^ initialized request +_toInitRequest config req0 accept = do + parsedReq <- NH.parseRequest $ BCL.unpack $ BCL.append (configHost config) (BCL.concat (rUrlPath req0)) + let req1 = _setAcceptHeader req0 accept & _setContentTypeHeader + reqHeaders = ("User-Agent", WH.toHeader (configUserAgent config)) : paramsHeaders (rParams req1) + reqQuery = NH.renderQuery True (paramsQuery (rParams req1)) + pReq = parsedReq { NH.method = (rMethod req1) + , NH.requestHeaders = reqHeaders + , NH.queryString = reqQuery } - outReq <- case paramsBody (params req1) of - ParamBodyNone -> pure (pReq { NH.requestBody = mempty }) - ParamBodyB bs -> pure (pReq { NH.requestBody = NH.RequestBodyBS bs }) - ParamBodyBL bl -> pure (pReq { NH.requestBody = NH.RequestBodyLBS bl }) - ParamBodyFormUrlEncoded form -> pure (pReq { NH.requestBody = NH.RequestBodyLBS (WH.urlEncodeForm form) }) - ParamBodyMultipartFormData parts -> NH.formDataBody parts pReq + outReq <- case paramsBody (rParams req1) of + ParamBodyNone -> pure (pReq { NH.requestBody = mempty }) + ParamBodyB bs -> pure (pReq { NH.requestBody = NH.RequestBodyBS bs }) + ParamBodyBL bl -> pure (pReq { NH.requestBody = NH.RequestBodyLBS bl }) + ParamBodyFormUrlEncoded form -> pure (pReq { NH.requestBody = NH.RequestBodyLBS (WH.urlEncodeForm form) }) + ParamBodyMultipartFormData parts -> NH.formDataBody parts pReq - pure (InitRequest outReq) + pure (InitRequest outReq) -- | modify the underlying Request -modifyInitRequest :: InitRequest req contentType res accept -> (NH.Request -> NH.Request) -> InitRequest req contentType res accept -modifyInitRequest (InitRequest req) f = InitRequest (f req) +modifyInitRequest :: InitRequest req contentType res accept -> (NH.Request -> NH.Request) -> InitRequest req contentType res accept +modifyInitRequest (InitRequest req) f = InitRequest (f req) -- | modify the underlying Request (monadic) -modifyInitRequestM :: Monad m => InitRequest req contentType res accept -> (NH.Request -> m NH.Request) -> m (InitRequest req contentType res accept) -modifyInitRequestM (InitRequest req) f = fmap InitRequest (f req) +modifyInitRequestM :: Monad m => InitRequest req contentType res accept -> (NH.Request -> m NH.Request) -> m (InitRequest req contentType res accept) +modifyInitRequestM (InitRequest req) f = fmap InitRequest (f req) -- * Logging -- | A block using a MonadLogger instance -type ExecLoggingT = forall m. P.MonadIO m => - forall a. LG.LoggingT m a -> m a +type ExecLoggingT = forall m. P.MonadIO m => + forall a. LG.LoggingT m a -> m a -- ** Null Logger @@ -263,7 +263,7 @@ nullLogger _ _ _ _ = return () -- | run the monad transformer that disables logging -runNullLoggingT :: LG.LoggingT m a -> m a +runNullLoggingT :: LG.LoggingT m a -> m a runNullLoggingT = (`LG.runLoggingT` nullLogger) -- ** Logging Filters @@ -281,38 +281,38 @@ debugLevelFilter = minLevelFilter LG.LevelDebug minLevelFilter :: LG.LogLevel -> LG.LogSource -> LG.LogLevel -> Bool -minLevelFilter l _ l' = l' >= l +minLevelFilter l _ l' = l' >= l -- ** Logging -- | Log a message using the current time -logNST :: (P.MonadIO m, LG.MonadLogger m) => LG.LogLevel -> Text -> Text -> m () -logNST level src msg = do - now <- P.liftIO (formatTimeLog <$> TI.getCurrentTime) - LG.logOtherNS sourceLog level (now <> " " <> msg) +logNST :: (P.MonadIO m, LG.MonadLogger m) => LG.LogLevel -> Text -> Text -> m () +logNST level src msg = do + now <- P.liftIO (formatTimeLog <$> TI.getCurrentTime) + LG.logOtherNS sourceLog level (now <> " " <> msg) where - sourceLog = "SwaggerPetstore/" <> src - formatTimeLog = + sourceLog = "SwaggerPetstore/" <> src + formatTimeLog = T.pack . TI.formatTime TI.defaultTimeLocale "%Y-%m-%dT%H:%M:%S%Z" -- | re-throws exceptions after logging them logExceptions - :: (LG.MonadLogger m, E.MonadCatch m, P.MonadIO m) - => Text -> m a -> m a -logExceptions src = + :: (LG.MonadLogger m, E.MonadCatch m, P.MonadIO m) + => Text -> m a -> m a +logExceptions src = E.handle - (\(e :: E.SomeException) -> do - logNST LG.LevelError src ((T.pack . show) e) - E.throw e) + (\(e :: E.SomeException) -> do + logNST LG.LevelError src ((T.pack . show) e) + E.throw e) -- | Run a block using the configured MonadLogger instance runLoggingT :: SwaggerPetstoreConfig -> ExecLoggingT -runLoggingT config = - configExecLoggingT config . LG.filterLogger (configLoggingFilter config) +runLoggingT config = + configExecLoggingT config . LG.filterLogger (configLoggingFilter config) -- | Run a block using the configured MonadLogger instance (logs exceptions) runExceptionLoggingT - :: (E.MonadCatch m, P.MonadIO m) - => T.Text -> SwaggerPetstoreConfig -> LG.LoggingT m a -> m a -runExceptionLoggingT logSrc config = runLoggingT config . logExceptions logSrc + :: (E.MonadCatch m, P.MonadIO m) + => T.Text -> SwaggerPetstoreConfig -> LG.LoggingT m a -> m a +runExceptionLoggingT logSrc config = runLoggingT config . logExceptions logSrc \ No newline at end of file diff --git a/samples/client/petstore/haskell-http-client/docs/src/SwaggerPetstore.Lens.html b/samples/client/petstore/haskell-http-client/docs/src/SwaggerPetstore.Lens.html index 83e9ff79157..72210d62f14 100644 --- a/samples/client/petstore/haskell-http-client/docs/src/SwaggerPetstore.Lens.html +++ b/samples/client/petstore/haskell-http-client/docs/src/SwaggerPetstore.Lens.html @@ -29,25 +29,25 @@ -- * Type Aliases -type Lens_' s a = Lens_ s s a a -type Lens_ s t a b = forall (f :: * -> *). Functor f => (a -> f b) -> s -> f t +type Lens_' s a = Lens_ s s a a +type Lens_ s t a b = forall (f :: * -> *). Functor f => (a -> f b) -> s -> f t -- * ApiResponse -- | 'apiResponseCode' Lens apiResponseCodeL :: Lens_' ApiResponse (Maybe Int) -apiResponseCodeL f ApiResponse{..} = (\apiResponseCode -> ApiResponse { apiResponseCode, ..} ) <$> f apiResponseCode +apiResponseCodeL f ApiResponse{..} = (\apiResponseCode -> ApiResponse { apiResponseCode, ..} ) <$> f apiResponseCode {-# INLINE apiResponseCodeL #-} -- | 'apiResponseType' Lens apiResponseTypeL :: Lens_' ApiResponse (Maybe Text) -apiResponseTypeL f ApiResponse{..} = (\apiResponseType -> ApiResponse { apiResponseType, ..} ) <$> f apiResponseType +apiResponseTypeL f ApiResponse{..} = (\apiResponseType -> ApiResponse { apiResponseType, ..} ) <$> f apiResponseType {-# INLINE apiResponseTypeL #-} -- | 'apiResponseMessage' Lens apiResponseMessageL :: Lens_' ApiResponse (Maybe Text) -apiResponseMessageL f ApiResponse{..} = (\apiResponseMessage -> ApiResponse { apiResponseMessage, ..} ) <$> f apiResponseMessage +apiResponseMessageL f ApiResponse{..} = (\apiResponseMessage -> ApiResponse { apiResponseMessage, ..} ) <$> f apiResponseMessage {-# INLINE apiResponseMessageL #-} @@ -56,12 +56,12 @@ -- | 'categoryId' Lens categoryIdL :: Lens_' Category (Maybe Integer) -categoryIdL f Category{..} = (\categoryId -> Category { categoryId, ..} ) <$> f categoryId +categoryIdL f Category{..} = (\categoryId -> Category { categoryId, ..} ) <$> f categoryId {-# INLINE categoryIdL #-} -- | 'categoryName' Lens categoryNameL :: Lens_' Category (Maybe Text) -categoryNameL f Category{..} = (\categoryName -> Category { categoryName, ..} ) <$> f categoryName +categoryNameL f Category{..} = (\categoryName -> Category { categoryName, ..} ) <$> f categoryName {-# INLINE categoryNameL #-} @@ -70,32 +70,32 @@ -- | 'orderId' Lens orderIdL :: Lens_' Order (Maybe Integer) -orderIdL f Order{..} = (\orderId -> Order { orderId, ..} ) <$> f orderId +orderIdL f Order{..} = (\orderId -> Order { orderId, ..} ) <$> f orderId {-# INLINE orderIdL #-} -- | 'orderPetId' Lens orderPetIdL :: Lens_' Order (Maybe Integer) -orderPetIdL f Order{..} = (\orderPetId -> Order { orderPetId, ..} ) <$> f orderPetId +orderPetIdL f Order{..} = (\orderPetId -> Order { orderPetId, ..} ) <$> f orderPetId {-# INLINE orderPetIdL #-} -- | 'orderQuantity' Lens orderQuantityL :: Lens_' Order (Maybe Int) -orderQuantityL f Order{..} = (\orderQuantity -> Order { orderQuantity, ..} ) <$> f orderQuantity +orderQuantityL f Order{..} = (\orderQuantity -> Order { orderQuantity, ..} ) <$> f orderQuantity {-# INLINE orderQuantityL #-} -- | 'orderShipDate' Lens orderShipDateL :: Lens_' Order (Maybe UTCTime) -orderShipDateL f Order{..} = (\orderShipDate -> Order { orderShipDate, ..} ) <$> f orderShipDate +orderShipDateL f Order{..} = (\orderShipDate -> Order { orderShipDate, ..} ) <$> f orderShipDate {-# INLINE orderShipDateL #-} -- | 'orderStatus' Lens orderStatusL :: Lens_' Order (Maybe Text) -orderStatusL f Order{..} = (\orderStatus -> Order { orderStatus, ..} ) <$> f orderStatus +orderStatusL f Order{..} = (\orderStatus -> Order { orderStatus, ..} ) <$> f orderStatus {-# INLINE orderStatusL #-} -- | 'orderComplete' Lens orderCompleteL :: Lens_' Order (Maybe Bool) -orderCompleteL f Order{..} = (\orderComplete -> Order { orderComplete, ..} ) <$> f orderComplete +orderCompleteL f Order{..} = (\orderComplete -> Order { orderComplete, ..} ) <$> f orderComplete {-# INLINE orderCompleteL #-} @@ -104,32 +104,32 @@ -- | 'petId' Lens petIdL :: Lens_' Pet (Maybe Integer) -petIdL f Pet{..} = (\petId -> Pet { petId, ..} ) <$> f petId +petIdL f Pet{..} = (\petId -> Pet { petId, ..} ) <$> f petId {-# INLINE petIdL #-} -- | 'petCategory' Lens petCategoryL :: Lens_' Pet (Maybe Category) -petCategoryL f Pet{..} = (\petCategory -> Pet { petCategory, ..} ) <$> f petCategory +petCategoryL f Pet{..} = (\petCategory -> Pet { petCategory, ..} ) <$> f petCategory {-# INLINE petCategoryL #-} -- | 'petName' Lens petNameL :: Lens_' Pet (Text) -petNameL f Pet{..} = (\petName -> Pet { petName, ..} ) <$> f petName +petNameL f Pet{..} = (\petName -> Pet { petName, ..} ) <$> f petName {-# INLINE petNameL #-} -- | 'petPhotoUrls' Lens petPhotoUrlsL :: Lens_' Pet ([Text]) -petPhotoUrlsL f Pet{..} = (\petPhotoUrls -> Pet { petPhotoUrls, ..} ) <$> f petPhotoUrls +petPhotoUrlsL f Pet{..} = (\petPhotoUrls -> Pet { petPhotoUrls, ..} ) <$> f petPhotoUrls {-# INLINE petPhotoUrlsL #-} -- | 'petTags' Lens petTagsL :: Lens_' Pet (Maybe [Tag]) -petTagsL f Pet{..} = (\petTags -> Pet { petTags, ..} ) <$> f petTags +petTagsL f Pet{..} = (\petTags -> Pet { petTags, ..} ) <$> f petTags {-# INLINE petTagsL #-} -- | 'petStatus' Lens petStatusL :: Lens_' Pet (Maybe Text) -petStatusL f Pet{..} = (\petStatus -> Pet { petStatus, ..} ) <$> f petStatus +petStatusL f Pet{..} = (\petStatus -> Pet { petStatus, ..} ) <$> f petStatus {-# INLINE petStatusL #-} @@ -138,12 +138,12 @@ -- | 'tagId' Lens tagIdL :: Lens_' Tag (Maybe Integer) -tagIdL f Tag{..} = (\tagId -> Tag { tagId, ..} ) <$> f tagId +tagIdL f Tag{..} = (\tagId -> Tag { tagId, ..} ) <$> f tagId {-# INLINE tagIdL #-} -- | 'tagName' Lens tagNameL :: Lens_' Tag (Maybe Text) -tagNameL f Tag{..} = (\tagName -> Tag { tagName, ..} ) <$> f tagName +tagNameL f Tag{..} = (\tagName -> Tag { tagName, ..} ) <$> f tagName {-# INLINE tagNameL #-} @@ -152,42 +152,42 @@ -- | 'userId' Lens userIdL :: Lens_' User (Maybe Integer) -userIdL f User{..} = (\userId -> User { userId, ..} ) <$> f userId +userIdL f User{..} = (\userId -> User { userId, ..} ) <$> f userId {-# INLINE userIdL #-} -- | 'userUsername' Lens userUsernameL :: Lens_' User (Maybe Text) -userUsernameL f User{..} = (\userUsername -> User { userUsername, ..} ) <$> f userUsername +userUsernameL f User{..} = (\userUsername -> User { userUsername, ..} ) <$> f userUsername {-# INLINE userUsernameL #-} -- | 'userFirstName' Lens userFirstNameL :: Lens_' User (Maybe Text) -userFirstNameL f User{..} = (\userFirstName -> User { userFirstName, ..} ) <$> f userFirstName +userFirstNameL f User{..} = (\userFirstName -> User { userFirstName, ..} ) <$> f userFirstName {-# INLINE userFirstNameL #-} -- | 'userLastName' Lens userLastNameL :: Lens_' User (Maybe Text) -userLastNameL f User{..} = (\userLastName -> User { userLastName, ..} ) <$> f userLastName +userLastNameL f User{..} = (\userLastName -> User { userLastName, ..} ) <$> f userLastName {-# INLINE userLastNameL #-} -- | 'userEmail' Lens userEmailL :: Lens_' User (Maybe Text) -userEmailL f User{..} = (\userEmail -> User { userEmail, ..} ) <$> f userEmail +userEmailL f User{..} = (\userEmail -> User { userEmail, ..} ) <$> f userEmail {-# INLINE userEmailL #-} -- | 'userPassword' Lens userPasswordL :: Lens_' User (Maybe Text) -userPasswordL f User{..} = (\userPassword -> User { userPassword, ..} ) <$> f userPassword +userPasswordL f User{..} = (\userPassword -> User { userPassword, ..} ) <$> f userPassword {-# INLINE userPasswordL #-} -- | 'userPhone' Lens userPhoneL :: Lens_' User (Maybe Text) -userPhoneL f User{..} = (\userPhone -> User { userPhone, ..} ) <$> f userPhone +userPhoneL f User{..} = (\userPhone -> User { userPhone, ..} ) <$> f userPhone {-# INLINE userPhoneL #-} -- | 'userUserStatus' Lens userUserStatusL :: Lens_' User (Maybe Int) -userUserStatusL f User{..} = (\userUserStatus -> User { userUserStatus, ..} ) <$> f userUserStatus +userUserStatusL f User{..} = (\userUserStatus -> User { userUserStatus, ..} ) <$> f userUserStatus {-# INLINE userUserStatusL #-} diff --git a/samples/client/petstore/haskell-http-client/docs/src/SwaggerPetstore.MimeTypes.html b/samples/client/petstore/haskell-http-client/docs/src/SwaggerPetstore.MimeTypes.html index fa8a6de4131..cec9866dffa 100644 --- a/samples/client/petstore/haskell-http-client/docs/src/SwaggerPetstore.MimeTypes.html +++ b/samples/client/petstore/haskell-http-client/docs/src/SwaggerPetstore.MimeTypes.html @@ -54,94 +54,94 @@ -- ** MimeType Class -class P.Typeable mtype => MimeType mtype where +class P.Typeable mtype => MimeType mtype where {-# MINIMAL mimeType | mimeTypes #-} - mimeTypes :: P.Proxy mtype -> [ME.MediaType] - mimeTypes p = - case mimeType p of - Just x -> [x] + mimeTypes :: P.Proxy mtype -> [ME.MediaType] + mimeTypes p = + case mimeType p of + Just x -> [x] Nothing -> [] - mimeType :: P.Proxy mtype -> Maybe ME.MediaType - mimeType p = - case mimeTypes p of + mimeType :: P.Proxy mtype -> Maybe ME.MediaType + mimeType p = + case mimeTypes p of [] -> Nothing - (x:_) -> Just x + (x:_) -> Just x - mimeType' :: mtype -> Maybe ME.MediaType - mimeType' _ = mimeType (P.Proxy :: P.Proxy mtype) - mimeTypes' :: mtype -> [ME.MediaType] - mimeTypes' _ = mimeTypes (P.Proxy :: P.Proxy mtype) + mimeType' :: mtype -> Maybe ME.MediaType + mimeType' _ = mimeType (P.Proxy :: P.Proxy mtype) + mimeTypes' :: mtype -> [ME.MediaType] + mimeTypes' _ = mimeTypes (P.Proxy :: P.Proxy mtype) -- ** MimeType Instances -- | @application/json@ instance MimeType MimeJSON where - mimeTypes _ = + mimeTypes _ = [ "application" ME.// "json" ME./: ("charset", "utf-8") , "application" ME.// "json" ] -- | @application/xml@ instance MimeType MimeXML where - mimeType _ = Just $ "application" ME.// "xml" + mimeType _ = Just $ "application" ME.// "xml" -- | @application/x-www-form-urlencoded@ instance MimeType MimeFormUrlEncoded where - mimeType _ = Just $ "application" ME.// "x-www-form-urlencoded" + mimeType _ = Just $ "application" ME.// "x-www-form-urlencoded" -- | @multipart/form-data@ instance MimeType MimeMultipartFormData where - mimeType _ = Just $ "multipart" ME.// "form-data" + mimeType _ = Just $ "multipart" ME.// "form-data" -- | @text/plain;charset=utf-8@ instance MimeType MimePlainText where - mimeType _ = Just $ "text" ME.// "plain" ME./: ("charset", "utf-8") + mimeType _ = Just $ "text" ME.// "plain" ME./: ("charset", "utf-8") instance MimeType MimeOctetStream where - mimeType _ = Just $ "application" ME.// "octet-stream" + mimeType _ = Just $ "application" ME.// "octet-stream" instance MimeType MimeNoContent where - mimeType _ = Nothing + mimeType _ = Nothing -- ** MimeRender Class -class MimeType mtype => MimeRender mtype x where - mimeRender :: P.Proxy mtype -> x -> BL.ByteString - mimeRender' :: mtype -> x -> BL.ByteString - mimeRender' _ x = mimeRender (P.Proxy :: P.Proxy mtype) x +class MimeType mtype => MimeRender mtype x where + mimeRender :: P.Proxy mtype -> x -> BL.ByteString + mimeRender' :: mtype -> x -> BL.ByteString + mimeRender' _ x = mimeRender (P.Proxy :: P.Proxy mtype) x -- ** MimeRender Instances -- | `A.encode` -instance A.ToJSON a => MimeRender MimeJSON a where mimeRender _ = A.encode +instance A.ToJSON a => MimeRender MimeJSON a where mimeRender _ = A.encode -- | @WH.urlEncodeAsForm@ -instance WH.ToForm a => MimeRender MimeFormUrlEncoded a where mimeRender _ = WH.urlEncodeAsForm +instance WH.ToForm a => MimeRender MimeFormUrlEncoded a where mimeRender _ = WH.urlEncodeAsForm -- | @P.id@ -instance MimeRender MimePlainText BL.ByteString where mimeRender _ = P.id +instance MimeRender MimePlainText BL.ByteString where mimeRender _ = P.id -- | @BL.fromStrict . T.encodeUtf8@ -instance MimeRender MimePlainText T.Text where mimeRender _ = BL.fromStrict . T.encodeUtf8 +instance MimeRender MimePlainText T.Text where mimeRender _ = BL.fromStrict . T.encodeUtf8 -- | @BCL.pack@ -instance MimeRender MimePlainText String where mimeRender _ = BCL.pack +instance MimeRender MimePlainText String where mimeRender _ = BCL.pack -- | @P.id@ -instance MimeRender MimeOctetStream BL.ByteString where mimeRender _ = P.id +instance MimeRender MimeOctetStream BL.ByteString where mimeRender _ = P.id -- | @BL.fromStrict . T.encodeUtf8@ -instance MimeRender MimeOctetStream T.Text where mimeRender _ = BL.fromStrict . T.encodeUtf8 +instance MimeRender MimeOctetStream T.Text where mimeRender _ = BL.fromStrict . T.encodeUtf8 -- | @BCL.pack@ -instance MimeRender MimeOctetStream String where mimeRender _ = BCL.pack +instance MimeRender MimeOctetStream String where mimeRender _ = BCL.pack -- | @P.id@ -instance MimeRender MimeMultipartFormData BL.ByteString where mimeRender _ = P.id +instance MimeRender MimeMultipartFormData BL.ByteString where mimeRender _ = P.id -- | @BL.fromStrict . T.encodeUtf8@ -instance MimeRender MimeMultipartFormData T.Text where mimeRender _ = BL.fromStrict . T.encodeUtf8 +instance MimeRender MimeMultipartFormData T.Text where mimeRender _ = BL.fromStrict . T.encodeUtf8 -- | @BCL.pack@ -instance MimeRender MimeMultipartFormData String where mimeRender _ = BCL.pack +instance MimeRender MimeMultipartFormData String where mimeRender _ = BCL.pack -- | @P.Right . P.const NoContent@ -instance MimeRender MimeNoContent NoContent where mimeRender _ = P.const BCL.empty +instance MimeRender MimeNoContent NoContent where mimeRender _ = P.const BCL.empty -- instance MimeRender MimeOctetStream Double where mimeRender _ = BB.toLazyByteString . BB.doubleDec -- instance MimeRender MimeOctetStream Float where mimeRender _ = BB.toLazyByteString . BB.floatDec @@ -151,41 +151,41 @@ -- ** MimeUnrender Class -class MimeType mtype => MimeUnrender mtype o where - mimeUnrender :: P.Proxy mtype -> BL.ByteString -> P.Either String o - mimeUnrender' :: mtype -> BL.ByteString -> P.Either String o - mimeUnrender' _ x = mimeUnrender (P.Proxy :: P.Proxy mtype) x +class MimeType mtype => MimeUnrender mtype o where + mimeUnrender :: P.Proxy mtype -> BL.ByteString -> P.Either String o + mimeUnrender' :: mtype -> BL.ByteString -> P.Either String o + mimeUnrender' _ x = mimeUnrender (P.Proxy :: P.Proxy mtype) x -- ** MimeUnrender Instances -- | @A.eitherDecode@ -instance A.FromJSON a => MimeUnrender MimeJSON a where mimeUnrender _ = A.eitherDecode +instance A.FromJSON a => MimeUnrender MimeJSON a where mimeUnrender _ = A.eitherDecode -- | @P.left T.unpack . WH.urlDecodeAsForm@ -instance WH.FromForm a => MimeUnrender MimeFormUrlEncoded a where mimeUnrender _ = P.left T.unpack . WH.urlDecodeAsForm +instance WH.FromForm a => MimeUnrender MimeFormUrlEncoded a where mimeUnrender _ = P.left T.unpack . WH.urlDecodeAsForm -- | @P.Right . P.id@ -instance MimeUnrender MimePlainText BL.ByteString where mimeUnrender _ = P.Right . P.id +instance MimeUnrender MimePlainText BL.ByteString where mimeUnrender _ = P.Right . P.id -- | @P.left P.show . TL.decodeUtf8'@ -instance MimeUnrender MimePlainText T.Text where mimeUnrender _ = P.left P.show . T.decodeUtf8' . BL.toStrict +instance MimeUnrender MimePlainText T.Text where mimeUnrender _ = P.left P.show . T.decodeUtf8' . BL.toStrict -- | @P.Right . BCL.unpack@ -instance MimeUnrender MimePlainText String where mimeUnrender _ = P.Right . BCL.unpack +instance MimeUnrender MimePlainText String where mimeUnrender _ = P.Right . BCL.unpack -- | @P.Right . P.id@ -instance MimeUnrender MimeOctetStream BL.ByteString where mimeUnrender _ = P.Right . P.id +instance MimeUnrender MimeOctetStream BL.ByteString where mimeUnrender _ = P.Right . P.id -- | @P.left P.show . T.decodeUtf8' . BL.toStrict@ -instance MimeUnrender MimeOctetStream T.Text where mimeUnrender _ = P.left P.show . T.decodeUtf8' . BL.toStrict +instance MimeUnrender MimeOctetStream T.Text where mimeUnrender _ = P.left P.show . T.decodeUtf8' . BL.toStrict -- | @P.Right . BCL.unpack@ -instance MimeUnrender MimeOctetStream String where mimeUnrender _ = P.Right . BCL.unpack +instance MimeUnrender MimeOctetStream String where mimeUnrender _ = P.Right . BCL.unpack -- | @P.Right . P.const NoContent@ -instance MimeUnrender MimeNoContent NoContent where mimeUnrender _ = P.Right . P.const NoContent +instance MimeUnrender MimeNoContent NoContent where mimeUnrender _ = P.Right . P.const NoContent -- ** Request Consumes -class MimeType mtype => Consumes req mtype where +class MimeType mtype => Consumes req mtype where -- ** Request Produces -class MimeType mtype => Produces req mtype where +class MimeType mtype => Produces req mtype where \ No newline at end of file diff --git a/samples/client/petstore/haskell-http-client/docs/src/SwaggerPetstore.Model.html b/samples/client/petstore/haskell-http-client/docs/src/SwaggerPetstore.Model.html index 1dd3fd817c3..ebdc681521a 100644 --- a/samples/client/petstore/haskell-http-client/docs/src/SwaggerPetstore.Model.html +++ b/samples/client/petstore/haskell-http-client/docs/src/SwaggerPetstore.Model.html @@ -2,377 +2,376 @@ Module : SwaggerPetstore.Model -} -{-# LANGUAGE DeriveAnyClass #-} -{-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE DeriveFoldable #-} -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE DeriveTraversable #-} -{-# LANGUAGE GeneralizedNewtypeDeriving #-} -{-# LANGUAGE NamedFieldPuns #-} -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE RecordWildCards #-} -{-# LANGUAGE TupleSections #-} -{-# LANGUAGE TypeFamilies #-} -{-# OPTIONS_GHC -fno-warn-unused-matches -fno-warn-unused-binds -fno-warn-unused-imports #-} - -module SwaggerPetstore.Model where - -import Data.Aeson ((.:),(.:!),(.:?),(.=)) -import Data.Text (Text) - -import Data.Aeson (Value) -import Data.ByteString.Lazy (ByteString) - -import qualified Data.Aeson as A -import qualified Data.ByteString as B -import qualified Data.Data as P (Data, Typeable) -import qualified Data.HashMap.Lazy as HM -import qualified Data.Map as Map -import qualified Data.Maybe as P -import qualified Data.Foldable as P -import qualified Web.FormUrlEncoded as WH -import qualified Web.HttpApiData as WH - -import qualified Data.Time as TI -import qualified Data.Time.ISO8601 as TI -import Data.Time (UTCTime) - -import Control.Applicative ((<|>)) -import Control.Applicative (Alternative) -import Prelude (($), (.),(<$>),(<*>),(>>=),Maybe(..),Bool(..),Char,Double,FilePath,Float,Int,Integer,String,fmap,undefined,mempty,maybe,pure,Monad,Applicative,Functor) -import qualified Prelude as P +{-# LANGUAGE DeriveDataTypeable #-} +{-# LANGUAGE DeriveFoldable #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DeriveTraversable #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE TupleSections #-} +{-# LANGUAGE TypeFamilies #-} +{-# OPTIONS_GHC -fno-warn-unused-matches -fno-warn-unused-binds -fno-warn-unused-imports #-} + +module SwaggerPetstore.Model where + +import Data.Aeson ((.:),(.:!),(.:?),(.=)) +import Data.Text (Text) + +import Data.Aeson (Value) +import Data.ByteString.Lazy (ByteString) + +import qualified Data.Aeson as A +import qualified Data.ByteString as B +import qualified Data.Data as P (Data, Typeable) +import qualified Data.HashMap.Lazy as HM +import qualified Data.Map as Map +import qualified Data.Maybe as P +import qualified Data.Foldable as P +import qualified Web.FormUrlEncoded as WH +import qualified Web.HttpApiData as WH + +import qualified Data.Time as TI +import qualified Data.Time.ISO8601 as TI +import Data.Time (UTCTime) + +import Control.Applicative ((<|>)) +import Control.Applicative (Alternative) +import Prelude (($), (.),(<$>),(<*>),(>>=),Maybe(..),Bool(..),Char,Double,FilePath,Float,Int,Integer,String,fmap,undefined,mempty,maybe,pure,Monad,Applicative,Functor) +import qualified Prelude as P + - --- * Models +-- * Models + - --- ** ApiResponse --- | --- An uploaded response --- --- Describes the result of uploading an image resource -data ApiResponse = ApiResponse - { apiResponseCode :: Maybe Int -- ^ "code" - , apiResponseType :: Maybe Text -- ^ "type" - , apiResponseMessage :: Maybe Text -- ^ "message" - } deriving (P.Show,P.Eq,P.Typeable) - -instance A.FromJSON ApiResponse where - parseJSON = A.withObject "ApiResponse" $ \o -> - ApiResponse - <$> (o .:? "code") - <*> (o .:? "type") - <*> (o .:? "message") - -instance A.ToJSON ApiResponse where - toJSON ApiResponse {..} = - _omitNulls - [ "code" .= apiResponseCode - , "type" .= apiResponseType - , "message" .= apiResponseMessage - ] +-- ** ApiResponse +-- | +-- An uploaded response +-- +-- Describes the result of uploading an image resource +data ApiResponse = ApiResponse + { apiResponseCode :: Maybe Int -- ^ "code" + , apiResponseType :: Maybe Text -- ^ "type" + , apiResponseMessage :: Maybe Text -- ^ "message" + } deriving (P.Show,P.Eq,P.Typeable) + +instance A.FromJSON ApiResponse where + parseJSON = A.withObject "ApiResponse" $ \o -> + ApiResponse + <$> (o .:? "code") + <*> (o .:? "type") + <*> (o .:? "message") + +instance A.ToJSON ApiResponse where + toJSON ApiResponse {..} = + _omitNulls + [ "code" .= apiResponseCode + , "type" .= apiResponseType + , "message" .= apiResponseMessage + ] + - --- | Construct a value of type 'ApiResponse' (by applying it's required fields, if any) -mkApiResponse - :: ApiResponse -mkApiResponse = - ApiResponse - { apiResponseCode = Nothing - , apiResponseType = Nothing - , apiResponseMessage = Nothing - } - +-- | Construct a value of type 'ApiResponse' (by applying it's required fields, if any) +mkApiResponse + :: ApiResponse +mkApiResponse = + ApiResponse + { apiResponseCode = Nothing + , apiResponseType = Nothing + , apiResponseMessage = Nothing + } + + - --- ** Category --- | --- Pet catehgry --- --- A category for a pet -data Category = Category - { categoryId :: Maybe Integer -- ^ "id" - , categoryName :: Maybe Text -- ^ "name" - } deriving (P.Show,P.Eq,P.Typeable) - -instance A.FromJSON Category where - parseJSON = A.withObject "Category" $ \o -> - Category - <$> (o .:? "id") - <*> (o .:? "name") - -instance A.ToJSON Category where - toJSON Category {..} = - _omitNulls - [ "id" .= categoryId - , "name" .= categoryName - ] +-- ** Category +-- | +-- Pet catehgry +-- +-- A category for a pet +data Category = Category + { categoryId :: Maybe Integer -- ^ "id" + , categoryName :: Maybe Text -- ^ "name" + } deriving (P.Show,P.Eq,P.Typeable) + +instance A.FromJSON Category where + parseJSON = A.withObject "Category" $ \o -> + Category + <$> (o .:? "id") + <*> (o .:? "name") + +instance A.ToJSON Category where + toJSON Category {..} = + _omitNulls + [ "id" .= categoryId + , "name" .= categoryName + ] + - --- | Construct a value of type 'Category' (by applying it's required fields, if any) -mkCategory - :: Category -mkCategory = - Category - { categoryId = Nothing - , categoryName = Nothing - } - +-- | Construct a value of type 'Category' (by applying it's required fields, if any) +mkCategory + :: Category +mkCategory = + Category + { categoryId = Nothing + , categoryName = Nothing + } + + - --- ** Order --- | --- Pet Order --- --- An order for a pets from the pet store -data Order = Order - { orderId :: Maybe Integer -- ^ "id" - , orderPetId :: Maybe Integer -- ^ "petId" - , orderQuantity :: Maybe Int -- ^ "quantity" - , orderShipDate :: Maybe UTCTime -- ^ "shipDate" - , orderStatus :: Maybe Text -- ^ "status" - Order Status - , orderComplete :: Maybe Bool -- ^ "complete" - } deriving (P.Show,P.Eq,P.Typeable) - -instance A.FromJSON Order where - parseJSON = A.withObject "Order" $ \o -> - Order - <$> (o .:? "id") - <*> (o .:? "petId") - <*> (o .:? "quantity") - <*> (o .:? "shipDate" >>= P.mapM _readDateTime) - <*> (o .:? "status") - <*> (o .:? "complete") - -instance A.ToJSON Order where - toJSON Order {..} = - _omitNulls - [ "id" .= orderId - , "petId" .= orderPetId - , "quantity" .= orderQuantity - , "shipDate" .= P.fmap _showDateTime orderShipDate - , "status" .= orderStatus - , "complete" .= orderComplete - ] +-- ** Order +-- | +-- Pet Order +-- +-- An order for a pets from the pet store +data Order = Order + { orderId :: Maybe Integer -- ^ "id" + , orderPetId :: Maybe Integer -- ^ "petId" + , orderQuantity :: Maybe Int -- ^ "quantity" + , orderShipDate :: Maybe UTCTime -- ^ "shipDate" + , orderStatus :: Maybe Text -- ^ "status" - Order Status + , orderComplete :: Maybe Bool -- ^ "complete" + } deriving (P.Show,P.Eq,P.Typeable) + +instance A.FromJSON Order where + parseJSON = A.withObject "Order" $ \o -> + Order + <$> (o .:? "id") + <*> (o .:? "petId") + <*> (o .:? "quantity") + <*> (o .:? "shipDate" >>= P.mapM _readDateTime) + <*> (o .:? "status") + <*> (o .:? "complete") + +instance A.ToJSON Order where + toJSON Order {..} = + _omitNulls + [ "id" .= orderId + , "petId" .= orderPetId + , "quantity" .= orderQuantity + , "shipDate" .= P.fmap _showDateTime orderShipDate + , "status" .= orderStatus + , "complete" .= orderComplete + ] + - --- | Construct a value of type 'Order' (by applying it's required fields, if any) -mkOrder - :: Order -mkOrder = - Order - { orderId = Nothing - , orderPetId = Nothing - , orderQuantity = Nothing - , orderShipDate = Nothing - , orderStatus = Nothing - , orderComplete = Nothing - } - +-- | Construct a value of type 'Order' (by applying it's required fields, if any) +mkOrder + :: Order +mkOrder = + Order + { orderId = Nothing + , orderPetId = Nothing + , orderQuantity = Nothing + , orderShipDate = Nothing + , orderStatus = Nothing + , orderComplete = Nothing + } + + - --- ** Pet --- | --- a Pet --- --- A pet for sale in the pet store -data Pet = Pet - { petId :: Maybe Integer -- ^ "id" - , petCategory :: Maybe Category -- ^ "category" - , petName :: Text -- ^ /Required/ "name" - , petPhotoUrls :: [Text] -- ^ /Required/ "photoUrls" - , petTags :: Maybe [Tag] -- ^ "tags" - , petStatus :: Maybe Text -- ^ "status" - pet status in the store - } deriving (P.Show,P.Eq,P.Typeable) - -instance A.FromJSON Pet where - parseJSON = A.withObject "Pet" $ \o -> - Pet - <$> (o .:? "id") - <*> (o .:? "category") - <*> (o .: "name") - <*> (o .: "photoUrls") - <*> (o .:? "tags") - <*> (o .:? "status") - -instance A.ToJSON Pet where - toJSON Pet {..} = - _omitNulls - [ "id" .= petId - , "category" .= petCategory - , "name" .= petName - , "photoUrls" .= petPhotoUrls - , "tags" .= petTags - , "status" .= petStatus - ] +-- ** Pet +-- | +-- a Pet +-- +-- A pet for sale in the pet store +data Pet = Pet + { petId :: Maybe Integer -- ^ "id" + , petCategory :: Maybe Category -- ^ "category" + , petName :: Text -- ^ /Required/ "name" + , petPhotoUrls :: [Text] -- ^ /Required/ "photoUrls" + , petTags :: Maybe [Tag] -- ^ "tags" + , petStatus :: Maybe Text -- ^ "status" - pet status in the store + } deriving (P.Show,P.Eq,P.Typeable) + +instance A.FromJSON Pet where + parseJSON = A.withObject "Pet" $ \o -> + Pet + <$> (o .:? "id") + <*> (o .:? "category") + <*> (o .: "name") + <*> (o .: "photoUrls") + <*> (o .:? "tags") + <*> (o .:? "status") + +instance A.ToJSON Pet where + toJSON Pet {..} = + _omitNulls + [ "id" .= petId + , "category" .= petCategory + , "name" .= petName + , "photoUrls" .= petPhotoUrls + , "tags" .= petTags + , "status" .= petStatus + ] + - --- | Construct a value of type 'Pet' (by applying it's required fields, if any) -mkPet - :: Text -- ^ 'petName' - -> [Text] -- ^ 'petPhotoUrls' - -> Pet -mkPet petName petPhotoUrls = - Pet - { petId = Nothing - , petCategory = Nothing - , petName - , petPhotoUrls - , petTags = Nothing - , petStatus = Nothing - } - +-- | Construct a value of type 'Pet' (by applying it's required fields, if any) +mkPet + :: Text -- ^ 'petName' + -> [Text] -- ^ 'petPhotoUrls' + -> Pet +mkPet petName petPhotoUrls = + Pet + { petId = Nothing + , petCategory = Nothing + , petName + , petPhotoUrls + , petTags = Nothing + , petStatus = Nothing + } + + - --- ** Tag --- | --- Pet Tag --- --- A tag for a pet -data Tag = Tag - { tagId :: Maybe Integer -- ^ "id" - , tagName :: Maybe Text -- ^ "name" - } deriving (P.Show,P.Eq,P.Typeable) - -instance A.FromJSON Tag where - parseJSON = A.withObject "Tag" $ \o -> - Tag - <$> (o .:? "id") - <*> (o .:? "name") - -instance A.ToJSON Tag where - toJSON Tag {..} = - _omitNulls - [ "id" .= tagId - , "name" .= tagName - ] +-- ** Tag +-- | +-- Pet Tag +-- +-- A tag for a pet +data Tag = Tag + { tagId :: Maybe Integer -- ^ "id" + , tagName :: Maybe Text -- ^ "name" + } deriving (P.Show,P.Eq,P.Typeable) + +instance A.FromJSON Tag where + parseJSON = A.withObject "Tag" $ \o -> + Tag + <$> (o .:? "id") + <*> (o .:? "name") + +instance A.ToJSON Tag where + toJSON Tag {..} = + _omitNulls + [ "id" .= tagId + , "name" .= tagName + ] + - --- | Construct a value of type 'Tag' (by applying it's required fields, if any) -mkTag - :: Tag -mkTag = - Tag - { tagId = Nothing - , tagName = Nothing - } - +-- | Construct a value of type 'Tag' (by applying it's required fields, if any) +mkTag + :: Tag +mkTag = + Tag + { tagId = Nothing + , tagName = Nothing + } + + - --- ** User --- | --- a User --- --- A User who is purchasing from the pet store -data User = User - { userId :: Maybe Integer -- ^ "id" - , userUsername :: Maybe Text -- ^ "username" - , userFirstName :: Maybe Text -- ^ "firstName" - , userLastName :: Maybe Text -- ^ "lastName" - , userEmail :: Maybe Text -- ^ "email" - , userPassword :: Maybe Text -- ^ "password" - , userPhone :: Maybe Text -- ^ "phone" - , userUserStatus :: Maybe Int -- ^ "userStatus" - User Status - } deriving (P.Show,P.Eq,P.Typeable) - -instance A.FromJSON User where - parseJSON = A.withObject "User" $ \o -> - User - <$> (o .:? "id") - <*> (o .:? "username") - <*> (o .:? "firstName") - <*> (o .:? "lastName") - <*> (o .:? "email") - <*> (o .:? "password") - <*> (o .:? "phone") - <*> (o .:? "userStatus") - -instance A.ToJSON User where - toJSON User {..} = - _omitNulls - [ "id" .= userId - , "username" .= userUsername - , "firstName" .= userFirstName - , "lastName" .= userLastName - , "email" .= userEmail - , "password" .= userPassword - , "phone" .= userPhone - , "userStatus" .= userUserStatus - ] +-- ** User +-- | +-- a User +-- +-- A User who is purchasing from the pet store +data User = User + { userId :: Maybe Integer -- ^ "id" + , userUsername :: Maybe Text -- ^ "username" + , userFirstName :: Maybe Text -- ^ "firstName" + , userLastName :: Maybe Text -- ^ "lastName" + , userEmail :: Maybe Text -- ^ "email" + , userPassword :: Maybe Text -- ^ "password" + , userPhone :: Maybe Text -- ^ "phone" + , userUserStatus :: Maybe Int -- ^ "userStatus" - User Status + } deriving (P.Show,P.Eq,P.Typeable) + +instance A.FromJSON User where + parseJSON = A.withObject "User" $ \o -> + User + <$> (o .:? "id") + <*> (o .:? "username") + <*> (o .:? "firstName") + <*> (o .:? "lastName") + <*> (o .:? "email") + <*> (o .:? "password") + <*> (o .:? "phone") + <*> (o .:? "userStatus") + +instance A.ToJSON User where + toJSON User {..} = + _omitNulls + [ "id" .= userId + , "username" .= userUsername + , "firstName" .= userFirstName + , "lastName" .= userLastName + , "email" .= userEmail + , "password" .= userPassword + , "phone" .= userPhone + , "userStatus" .= userUserStatus + ] + - --- | Construct a value of type 'User' (by applying it's required fields, if any) -mkUser - :: User -mkUser = - User - { userId = Nothing - , userUsername = Nothing - , userFirstName = Nothing - , userLastName = Nothing - , userEmail = Nothing - , userPassword = Nothing - , userPhone = Nothing - , userUserStatus = Nothing - } - +-- | Construct a value of type 'User' (by applying it's required fields, if any) +mkUser + :: User +mkUser = + User + { userId = Nothing + , userUsername = Nothing + , userFirstName = Nothing + , userLastName = Nothing + , userEmail = Nothing + , userPassword = Nothing + , userPhone = Nothing + , userUserStatus = Nothing + } + + - --- * Utils - --- | Removes Null fields. (OpenAPI-Specification 2.0 does not allow Null in JSON) - -_omitNulls :: [(Text, A.Value)] -> A.Value -_omitNulls = A.object . P.filter notNull - where - notNull (_, A.Null) = False - notNull _ = True - -_toFormItem :: (WH.ToHttpApiData a, Functor f) => t -> f a -> f (t, [Text]) -_toFormItem name x = (name,) . (:[]) . WH.toQueryParam <$> x - -_emptyToNothing :: Maybe String -> Maybe String -_emptyToNothing (Just "") = Nothing -_emptyToNothing x = x -{-# INLINE _emptyToNothing #-} - -_memptyToNothing :: (P.Monoid a, P.Eq a) => Maybe a -> Maybe a -_memptyToNothing (Just x) | x P.== P.mempty = Nothing -_memptyToNothing x = x -{-# INLINE _memptyToNothing #-} - --- * DateTime Formatting - --- | @_parseISO8601@ -_readDateTime :: (TI.ParseTime t, Monad m, Alternative m) => String -> m t -_readDateTime = - _parseISO8601 -{-# INLINE _readDateTime #-} - --- | @TI.formatISO8601Millis@ -_showDateTime :: (t ~ UTCTime, TI.FormatTime t) => t -> String -_showDateTime = - TI.formatISO8601Millis -{-# INLINE _showDateTime #-} - -_parseISO8601 :: (TI.ParseTime t, Monad m, Alternative m) => String -> m t -_parseISO8601 t = - P.asum $ - P.flip (TI.parseTimeM True TI.defaultTimeLocale) t <$> - ["%FT%T%QZ", "%FT%T%Q%z", "%FT%T%Q%Z"] -{-# INLINE _parseISO8601 #-} - --- * Date Formatting - --- | @TI.parseTimeM True TI.defaultTimeLocale "%Y-%m-%d"@ -_readDate :: (TI.ParseTime t, Monad m) => String -> m t -_readDate = - TI.parseTimeM True TI.defaultTimeLocale "%Y-%m-%d" -{-# INLINE _readDate #-} - --- | @TI.formatTime TI.defaultTimeLocale "%Y-%m-%d"@ -_showDate :: TI.FormatTime t => t -> String -_showDate = - TI.formatTime TI.defaultTimeLocale "%Y-%m-%d" -{-# INLINE _showDate #-} \ No newline at end of file +-- * Utils + +-- | Removes Null fields. (OpenAPI-Specification 2.0 does not allow Null in JSON) + +_omitNulls :: [(Text, A.Value)] -> A.Value +_omitNulls = A.object . P.filter notNull + where + notNull (_, A.Null) = False + notNull _ = True + +_toFormItem :: (WH.ToHttpApiData a, Functor f) => t -> f a -> f (t, [Text]) +_toFormItem name x = (name,) . (:[]) . WH.toQueryParam <$> x + +_emptyToNothing :: Maybe String -> Maybe String +_emptyToNothing (Just "") = Nothing +_emptyToNothing x = x +{-# INLINE _emptyToNothing #-} + +_memptyToNothing :: (P.Monoid a, P.Eq a) => Maybe a -> Maybe a +_memptyToNothing (Just x) | x P.== P.mempty = Nothing +_memptyToNothing x = x +{-# INLINE _memptyToNothing #-} + +-- * DateTime Formatting + +-- | @_parseISO8601@ +_readDateTime :: (TI.ParseTime t, Monad m, Alternative m) => String -> m t +_readDateTime = + _parseISO8601 +{-# INLINE _readDateTime #-} + +-- | @TI.formatISO8601Millis@ +_showDateTime :: (t ~ UTCTime, TI.FormatTime t) => t -> String +_showDateTime = + TI.formatISO8601Millis +{-# INLINE _showDateTime #-} + +_parseISO8601 :: (TI.ParseTime t, Monad m, Alternative m) => String -> m t +_parseISO8601 t = + P.asum $ + P.flip (TI.parseTimeM True TI.defaultTimeLocale) t <$> + ["%FT%T%QZ", "%FT%T%Q%z", "%FT%T%Q%Z"] +{-# INLINE _parseISO8601 #-} + +-- * Date Formatting + +-- | @TI.parseTimeM True TI.defaultTimeLocale "%Y-%m-%d"@ +_readDate :: (TI.ParseTime t, Monad m) => String -> m t +_readDate = + TI.parseTimeM True TI.defaultTimeLocale "%Y-%m-%d" +{-# INLINE _readDate #-} + +-- | @TI.formatTime TI.defaultTimeLocale "%Y-%m-%d"@ +_showDate :: TI.FormatTime t => t -> String +_showDate = + TI.formatTime TI.defaultTimeLocale "%Y-%m-%d" +{-# INLINE _showDate #-} \ No newline at end of file diff --git a/samples/client/petstore/haskell-http-client/example-app/package.yaml b/samples/client/petstore/haskell-http-client/example-app/package.yaml index 072f0a2d323..d77a45b3178 100644 --- a/samples/client/petstore/haskell-http-client/example-app/package.yaml +++ b/samples/client/petstore/haskell-http-client/example-app/package.yaml @@ -31,7 +31,7 @@ dependencies: - vector >=0.10.9 && <0.13 - case-insensitive - swagger-petstore -- microlens +- microlens >= 0.4.3 && <0.5 executables: swagger-petstore-app: main: Main.hs diff --git a/samples/client/petstore/haskell-http-client/example-app/swagger-petstore-app.cabal b/samples/client/petstore/haskell-http-client/example-app/swagger-petstore-app.cabal index c62609490b1..4c81fc4f6aa 100644 --- a/samples/client/petstore/haskell-http-client/example-app/swagger-petstore-app.cabal +++ b/samples/client/petstore/haskell-http-client/example-app/swagger-petstore-app.cabal @@ -39,5 +39,5 @@ executable swagger-petstore-app , vector >=0.10.9 && <0.13 , case-insensitive , swagger-petstore - , microlens + , microlens >= 0.4.3 && <0.5 default-language: Haskell2010 diff --git a/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/API.hs b/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/API.hs index 0d2f2ee8b20..bd49d5fd629 100644 --- a/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/API.hs +++ b/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/API.hs @@ -11,13 +11,15 @@ Module : SwaggerPetstore.API {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE InstanceSigs #-} -{-# OPTIONS_GHC -fno-warn-unused-binds -fno-warn-unused-imports #-} +{-# LANGUAGE NamedFieldPuns #-} +{-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-unused-binds -fno-warn-unused-imports #-} module SwaggerPetstore.API where import SwaggerPetstore.Model as M import SwaggerPetstore.MimeTypes +import SwaggerPetstore.Lens import qualified Data.Aeson as A import Data.Aeson (Value) @@ -52,6 +54,8 @@ import qualified Data.Text.Lazy.Encoding as TL import qualified GHC.Base as P (Alternative) import qualified Control.Arrow as P (left) +import qualified Lens.Micro as L + import Data.Monoid ((<>)) import Data.Function ((&)) import Data.Set (Set) @@ -676,11 +680,26 @@ newtype File = File { unFile :: FilePath } deriving (P.Eq, P.Show) -- | Represents a request. The "req" type variable is the request type. The "res" type variable is the response type. data SwaggerPetstoreRequest req contentType res = SwaggerPetstoreRequest { rMethod :: NH.Method -- ^ Method of SwaggerPetstoreRequest - , urlPath :: [BCL.ByteString] -- ^ Endpoint of SwaggerPetstoreRequest - , params :: Params -- ^ params of SwaggerPetstoreRequest + , rUrlPath :: [BCL.ByteString] -- ^ Endpoint of SwaggerPetstoreRequest + , rParams :: Params -- ^ params of SwaggerPetstoreRequest } deriving (P.Show) +-- | 'rMethod' Lens +rMethodL :: Lens_' (SwaggerPetstoreRequest req contentType res) NH.Method +rMethodL f SwaggerPetstoreRequest{..} = (\rMethod -> SwaggerPetstoreRequest { rMethod, ..} ) <$> f rMethod +{-# INLINE rMethodL #-} + +-- | 'rUrlPath' Lens +rUrlPathL :: Lens_' (SwaggerPetstoreRequest req contentType res) [BCL.ByteString] +rUrlPathL f SwaggerPetstoreRequest{..} = (\rUrlPath -> SwaggerPetstoreRequest { rUrlPath, ..} ) <$> f rUrlPath +{-# INLINE rUrlPathL #-} + +-- | 'rParams' Lens +rParamsL :: Lens_' (SwaggerPetstoreRequest req contentType res) Params +rParamsL f SwaggerPetstoreRequest{..} = (\rParams -> SwaggerPetstoreRequest { rParams, ..} ) <$> f rParams +{-# INLINE rParamsL #-} + -- | Request Params data Params = Params { paramsQuery :: NH.Query @@ -689,6 +708,21 @@ data Params = Params } deriving (P.Show) +-- | 'paramsQuery' Lens +paramsQueryL :: Lens_' Params NH.Query +paramsQueryL f Params{..} = (\paramsQuery -> Params { paramsQuery, ..} ) <$> f paramsQuery +{-# INLINE paramsQueryL #-} + +-- | 'paramsHeaders' Lens +paramsHeadersL :: Lens_' Params NH.RequestHeaders +paramsHeadersL f Params{..} = (\paramsHeaders -> Params { paramsHeaders, ..} ) <$> f paramsHeaders +{-# INLINE paramsHeadersL #-} + +-- | 'paramsBody' Lens +paramsBodyL :: Lens_' Params ParamBody +paramsBodyL f Params{..} = (\paramsBody -> Params { paramsBody, ..} ) <$> f paramsBody +{-# INLINE paramsBodyL #-} + -- | Request Body data ParamBody = ParamBodyNone @@ -709,15 +743,18 @@ _mkParams :: Params _mkParams = Params [] [] ParamBodyNone setHeader :: SwaggerPetstoreRequest req contentType res -> [NH.Header] -> SwaggerPetstoreRequest req contentType res -setHeader req header = - let _params = params (req `removeHeader` P.fmap P.fst header) - in req { params = _params { paramsHeaders = header P.++ paramsHeaders _params } } +setHeader req header = + req `removeHeader` P.fmap P.fst header & + L.over (rParamsL . paramsHeadersL) (header P.++) removeHeader :: SwaggerPetstoreRequest req contentType res -> [NH.HeaderName] -> SwaggerPetstoreRequest req contentType res -removeHeader req header = - let _params = params req - in req { params = _params { paramsHeaders = [h | h <- paramsHeaders _params, cifst h `P.notElem` P.fmap CI.mk header] } } - where cifst = CI.mk . P.fst +removeHeader req header = + req & + L.over + (rParamsL . paramsHeadersL) + (P.filter (\h -> cifst h `P.notElem` P.fmap CI.mk header)) + where + cifst = CI.mk . P.fst _setContentTypeHeader :: forall req contentType res. MimeType contentType => SwaggerPetstoreRequest req contentType res -> SwaggerPetstoreRequest req contentType res @@ -734,35 +771,34 @@ _setAcceptHeader req accept = _setQuery :: SwaggerPetstoreRequest req contentType res -> [NH.QueryItem] -> SwaggerPetstoreRequest req contentType res _setQuery req query = - let _params = params req - in req { params = _params { paramsQuery = query P.++ [q | q <- paramsQuery _params, cifst q `P.notElem` P.fmap cifst query] } } - where cifst = CI.mk . P.fst + req & + L.over + (rParamsL . paramsQueryL) + ((query P.++) . P.filter (\q -> cifst q `P.notElem` P.fmap cifst query)) + where + cifst = CI.mk . P.fst _addForm :: SwaggerPetstoreRequest req contentType res -> WH.Form -> SwaggerPetstoreRequest req contentType res _addForm req newform = - let _params = params req - form = case paramsBody _params of + let form = case paramsBody (rParams req) of ParamBodyFormUrlEncoded _form -> _form _ -> mempty - in req { params = _params { paramsBody = ParamBodyFormUrlEncoded (newform <> form) } } + in req & L.set (rParamsL . paramsBodyL) (ParamBodyFormUrlEncoded (newform <> form)) _addMultiFormPart :: SwaggerPetstoreRequest req contentType res -> NH.Part -> SwaggerPetstoreRequest req contentType res _addMultiFormPart req newpart = - let _params = params req - parts = case paramsBody _params of + let parts = case paramsBody (rParams req) of ParamBodyMultipartFormData _parts -> _parts _ -> [] - in req { params = _params { paramsBody = ParamBodyMultipartFormData (newpart : parts) } } + in req & L.set (rParamsL . paramsBodyL) (ParamBodyMultipartFormData (newpart : parts)) _setBodyBS :: SwaggerPetstoreRequest req contentType res -> B.ByteString -> SwaggerPetstoreRequest req contentType res _setBodyBS req body = - let _params = params req - in req { params = _params { paramsBody = ParamBodyB body } } + req & L.set (rParamsL . paramsBodyL) (ParamBodyB body) _setBodyLBS :: SwaggerPetstoreRequest req contentType res -> BL.ByteString -> SwaggerPetstoreRequest req contentType res _setBodyLBS req body = - let _params = params req - in req { params = _params { paramsBody = ParamBodyBL body } } + req & L.set (rParamsL . paramsBodyL) (ParamBodyBL body) -- ** Params Utils diff --git a/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/Client.hs b/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/Client.hs index 8d9d6b53f7b..681ecb28607 100644 --- a/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/Client.hs +++ b/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/Client.hs @@ -225,15 +225,15 @@ _toInitRequest -> accept -- ^ "accept" 'MimeType' -> IO (InitRequest req contentType res accept) -- ^ initialized request _toInitRequest config req0 accept = do - parsedReq <- NH.parseRequest $ BCL.unpack $ BCL.append (configHost config) (BCL.concat (urlPath req0)) + parsedReq <- NH.parseRequest $ BCL.unpack $ BCL.append (configHost config) (BCL.concat (rUrlPath req0)) let req1 = _setAcceptHeader req0 accept & _setContentTypeHeader - reqHeaders = ("User-Agent", WH.toHeader (configUserAgent config)) : paramsHeaders (params req1) - reqQuery = NH.renderQuery True (paramsQuery (params req1)) + reqHeaders = ("User-Agent", WH.toHeader (configUserAgent config)) : paramsHeaders (rParams req1) + reqQuery = NH.renderQuery True (paramsQuery (rParams req1)) pReq = parsedReq { NH.method = (rMethod req1) , NH.requestHeaders = reqHeaders , NH.queryString = reqQuery } - outReq <- case paramsBody (params req1) of + outReq <- case paramsBody (rParams req1) of ParamBodyNone -> pure (pReq { NH.requestBody = mempty }) ParamBodyB bs -> pure (pReq { NH.requestBody = NH.RequestBodyBS bs }) ParamBodyBL bl -> pure (pReq { NH.requestBody = NH.RequestBodyLBS bl }) diff --git a/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/Model.hs b/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/Model.hs index b2df5ab575c..d14764e85a8 100644 --- a/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/Model.hs +++ b/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/Model.hs @@ -2,7 +2,6 @@ Module : SwaggerPetstore.Model -} -{-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveGeneric #-} diff --git a/samples/client/petstore/haskell-http-client/package.yaml b/samples/client/petstore/haskell-http-client/package.yaml index 19711dee476..4ec0778ce1a 100644 --- a/samples/client/petstore/haskell-http-client/package.yaml +++ b/samples/client/petstore/haskell-http-client/package.yaml @@ -33,9 +33,11 @@ dependencies: - transformers >=0.4.0.0 - mtl >=2.2.1 - unordered-containers +ghc-options: -Wall library: source-dirs: lib - ghc-options: -Wall + ghc-options: + exposed-modules: - SwaggerPetstore - SwaggerPetstore.API @@ -62,6 +64,7 @@ library: - monad-logger >=0.3 && <0.4 - safe-exceptions <0.2 - case-insensitive + - microlens >= 0.4.3 && <0.5 tests: tests: main: Test.hs diff --git a/samples/client/petstore/haskell-http-client/swagger-petstore.cabal b/samples/client/petstore/haskell-http-client/swagger-petstore.cabal index 3d96cf923d8..e8e4b538161 100644 --- a/samples/client/petstore/haskell-http-client/swagger-petstore.cabal +++ b/samples/client/petstore/haskell-http-client/swagger-petstore.cabal @@ -56,6 +56,7 @@ library , monad-logger >=0.3 && <0.4 , safe-exceptions <0.2 , case-insensitive + , microlens >= 0.4.3 && <0.5 exposed-modules: SwaggerPetstore SwaggerPetstore.API @@ -72,7 +73,7 @@ test-suite tests main-is: Test.hs hs-source-dirs: tests - ghc-options: -fno-warn-orphans + ghc-options: -Wall -fno-warn-orphans build-depends: base >=4.7 && <5.0 , transformers >=0.4.0.0 diff --git a/samples/client/petstore/haskell-http-client/tests-integration/package.yaml b/samples/client/petstore/haskell-http-client/tests-integration/package.yaml index dec56e307b3..44bc8174414 100644 --- a/samples/client/petstore/haskell-http-client/tests-integration/package.yaml +++ b/samples/client/petstore/haskell-http-client/tests-integration/package.yaml @@ -33,7 +33,7 @@ dependencies: - exceptions >= 0.4 - case-insensitive - safe-exceptions <0.2 -- microlens +- microlens >= 0.4.3 && <0.5 - swagger-petstore tests: tests: diff --git a/samples/client/petstore/haskell-http-client/tests-integration/swagger-petstore-tests-integration.cabal b/samples/client/petstore/haskell-http-client/tests-integration/swagger-petstore-tests-integration.cabal index 7255abfa1f6..98c3670066a 100644 --- a/samples/client/petstore/haskell-http-client/tests-integration/swagger-petstore-tests-integration.cabal +++ b/samples/client/petstore/haskell-http-client/tests-integration/swagger-petstore-tests-integration.cabal @@ -44,7 +44,7 @@ test-suite tests , exceptions >= 0.4 , case-insensitive , safe-exceptions <0.2 - , microlens + , microlens >= 0.4.3 && <0.5 , swagger-petstore , swagger-petstore , bytestring >=0.10.0 && <0.11 diff --git a/samples/client/petstore/haskell-http-client/tests/Instances.hs b/samples/client/petstore/haskell-http-client/tests/Instances.hs index 6f995219f7c..850a838576f 100644 --- a/samples/client/petstore/haskell-http-client/tests/Instances.hs +++ b/samples/client/petstore/haskell-http-client/tests/Instances.hs @@ -1,3 +1,5 @@ +{-# OPTIONS_GHC -fno-warn-unused-imports #-} + module Instances where import Data.Text (Text, pack) diff --git a/samples/client/petstore/haskell-http-client/tests/PropMime.hs b/samples/client/petstore/haskell-http-client/tests/PropMime.hs index c7f66604461..ed3cbebb2d7 100644 --- a/samples/client/petstore/haskell-http-client/tests/PropMime.hs +++ b/samples/client/petstore/haskell-http-client/tests/PropMime.hs @@ -1,6 +1,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ConstraintKinds #-} +{-# OPTIONS_GHC -fno-warn-unused-imports #-} module PropMime where