Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust the endpoint API_IMAGE_ALL #53

Open
wants to merge 4 commits into
base: gnt
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions src/api.ml
Original file line number Diff line number Diff line change
Expand Up @@ -417,20 +417,12 @@ let print_img_all conf base =
else
Api_util.print_result conf (fl list)
in
let compute_sosa = Api_util.compute_sosa conf base false in
if Api_util.p_getenvbin conf.env "full_infos" = Some "1" then
aux
(fun p img ->
let p = Api_util.pers_to_piqi_person_full conf base p compute_sosa in
Api_piqi.Full_image.({person = p; img = img;}))
(fun list -> Api_piqi_ext.gen_list_full_images @@ Api_piqi.List_full_images.({images = list}) )
else
aux
(fun p img ->
let p = Api_util.pers_to_piqi_person_light conf base p compute_sosa in
Api_piqi.Image.({person = p; img}))
(fun list ->
Api_piqi_ext.gen_list_images @@ Api_piqi.List_images.({list_images = list}))
aux
(fun p img ->
let p = Api_util.person_to_reference_person base p in
Api_piqi.Image.({person = p; img}))
(fun list ->
Api_piqi_ext.gen_list_images @@ Api_piqi.List_images.({list_images = list}))

(**/**) (* API_IMAGE_APP *)

Expand Down
13 changes: 2 additions & 11 deletions src/assets/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -241,23 +241,14 @@ message SearchParams {
}

message Image {
required Person person = 1;
required string img = 2;
}

message FullImage {
required FullPerson person = 1;
required ReferencePerson person = 1;
required string img = 2;
}

message ListImages {
repeated Image list_images = 1;
}

message ListFullImages {
repeated FullImage images = 1;
}

message PersImg {
required ReferencePerson person = 1;
required string img = 2;
Expand Down Expand Up @@ -804,7 +795,7 @@ message HistoryPerson {
optional int32 year1 = 6;
optional int32 year2 = 7;
required bool exists_in_base = 8;
required bool has_history = 9;
required bool has_history = 9;
}

message HistoryNote {
Expand Down
5 changes: 3 additions & 2 deletions src/plugin_api.ml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ let () =
try Scanf.sscanf s "dico_profession_%[a-z].csv" (aux `profession s)
with _ -> ()
end (Sys.readdir assets) ;
let aux fn _assets conf base =
let aux ?timeout fn _assets conf base =
Option.iter Wserver.set_timeout timeout;
set_request_timeout ();
fn { conf with Geneweb.Config.api_mode = true } base ; true
in
Expand Down Expand Up @@ -95,7 +96,7 @@ let () =
; ( "API_INFO_IND"
, aux @@ w_base @@ Plugin_api_lib.Api.print_info_ind)
; ( "API_IMAGE_ALL"
, aux @@ w_base @@ Plugin_api_lib.Api.print_img_all)
, aux ~timeout:0 @@ w_base @@ Plugin_api_lib.Api.print_img_all)
; ( "API_IMAGE_PERSON"
, aux @@ w_base @@ Plugin_api_lib.Api.print_img_person)
; ( "API_IMAGE_UPDATE"
Expand Down