update erlang samples

This commit is contained in:
William Cheng 2023-03-22 00:26:36 +08:00
parent fc91fca737
commit 38d9dc1f36
5 changed files with 5 additions and 16 deletions

View File

@ -1 +1 @@
5.3.0-SNAPSHOT
6.5.0-SNAPSHOT

View File

@ -12,7 +12,6 @@
-define(BASE_URL, <<"/v2">>).
%% @doc Add a new pet to the store
%%
-spec add_pet(ctx:ctx(), petstore_pet:petstore_pet()) -> {ok, petstore_pet:petstore_pet(), petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
add_pet(Ctx, PetstorePet) ->
add_pet(Ctx, PetstorePet, #{}).
@ -33,7 +32,6 @@ add_pet(Ctx, PetstorePet, Optional) ->
petstore_utils:request(Ctx, Method, Path, QS, ContentTypeHeader++Headers, Body1, Opts, Cfg).
%% @doc Deletes a pet
%%
-spec delete_pet(ctx:ctx(), integer()) -> {ok, [], petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
delete_pet(Ctx, PetId) ->
delete_pet(Ctx, PetId, #{}).
@ -117,7 +115,6 @@ get_pet_by_id(Ctx, PetId, Optional) ->
petstore_utils:request(Ctx, Method, Path, QS, ContentTypeHeader++Headers, Body1, Opts, Cfg).
%% @doc Update an existing pet
%%
-spec update_pet(ctx:ctx(), petstore_pet:petstore_pet()) -> {ok, petstore_pet:petstore_pet(), petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
update_pet(Ctx, PetstorePet) ->
update_pet(Ctx, PetstorePet, #{}).
@ -138,7 +135,6 @@ update_pet(Ctx, PetstorePet, Optional) ->
petstore_utils:request(Ctx, Method, Path, QS, ContentTypeHeader++Headers, Body1, Opts, Cfg).
%% @doc Updates a pet in the store with form data
%%
-spec update_pet_with_form(ctx:ctx(), integer()) -> {ok, [], petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
update_pet_with_form(Ctx, PetId) ->
update_pet_with_form(Ctx, PetId, #{}).
@ -159,7 +155,6 @@ update_pet_with_form(Ctx, PetId, Optional) ->
petstore_utils:request(Ctx, Method, Path, QS, ContentTypeHeader++Headers, Body1, Opts, Cfg).
%% @doc uploads an image
%%
-spec upload_file(ctx:ctx(), integer()) -> {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) ->
upload_file(Ctx, PetId, #{}).

View File

@ -71,7 +71,6 @@ get_order_by_id(Ctx, OrderId, Optional) ->
petstore_utils:request(Ctx, Method, Path, QS, ContentTypeHeader++Headers, Body1, Opts, Cfg).
%% @doc Place an order for a pet
%%
-spec place_order(ctx:ctx(), petstore_order:petstore_order()) -> {ok, petstore_order:petstore_order(), petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
place_order(Ctx, PetstoreOrder) ->
place_order(Ctx, PetstoreOrder, #{}).

View File

@ -33,7 +33,6 @@ create_user(Ctx, PetstoreUser, Optional) ->
petstore_utils:request(Ctx, Method, Path, QS, ContentTypeHeader++Headers, Body1, Opts, Cfg).
%% @doc Creates list of users with given input array
%%
-spec create_users_with_array_input(ctx:ctx(), list()) -> {ok, [], petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
create_users_with_array_input(Ctx, PetstoreUserArray) ->
create_users_with_array_input(Ctx, PetstoreUserArray, #{}).
@ -54,7 +53,6 @@ create_users_with_array_input(Ctx, PetstoreUserArray, Optional) ->
petstore_utils:request(Ctx, Method, Path, QS, ContentTypeHeader++Headers, Body1, Opts, Cfg).
%% @doc Creates list of users with given input array
%%
-spec create_users_with_list_input(ctx:ctx(), list()) -> {ok, [], petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
create_users_with_list_input(Ctx, PetstoreUserArray) ->
create_users_with_list_input(Ctx, PetstoreUserArray, #{}).
@ -96,7 +94,6 @@ delete_user(Ctx, Username, Optional) ->
petstore_utils:request(Ctx, Method, Path, QS, ContentTypeHeader++Headers, Body1, Opts, Cfg).
%% @doc Get user by user name
%%
-spec get_user_by_name(ctx:ctx(), binary()) -> {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) ->
get_user_by_name(Ctx, Username, #{}).
@ -117,7 +114,6 @@ get_user_by_name(Ctx, Username, Optional) ->
petstore_utils:request(Ctx, Method, Path, QS, ContentTypeHeader++Headers, Body1, Opts, Cfg).
%% @doc Logs user into the system
%%
-spec login_user(ctx:ctx(), binary(), binary()) -> {ok, binary(), petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
login_user(Ctx, Username, Password) ->
login_user(Ctx, Username, Password, #{}).
@ -138,7 +134,6 @@ login_user(Ctx, Username, Password, Optional) ->
petstore_utils:request(Ctx, Method, Path, QS, ContentTypeHeader++Headers, Body1, Opts, Cfg).
%% @doc Logs out current logged in user session
%%
-spec logout_user(ctx:ctx()) -> {ok, [], petstore_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), petstore_utils:response_info()}.
logout_user(Ctx) ->
logout_user(Ctx, #{}).

View File

@ -81,12 +81,12 @@ auth_with_prefix(Cfg, Key, Token) ->
update_params_with_auth(Cfg, Headers, QS) ->
AuthSettings = maps:get(auth, Cfg, #{}),
Auths = #{ 'api_key' =>
#{type => 'apiKey',
key => <<"api_key">>,
in => header}, 'petstore_auth' =>
Auths = #{ 'petstore_auth' =>
#{type => 'oauth2',
key => <<"Authorization">>,
in => header}, 'api_key' =>
#{type => 'apiKey',
key => <<"api_key">>,
in => header}},
maps:fold(fun(AuthName, #{type := _Type,