forked from loafle/openapi-generator-original
Get API configuration from application environment for erlang-client (#14752)
* Get config from classname api * Use the packageName * Add samples
This commit is contained in:
parent
f4e53db8cf
commit
3aa7ec6a39
@ -18,7 +18,7 @@
|
||||
-spec {{operationId}}(ctx:ctx(){{#allParams}}{{#required}}, {{{dataType}}}{{/required}}{{/allParams}}, maps:map()) -> {ok, {{{returnType}}}{{^returnType}}[]{{/returnType}}, {{packageName}}_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), {{packageName}}_utils:response_info()}.
|
||||
{{operationId}}(Ctx{{#allParams}}{{#required}}, {{paramName}}{{/required}}{{/allParams}}, Optional) ->
|
||||
_OptionalParams = maps:get(params, Optional, #{}),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(kuberl, config, #{})),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env({{packageName}}_api, config, #{})),
|
||||
|
||||
Method = {{httpMethod}},
|
||||
Path = [<<"{{{replacedPathName}}}">>],
|
||||
|
@ -1 +1 @@
|
||||
5.2.0-SNAPSHOT
|
||||
5.3.0-SNAPSHOT
|
@ -20,7 +20,7 @@ add_pet(Ctx, PetstorePet) ->
|
||||
-spec add_pet(ctx:ctx(), petstore_pet:petstore_pet(), maps:map()) -> {ok, petstore_pet:petstore_pet(), petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
|
||||
add_pet(Ctx, PetstorePet, Optional) ->
|
||||
_OptionalParams = maps:get(params, Optional, #{}),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(kuberl, config, #{})),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(petstore_api, config, #{})),
|
||||
|
||||
Method = post,
|
||||
Path = [<<"/pet">>],
|
||||
@ -41,7 +41,7 @@ delete_pet(Ctx, PetId) ->
|
||||
-spec delete_pet(ctx:ctx(), integer(), maps:map()) -> {ok, [], petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
|
||||
delete_pet(Ctx, PetId, Optional) ->
|
||||
_OptionalParams = maps:get(params, Optional, #{}),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(kuberl, config, #{})),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(petstore_api, config, #{})),
|
||||
|
||||
Method = delete,
|
||||
Path = [<<"/pet/", PetId, "">>],
|
||||
@ -62,7 +62,7 @@ find_pets_by_status(Ctx, Status) ->
|
||||
-spec find_pets_by_status(ctx:ctx(), list(), maps:map()) -> {ok, [petstore_pet:petstore_pet()], petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
|
||||
find_pets_by_status(Ctx, Status, Optional) ->
|
||||
_OptionalParams = maps:get(params, Optional, #{}),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(kuberl, config, #{})),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(petstore_api, config, #{})),
|
||||
|
||||
Method = get,
|
||||
Path = [<<"/pet/findByStatus">>],
|
||||
@ -83,7 +83,7 @@ find_pets_by_tags(Ctx, Tags) ->
|
||||
-spec find_pets_by_tags(ctx:ctx(), list(), maps:map()) -> {ok, [petstore_pet:petstore_pet()], petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
|
||||
find_pets_by_tags(Ctx, Tags, Optional) ->
|
||||
_OptionalParams = maps:get(params, Optional, #{}),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(kuberl, config, #{})),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(petstore_api, config, #{})),
|
||||
|
||||
Method = get,
|
||||
Path = [<<"/pet/findByTags">>],
|
||||
@ -104,7 +104,7 @@ get_pet_by_id(Ctx, PetId) ->
|
||||
-spec get_pet_by_id(ctx:ctx(), integer(), maps:map()) -> {ok, petstore_pet:petstore_pet(), petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
|
||||
get_pet_by_id(Ctx, PetId, Optional) ->
|
||||
_OptionalParams = maps:get(params, Optional, #{}),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(kuberl, config, #{})),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(petstore_api, config, #{})),
|
||||
|
||||
Method = get,
|
||||
Path = [<<"/pet/", PetId, "">>],
|
||||
@ -125,7 +125,7 @@ update_pet(Ctx, PetstorePet) ->
|
||||
-spec update_pet(ctx:ctx(), petstore_pet:petstore_pet(), maps:map()) -> {ok, petstore_pet:petstore_pet(), petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
|
||||
update_pet(Ctx, PetstorePet, Optional) ->
|
||||
_OptionalParams = maps:get(params, Optional, #{}),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(kuberl, config, #{})),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(petstore_api, config, #{})),
|
||||
|
||||
Method = put,
|
||||
Path = [<<"/pet">>],
|
||||
@ -146,7 +146,7 @@ update_pet_with_form(Ctx, PetId) ->
|
||||
-spec update_pet_with_form(ctx:ctx(), integer(), maps:map()) -> {ok, [], petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
|
||||
update_pet_with_form(Ctx, PetId, Optional) ->
|
||||
_OptionalParams = maps:get(params, Optional, #{}),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(kuberl, config, #{})),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(petstore_api, config, #{})),
|
||||
|
||||
Method = post,
|
||||
Path = [<<"/pet/", PetId, "">>],
|
||||
@ -167,7 +167,7 @@ upload_file(Ctx, PetId) ->
|
||||
-spec upload_file(ctx:ctx(), integer(), maps:map()) -> {ok, petstore_api_response:petstore_api_response(), petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
|
||||
upload_file(Ctx, PetId, Optional) ->
|
||||
_OptionalParams = maps:get(params, Optional, #{}),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(kuberl, config, #{})),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(petstore_api, config, #{})),
|
||||
|
||||
Method = post,
|
||||
Path = [<<"/pet/", PetId, "/uploadImage">>],
|
||||
|
@ -16,7 +16,7 @@ delete_order(Ctx, OrderId) ->
|
||||
-spec delete_order(ctx:ctx(), binary(), maps:map()) -> {ok, [], petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
|
||||
delete_order(Ctx, OrderId, Optional) ->
|
||||
_OptionalParams = maps:get(params, Optional, #{}),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(kuberl, config, #{})),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(petstore_api, config, #{})),
|
||||
|
||||
Method = delete,
|
||||
Path = [<<"/store/order/", OrderId, "">>],
|
||||
@ -37,7 +37,7 @@ get_inventory(Ctx) ->
|
||||
-spec get_inventory(ctx:ctx(), maps:map()) -> {ok, maps:map(), petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
|
||||
get_inventory(Ctx, Optional) ->
|
||||
_OptionalParams = maps:get(params, Optional, #{}),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(kuberl, config, #{})),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(petstore_api, config, #{})),
|
||||
|
||||
Method = get,
|
||||
Path = [<<"/store/inventory">>],
|
||||
@ -58,7 +58,7 @@ get_order_by_id(Ctx, OrderId) ->
|
||||
-spec get_order_by_id(ctx:ctx(), integer(), maps:map()) -> {ok, petstore_order:petstore_order(), petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
|
||||
get_order_by_id(Ctx, OrderId, Optional) ->
|
||||
_OptionalParams = maps:get(params, Optional, #{}),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(kuberl, config, #{})),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(petstore_api, config, #{})),
|
||||
|
||||
Method = get,
|
||||
Path = [<<"/store/order/", OrderId, "">>],
|
||||
@ -79,7 +79,7 @@ place_order(Ctx, PetstoreOrder) ->
|
||||
-spec place_order(ctx:ctx(), petstore_order:petstore_order(), maps:map()) -> {ok, petstore_order:petstore_order(), petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
|
||||
place_order(Ctx, PetstoreOrder, Optional) ->
|
||||
_OptionalParams = maps:get(params, Optional, #{}),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(kuberl, config, #{})),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(petstore_api, config, #{})),
|
||||
|
||||
Method = post,
|
||||
Path = [<<"/store/order">>],
|
||||
|
@ -20,7 +20,7 @@ create_user(Ctx, PetstoreUser) ->
|
||||
-spec create_user(ctx:ctx(), petstore_user:petstore_user(), maps:map()) -> {ok, [], petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
|
||||
create_user(Ctx, PetstoreUser, Optional) ->
|
||||
_OptionalParams = maps:get(params, Optional, #{}),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(kuberl, config, #{})),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(petstore_api, config, #{})),
|
||||
|
||||
Method = post,
|
||||
Path = [<<"/user">>],
|
||||
@ -41,7 +41,7 @@ create_users_with_array_input(Ctx, PetstoreUserArray) ->
|
||||
-spec create_users_with_array_input(ctx:ctx(), list(), maps:map()) -> {ok, [], petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
|
||||
create_users_with_array_input(Ctx, PetstoreUserArray, Optional) ->
|
||||
_OptionalParams = maps:get(params, Optional, #{}),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(kuberl, config, #{})),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(petstore_api, config, #{})),
|
||||
|
||||
Method = post,
|
||||
Path = [<<"/user/createWithArray">>],
|
||||
@ -62,7 +62,7 @@ create_users_with_list_input(Ctx, PetstoreUserArray) ->
|
||||
-spec create_users_with_list_input(ctx:ctx(), list(), maps:map()) -> {ok, [], petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
|
||||
create_users_with_list_input(Ctx, PetstoreUserArray, Optional) ->
|
||||
_OptionalParams = maps:get(params, Optional, #{}),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(kuberl, config, #{})),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(petstore_api, config, #{})),
|
||||
|
||||
Method = post,
|
||||
Path = [<<"/user/createWithList">>],
|
||||
@ -83,7 +83,7 @@ delete_user(Ctx, Username) ->
|
||||
-spec delete_user(ctx:ctx(), binary(), maps:map()) -> {ok, [], petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
|
||||
delete_user(Ctx, Username, Optional) ->
|
||||
_OptionalParams = maps:get(params, Optional, #{}),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(kuberl, config, #{})),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(petstore_api, config, #{})),
|
||||
|
||||
Method = delete,
|
||||
Path = [<<"/user/", Username, "">>],
|
||||
@ -104,7 +104,7 @@ get_user_by_name(Ctx, Username) ->
|
||||
-spec get_user_by_name(ctx:ctx(), binary(), maps:map()) -> {ok, petstore_user:petstore_user(), petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
|
||||
get_user_by_name(Ctx, Username, Optional) ->
|
||||
_OptionalParams = maps:get(params, Optional, #{}),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(kuberl, config, #{})),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(petstore_api, config, #{})),
|
||||
|
||||
Method = get,
|
||||
Path = [<<"/user/", Username, "">>],
|
||||
@ -125,7 +125,7 @@ login_user(Ctx, Username, Password) ->
|
||||
-spec login_user(ctx:ctx(), binary(), binary(), maps:map()) -> {ok, binary(), petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
|
||||
login_user(Ctx, Username, Password, Optional) ->
|
||||
_OptionalParams = maps:get(params, Optional, #{}),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(kuberl, config, #{})),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(petstore_api, config, #{})),
|
||||
|
||||
Method = get,
|
||||
Path = [<<"/user/login">>],
|
||||
@ -146,7 +146,7 @@ logout_user(Ctx) ->
|
||||
-spec logout_user(ctx:ctx(), maps:map()) -> {ok, [], petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
|
||||
logout_user(Ctx, Optional) ->
|
||||
_OptionalParams = maps:get(params, Optional, #{}),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(kuberl, config, #{})),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(petstore_api, config, #{})),
|
||||
|
||||
Method = get,
|
||||
Path = [<<"/user/logout">>],
|
||||
@ -167,7 +167,7 @@ update_user(Ctx, Username, PetstoreUser) ->
|
||||
-spec update_user(ctx:ctx(), binary(), petstore_user:petstore_user(), maps:map()) -> {ok, [], petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
|
||||
update_user(Ctx, Username, PetstoreUser, Optional) ->
|
||||
_OptionalParams = maps:get(params, Optional, #{}),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(kuberl, config, #{})),
|
||||
Cfg = maps:get(cfg, Optional, application:get_env(petstore_api, config, #{})),
|
||||
|
||||
Method = put,
|
||||
Path = [<<"/user/", Username, "">>],
|
||||
|
Loading…
x
Reference in New Issue
Block a user