@@ -62,6 +62,8 @@ defmodule ExAws.Dynamo do
6262
6363 import ExAws.Utils , only: [ camelize: 1 , camelize_keys: 1 , camelize_keys: 2 , upcase: 1 ]
6464 alias __MODULE__
65+ alias ExAws.Dynamo . { Decoder , Lazy }
66+ alias ExAws.Operation.JSON
6567
6668 @ nested_opts [ :exclusive_start_key , :expression_attribute_values , :expression_attribute_names ]
6769 @ upcase_opts [ :return_values , :return_item_collection_metrics , :select , :total_segments ]
@@ -125,8 +127,8 @@ defmodule ExAws.Dynamo do
125127 |> Dynamo.decode_item(as: User)
126128 ```
127129 """
128- @ spec decode_item ( Map . t ( ) ) :: Map . t ( )
129- @ spec decode_item ( Map . t ( ) , as: atom ) :: Map . t ( )
130+ @ spec decode_item ( map ( ) ) :: map ( )
131+ @ spec decode_item ( map ( ) , as: atom ) :: map ( )
130132 def decode_item ( item , opts \\ [ ] )
131133
132134 def decode_item ( % { "Items" => items } , opts ) do
@@ -138,12 +140,12 @@ defmodule ExAws.Dynamo do
138140 end
139141
140142 def decode_item ( item , opts ) do
141- ExAws.Dynamo. Decoder. decode ( item , opts )
143+ Decoder . decode ( item , opts )
142144 end
143145
144146 @ doc "List tables"
145- @ spec list_tables ( ) :: ExAws.Operation. JSON. t ( )
146- def list_tables ( ) do
147+ @ spec list_tables ( ) :: JSON . t ( )
148+ def list_tables do
147149 request ( :list_tables , % { } )
148150 end
149151
@@ -163,7 +165,7 @@ defmodule ExAws.Dynamo do
163165 read_capacity :: pos_integer ,
164166 write_capacity :: pos_integer ,
165167 billing_mode :: dynamo_billing_types
166- ) :: ExAws.Operation. JSON. t ( )
168+ ) :: JSON . t ( )
167169 def create_table (
168170 name ,
169171 primary_key ,
@@ -252,10 +254,10 @@ defmodule ExAws.Dynamo do
252254 key_definitions :: key_definitions ,
253255 read_capacity :: pos_integer ,
254256 write_capacity :: pos_integer ,
255- global_indexes :: [ Map . t ( ) ] ,
256- local_indexes :: [ Map . t ( ) ] ,
257+ global_indexes :: [ map ( ) ] ,
258+ local_indexes :: [ map ( ) ] ,
257259 billing_mode :: dynamo_billing_types
258- ) :: ExAws.ExAws.Operation. JSON. t ( )
260+ ) :: JSON . t ( )
259261 def create_table (
260262 name ,
261263 key_schema ,
@@ -303,7 +305,7 @@ defmodule ExAws.Dynamo do
303305 read_capacity :: pos_integer ,
304306 write_capacity :: pos_integer ,
305307 billing_mode :: dynamo_billing_types
306- ) :: Map . t ( )
308+ ) :: map ( )
307309 defp build_billing_mode ( read_capacity , write_capacity , :provisioned ) do
308310 % {
309311 "BillingMode" => "PROVISIONED" ,
@@ -320,14 +322,14 @@ defmodule ExAws.Dynamo do
320322 end
321323
322324 @ doc "Describe table"
323- @ spec describe_table ( name :: binary ) :: ExAws.Operation. JSON. t ( )
325+ @ spec describe_table ( name :: binary ) :: JSON . t ( )
324326 def describe_table ( name ) do
325327 request ( :describe_table , % { "TableName" => name } )
326328 end
327329
328330 @ doc "Update Table"
329- @ spec update_table ( name :: binary , attributes :: Keyword . t ( ) | Map . t ( ) ) ::
330- ExAws.Operation. JSON. t ( )
331+ @ spec update_table ( name :: binary , attributes :: Keyword . t ( ) | map ( ) ) ::
332+ JSON . t ( )
331333 def update_table ( name , attributes ) do
332334 data =
333335 attributes
@@ -338,46 +340,46 @@ defmodule ExAws.Dynamo do
338340 request ( :update_table , data )
339341 end
340342
341- @ spec maybe_convert_billing_mode ( attributes :: Keyword . t ( ) | Map . t ( ) ) :: Keyword . t ( ) | Map . t ( )
343+ @ spec maybe_convert_billing_mode ( attributes :: Keyword . t ( ) | map ( ) ) :: Keyword . t ( ) | map ( )
342344 defp maybe_convert_billing_mode ( attributes ) do
343345 case attributes [ :billing_mode ] do
344346 nil -> attributes
345347 _ -> convert_billing_mode ( attributes , attributes [ :billing_mode ] )
346348 end
347349 end
348350
349- @ spec convert_billing_mode ( attributes :: Keyword . t ( ) | Map . t ( ) , dynamo_billing_types ) ::
350- Keyword . t ( ) | Map . t ( )
351+ @ spec convert_billing_mode ( attributes :: Keyword . t ( ) | map ( ) , dynamo_billing_types ) ::
352+ Keyword . t ( ) | map ( )
351353 defp convert_billing_mode ( attributes , :provisioned ) ,
352354 do: do_convert_billing_mode ( attributes , "PROVISIONED" )
353355
354356 defp convert_billing_mode ( attributes , :pay_per_request ) ,
355357 do: do_convert_billing_mode ( attributes , "PAY_PER_REQUEST" )
356358
357- @ spec do_convert_billing_mode ( attributes :: Keyword . t ( ) | Map . t ( ) , value :: String . t ( ) ) ::
358- Keyword . t ( ) | Map . t ( )
359+ @ spec do_convert_billing_mode ( attributes :: Keyword . t ( ) | map ( ) , value :: String . t ( ) ) ::
360+ Keyword . t ( ) | map ( )
359361 defp do_convert_billing_mode ( attributes , value ) when is_map ( attributes ) ,
360362 do: Map . replace! ( attributes , :billing_mode , value )
361363
362364 defp do_convert_billing_mode ( attributes , value ) when is_list ( attributes ) ,
363365 do: Keyword . replace! ( attributes , :billing_mode , value )
364366
365367 @ doc "Delete Table"
366- @ spec delete_table ( table :: binary ) :: ExAws.Operation. JSON. t ( )
368+ @ spec delete_table ( table :: binary ) :: JSON . t ( )
367369 def delete_table ( table ) do
368370 request ( :delete_table , % { "TableName" => table } )
369371 end
370372
371373 @ doc "Update time to live"
372374 @ spec update_time_to_live ( table :: binary , ttl_attribute :: binary , enabled :: boolean ) ::
373- ExAws.Operation. JSON. t ( )
375+ JSON . t ( )
374376 def update_time_to_live ( table , ttl_attribute , enabled ) do
375377 data = build_time_to_live ( ttl_attribute , enabled ) |> Map . merge ( % { "TableName" => table } )
376378
377379 request ( :update_time_to_live , data )
378380 end
379381
380- @ spec build_time_to_live ( ttl_attribute :: binary , enabled :: boolean ) :: Map . t ( )
382+ @ spec build_time_to_live ( ttl_attribute :: binary , enabled :: boolean ) :: map ( )
381383 defp build_time_to_live ( "" , _enabled ) do
382384 % { }
383385 end
@@ -396,7 +398,7 @@ defmodule ExAws.Dynamo do
396398 end
397399
398400 @ doc "Describe time to live"
399- @ spec describe_time_to_live ( table :: binary ) :: ExAws.Operation. JSON. t ( )
401+ @ spec describe_time_to_live ( table :: binary ) :: JSON . t ( )
400402 def describe_time_to_live ( table ) do
401403 request ( :describe_time_to_live , % { "TableName" => table } )
402404 end
@@ -437,15 +439,15 @@ defmodule ExAws.Dynamo do
437439 | { :select , select_vals }
438440 | { :total_segments , pos_integer }
439441 ]
440- @ spec scan ( table_name :: table_name ) :: ExAws.Operation. JSON. t ( )
441- @ spec scan ( table_name :: table_name , opts :: scan_opts ) :: ExAws.Operation. JSON. t ( )
442+ @ spec scan ( table_name :: table_name ) :: JSON . t ( )
443+ @ spec scan ( table_name :: table_name , opts :: scan_opts ) :: JSON . t ( )
442444 def scan ( name , opts \\ [ ] ) do
443445 data =
444446 opts
445447 |> build_opts ( )
446448 |> Map . merge ( % { "TableName" => name } )
447449
448- request ( :scan , data , % { stream_builder: & ExAws.Dynamo. Lazy. stream_scan ( name , opts , & 1 ) } )
450+ request ( :scan , data , % { stream_builder: & Lazy . stream_scan ( name , opts , & 1 ) } )
449451 end
450452
451453 @ doc """
@@ -477,15 +479,15 @@ defmodule ExAws.Dynamo do
477479 | { :scan_index_forward , boolean }
478480 | { :select , select_vals }
479481 ]
480- @ spec query ( table_name :: table_name ) :: ExAws.Operation. JSON. t ( )
481- @ spec query ( table_name :: table_name , opts :: query_opts ) :: ExAws.Operation. JSON. t ( )
482+ @ spec query ( table_name :: table_name ) :: JSON . t ( )
483+ @ spec query ( table_name :: table_name , opts :: query_opts ) :: JSON . t ( )
482484 def query ( name , opts \\ [ ] ) do
483485 data =
484486 opts
485487 |> build_opts ( )
486488 |> Map . merge ( % { "TableName" => name } )
487489
488- request ( :query , data , % { stream_builder: & ExAws.Dynamo. Lazy. stream_query ( name , opts , & 1 ) } )
490+ request ( :query , data , % { stream_builder: & Lazy . stream_query ( name , opts , & 1 ) } )
489491 end
490492
491493 @ doc """
@@ -529,9 +531,9 @@ defmodule ExAws.Dynamo do
529531 | { :expression_attribute_names , expression_attribute_names_vals }
530532 | { :projection_expression , binary }
531533 ]
532- @ spec batch_get_item ( % { table_name => get_item } ) :: ExAws.Operation. JSON. t ( )
534+ @ spec batch_get_item ( % { table_name => get_item } ) :: JSON . t ( )
533535 @ spec batch_get_item ( % { table_name => get_item } , opts :: batch_get_item_opts ) ::
534- ExAws.Operation. JSON. t ( )
536+ JSON . t ( )
535537 def batch_get_item ( data , opts \\ [ ] ) do
536538 request_items =
537539 data
@@ -571,9 +573,9 @@ defmodule ExAws.Dynamo do
571573 | { :return_item_collection_metrics , return_item_collection_metrics_vals }
572574 | { :return_values , return_values_vals }
573575 ]
574- @ spec put_item ( table_name :: table_name , record :: map ( ) ) :: ExAws.Operation. JSON. t ( )
576+ @ spec put_item ( table_name :: table_name , record :: map ( ) ) :: JSON . t ( )
575577 @ spec put_item ( table_name :: table_name , record :: map ( ) , opts :: put_item_opts ) ::
576- ExAws.Operation. JSON. t ( )
578+ JSON . t ( )
577579 def put_item ( name , record , opts \\ [ ] ) do
578580 data =
579581 opts
@@ -603,9 +605,9 @@ defmodule ExAws.Dynamo do
603605 { :return_consumed_capacity , return_consumed_capacity_vals }
604606 | { :return_item_collection_metrics , return_item_collection_metrics_vals }
605607 ]
606- @ spec batch_write_item ( % { table_name => [ write_item ] } ) :: ExAws.Operation. JSON. t ( )
608+ @ spec batch_write_item ( % { table_name => [ write_item ] } ) :: JSON . t ( )
607609 @ spec batch_write_item ( % { table_name => [ write_item ] } , opts :: batch_write_item_opts ) ::
608- ExAws.Operation. JSON. t ( )
610+ JSON . t ( )
609611 def batch_write_item ( data , opts \\ [ ] ) do
610612 request_items =
611613 data
@@ -638,9 +640,9 @@ defmodule ExAws.Dynamo do
638640 | { :projection_expression , binary }
639641 | { :return_consumed_capacity , return_consumed_capacity_vals }
640642 ]
641- @ spec get_item ( table_name :: table_name , primary_key :: primary_key ) :: ExAws.Operation. JSON. t ( )
643+ @ spec get_item ( table_name :: table_name , primary_key :: primary_key ) :: JSON . t ( )
642644 @ spec get_item ( table_name :: table_name , primary_key :: primary_key , opts :: get_item_opts ) ::
643- ExAws.Operation. JSON. t ( )
645+ JSON . t ( )
644646 def get_item ( name , primary_key , opts \\ [ ] ) do
645647 data =
646648 opts
@@ -672,7 +674,7 @@ defmodule ExAws.Dynamo do
672674 table_name :: table_name ,
673675 primary_key :: primary_key ,
674676 opts :: update_item_opts
675- ) :: ExAws.Operation. JSON. t ( )
677+ ) :: JSON . t ( )
676678 def update_item ( table_name , primary_key , update_opts ) do
677679 data =
678680 update_opts
@@ -695,12 +697,12 @@ defmodule ExAws.Dynamo do
695697 | { :return_values , return_values_vals }
696698 ]
697699 @ spec delete_item ( table_name :: table_name , primary_key :: primary_key ) ::
698- ExAws.Operation. JSON. t ( )
700+ JSON . t ( )
699701 @ spec delete_item (
700702 table_name :: table_name ,
701703 primary_key :: primary_key ,
702704 opts :: delete_item_opts
703- ) :: ExAws.Operation. JSON. t ( )
705+ ) :: JSON . t ( )
704706 def delete_item ( name , primary_key , opts \\ [ ] ) do
705707 data =
706708 opts
@@ -727,8 +729,8 @@ defmodule ExAws.Dynamo do
727729 ]
728730
729731 @ spec transact_get_items ( items :: [ transact_get_item ] , transact_get_items_opts ) ::
730- ExAws.Operation. JSON. t ( )
731- @ spec transact_get_items ( items :: [ transact_get_item ] ) :: ExAws.Operation. JSON. t ( )
732+ JSON . t ( )
733+ @ spec transact_get_items ( items :: [ transact_get_item ] ) :: JSON . t ( )
732734
733735 @ doc """
734736 A synchronous operation that retrieves multiple items from one or more tables (but not from indexes) in a single account and region
@@ -801,8 +803,8 @@ defmodule ExAws.Dynamo do
801803 A synchronous write operation that groups up to 25 action requests
802804 """
803805 @ spec transact_write_items ( items :: [ transact_write_item ] , transact_write_items_opts ) ::
804- ExAws.Operation. JSON. t ( )
805- @ spec transact_write_items ( items :: [ transact_write_item ] ) :: ExAws.Operation. JSON. t ( )
806+ JSON . t ( )
807+ @ spec transact_write_items ( items :: [ transact_write_item ] ) :: JSON . t ( )
806808 def transact_write_items ( items , opts \\ [ ] ) do
807809 data =
808810 opts
@@ -896,7 +898,7 @@ defmodule ExAws.Dynamo do
896898 |> Atom . to_string ( )
897899 |> Macro . camelize ( )
898900
899- ExAws.Operation. JSON. new (
901+ JSON . new (
900902 :dynamodb ,
901903 % {
902904 data: data ,
0 commit comments