Skip to content

Commit

Permalink
export save/3 (2600hz#3319)
Browse files Browse the repository at this point in the history
* export save/3

* apppease the Dialyzer
  • Loading branch information
jamhed authored and k-anderson committed Feb 23, 2017
1 parent 2dc5914 commit f48c5f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion applications/crossbar/src/crossbar.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
,req_nouns = [{<<"404">>, []}] :: req_nouns() % {module, [id]} most typical
,req_json = kz_json:new() :: req_json()
,req_files = [] :: req_files()
,req_data :: kz_json:json_term() % the "data" from the request JSON envelope
,req_data = kz_json:new() :: kz_json:json_term() % the "data" from the request JSON envelope
,req_headers = [] :: cowboy:http_headers()
,query_json = kz_json:new() :: kz_json:object()
,account_id :: api_ne_binary()
Expand Down
13 changes: 7 additions & 6 deletions applications/crossbar/src/crossbar_doc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
,patch_and_validate/3
,load_view/3, load_view/4, load_view/5, load_view/6
,load_attachment/4, load_docs/2
,save/1, save/2
,save/1, save/2, save/3
,delete/1, delete/2
,save_attachment/4, save_attachment/5
,delete_attachment/3
Expand Down Expand Up @@ -342,7 +342,7 @@ patch_and_validate_doc(Id, Context, ValidateFun, _RespStatus) ->
cb_context:context().
-spec load_view(ne_binary() | 'all_docs', kz_proplist(), cb_context:context(), kz_json:json_term(), pos_integer()) ->
cb_context:context().
-spec load_view(ne_binary() | 'all_docs', kz_proplist(), cb_context:context(), kz_json:json_term(), pos_integer(), filter_fun() | 'undefined') ->
-spec load_view(ne_binary() | 'all_docs', kz_proplist(), cb_context:context(), kz_json:json_term(), pos_integer(), filter_fun()) ->
cb_context:context().
load_view(View, Options, Context) ->
load_view(View, Options, Context
Expand Down Expand Up @@ -978,11 +978,12 @@ handle_datamgr_pagination_success([_|_]=JObjs
end.

-type filter_fun() :: fun((kz_json:object(), kz_json:objects()) -> kz_json:objects()) |
fun((cb_context:context(), kz_json:object(), kz_json:objects()) -> kz_json:objects()).
fun((cb_context:context(), kz_json:object(), kz_json:objects()) -> kz_json:objects()) |
'undefined'.

-spec apply_filter('undefined' | filter_fun(), kz_json:objects(), cb_context:context(), direction()) ->
-spec apply_filter(filter_fun(), kz_json:objects(), cb_context:context(), direction()) ->
kz_json:objects().
-spec apply_filter('undefined' | filter_fun(), kz_json:objects(), cb_context:context(), direction(), boolean()) ->
-spec apply_filter(filter_fun(), kz_json:objects(), cb_context:context(), direction(), boolean()) ->
kz_json:objects().
apply_filter(FilterFun, JObjs, Context, Direction) ->
apply_filter(FilterFun, JObjs, Context, Direction, has_qs_filter(Context)).
Expand All @@ -1004,7 +1005,7 @@ apply_filter(FilterFun, JObjs, Context, Direction, HasQSFilter) ->
'descending' -> lists:reverse(Filtered)
end.

-spec maybe_apply_custom_filter(cb_context:context(), 'undefined' | filter_fun(), kz_json:objects()) -> kz_json:objects().
-spec maybe_apply_custom_filter(cb_context:context(), filter_fun(), kz_json:objects()) -> kz_json:objects().
maybe_apply_custom_filter(_Context, 'undefined', JObjs) -> JObjs;
maybe_apply_custom_filter(Context, FilterFun, JObjs) ->
Fun = case is_function(FilterFun, 2) of
Expand Down

0 comments on commit f48c5f3

Please sign in to comment.