forked from loafle/openapi-generator-original
Migrate OCaml petstore to use OAS v3 spec (#6348)
* migrate ocaml petstore to use oas3 * break the build * Revert "break the build" This reverts commit a7c12d90fea50c9739ed302f3c8e94e9f437d491.
This commit is contained in:
parent
583aa24152
commit
202d184ce2
@ -28,7 +28,7 @@ fi
|
|||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
|
||||||
args="generate -t modules/openapi-generator/src/main/resources/ocaml -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g ocaml -o samples/client/petstore/ocaml --additional-properties packageName=petstore_client $@"
|
args="generate -t modules/openapi-generator/src/main/resources/ocaml -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g ocaml -o samples/client/petstore/ocaml --additional-properties packageName=petstore_client $@"
|
||||||
|
|
||||||
echo "java ${JAVA_OPTS} -jar ${executable} ${args}"
|
echo "java ${JAVA_OPTS} -jar ${executable} ${args}"
|
||||||
java $JAVA_OPTS -jar $executable $args
|
java $JAVA_OPTS -jar $executable $args
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn -B clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DdebugOperations -DloggerPath=conf/log4j.properties"
|
|
||||||
|
|
||||||
args="generate -t modules/openapi-generator/src/main/resources/ocaml -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ocaml -o samples/openapi3/client/petstore/ocaml/ --additional-properties packageName=petstore_client $@"
|
|
||||||
|
|
||||||
echo "java ${JAVA_OPTS} -jar ${executable} ${args}"
|
|
||||||
java $JAVA_OPTS -jar $executable $args
|
|
@ -5,6 +5,6 @@ If Not Exist %executable% (
|
|||||||
)
|
)
|
||||||
|
|
||||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
|
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
|
||||||
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g ocaml -o samples\client\petstore\ocaml
|
set ags=generate -i modules\openapi-generator\src\test\resources\3_0\petstore.yaml -g ocaml -o samples\client\petstore\ocaml
|
||||||
|
|
||||||
java %JAVA_OPTS% -jar %executable% %ags%
|
java %JAVA_OPTS% -jar %executable% %ags%
|
||||||
|
@ -1 +1 @@
|
|||||||
4.2.2-SNAPSHOT
|
5.0.0-SNAPSHOT
|
@ -5,13 +5,13 @@
|
|||||||
*
|
*
|
||||||
*)
|
*)
|
||||||
|
|
||||||
let add_pet ~body =
|
let add_pet ~pet_t =
|
||||||
let open Lwt in
|
let open Lwt in
|
||||||
let uri = Request.build_uri "/pet" in
|
let uri = Request.build_uri "/pet" in
|
||||||
let headers = Request.default_headers in
|
let headers = Request.default_headers in
|
||||||
let body = Request.write_as_json_body Pet.to_yojson body in
|
let body = Request.write_as_json_body Pet.to_yojson pet_t in
|
||||||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
|
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
|
||||||
Request.handle_unit_response resp
|
Request.read_json_body_as (JsonSupport.unwrap Pet.of_yojson) resp body
|
||||||
|
|
||||||
let delete_pet ~pet_id ?api_key () =
|
let delete_pet ~pet_id ?api_key () =
|
||||||
let open Lwt in
|
let open Lwt in
|
||||||
@ -47,13 +47,13 @@ let get_pet_by_id ~pet_id =
|
|||||||
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) ->
|
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) ->
|
||||||
Request.read_json_body_as (JsonSupport.unwrap Pet.of_yojson) resp body
|
Request.read_json_body_as (JsonSupport.unwrap Pet.of_yojson) resp body
|
||||||
|
|
||||||
let update_pet ~body =
|
let update_pet ~pet_t =
|
||||||
let open Lwt in
|
let open Lwt in
|
||||||
let uri = Request.build_uri "/pet" in
|
let uri = Request.build_uri "/pet" in
|
||||||
let headers = Request.default_headers in
|
let headers = Request.default_headers in
|
||||||
let body = Request.write_as_json_body Pet.to_yojson body in
|
let body = Request.write_as_json_body Pet.to_yojson pet_t in
|
||||||
Cohttp_lwt_unix.Client.call `PUT uri ~headers ~body >>= fun (resp, body) ->
|
Cohttp_lwt_unix.Client.call `PUT uri ~headers ~body >>= fun (resp, body) ->
|
||||||
Request.handle_unit_response resp
|
Request.read_json_body_as (JsonSupport.unwrap Pet.of_yojson) resp body
|
||||||
|
|
||||||
let update_pet_with_form ~pet_id ?name ?status () =
|
let update_pet_with_form ~pet_id ?name ?status () =
|
||||||
let open Lwt in
|
let open Lwt in
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
*
|
*
|
||||||
*)
|
*)
|
||||||
|
|
||||||
val add_pet : body:Pet.t -> unit Lwt.t
|
val add_pet : pet_t:Pet.t -> Pet.t Lwt.t
|
||||||
val delete_pet : pet_id:int64 -> ?api_key:string -> unit -> unit Lwt.t
|
val delete_pet : pet_id:int64 -> ?api_key:string -> unit -> unit Lwt.t
|
||||||
val find_pets_by_status : status:Enums.pet_status list -> Pet.t list Lwt.t
|
val find_pets_by_status : status:Enums.pet_status list -> Pet.t list Lwt.t
|
||||||
val find_pets_by_tags : tags:string list -> Pet.t list Lwt.t
|
val find_pets_by_tags : tags:string list -> Pet.t list Lwt.t
|
||||||
val get_pet_by_id : pet_id:int64 -> Pet.t Lwt.t
|
val get_pet_by_id : pet_id:int64 -> Pet.t Lwt.t
|
||||||
val update_pet : body:Pet.t -> unit Lwt.t
|
val update_pet : pet_t:Pet.t -> Pet.t Lwt.t
|
||||||
val update_pet_with_form : pet_id:int64 -> ?name:string -> ?status:string -> unit -> unit Lwt.t
|
val update_pet_with_form : pet_id:int64 -> ?name:string -> ?status:string -> unit -> unit Lwt.t
|
||||||
val upload_file : pet_id:int64 -> ?additional_metadata:string -> ?file:string -> unit -> Api_response.t Lwt.t
|
val upload_file : pet_id:int64 -> ?additional_metadata:string -> ?file:string -> unit -> Api_response.t Lwt.t
|
||||||
|
@ -29,11 +29,11 @@ let get_order_by_id ~order_id =
|
|||||||
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) ->
|
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) ->
|
||||||
Request.read_json_body_as (JsonSupport.unwrap Order.of_yojson) resp body
|
Request.read_json_body_as (JsonSupport.unwrap Order.of_yojson) resp body
|
||||||
|
|
||||||
let place_order ~body =
|
let place_order ~order_t =
|
||||||
let open Lwt in
|
let open Lwt in
|
||||||
let uri = Request.build_uri "/store/order" in
|
let uri = Request.build_uri "/store/order" in
|
||||||
let headers = Request.default_headers in
|
let headers = Request.default_headers in
|
||||||
let body = Request.write_as_json_body Order.to_yojson body in
|
let body = Request.write_as_json_body Order.to_yojson order_t in
|
||||||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
|
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
|
||||||
Request.read_json_body_as (JsonSupport.unwrap Order.of_yojson) resp body
|
Request.read_json_body_as (JsonSupport.unwrap Order.of_yojson) resp body
|
||||||
|
|
||||||
|
@ -8,4 +8,4 @@
|
|||||||
val delete_order : order_id:string -> unit Lwt.t
|
val delete_order : order_id:string -> unit Lwt.t
|
||||||
val get_inventory : unit -> (string * int32) list Lwt.t
|
val get_inventory : unit -> (string * int32) list Lwt.t
|
||||||
val get_order_by_id : order_id:int64 -> Order.t Lwt.t
|
val get_order_by_id : order_id:int64 -> Order.t Lwt.t
|
||||||
val place_order : body:Order.t -> Order.t Lwt.t
|
val place_order : order_t:Order.t -> Order.t Lwt.t
|
||||||
|
@ -5,27 +5,30 @@
|
|||||||
*
|
*
|
||||||
*)
|
*)
|
||||||
|
|
||||||
let create_user ~body =
|
let create_user ~user_t =
|
||||||
let open Lwt in
|
let open Lwt in
|
||||||
let uri = Request.build_uri "/user" in
|
let uri = Request.build_uri "/user" in
|
||||||
let headers = Request.default_headers in
|
let headers = Request.default_headers in
|
||||||
let body = Request.write_as_json_body User.to_yojson body in
|
let headers = Cohttp.Header.add headers "api_key" Request.api_key in
|
||||||
|
let body = Request.write_as_json_body User.to_yojson user_t in
|
||||||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
|
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
|
||||||
Request.handle_unit_response resp
|
Request.handle_unit_response resp
|
||||||
|
|
||||||
let create_users_with_array_input ~body =
|
let create_users_with_array_input ~user =
|
||||||
let open Lwt in
|
let open Lwt in
|
||||||
let uri = Request.build_uri "/user/createWithArray" in
|
let uri = Request.build_uri "/user/createWithArray" in
|
||||||
let headers = Request.default_headers in
|
let headers = Request.default_headers in
|
||||||
let body = Request.write_as_json_body (JsonSupport.of_list_of User.to_yojson) body in
|
let headers = Cohttp.Header.add headers "api_key" Request.api_key in
|
||||||
|
let body = Request.write_as_json_body (JsonSupport.of_list_of User.to_yojson) user in
|
||||||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
|
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
|
||||||
Request.handle_unit_response resp
|
Request.handle_unit_response resp
|
||||||
|
|
||||||
let create_users_with_list_input ~body =
|
let create_users_with_list_input ~user =
|
||||||
let open Lwt in
|
let open Lwt in
|
||||||
let uri = Request.build_uri "/user/createWithList" in
|
let uri = Request.build_uri "/user/createWithList" in
|
||||||
let headers = Request.default_headers in
|
let headers = Request.default_headers in
|
||||||
let body = Request.write_as_json_body (JsonSupport.of_list_of User.to_yojson) body in
|
let headers = Cohttp.Header.add headers "api_key" Request.api_key in
|
||||||
|
let body = Request.write_as_json_body (JsonSupport.of_list_of User.to_yojson) user in
|
||||||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
|
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
|
||||||
Request.handle_unit_response resp
|
Request.handle_unit_response resp
|
||||||
|
|
||||||
@ -33,6 +36,7 @@ let delete_user ~username =
|
|||||||
let open Lwt in
|
let open Lwt in
|
||||||
let uri = Request.build_uri "/user/{username}" in
|
let uri = Request.build_uri "/user/{username}" in
|
||||||
let headers = Request.default_headers in
|
let headers = Request.default_headers in
|
||||||
|
let headers = Cohttp.Header.add headers "api_key" Request.api_key in
|
||||||
let uri = Request.replace_path_param uri "username" (fun x -> x) username in
|
let uri = Request.replace_path_param uri "username" (fun x -> x) username in
|
||||||
Cohttp_lwt_unix.Client.call `DELETE uri ~headers >>= fun (resp, body) ->
|
Cohttp_lwt_unix.Client.call `DELETE uri ~headers >>= fun (resp, body) ->
|
||||||
Request.handle_unit_response resp
|
Request.handle_unit_response resp
|
||||||
@ -58,15 +62,17 @@ let logout_user () =
|
|||||||
let open Lwt in
|
let open Lwt in
|
||||||
let uri = Request.build_uri "/user/logout" in
|
let uri = Request.build_uri "/user/logout" in
|
||||||
let headers = Request.default_headers in
|
let headers = Request.default_headers in
|
||||||
|
let headers = Cohttp.Header.add headers "api_key" Request.api_key in
|
||||||
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) ->
|
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) ->
|
||||||
Request.handle_unit_response resp
|
Request.handle_unit_response resp
|
||||||
|
|
||||||
let update_user ~username ~body =
|
let update_user ~username ~user_t =
|
||||||
let open Lwt in
|
let open Lwt in
|
||||||
let uri = Request.build_uri "/user/{username}" in
|
let uri = Request.build_uri "/user/{username}" in
|
||||||
let headers = Request.default_headers in
|
let headers = Request.default_headers in
|
||||||
|
let headers = Cohttp.Header.add headers "api_key" Request.api_key in
|
||||||
let uri = Request.replace_path_param uri "username" (fun x -> x) username in
|
let uri = Request.replace_path_param uri "username" (fun x -> x) username in
|
||||||
let body = Request.write_as_json_body User.to_yojson body in
|
let body = Request.write_as_json_body User.to_yojson user_t in
|
||||||
Cohttp_lwt_unix.Client.call `PUT uri ~headers ~body >>= fun (resp, body) ->
|
Cohttp_lwt_unix.Client.call `PUT uri ~headers ~body >>= fun (resp, body) ->
|
||||||
Request.handle_unit_response resp
|
Request.handle_unit_response resp
|
||||||
|
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
*
|
*
|
||||||
*)
|
*)
|
||||||
|
|
||||||
val create_user : body:User.t -> unit Lwt.t
|
val create_user : user_t:User.t -> unit Lwt.t
|
||||||
val create_users_with_array_input : body:User.t list -> unit Lwt.t
|
val create_users_with_array_input : user:User.t list -> unit Lwt.t
|
||||||
val create_users_with_list_input : body:User.t list -> unit Lwt.t
|
val create_users_with_list_input : user:User.t list -> unit Lwt.t
|
||||||
val delete_user : username:string -> unit Lwt.t
|
val delete_user : username:string -> unit Lwt.t
|
||||||
val get_user_by_name : username:string -> User.t Lwt.t
|
val get_user_by_name : username:string -> User.t Lwt.t
|
||||||
val login_user : username:string -> password:string -> string Lwt.t
|
val login_user : username:string -> password:string -> string Lwt.t
|
||||||
val logout_user : unit -> unit Lwt.t
|
val logout_user : unit -> unit Lwt.t
|
||||||
val update_user : username:string -> body:User.t -> unit Lwt.t
|
val update_user : username:string -> user_t:User.t -> unit Lwt.t
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
# OpenAPI Generator Ignore
|
|
||||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
|
||||||
|
|
||||||
# Use this file to prevent files from being overwritten by the generator.
|
|
||||||
# The patterns follow closely to .gitignore or .dockerignore.
|
|
||||||
|
|
||||||
# As an example, the C# client generator defines ApiClient.cs.
|
|
||||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
|
||||||
#ApiClient.cs
|
|
||||||
|
|
||||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
|
||||||
#foo/*/qux
|
|
||||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
|
||||||
|
|
||||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
|
||||||
#foo/**/qux
|
|
||||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
|
||||||
|
|
||||||
# You can also negate patterns with an exclamation (!).
|
|
||||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
|
||||||
#docs/*.md
|
|
||||||
# Then explicitly reverse the ignore rule for a single file:
|
|
||||||
#!docs/README.md
|
|
@ -1 +0,0 @@
|
|||||||
4.1.0-SNAPSHOT
|
|
@ -1,27 +0,0 @@
|
|||||||
#
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \'' \\
|
|
||||||
|
|
||||||
This OCaml package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
|
||||||
|
|
||||||
- API version: 1.0.0
|
|
||||||
- Package version: 1.0.0
|
|
||||||
- Build package: org.openapitools.codegen.languages.OCamlClientCodegen
|
|
||||||
|
|
||||||
## Requirements.
|
|
||||||
|
|
||||||
OCaml 4.x
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
Please run the following commands to build the package `petstore_client`:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
opam install ppx_deriving_yojson cohttp ppx_deriving cohttp-lwt-unix
|
|
||||||
eval $(opam env)
|
|
||||||
dune build
|
|
||||||
```
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
TODO
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
|||||||
(include_subdirs unqualified)
|
|
||||||
(library
|
|
||||||
(name petstore_client)
|
|
||||||
(public_name petstore_client)
|
|
||||||
(flags (:standard -w -27))
|
|
||||||
(libraries str cohttp-lwt-unix lwt yojson ppx_deriving_yojson.runtime)
|
|
||||||
(preprocess (pps ppx_deriving_yojson ppx_deriving.std))
|
|
||||||
(wrapped true)
|
|
||||||
)
|
|
@ -1,2 +0,0 @@
|
|||||||
(lang dune 1.10)
|
|
||||||
(name petstore_client)
|
|
@ -1,15 +0,0 @@
|
|||||||
opam-version: "2.0"
|
|
||||||
name: "petstore_client"
|
|
||||||
version: "1.0.0"
|
|
||||||
synopsis: ""
|
|
||||||
description: """
|
|
||||||
Longer description
|
|
||||||
"""
|
|
||||||
maintainer: "Name <email>"
|
|
||||||
authors: "Name <email>"
|
|
||||||
license: ""
|
|
||||||
homepage: ""
|
|
||||||
bug-reports: ""
|
|
||||||
dev-repo: ""
|
|
||||||
depends: [ "ocaml" "ocamlfind" ]
|
|
||||||
build: ["dune" "build" "-p" name]
|
|
@ -1,15 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
let call_123_test_special_tags ~client_t =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/another-fake/dummy" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let body = Request.write_as_json_body Client.to_yojson client_t in
|
|
||||||
Cohttp_lwt_unix.Client.call `PATCH uri ~headers ~body >>= fun (resp, body) ->
|
|
||||||
Request.read_json_body_as (JsonSupport.unwrap Client.of_yojson) resp body
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
val call_123_test_special_tags : client_t:Client.t -> Client.t Lwt.t
|
|
@ -1,14 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
let foo_get () =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/foo" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) ->
|
|
||||||
Request.read_json_body_as (JsonSupport.unwrap Inline_response_default.of_yojson) resp body
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
val foo_get : unit -> Inline_response_default.t Lwt.t
|
|
@ -1,143 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
let fake_health_get () =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/fake/health" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) ->
|
|
||||||
Request.read_json_body_as (JsonSupport.unwrap Health_check_result.of_yojson) resp body
|
|
||||||
|
|
||||||
let fake_outer_boolean_serialize ~body () =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/fake/outer/boolean" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let body = Request.write_as_json_body JsonSupport.of_bool body in
|
|
||||||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
|
|
||||||
Request.read_json_body_as (JsonSupport.to_bool) resp body
|
|
||||||
|
|
||||||
let fake_outer_composite_serialize ~outer_composite_t () =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/fake/outer/composite" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let body = Request.write_as_json_body Outer_composite.to_yojson outer_composite_t in
|
|
||||||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
|
|
||||||
Request.read_json_body_as (JsonSupport.unwrap Outer_composite.of_yojson) resp body
|
|
||||||
|
|
||||||
let fake_outer_number_serialize ~body () =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/fake/outer/number" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let body = Request.write_as_json_body JsonSupport.of_float body in
|
|
||||||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
|
|
||||||
Request.read_json_body_as (JsonSupport.to_float) resp body
|
|
||||||
|
|
||||||
let fake_outer_string_serialize ~body () =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/fake/outer/string" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let body = Request.write_as_json_body JsonSupport.of_string body in
|
|
||||||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
|
|
||||||
Request.read_json_body_as (JsonSupport.to_string) resp body
|
|
||||||
|
|
||||||
let test_body_with_file_schema ~file_schema_test_class_t =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/fake/body-with-file-schema" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let body = Request.write_as_json_body File_schema_test_class.to_yojson file_schema_test_class_t in
|
|
||||||
Cohttp_lwt_unix.Client.call `PUT uri ~headers ~body >>= fun (resp, body) ->
|
|
||||||
Request.handle_unit_response resp
|
|
||||||
|
|
||||||
let test_body_with_query_params ~query ~user_t =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/fake/body-with-query-params" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let uri = Request.add_query_param uri "query" (fun x -> x) query in
|
|
||||||
let body = Request.write_as_json_body User.to_yojson user_t in
|
|
||||||
Cohttp_lwt_unix.Client.call `PUT uri ~headers ~body >>= fun (resp, body) ->
|
|
||||||
Request.handle_unit_response resp
|
|
||||||
|
|
||||||
let test_client_model ~client_t =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/fake" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let body = Request.write_as_json_body Client.to_yojson client_t in
|
|
||||||
Cohttp_lwt_unix.Client.call `PATCH uri ~headers ~body >>= fun (resp, body) ->
|
|
||||||
Request.read_json_body_as (JsonSupport.unwrap Client.of_yojson) resp body
|
|
||||||
|
|
||||||
let test_endpoint_parameters ~number ~double ~pattern_without_delimiter ~byte ?integer ?int32 ?int64 ?float ?string ?binary ?date ?date_time ?password ?callback () =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/fake" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let body = Request.init_form_encoded_body () in
|
|
||||||
let body = Request.maybe_add_form_encoded_body_param body "integer" Int32.to_string integer in
|
|
||||||
let body = Request.maybe_add_form_encoded_body_param body "int32" Int32.to_string int32 in
|
|
||||||
let body = Request.maybe_add_form_encoded_body_param body "int64" Int64.to_string int64 in
|
|
||||||
let body = Request.add_form_encoded_body_param body "number" string_of_float number in
|
|
||||||
let body = Request.maybe_add_form_encoded_body_param body "float" string_of_float float in
|
|
||||||
let body = Request.add_form_encoded_body_param body "double" string_of_float double in
|
|
||||||
let body = Request.maybe_add_form_encoded_body_param body "string" (fun x -> x) string in
|
|
||||||
let body = Request.add_form_encoded_body_param body "pattern_without_delimiter" (fun x -> x) pattern_without_delimiter in
|
|
||||||
let body = Request.add_form_encoded_body_param body "byte" (fun x -> x) byte in
|
|
||||||
let body = Request.maybe_add_form_encoded_body_param body "binary" (fun x -> x) binary in
|
|
||||||
let body = Request.maybe_add_form_encoded_body_param body "date" (fun x -> x) date in
|
|
||||||
let body = Request.maybe_add_form_encoded_body_param body "date_time" (fun x -> x) date_time in
|
|
||||||
let body = Request.maybe_add_form_encoded_body_param body "password" (fun x -> x) password in
|
|
||||||
let body = Request.maybe_add_form_encoded_body_param body "callback" (fun x -> x) callback in
|
|
||||||
let body = Request.finalize_form_encoded_body body in
|
|
||||||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
|
|
||||||
Request.handle_unit_response resp
|
|
||||||
|
|
||||||
let test_enum_parameters ?(enum_header_string_array = []) ?(enum_header_string = `Minusefg) ?(enum_query_string_array = []) ?(enum_query_string = `Minusefg) ?enum_query_integer ?enum_query_double ?(enum_form_string_array = [`Dollar]) ?(enum_form_string = `Minusefg) () =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/fake" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let headers = Request.add_header_multi headers "enum_header_string_array" (List.map Enums.show_enum_form_string_array) enum_header_string_array in
|
|
||||||
let headers = Request.add_header headers "enum_header_string" Enums.show_enumclass enum_header_string in
|
|
||||||
let uri = Request.add_query_param_list uri "enum_query_string_array" (List.map Enums.show_enum_form_string_array) enum_query_string_array in
|
|
||||||
let uri = Request.add_query_param uri "enum_query_string" Enums.show_enumclass enum_query_string in
|
|
||||||
let uri = Request.maybe_add_query_param uri "enum_query_integer" Enums.show_enum_query_integer enum_query_integer in
|
|
||||||
let uri = Request.maybe_add_query_param uri "enum_query_double" Enums.show_enum_number enum_query_double in
|
|
||||||
let body = Request.init_form_encoded_body () in
|
|
||||||
let body = Request.add_form_encoded_body_param_list body "enum_form_string_array" (List.map Enums.show_enum_form_string_array) enum_form_string_array in
|
|
||||||
let body = Request.add_form_encoded_body_param body "enum_form_string" Enums.show_enumclass enum_form_string in
|
|
||||||
let body = Request.finalize_form_encoded_body body in
|
|
||||||
Cohttp_lwt_unix.Client.call `GET uri ~headers ~body >>= fun (resp, body) ->
|
|
||||||
Request.handle_unit_response resp
|
|
||||||
|
|
||||||
let test_group_parameters ~required_string_group ~required_boolean_group ~required_int64_group ?string_group ?boolean_group ?int64_group () =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/fake" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let headers = Request.add_header headers "required_boolean_group" string_of_bool required_boolean_group in
|
|
||||||
let headers = Request.maybe_add_header headers "boolean_group" string_of_bool boolean_group in
|
|
||||||
let uri = Request.add_query_param uri "required_string_group" Int32.to_string required_string_group in
|
|
||||||
let uri = Request.add_query_param uri "required_int64_group" Int64.to_string required_int64_group in
|
|
||||||
let uri = Request.maybe_add_query_param uri "string_group" Int32.to_string string_group in
|
|
||||||
let uri = Request.maybe_add_query_param uri "int64_group" Int64.to_string int64_group in
|
|
||||||
Cohttp_lwt_unix.Client.call `DELETE uri ~headers >>= fun (resp, body) ->
|
|
||||||
Request.handle_unit_response resp
|
|
||||||
|
|
||||||
let test_inline_additional_properties ~request_body =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/fake/inline-additionalProperties" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let body = Request.write_as_json_body (JsonSupport.of_map_of JsonSupport.of_string) request_body in
|
|
||||||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
|
|
||||||
Request.handle_unit_response resp
|
|
||||||
|
|
||||||
let test_json_form_data ~param ~param2 =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/fake/jsonFormData" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let body = Request.init_form_encoded_body () in
|
|
||||||
let body = Request.add_form_encoded_body_param body "param" (fun x -> x) param in
|
|
||||||
let body = Request.add_form_encoded_body_param body "param2" (fun x -> x) param2 in
|
|
||||||
let body = Request.finalize_form_encoded_body body in
|
|
||||||
Cohttp_lwt_unix.Client.call `GET uri ~headers ~body >>= fun (resp, body) ->
|
|
||||||
Request.handle_unit_response resp
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
val fake_health_get : unit -> Health_check_result.t Lwt.t
|
|
||||||
val fake_outer_boolean_serialize : body:bool -> unit -> bool Lwt.t
|
|
||||||
val fake_outer_composite_serialize : outer_composite_t:Outer_composite.t -> unit -> Outer_composite.t Lwt.t
|
|
||||||
val fake_outer_number_serialize : body:float -> unit -> float Lwt.t
|
|
||||||
val fake_outer_string_serialize : body:string -> unit -> string Lwt.t
|
|
||||||
val test_body_with_file_schema : file_schema_test_class_t:File_schema_test_class.t -> unit Lwt.t
|
|
||||||
val test_body_with_query_params : query:string -> user_t:User.t -> unit Lwt.t
|
|
||||||
val test_client_model : client_t:Client.t -> Client.t Lwt.t
|
|
||||||
val test_endpoint_parameters : number:float -> double:float -> pattern_without_delimiter:string -> byte:string -> ?integer:int32 -> ?int32:int32 -> ?int64:int64 -> ?float:float -> ?string:string -> ?binary:string -> ?date:string -> ?date_time:string -> ?password:string -> ?callback:string -> unit -> unit Lwt.t
|
|
||||||
val test_enum_parameters : ?enum_header_string_array:Enums.enum_form_string_array list -> ?enum_header_string:Enums.enumclass -> ?enum_query_string_array:Enums.enum_form_string_array list -> ?enum_query_string:Enums.enumclass -> ?enum_query_integer:Enums.enum_query_integer -> ?enum_query_double:Enums.enum_number -> ?enum_form_string_array:Enums.enum_form_string_array list -> ?enum_form_string:Enums.enumclass -> unit -> unit Lwt.t
|
|
||||||
val test_group_parameters : required_string_group:int32 -> required_boolean_group:bool -> required_int64_group:int64 -> ?string_group:int32 -> ?boolean_group:bool -> ?int64_group:int64 -> unit -> unit Lwt.t
|
|
||||||
val test_inline_additional_properties : request_body:(string * string) list -> unit Lwt.t
|
|
||||||
val test_json_form_data : param:string -> param2:string -> unit Lwt.t
|
|
@ -1,16 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
let test_classname ~client_t =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/fake_classname_test" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let uri = Uri.add_query_param' uri ("api_key_query", Request.api_key) in
|
|
||||||
let body = Request.write_as_json_body Client.to_yojson client_t in
|
|
||||||
Cohttp_lwt_unix.Client.call `PATCH uri ~headers ~body >>= fun (resp, body) ->
|
|
||||||
Request.read_json_body_as (JsonSupport.unwrap Client.of_yojson) resp body
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
val test_classname : client_t:Client.t -> Client.t Lwt.t
|
|
@ -1,93 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
let add_pet ~pet_t =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/pet" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let body = Request.write_as_json_body Pet.to_yojson pet_t in
|
|
||||||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
|
|
||||||
Request.handle_unit_response resp
|
|
||||||
|
|
||||||
let delete_pet ~pet_id ?api_key () =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/pet/{petId}" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let headers = Request.maybe_add_header headers "api_key" (fun x -> x) api_key in
|
|
||||||
let uri = Request.replace_path_param uri "petId" Int64.to_string pet_id in
|
|
||||||
Cohttp_lwt_unix.Client.call `DELETE uri ~headers >>= fun (resp, body) ->
|
|
||||||
Request.handle_unit_response resp
|
|
||||||
|
|
||||||
let find_pets_by_status ~status =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/pet/findByStatus" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let uri = Request.add_query_param_list uri "status" (List.map Enums.show_pet_status) status in
|
|
||||||
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) ->
|
|
||||||
Request.read_json_body_as_list_of (JsonSupport.unwrap Pet.of_yojson) resp body
|
|
||||||
|
|
||||||
let find_pets_by_tags ~tags =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/pet/findByTags" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let uri = Request.add_query_param_list uri "tags" (List.map (fun x -> x)) tags in
|
|
||||||
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) ->
|
|
||||||
Request.read_json_body_as_list_of (JsonSupport.unwrap Pet.of_yojson) resp body
|
|
||||||
|
|
||||||
let get_pet_by_id ~pet_id =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/pet/{petId}" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let headers = Cohttp.Header.add headers "api_key" Request.api_key in
|
|
||||||
let uri = Request.replace_path_param uri "petId" Int64.to_string pet_id in
|
|
||||||
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) ->
|
|
||||||
Request.read_json_body_as (JsonSupport.unwrap Pet.of_yojson) resp body
|
|
||||||
|
|
||||||
let update_pet ~pet_t =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/pet" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let body = Request.write_as_json_body Pet.to_yojson pet_t in
|
|
||||||
Cohttp_lwt_unix.Client.call `PUT uri ~headers ~body >>= fun (resp, body) ->
|
|
||||||
Request.handle_unit_response resp
|
|
||||||
|
|
||||||
let update_pet_with_form ~pet_id ?name ?status () =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/pet/{petId}" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let uri = Request.replace_path_param uri "petId" Int64.to_string pet_id in
|
|
||||||
let body = Request.init_form_encoded_body () in
|
|
||||||
let body = Request.maybe_add_form_encoded_body_param body "name" (fun x -> x) name in
|
|
||||||
let body = Request.maybe_add_form_encoded_body_param body "status" (fun x -> x) status in
|
|
||||||
let body = Request.finalize_form_encoded_body body in
|
|
||||||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
|
|
||||||
Request.handle_unit_response resp
|
|
||||||
|
|
||||||
let upload_file ~pet_id ?additional_metadata ?file () =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/pet/{petId}/uploadImage" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let uri = Request.replace_path_param uri "petId" Int64.to_string pet_id in
|
|
||||||
let body = Request.init_form_encoded_body () in
|
|
||||||
let body = Request.maybe_add_form_encoded_body_param body "additional_metadata" (fun x -> x) additional_metadata in
|
|
||||||
let body = Request.maybe_add_form_encoded_body_param body "file" (fun x -> x) file in
|
|
||||||
let body = Request.finalize_form_encoded_body body in
|
|
||||||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
|
|
||||||
Request.read_json_body_as (JsonSupport.unwrap Api_response.of_yojson) resp body
|
|
||||||
|
|
||||||
let upload_file_with_required_file ~pet_id ~required_file ?additional_metadata () =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/fake/{petId}/uploadImageWithRequiredFile" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let uri = Request.replace_path_param uri "petId" Int64.to_string pet_id in
|
|
||||||
let body = Request.init_form_encoded_body () in
|
|
||||||
let body = Request.maybe_add_form_encoded_body_param body "additional_metadata" (fun x -> x) additional_metadata in
|
|
||||||
let body = Request.add_form_encoded_body_param body "required_file" (fun x -> x) required_file in
|
|
||||||
let body = Request.finalize_form_encoded_body body in
|
|
||||||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
|
|
||||||
Request.read_json_body_as (JsonSupport.unwrap Api_response.of_yojson) resp body
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
val add_pet : pet_t:Pet.t -> unit Lwt.t
|
|
||||||
val delete_pet : pet_id:int64 -> ?api_key:string -> unit -> unit Lwt.t
|
|
||||||
val find_pets_by_status : status:Enums.pet_status list -> Pet.t list Lwt.t
|
|
||||||
val find_pets_by_tags : tags:string list -> Pet.t list Lwt.t
|
|
||||||
val get_pet_by_id : pet_id:int64 -> Pet.t Lwt.t
|
|
||||||
val update_pet : pet_t:Pet.t -> unit Lwt.t
|
|
||||||
val update_pet_with_form : pet_id:int64 -> ?name:string -> ?status:string -> unit -> unit Lwt.t
|
|
||||||
val upload_file : pet_id:int64 -> ?additional_metadata:string -> ?file:string -> unit -> Api_response.t Lwt.t
|
|
||||||
val upload_file_with_required_file : pet_id:int64 -> required_file:string -> ?additional_metadata:string -> unit -> Api_response.t Lwt.t
|
|
@ -1,39 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
let delete_order ~order_id =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/store/order/{order_id}" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let uri = Request.replace_path_param uri "order_id" (fun x -> x) order_id in
|
|
||||||
Cohttp_lwt_unix.Client.call `DELETE uri ~headers >>= fun (resp, body) ->
|
|
||||||
Request.handle_unit_response resp
|
|
||||||
|
|
||||||
let get_inventory () =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/store/inventory" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let headers = Cohttp.Header.add headers "api_key" Request.api_key in
|
|
||||||
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) ->
|
|
||||||
Request.read_json_body_as_map_of (JsonSupport.to_int32) resp body
|
|
||||||
|
|
||||||
let get_order_by_id ~order_id =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/store/order/{order_id}" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let uri = Request.replace_path_param uri "order_id" Int64.to_string order_id in
|
|
||||||
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) ->
|
|
||||||
Request.read_json_body_as (JsonSupport.unwrap Order.of_yojson) resp body
|
|
||||||
|
|
||||||
let place_order ~order_t =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/store/order" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let body = Request.write_as_json_body Order.to_yojson order_t in
|
|
||||||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
|
|
||||||
Request.read_json_body_as (JsonSupport.unwrap Order.of_yojson) resp body
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
val delete_order : order_id:string -> unit Lwt.t
|
|
||||||
val get_inventory : unit -> (string * int32) list Lwt.t
|
|
||||||
val get_order_by_id : order_id:int64 -> Order.t Lwt.t
|
|
||||||
val place_order : order_t:Order.t -> Order.t Lwt.t
|
|
@ -1,72 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
let create_user ~user_t =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/user" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let body = Request.write_as_json_body User.to_yojson user_t in
|
|
||||||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
|
|
||||||
Request.handle_unit_response resp
|
|
||||||
|
|
||||||
let create_users_with_array_input ~user =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/user/createWithArray" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let body = Request.write_as_json_body (JsonSupport.of_list_of User.to_yojson) user in
|
|
||||||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
|
|
||||||
Request.handle_unit_response resp
|
|
||||||
|
|
||||||
let create_users_with_list_input ~user =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/user/createWithList" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let body = Request.write_as_json_body (JsonSupport.of_list_of User.to_yojson) user in
|
|
||||||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) ->
|
|
||||||
Request.handle_unit_response resp
|
|
||||||
|
|
||||||
let delete_user ~username =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/user/{username}" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let uri = Request.replace_path_param uri "username" (fun x -> x) username in
|
|
||||||
Cohttp_lwt_unix.Client.call `DELETE uri ~headers >>= fun (resp, body) ->
|
|
||||||
Request.handle_unit_response resp
|
|
||||||
|
|
||||||
let get_user_by_name ~username =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/user/{username}" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let uri = Request.replace_path_param uri "username" (fun x -> x) username in
|
|
||||||
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) ->
|
|
||||||
Request.read_json_body_as (JsonSupport.unwrap User.of_yojson) resp body
|
|
||||||
|
|
||||||
let login_user ~username ~password =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/user/login" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let uri = Request.add_query_param uri "username" (fun x -> x) username in
|
|
||||||
let uri = Request.add_query_param uri "password" (fun x -> x) password in
|
|
||||||
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) ->
|
|
||||||
Request.read_json_body_as (JsonSupport.to_string) resp body
|
|
||||||
|
|
||||||
let logout_user () =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/user/logout" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) ->
|
|
||||||
Request.handle_unit_response resp
|
|
||||||
|
|
||||||
let update_user ~username ~user_t =
|
|
||||||
let open Lwt in
|
|
||||||
let uri = Request.build_uri "/user/{username}" in
|
|
||||||
let headers = Request.default_headers in
|
|
||||||
let uri = Request.replace_path_param uri "username" (fun x -> x) username in
|
|
||||||
let body = Request.write_as_json_body User.to_yojson user_t in
|
|
||||||
Cohttp_lwt_unix.Client.call `PUT uri ~headers ~body >>= fun (resp, body) ->
|
|
||||||
Request.handle_unit_response resp
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
val create_user : user_t:User.t -> unit Lwt.t
|
|
||||||
val create_users_with_array_input : user:User.t list -> unit Lwt.t
|
|
||||||
val create_users_with_list_input : user:User.t list -> unit Lwt.t
|
|
||||||
val delete_user : username:string -> unit Lwt.t
|
|
||||||
val get_user_by_name : username:string -> User.t Lwt.t
|
|
||||||
val login_user : username:string -> password:string -> string Lwt.t
|
|
||||||
val logout_user : unit -> unit Lwt.t
|
|
||||||
val update_user : username:string -> user_t:User.t -> unit Lwt.t
|
|
@ -1,17 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
map_property: (string * string) list;
|
|
||||||
map_of_map_property: (string * (string * string) list) list;
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
map_property = [];
|
|
||||||
map_of_map_property = [];
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
class_name: string;
|
|
||||||
color: string option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create (class_name : string) : t = {
|
|
||||||
class_name = class_name;
|
|
||||||
color = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
code: int32 option [@default None];
|
|
||||||
_type: string option [@default None];
|
|
||||||
message: string option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
code = None;
|
|
||||||
_type = None;
|
|
||||||
message = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
array_array_number: float list list;
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
array_array_number = [];
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
array_number: float list;
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
array_number = [];
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
array_of_string: string list;
|
|
||||||
array_array_of_integer: int64 list list;
|
|
||||||
array_array_of_model: Read_only_first.t list list;
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
array_of_string = [];
|
|
||||||
array_array_of_integer = [];
|
|
||||||
array_array_of_model = [];
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
small_camel: string option [@default None];
|
|
||||||
capital_camel: string option [@default None];
|
|
||||||
small_snake: string option [@default None];
|
|
||||||
capital_snake: string option [@default None];
|
|
||||||
sca_eth_flow_points: string option [@default None];
|
|
||||||
(* Name of the pet *)
|
|
||||||
att_name: string option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
small_camel = None;
|
|
||||||
capital_camel = None;
|
|
||||||
small_snake = None;
|
|
||||||
capital_snake = None;
|
|
||||||
sca_eth_flow_points = None;
|
|
||||||
att_name = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
class_name: string;
|
|
||||||
color: string option [@default None];
|
|
||||||
declawed: bool option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create (class_name : string) : t = {
|
|
||||||
class_name = class_name;
|
|
||||||
color = None;
|
|
||||||
declawed = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
declawed: bool option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
declawed = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
id: int64 option [@default None];
|
|
||||||
name: string;
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create (name : string) : t = {
|
|
||||||
id = None;
|
|
||||||
name = name;
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
* Schema Class_model.t : Model for testing model with \''_class\'' property
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
_class: string option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
(** Model for testing model with \''_class\'' property *)
|
|
||||||
let create () : t = {
|
|
||||||
_class = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
client: string option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
client = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
class_name: string;
|
|
||||||
color: string option [@default None];
|
|
||||||
breed: string option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create (class_name : string) : t = {
|
|
||||||
class_name = class_name;
|
|
||||||
color = None;
|
|
||||||
breed = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
breed: string option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
breed = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
just_symbol: Enums.just_symbol option [@default None];
|
|
||||||
array_enum: Enums.array_enum list;
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
just_symbol = None;
|
|
||||||
array_enum = [];
|
|
||||||
}
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
enum_string: Enums.enum_string option [@default None];
|
|
||||||
enum_string_required: Enums.enum_string;
|
|
||||||
enum_integer: Enums.enum_integer option [@default None];
|
|
||||||
enum_number: Enums.enum_number option [@default None];
|
|
||||||
outer_enum: Enums.status option [@default None];
|
|
||||||
outer_enum_integer: Enums.outerenuminteger option [@default None];
|
|
||||||
outer_enum_default_value: Enums.status option [@default None];
|
|
||||||
outer_enum_integer_default_value: Enums.outerenuminteger option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create (enum_string_required : Enums.enum_string) : t = {
|
|
||||||
enum_string = None;
|
|
||||||
enum_string_required = enum_string_required;
|
|
||||||
enum_integer = None;
|
|
||||||
enum_number = None;
|
|
||||||
outer_enum = None;
|
|
||||||
outer_enum_integer = None;
|
|
||||||
outer_enum_default_value = None;
|
|
||||||
outer_enum_integer_default_value = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
* Schema File.t : Must be named `File` for test.
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
(* Test capitalization *)
|
|
||||||
source_uri: string option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
(** Must be named `File` for test. *)
|
|
||||||
let create () : t = {
|
|
||||||
source_uri = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
file: File.t option [@default None];
|
|
||||||
files: File.t list;
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
file = None;
|
|
||||||
files = [];
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
bar: string option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
bar = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
integer: int32 option [@default None];
|
|
||||||
int32: int32 option [@default None];
|
|
||||||
int64: int64 option [@default None];
|
|
||||||
number: float;
|
|
||||||
float: float option [@default None];
|
|
||||||
double: float option [@default None];
|
|
||||||
string: string option [@default None];
|
|
||||||
byte: string;
|
|
||||||
binary: string option [@default None];
|
|
||||||
date: string;
|
|
||||||
date_time: string option [@default None];
|
|
||||||
uuid: string option [@default None];
|
|
||||||
password: string;
|
|
||||||
(* A string that is a 10 digit number. Can have leading zeros. *)
|
|
||||||
pattern_with_digits: string option [@default None];
|
|
||||||
(* A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. *)
|
|
||||||
pattern_with_digits_and_delimiter: string option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create (number : float) (byte : string) (date : string) (password : string) : t = {
|
|
||||||
integer = None;
|
|
||||||
int32 = None;
|
|
||||||
int64 = None;
|
|
||||||
number = number;
|
|
||||||
float = None;
|
|
||||||
double = None;
|
|
||||||
string = None;
|
|
||||||
byte = byte;
|
|
||||||
binary = None;
|
|
||||||
date = date;
|
|
||||||
date_time = None;
|
|
||||||
uuid = None;
|
|
||||||
password = password;
|
|
||||||
pattern_with_digits = None;
|
|
||||||
pattern_with_digits_and_delimiter = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
bar: string option [@default None];
|
|
||||||
foo: string option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
bar = None;
|
|
||||||
foo = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
* Schema Health_check_result.t : Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
nullable_message: string option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
(** Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. *)
|
|
||||||
let create () : t = {
|
|
||||||
nullable_message = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
(* Form parameter enum test (string array) *)
|
|
||||||
enum_form_string_array: Enums.enum_form_string_array list;
|
|
||||||
(* Form parameter enum test (string) *)
|
|
||||||
enum_form_string: Enums.enumclass option [@default Some(`Minusefg)];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
enum_form_string_array = [];
|
|
||||||
enum_form_string = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
(* None *)
|
|
||||||
integer: int32 option [@default None];
|
|
||||||
(* None *)
|
|
||||||
int32: int32 option [@default None];
|
|
||||||
(* None *)
|
|
||||||
int64: int64 option [@default None];
|
|
||||||
(* None *)
|
|
||||||
number: float;
|
|
||||||
(* None *)
|
|
||||||
float: float option [@default None];
|
|
||||||
(* None *)
|
|
||||||
double: float;
|
|
||||||
(* None *)
|
|
||||||
string: string option [@default None];
|
|
||||||
(* None *)
|
|
||||||
pattern_without_delimiter: string;
|
|
||||||
(* None *)
|
|
||||||
byte: string;
|
|
||||||
(* None *)
|
|
||||||
binary: string option [@default None];
|
|
||||||
(* None *)
|
|
||||||
date: string option [@default None];
|
|
||||||
(* None *)
|
|
||||||
date_time: string option [@default None];
|
|
||||||
(* None *)
|
|
||||||
password: string option [@default None];
|
|
||||||
(* None *)
|
|
||||||
callback: string option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create (number : float) (double : float) (pattern_without_delimiter : string) (byte : string) : t = {
|
|
||||||
integer = None;
|
|
||||||
int32 = None;
|
|
||||||
int64 = None;
|
|
||||||
number = number;
|
|
||||||
float = None;
|
|
||||||
double = double;
|
|
||||||
string = None;
|
|
||||||
pattern_without_delimiter = pattern_without_delimiter;
|
|
||||||
byte = byte;
|
|
||||||
binary = None;
|
|
||||||
date = None;
|
|
||||||
date_time = None;
|
|
||||||
password = None;
|
|
||||||
callback = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
(* field1 *)
|
|
||||||
param: string;
|
|
||||||
(* field2 *)
|
|
||||||
param2: string;
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create (param : string) (param2 : string) : t = {
|
|
||||||
param = param;
|
|
||||||
param2 = param2;
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
(* Additional data to pass to server *)
|
|
||||||
additional_metadata: string option [@default None];
|
|
||||||
(* file to upload *)
|
|
||||||
required_file: string;
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create (required_file : string) : t = {
|
|
||||||
additional_metadata = None;
|
|
||||||
required_file = required_file;
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
string: Foo.t option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
string = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
map_map_of_string: (string * (string * string) list) list;
|
|
||||||
map_of_enum_string: (string * Enums.map_of_enum_string) list;
|
|
||||||
direct_map: (string * bool) list;
|
|
||||||
indirect_map: (string * bool) list;
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
map_map_of_string = [];
|
|
||||||
map_of_enum_string = [];
|
|
||||||
direct_map = [];
|
|
||||||
indirect_map = [];
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
uuid: string option [@default None];
|
|
||||||
date_time: string option [@default None];
|
|
||||||
map: (string * Animal.t) list;
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
uuid = None;
|
|
||||||
date_time = None;
|
|
||||||
map = [];
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
* Schema Model_200_response.t : Model for testing model name starting with number
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
name: int32 option [@default None];
|
|
||||||
_class: string option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
(** Model for testing model name starting with number *)
|
|
||||||
let create () : t = {
|
|
||||||
name = None;
|
|
||||||
_class = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
special_property_name: int64 option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
special_property_name = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
* Schema Name.t : Model for testing model name same as property name
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
name: int32;
|
|
||||||
snake_case: int32 option [@default None];
|
|
||||||
property: string option [@default None];
|
|
||||||
var_123_number: int32 option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
(** Model for testing model name same as property name *)
|
|
||||||
let create (name : int32) : t = {
|
|
||||||
name = name;
|
|
||||||
snake_case = None;
|
|
||||||
property = None;
|
|
||||||
var_123_number = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
integer_prop: int32 option [@default None];
|
|
||||||
number_prop: float option [@default None];
|
|
||||||
boolean_prop: bool option [@default None];
|
|
||||||
string_prop: string option [@default None];
|
|
||||||
date_prop: string option [@default None];
|
|
||||||
datetime_prop: string option [@default None];
|
|
||||||
array_nullable_prop: Yojson.Safe.t list;
|
|
||||||
array_and_items_nullable_prop: Yojson.Safe.t list;
|
|
||||||
array_items_nullable: Yojson.Safe.t list;
|
|
||||||
object_nullable_prop: (string * Yojson.Safe.t) list;
|
|
||||||
object_and_items_nullable_prop: (string * Yojson.Safe.t) list;
|
|
||||||
object_items_nullable: (string * Yojson.Safe.t) list;
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
integer_prop = None;
|
|
||||||
number_prop = None;
|
|
||||||
boolean_prop = None;
|
|
||||||
string_prop = None;
|
|
||||||
date_prop = None;
|
|
||||||
datetime_prop = None;
|
|
||||||
array_nullable_prop = [];
|
|
||||||
array_and_items_nullable_prop = [];
|
|
||||||
array_items_nullable = [];
|
|
||||||
object_nullable_prop = [];
|
|
||||||
object_and_items_nullable_prop = [];
|
|
||||||
object_items_nullable = [];
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
just_number: float option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
just_number = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
id: int64 option [@default None];
|
|
||||||
pet_id: int64 option [@default None];
|
|
||||||
quantity: int32 option [@default None];
|
|
||||||
ship_date: string option [@default None];
|
|
||||||
(* Order Status *)
|
|
||||||
status: Enums.status option [@default None];
|
|
||||||
complete: bool option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
id = None;
|
|
||||||
pet_id = None;
|
|
||||||
quantity = None;
|
|
||||||
ship_date = None;
|
|
||||||
status = None;
|
|
||||||
complete = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
my_number: float option [@default None];
|
|
||||||
my_string: string option [@default None];
|
|
||||||
my_boolean: bool option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
my_number = None;
|
|
||||||
my_string = None;
|
|
||||||
my_boolean = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
id: int64 option [@default None];
|
|
||||||
category: Category.t option [@default None];
|
|
||||||
name: string;
|
|
||||||
photo_urls: string list;
|
|
||||||
tags: Tag.t list;
|
|
||||||
(* pet status in the store *)
|
|
||||||
status: Enums.pet_status option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create (name : string) (photo_urls : string list) : t = {
|
|
||||||
id = None;
|
|
||||||
category = None;
|
|
||||||
name = name;
|
|
||||||
photo_urls = photo_urls;
|
|
||||||
tags = [];
|
|
||||||
status = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
bar: string option [@default None];
|
|
||||||
baz: string option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
bar = None;
|
|
||||||
baz = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
* Schema Return.t : Model for testing reserved words
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
return: int32 option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
(** Model for testing reserved words *)
|
|
||||||
let create () : t = {
|
|
||||||
return = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
id: int64 option [@default None];
|
|
||||||
name: string option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
id = None;
|
|
||||||
name = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
|
||||||
id: int64 option [@default None];
|
|
||||||
username: string option [@default None];
|
|
||||||
first_name: string option [@default None];
|
|
||||||
last_name: string option [@default None];
|
|
||||||
email: string option [@default None];
|
|
||||||
password: string option [@default None];
|
|
||||||
phone: string option [@default None];
|
|
||||||
(* User Status *)
|
|
||||||
user_status: int32 option [@default None];
|
|
||||||
} [@@deriving yojson { strict = false }, show ];;
|
|
||||||
|
|
||||||
let create () : t = {
|
|
||||||
id = None;
|
|
||||||
username = None;
|
|
||||||
first_name = None;
|
|
||||||
last_name = None;
|
|
||||||
email = None;
|
|
||||||
password = None;
|
|
||||||
phone = None;
|
|
||||||
user_status = None;
|
|
||||||
}
|
|
||||||
|
|
@ -1,142 +0,0 @@
|
|||||||
(*
|
|
||||||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
type outerenuminteger = [
|
|
||||||
| `_0 [@printer fun fmt _ -> Format.pp_print_string fmt "0"] [@name "0"]
|
|
||||||
| `_1 [@printer fun fmt _ -> Format.pp_print_string fmt "1"] [@name "1"]
|
|
||||||
| `_2 [@printer fun fmt _ -> Format.pp_print_string fmt "2"] [@name "2"]
|
|
||||||
] [@@deriving yojson, show { with_path = false }];;
|
|
||||||
|
|
||||||
let outerenuminteger_of_yojson json = outerenuminteger_of_yojson (`List [json])
|
|
||||||
let outerenuminteger_to_yojson e =
|
|
||||||
match outerenuminteger_to_yojson e with
|
|
||||||
| `List [json] -> json
|
|
||||||
| json -> json
|
|
||||||
|
|
||||||
type status = [
|
|
||||||
| `Placed [@printer fun fmt _ -> Format.pp_print_string fmt "placed"] [@name "placed"]
|
|
||||||
| `Approved [@printer fun fmt _ -> Format.pp_print_string fmt "approved"] [@name "approved"]
|
|
||||||
| `Delivered [@printer fun fmt _ -> Format.pp_print_string fmt "delivered"] [@name "delivered"]
|
|
||||||
] [@@deriving yojson, show { with_path = false }];;
|
|
||||||
|
|
||||||
let status_of_yojson json = status_of_yojson (`List [json])
|
|
||||||
let status_to_yojson e =
|
|
||||||
match status_to_yojson e with
|
|
||||||
| `List [json] -> json
|
|
||||||
| json -> json
|
|
||||||
|
|
||||||
type enum_query_integer = [
|
|
||||||
| `_1 [@printer fun fmt _ -> Format.pp_print_string fmt "1"] [@name "1"]
|
|
||||||
| `Minus2 [@printer fun fmt _ -> Format.pp_print_string fmt "-2"] [@name "-2"]
|
|
||||||
] [@@deriving yojson, show { with_path = false }];;
|
|
||||||
|
|
||||||
let enum_query_integer_of_yojson json = enum_query_integer_of_yojson (`List [json])
|
|
||||||
let enum_query_integer_to_yojson e =
|
|
||||||
match enum_query_integer_to_yojson e with
|
|
||||||
| `List [json] -> json
|
|
||||||
| json -> json
|
|
||||||
|
|
||||||
type enum_form_string_array = [
|
|
||||||
| `Greater_Than [@printer fun fmt _ -> Format.pp_print_string fmt ">"] [@name ">"]
|
|
||||||
| `Dollar [@printer fun fmt _ -> Format.pp_print_string fmt "$"] [@name "$"]
|
|
||||||
] [@@deriving yojson, show { with_path = false }];;
|
|
||||||
|
|
||||||
let enum_form_string_array_of_yojson json = enum_form_string_array_of_yojson (`List [json])
|
|
||||||
let enum_form_string_array_to_yojson e =
|
|
||||||
match enum_form_string_array_to_yojson e with
|
|
||||||
| `List [json] -> json
|
|
||||||
| json -> json
|
|
||||||
|
|
||||||
type enum_number = [
|
|
||||||
| `_1Period1 [@printer fun fmt _ -> Format.pp_print_string fmt "1.1"] [@name "1.1"]
|
|
||||||
| `Minus1Period2 [@printer fun fmt _ -> Format.pp_print_string fmt "-1.2"] [@name "-1.2"]
|
|
||||||
] [@@deriving yojson, show { with_path = false }];;
|
|
||||||
|
|
||||||
let enum_number_of_yojson json = enum_number_of_yojson (`List [json])
|
|
||||||
let enum_number_to_yojson e =
|
|
||||||
match enum_number_to_yojson e with
|
|
||||||
| `List [json] -> json
|
|
||||||
| json -> json
|
|
||||||
|
|
||||||
type map_of_enum_string = [
|
|
||||||
| `UPPER [@printer fun fmt _ -> Format.pp_print_string fmt "UPPER"] [@name "UPPER"]
|
|
||||||
| `Lower [@printer fun fmt _ -> Format.pp_print_string fmt "lower"] [@name "lower"]
|
|
||||||
] [@@deriving yojson, show { with_path = false }];;
|
|
||||||
|
|
||||||
let map_of_enum_string_of_yojson json = map_of_enum_string_of_yojson (`List [json])
|
|
||||||
let map_of_enum_string_to_yojson e =
|
|
||||||
match map_of_enum_string_to_yojson e with
|
|
||||||
| `List [json] -> json
|
|
||||||
| json -> json
|
|
||||||
|
|
||||||
type enum_integer = [
|
|
||||||
| `_1 [@printer fun fmt _ -> Format.pp_print_string fmt "1"] [@name "1"]
|
|
||||||
| `Minus1 [@printer fun fmt _ -> Format.pp_print_string fmt "-1"] [@name "-1"]
|
|
||||||
] [@@deriving yojson, show { with_path = false }];;
|
|
||||||
|
|
||||||
let enum_integer_of_yojson json = enum_integer_of_yojson (`List [json])
|
|
||||||
let enum_integer_to_yojson e =
|
|
||||||
match enum_integer_to_yojson e with
|
|
||||||
| `List [json] -> json
|
|
||||||
| json -> json
|
|
||||||
|
|
||||||
type just_symbol = [
|
|
||||||
| `Greater_ThanEqual [@printer fun fmt _ -> Format.pp_print_string fmt ">="] [@name ">="]
|
|
||||||
| `Dollar [@printer fun fmt _ -> Format.pp_print_string fmt "$"] [@name "$"]
|
|
||||||
] [@@deriving yojson, show { with_path = false }];;
|
|
||||||
|
|
||||||
let just_symbol_of_yojson json = just_symbol_of_yojson (`List [json])
|
|
||||||
let just_symbol_to_yojson e =
|
|
||||||
match just_symbol_to_yojson e with
|
|
||||||
| `List [json] -> json
|
|
||||||
| json -> json
|
|
||||||
|
|
||||||
type array_enum = [
|
|
||||||
| `Fish [@printer fun fmt _ -> Format.pp_print_string fmt "fish"] [@name "fish"]
|
|
||||||
| `Crab [@printer fun fmt _ -> Format.pp_print_string fmt "crab"] [@name "crab"]
|
|
||||||
] [@@deriving yojson, show { with_path = false }];;
|
|
||||||
|
|
||||||
let array_enum_of_yojson json = array_enum_of_yojson (`List [json])
|
|
||||||
let array_enum_to_yojson e =
|
|
||||||
match array_enum_to_yojson e with
|
|
||||||
| `List [json] -> json
|
|
||||||
| json -> json
|
|
||||||
|
|
||||||
type pet_status = [
|
|
||||||
| `Available [@printer fun fmt _ -> Format.pp_print_string fmt "available"] [@name "available"]
|
|
||||||
| `Pending [@printer fun fmt _ -> Format.pp_print_string fmt "pending"] [@name "pending"]
|
|
||||||
| `Sold [@printer fun fmt _ -> Format.pp_print_string fmt "sold"] [@name "sold"]
|
|
||||||
] [@@deriving yojson, show { with_path = false }];;
|
|
||||||
|
|
||||||
let pet_status_of_yojson json = pet_status_of_yojson (`List [json])
|
|
||||||
let pet_status_to_yojson e =
|
|
||||||
match pet_status_to_yojson e with
|
|
||||||
| `List [json] -> json
|
|
||||||
| json -> json
|
|
||||||
|
|
||||||
type enumclass = [
|
|
||||||
| `_abc [@printer fun fmt _ -> Format.pp_print_string fmt "_abc"] [@name "_abc"]
|
|
||||||
| `Minusefg [@printer fun fmt _ -> Format.pp_print_string fmt "-efg"] [@name "-efg"]
|
|
||||||
| `Left_ParenthesisxyzRight_Parenthesis [@printer fun fmt _ -> Format.pp_print_string fmt "(xyz)"] [@name "(xyz)"]
|
|
||||||
] [@@deriving yojson, show { with_path = false }];;
|
|
||||||
|
|
||||||
let enumclass_of_yojson json = enumclass_of_yojson (`List [json])
|
|
||||||
let enumclass_to_yojson e =
|
|
||||||
match enumclass_to_yojson e with
|
|
||||||
| `List [json] -> json
|
|
||||||
| json -> json
|
|
||||||
|
|
||||||
type enum_string = [
|
|
||||||
| `UPPER [@printer fun fmt _ -> Format.pp_print_string fmt "UPPER"] [@name "UPPER"]
|
|
||||||
| `Lower [@printer fun fmt _ -> Format.pp_print_string fmt "lower"] [@name "lower"]
|
|
||||||
] [@@deriving yojson, show { with_path = false }];;
|
|
||||||
|
|
||||||
let enum_string_of_yojson json = enum_string_of_yojson (`List [json])
|
|
||||||
let enum_string_to_yojson e =
|
|
||||||
match enum_string_to_yojson e with
|
|
||||||
| `List [json] -> json
|
|
||||||
| json -> json
|
|
@ -1,55 +0,0 @@
|
|||||||
open Ppx_deriving_yojson_runtime
|
|
||||||
|
|
||||||
let unwrap to_json json =
|
|
||||||
match to_json json with
|
|
||||||
| Result.Ok json -> json
|
|
||||||
| Result.Error s -> failwith s
|
|
||||||
|
|
||||||
let to_int json =
|
|
||||||
match json with
|
|
||||||
| `Int x -> x
|
|
||||||
| `Intlit s -> int_of_string s
|
|
||||||
| _ -> failwith "JsonSupport.to_int"
|
|
||||||
|
|
||||||
let to_bool json =
|
|
||||||
match json with
|
|
||||||
| `Bool x -> x
|
|
||||||
| _ -> failwith "JsonSupport.to_bool"
|
|
||||||
|
|
||||||
let to_float json =
|
|
||||||
match json with
|
|
||||||
| `Float x -> x
|
|
||||||
| _ -> failwith "JsonSupport.to_float"
|
|
||||||
|
|
||||||
let to_string json =
|
|
||||||
match json with
|
|
||||||
| `String s -> s
|
|
||||||
| _ -> failwith "JsonSupport.to_string"
|
|
||||||
|
|
||||||
let to_int32 json : int32 =
|
|
||||||
match json with
|
|
||||||
| `Int x -> Int32.of_int x
|
|
||||||
| `Intlit s -> Int32.of_string s
|
|
||||||
| _ -> failwith "JsonSupport.to_int32"
|
|
||||||
|
|
||||||
let to_int64 json : int64 =
|
|
||||||
match json with
|
|
||||||
| `Int x -> Int64.of_int x
|
|
||||||
| `Intlit s -> Int64.of_string s
|
|
||||||
| _ -> failwith "JsonSupport.to_int64"
|
|
||||||
|
|
||||||
let of_int x = `Int x
|
|
||||||
|
|
||||||
let of_bool b = `Bool b
|
|
||||||
|
|
||||||
let of_float x = `Float x
|
|
||||||
|
|
||||||
let of_string s = `String s
|
|
||||||
|
|
||||||
let of_int32 x = `Intlit (Int32.to_string x)
|
|
||||||
|
|
||||||
let of_int64 x = `Intlit (Int64.to_string x)
|
|
||||||
|
|
||||||
let of_list_of of_f l = `List (List.map of_f l)
|
|
||||||
|
|
||||||
let of_map_of of_f l = `Assoc (List.map (fun (k, v) -> (k, of_f v)) l)
|
|
@ -1,97 +0,0 @@
|
|||||||
let api_key = ""
|
|
||||||
let base_url = "http://petstore.swagger.io:80/v2"
|
|
||||||
let default_headers = Cohttp.Header.init_with "Content-Type" "application/json"
|
|
||||||
|
|
||||||
let option_fold f default o =
|
|
||||||
match o with
|
|
||||||
| Some v -> f v
|
|
||||||
| None -> default
|
|
||||||
|
|
||||||
let build_uri operation_path = Uri.of_string (base_url ^ operation_path)
|
|
||||||
|
|
||||||
let add_string_header headers key value =
|
|
||||||
Cohttp.Header.add headers key value
|
|
||||||
|
|
||||||
let add_string_header_multi headers key values =
|
|
||||||
Cohttp.Header.add_multi headers key values
|
|
||||||
|
|
||||||
let add_header headers key to_string value =
|
|
||||||
Cohttp.Header.add headers key (to_string value)
|
|
||||||
|
|
||||||
let add_header_multi headers key to_string value =
|
|
||||||
Cohttp.Header.add_multi headers key (to_string value)
|
|
||||||
|
|
||||||
let maybe_add_header headers key to_string value =
|
|
||||||
option_fold (add_header headers key to_string) headers value
|
|
||||||
|
|
||||||
let maybe_add_header_multi headers key to_string value =
|
|
||||||
option_fold (add_header_multi headers key to_string) headers value
|
|
||||||
|
|
||||||
let write_string_body s = Cohttp_lwt.Body.of_string s
|
|
||||||
|
|
||||||
let write_json_body payload =
|
|
||||||
Cohttp_lwt.Body.of_string (Yojson.Safe.to_string payload ~std:true)
|
|
||||||
|
|
||||||
let write_as_json_body to_json payload = write_json_body (to_json payload)
|
|
||||||
|
|
||||||
let handle_response resp on_success_handler =
|
|
||||||
match Cohttp_lwt.Response.status resp with
|
|
||||||
| #Cohttp.Code.success_status -> on_success_handler ()
|
|
||||||
| s -> failwith ("Server responded with status " ^ Cohttp.Code.(reason_phrase_of_code (code_of_status s)))
|
|
||||||
|
|
||||||
let handle_unit_response resp = handle_response resp (fun () -> Lwt.return ())
|
|
||||||
|
|
||||||
let read_json_body resp body =
|
|
||||||
handle_response resp (fun () ->
|
|
||||||
(Lwt.(Cohttp_lwt.Body.to_string body >|= Yojson.Safe.from_string)))
|
|
||||||
|
|
||||||
let read_json_body_as of_json resp body =
|
|
||||||
Lwt.(read_json_body resp body >|= of_json)
|
|
||||||
|
|
||||||
let read_json_body_as_list resp body =
|
|
||||||
Lwt.(read_json_body resp body >|= Yojson.Safe.Util.to_list)
|
|
||||||
|
|
||||||
let read_json_body_as_list_of of_json resp body =
|
|
||||||
Lwt.(read_json_body_as_list resp body >|= List.map of_json)
|
|
||||||
|
|
||||||
let read_json_body_as_map resp body =
|
|
||||||
Lwt.(read_json_body resp body >|= Yojson.Safe.Util.to_assoc)
|
|
||||||
|
|
||||||
let read_json_body_as_map_of of_json resp body =
|
|
||||||
Lwt.(read_json_body_as_map resp body >|= List.map (fun (s, v) -> (s, of_json v)))
|
|
||||||
|
|
||||||
let replace_string_path_param uri param_name param_value =
|
|
||||||
let regexp = Str.regexp (Str.quote ("{" ^ param_name ^ "}")) in
|
|
||||||
let path = Str.global_replace regexp param_value (Uri.pct_decode (Uri.path uri)) in
|
|
||||||
Uri.with_path uri path
|
|
||||||
|
|
||||||
let replace_path_param uri param_name to_string param_value =
|
|
||||||
replace_string_path_param uri param_name (to_string param_value)
|
|
||||||
|
|
||||||
let maybe_replace_path_param uri param_name to_string param_value =
|
|
||||||
option_fold (replace_path_param uri param_name to_string) uri param_value
|
|
||||||
|
|
||||||
let add_query_param uri param_name to_string param_value =
|
|
||||||
Uri.add_query_param' uri (param_name, to_string param_value)
|
|
||||||
|
|
||||||
let add_query_param_list uri param_name to_string param_value =
|
|
||||||
Uri.add_query_param uri (param_name, to_string param_value)
|
|
||||||
|
|
||||||
let maybe_add_query_param uri param_name to_string param_value =
|
|
||||||
option_fold (add_query_param uri param_name to_string) uri param_value
|
|
||||||
|
|
||||||
let init_form_encoded_body () = ""
|
|
||||||
|
|
||||||
let add_form_encoded_body_param params param_name to_string param_value =
|
|
||||||
let new_param_enc = Printf.sprintf {|%s=%s|} (Uri.pct_encode param_name) (Uri.pct_encode (to_string param_value)) in
|
|
||||||
if params = ""
|
|
||||||
then new_param_enc
|
|
||||||
else Printf.sprintf {|%s&%s|} params new_param_enc
|
|
||||||
|
|
||||||
let add_form_encoded_body_param_list params param_name to_string new_params =
|
|
||||||
add_form_encoded_body_param params param_name (String.concat ",") (to_string new_params)
|
|
||||||
|
|
||||||
let maybe_add_form_encoded_body_param params param_name to_string param_value =
|
|
||||||
option_fold (add_form_encoded_body_param params param_name to_string) params param_value
|
|
||||||
|
|
||||||
let finalize_form_encoded_body body = Cohttp_lwt.Body.of_string body
|
|
Loading…
x
Reference in New Issue
Block a user