Skip to content

Commit

Permalink
Remove special handling for get_all_records messages in C# SDK
Browse files Browse the repository at this point in the history
Signed-off-by: Danilo Del Busso <[email protected]>
  • Loading branch information
danilo-delbusso committed Nov 27, 2023
1 parent 3ba5680 commit 0a2b08b
Showing 1 changed file with 1 addition and 70 deletions.
71 changes: 1 addition & 70 deletions ocaml/sdk-gen/csharp/gen_csharp_binding.ml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ let api =
let message_filter msg =
Datamodel_utils.on_client_side msg
&& (not msg.msg_hide_from_docs)
(* XXX: C# binding generates get_all_records some other way *)
&& msg.msg_tag <> FromObject GetAllRecords
&& List.mem "closed" msg.msg_release.internal
in
filter obj_filter field_filter message_filter
Expand Down Expand Up @@ -426,61 +424,9 @@ and gen_class out_chan cls =
messages |> List.map (gen_exposed_method_overloads cls) |> List.concat
in
List.iter (print "%s") all_methods ;

(* Don't create duplicate get_all_records call *)
if
(not
(List.exists
(fun msg -> String.compare msg.msg_name "get_all_records" = 0)
messages
)
)
&& List.mem cls.name expose_get_all_messages_for
then
print "%s" (gen_exposed_method cls (get_all_records_method cls.name) []) ;

List.iter (gen_exposed_field out_chan cls) contents ;

print " }\n}\n"

and get_all_records_method classname =
{
default_message with
msg_name= "get_all_records"
; msg_params= []
; msg_result=
Some
( Map (Ref classname, Record classname)
, sprintf "A map from %s to %s.Record" classname classname
)
; msg_doc=
sprintf "Get all the %s Records at once, in a single XML RPC call"
classname
; msg_session= true
; msg_async= false
; msg_release=
{
opensource= ["3.0.3"]
; internal= ["closed"; "debug"]
; internal_deprecated_since= None
}
; msg_lifecycle= Lifecycle.from []
; msg_has_effect= false
; msg_tag= Custom
; msg_obj_name= classname
; msg_errors= []
; msg_secret= false
; msg_custom_marshaller= false
; msg_no_current_operations= false
; msg_hide_from_docs= false
; msg_pool_internal= false
; msg_db_only= false
; msg_force_custom= None
; msg_allowed_roles= None
; msg_map_keys_roles= []
; msg_doc_tags= []
}

and get_constructor_params content = get_constructor_params' content []

and get_constructor_params' content elements =
Expand Down Expand Up @@ -808,22 +754,7 @@ and gen_proxy_class_methods {name; messages; _} =
let generator params = gen_proxy_method name message params in
gen_overloads generator message
in
let overloads =
messages |> List.map (gen_message_overloads name) |> List.concat
in
let records =
if
not
(List.exists
(fun msg -> String.compare msg.msg_name "get_all_records" = 0)
messages
)
then
gen_proxy_method name (get_all_records_method name) []
else
""
in
overloads @ [records]
messages |> List.map (gen_message_overloads name) |> List.concat

and gen_proxy_method classname message params =
let proxy_msg_name = proxy_msg_name classname message in
Expand Down

0 comments on commit 0a2b08b

Please sign in to comment.