Refactor for new system service
- upd(all): indent spec.json files on all apps - upd(auth): rename auth app to cmd - upd(sam): move orgs, teams to system - upd(system): extend spec.json for check - upd(codegen): include system/ - upd(codegen): always generate spec files - upd(sam): references from auth to system
This commit is contained in:
36
codegen/system/rest/request/index.php
Normal file
36
codegen/system/rest/request/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
$templates = array(
|
||||
"http_request_inline.tpl" => function($name, $api) {
|
||||
return strtolower($name) . ".go";
|
||||
},
|
||||
);
|
||||
|
||||
foreach ($templates as $template => $fn)
|
||||
foreach ($apis as $api) {
|
||||
$name = ucfirst($api['interface']);
|
||||
$filename = $dirname . "/" . $fn($name, $api);
|
||||
|
||||
$tpl->load($template);
|
||||
$tpl->assign($common);
|
||||
$tpl->assign("package", basename(__DIR__));
|
||||
$tpl->assign("name", $name);
|
||||
$tpl->assign("api", $api);
|
||||
$tpl->assign("apis", $apis);
|
||||
$tpl->assign("self", strtolower(substr($name, 0, 1)));
|
||||
$tpl->assign("structs", $api['struct']);
|
||||
$imports = array();
|
||||
if (is_array($api['struct']))
|
||||
foreach ($api['struct'] as $struct) {
|
||||
if (isset($struct['imports']))
|
||||
foreach ($struct['imports'] as $import) {
|
||||
$imports[] = $import;
|
||||
}
|
||||
}
|
||||
$tpl->assign("imports", $imports);
|
||||
$tpl->assign("calls", $api['apis']);
|
||||
$contents = str_replace("\n\n}", "\n}", $tpl->get());
|
||||
|
||||
file_put_contents($filename, $contents);
|
||||
echo $filename . "\n";
|
||||
}
|
||||
Reference in New Issue
Block a user