@voxgig/sdkgen 0.35.1 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/voxgig-sdkgen +1 -1
- package/dist/cmp/Readme.js +5 -5
- package/dist/cmp/Readme.js.map +1 -1
- package/dist/cmp/ReadmeEntity.js +74 -24
- package/dist/cmp/ReadmeEntity.js.map +1 -1
- package/dist/cmp/ReadmeExplanation.d.ts +2 -0
- package/dist/cmp/ReadmeExplanation.js +308 -0
- package/dist/cmp/ReadmeExplanation.js.map +1 -0
- package/dist/cmp/ReadmeHowto.d.ts +2 -0
- package/dist/cmp/ReadmeHowto.js +18 -0
- package/dist/cmp/ReadmeHowto.js.map +1 -0
- package/dist/cmp/ReadmeIntro.js +8 -23
- package/dist/cmp/ReadmeIntro.js.map +1 -1
- package/dist/cmp/ReadmeModel.js +55 -91
- package/dist/cmp/ReadmeModel.js.map +1 -1
- package/dist/cmp/ReadmeOptions.js +35 -11
- package/dist/cmp/ReadmeOptions.js.map +1 -1
- package/dist/cmp/ReadmeQuick.js +4 -1
- package/dist/cmp/ReadmeQuick.js.map +1 -1
- package/dist/cmp/ReadmeRef.js +1042 -40
- package/dist/cmp/ReadmeRef.js.map +1 -1
- package/dist/cmp/ReadmeTop.d.ts +2 -0
- package/dist/cmp/ReadmeTop.js +171 -0
- package/dist/cmp/ReadmeTop.js.map +1 -0
- package/dist/sdkgen.d.ts +7 -1
- package/dist/sdkgen.js +13 -1
- package/dist/sdkgen.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/project/.sdk/model/feature/feature-index.jsonic +5 -0
- package/project/.sdk/model/feature/log.jsonic +5 -1
- package/project/.sdk/model/feature/test.jsonic +1 -1
- package/project/.sdk/model/target/lua.jsonic +23 -0
- package/project/.sdk/model/target/php.jsonic +22 -0
- package/project/.sdk/model/target/py.jsonic +23 -0
- package/project/.sdk/model/target/rb.jsonic +23 -0
- package/project/.sdk/src/cmp/go/Main_go.ts +2 -6
- package/project/.sdk/src/cmp/go/ReadmeExplanation_go.ts +42 -0
- package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +112 -0
- package/project/.sdk/src/cmp/go/ReadmeInstall_go.ts +29 -0
- package/project/.sdk/src/cmp/go/ReadmeModel_go.ts +129 -0
- package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +163 -0
- package/project/.sdk/src/cmp/go/ReadmeTopHowto_go.ts +24 -0
- package/project/.sdk/src/cmp/go/ReadmeTopQuick_go.ts +67 -0
- package/project/.sdk/src/cmp/go/ReadmeTopTest_go.ts +40 -0
- package/project/.sdk/src/cmp/go/TestDirect_go.ts +46 -2
- package/project/.sdk/src/cmp/go/TestEntity_go.ts +360 -160
- package/project/.sdk/src/cmp/go/Test_go.ts +24 -1
- package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +1 -1
- package/project/.sdk/src/cmp/js/fragment/Main.fragment.js +0 -4
- package/project/.sdk/src/cmp/lua/Config_lua.ts +112 -0
- package/project/.sdk/src/cmp/lua/EntityOperation_lua.ts +44 -0
- package/project/.sdk/src/cmp/lua/Entity_lua.ts +62 -0
- package/project/.sdk/src/cmp/lua/MainEntity_lua.ts +23 -0
- package/project/.sdk/src/cmp/lua/Main_lua.ts +133 -0
- package/project/.sdk/src/cmp/lua/Package_lua.ts +80 -0
- package/project/.sdk/src/cmp/lua/ReadmeExplanation_lua.ts +42 -0
- package/project/.sdk/src/cmp/lua/ReadmeHowto_lua.ts +100 -0
- package/project/.sdk/src/cmp/lua/ReadmeInstall_lua.ts +26 -0
- package/project/.sdk/src/cmp/lua/ReadmeModel_lua.ts +129 -0
- package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +99 -0
- package/project/.sdk/src/cmp/lua/ReadmeTopHowto_lua.ts +24 -0
- package/project/.sdk/src/cmp/lua/ReadmeTopQuick_lua.ts +55 -0
- package/project/.sdk/src/cmp/lua/ReadmeTopTest_lua.ts +38 -0
- package/project/.sdk/src/cmp/lua/TestDirect_lua.ts +261 -0
- package/project/.sdk/src/cmp/lua/TestEntity_lua.ts +483 -0
- package/project/.sdk/src/cmp/lua/Test_lua.ts +49 -0
- package/project/.sdk/src/cmp/lua/fragment/Entity.fragment.lua +147 -0
- package/project/.sdk/src/cmp/lua/fragment/EntityCreateOp.fragment.lua +27 -0
- package/project/.sdk/src/cmp/lua/fragment/EntityListOp.fragment.lua +24 -0
- package/project/.sdk/src/cmp/lua/fragment/EntityLoadOp.fragment.lua +30 -0
- package/project/.sdk/src/cmp/lua/fragment/EntityRemoveOp.fragment.lua +30 -0
- package/project/.sdk/src/cmp/lua/fragment/EntityUpdateOp.fragment.lua +30 -0
- package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +256 -0
- package/project/.sdk/src/cmp/lua/fragment/SdkError.fragment.lua +26 -0
- package/project/.sdk/src/cmp/lua/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/lua/utility_lua.ts +84 -0
- package/project/.sdk/src/cmp/php/Config_php.ts +107 -0
- package/project/.sdk/src/cmp/php/EntityOperation_php.ts +44 -0
- package/project/.sdk/src/cmp/php/Entity_php.ts +62 -0
- package/project/.sdk/src/cmp/php/MainEntity_php.ts +24 -0
- package/project/.sdk/src/cmp/php/Main_php.ts +135 -0
- package/project/.sdk/src/cmp/php/Package_php.ts +87 -0
- package/project/.sdk/src/cmp/php/ReadmeExplanation_php.ts +42 -0
- package/project/.sdk/src/cmp/php/ReadmeHowto_php.ts +101 -0
- package/project/.sdk/src/cmp/php/ReadmeInstall_php.ts +19 -0
- package/project/.sdk/src/cmp/php/ReadmeModel_php.ts +129 -0
- package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +100 -0
- package/project/.sdk/src/cmp/php/ReadmeTopHowto_php.ts +24 -0
- package/project/.sdk/src/cmp/php/ReadmeTopQuick_php.ts +56 -0
- package/project/.sdk/src/cmp/php/ReadmeTopTest_php.ts +38 -0
- package/project/.sdk/src/cmp/php/TestDirect_php.ts +270 -0
- package/project/.sdk/src/cmp/php/TestEntity_php.ts +484 -0
- package/project/.sdk/src/cmp/php/Test_php.ts +56 -0
- package/project/.sdk/src/cmp/php/fragment/Entity.fragment.php +146 -0
- package/project/.sdk/src/cmp/php/fragment/EntityCreateOp.fragment.php +26 -0
- package/project/.sdk/src/cmp/php/fragment/EntityListOp.fragment.php +23 -0
- package/project/.sdk/src/cmp/php/fragment/EntityLoadOp.fragment.php +29 -0
- package/project/.sdk/src/cmp/php/fragment/EntityRemoveOp.fragment.php +29 -0
- package/project/.sdk/src/cmp/php/fragment/EntityUpdateOp.fragment.php +29 -0
- package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +233 -0
- package/project/.sdk/src/cmp/php/fragment/SdkError.fragment.php +24 -0
- package/project/.sdk/src/cmp/php/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/php/utility_php.ts +85 -0
- package/project/.sdk/src/cmp/py/Config_py.ts +93 -0
- package/project/.sdk/src/cmp/py/EntityOperation_py.ts +44 -0
- package/project/.sdk/src/cmp/py/Entity_py.ts +62 -0
- package/project/.sdk/src/cmp/py/MainEntity_py.ts +22 -0
- package/project/.sdk/src/cmp/py/Main_py.ts +156 -0
- package/project/.sdk/src/cmp/py/Package_py.ts +75 -0
- package/project/.sdk/src/cmp/py/ReadmeExplanation_py.ts +41 -0
- package/project/.sdk/src/cmp/py/ReadmeHowto_py.ts +98 -0
- package/project/.sdk/src/cmp/py/ReadmeInstall_py.ts +25 -0
- package/project/.sdk/src/cmp/py/ReadmeModel_py.ts +130 -0
- package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +100 -0
- package/project/.sdk/src/cmp/py/ReadmeTopHowto_py.ts +24 -0
- package/project/.sdk/src/cmp/py/ReadmeTopQuick_py.ts +56 -0
- package/project/.sdk/src/cmp/py/ReadmeTopTest_py.ts +38 -0
- package/project/.sdk/src/cmp/py/TestDirect_py.ts +248 -0
- package/project/.sdk/src/cmp/py/TestEntity_py.ts +475 -0
- package/project/.sdk/src/cmp/py/Test_py.ts +55 -0
- package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +112 -0
- package/project/.sdk/src/cmp/py/fragment/EntityCreateOp.fragment.py +25 -0
- package/project/.sdk/src/cmp/py/fragment/EntityListOp.fragment.py +22 -0
- package/project/.sdk/src/cmp/py/fragment/EntityLoadOp.fragment.py +27 -0
- package/project/.sdk/src/cmp/py/fragment/EntityRemoveOp.fragment.py +27 -0
- package/project/.sdk/src/cmp/py/fragment/EntityUpdateOp.fragment.py +27 -0
- package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +222 -0
- package/project/.sdk/src/cmp/py/fragment/SdkError.fragment.py +16 -0
- package/project/.sdk/src/cmp/py/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/py/utility_py.ts +84 -0
- package/project/.sdk/src/cmp/rb/Config_rb.ts +101 -0
- package/project/.sdk/src/cmp/rb/EntityOperation_rb.ts +44 -0
- package/project/.sdk/src/cmp/rb/Entity_rb.ts +62 -0
- package/project/.sdk/src/cmp/rb/MainEntity_rb.ts +23 -0
- package/project/.sdk/src/cmp/rb/Main_rb.ts +130 -0
- package/project/.sdk/src/cmp/rb/Package_rb.ts +111 -0
- package/project/.sdk/src/cmp/rb/ReadmeExplanation_rb.ts +42 -0
- package/project/.sdk/src/cmp/rb/ReadmeHowto_rb.ts +98 -0
- package/project/.sdk/src/cmp/rb/ReadmeInstall_rb.ts +31 -0
- package/project/.sdk/src/cmp/rb/ReadmeModel_rb.ts +129 -0
- package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +99 -0
- package/project/.sdk/src/cmp/rb/ReadmeTopHowto_rb.ts +24 -0
- package/project/.sdk/src/cmp/rb/ReadmeTopQuick_rb.ts +55 -0
- package/project/.sdk/src/cmp/rb/ReadmeTopTest_rb.ts +38 -0
- package/project/.sdk/src/cmp/rb/TestDirect_rb.ts +260 -0
- package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +476 -0
- package/project/.sdk/src/cmp/rb/Test_rb.ts +50 -0
- package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +116 -0
- package/project/.sdk/src/cmp/rb/fragment/EntityCreateOp.fragment.rb +25 -0
- package/project/.sdk/src/cmp/rb/fragment/EntityListOp.fragment.rb +20 -0
- package/project/.sdk/src/cmp/rb/fragment/EntityLoadOp.fragment.rb +26 -0
- package/project/.sdk/src/cmp/rb/fragment/EntityRemoveOp.fragment.rb +26 -0
- package/project/.sdk/src/cmp/rb/fragment/EntityUpdateOp.fragment.rb +26 -0
- package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +203 -0
- package/project/.sdk/src/cmp/rb/fragment/SdkError.fragment.rb +16 -0
- package/project/.sdk/src/cmp/rb/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/rb/utility_rb.ts +84 -0
- package/project/.sdk/src/cmp/ts/ReadmeExplanation_ts.ts +34 -0
- package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +123 -0
- package/project/.sdk/src/cmp/ts/ReadmeInstall_ts.ts +1 -1
- package/project/.sdk/src/cmp/ts/ReadmeModel_ts.ts +159 -0
- package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +69 -54
- package/project/.sdk/src/cmp/ts/ReadmeTopHowto_ts.ts +25 -0
- package/project/.sdk/src/cmp/ts/ReadmeTopQuick_ts.ts +65 -0
- package/project/.sdk/src/cmp/ts/ReadmeTopTest_ts.ts +36 -0
- package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +0 -3
- package/project/.sdk/tm/go/feature/log_feature.go +133 -0
- package/project/.sdk/tm/go/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/lua/LICENSE +22 -0
- package/project/.sdk/tm/lua/Makefile +10 -0
- package/project/.sdk/tm/lua/core/context.lua +208 -0
- package/project/.sdk/tm/lua/core/control.lua +17 -0
- package/project/.sdk/tm/lua/core/error.lua +30 -0
- package/project/.sdk/tm/lua/core/helpers.lua +30 -0
- package/project/.sdk/tm/lua/core/operation.lua +51 -0
- package/project/.sdk/tm/lua/core/response.lua +45 -0
- package/project/.sdk/tm/lua/core/result.lua +58 -0
- package/project/.sdk/tm/lua/core/spec.lua +29 -0
- package/project/.sdk/tm/lua/core/utility_type.lua +90 -0
- package/project/.sdk/tm/lua/feature/base_feature.lua +35 -0
- package/project/.sdk/tm/lua/feature/log_feature.lua +80 -0
- package/project/.sdk/tm/lua/feature/test_feature.lua +202 -0
- package/project/.sdk/tm/lua/src/feature/README.md +3 -0
- package/project/.sdk/tm/lua/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/lua/test/runner.lua +86 -0
- package/project/.sdk/tm/lua/utility/clean.lua +7 -0
- package/project/.sdk/tm/lua/utility/done.lua +19 -0
- package/project/.sdk/tm/lua/utility/feature_add.lua +8 -0
- package/project/.sdk/tm/lua/utility/feature_hook.lua +21 -0
- package/project/.sdk/tm/lua/utility/feature_init.lua +24 -0
- package/project/.sdk/tm/lua/utility/fetcher.lua +96 -0
- package/project/.sdk/tm/lua/utility/make_context.lua +9 -0
- package/project/.sdk/tm/lua/utility/make_error.lua +73 -0
- package/project/.sdk/tm/lua/utility/make_fetch_def.lua +43 -0
- package/project/.sdk/tm/lua/utility/make_options.lua +116 -0
- package/project/.sdk/tm/lua/utility/make_point.lua +92 -0
- package/project/.sdk/tm/lua/utility/make_request.lua +58 -0
- package/project/.sdk/tm/lua/utility/make_response.lua +44 -0
- package/project/.sdk/tm/lua/utility/make_result.lua +51 -0
- package/project/.sdk/tm/lua/utility/make_spec.lua +72 -0
- package/project/.sdk/tm/lua/utility/make_url.lua +46 -0
- package/project/.sdk/tm/lua/utility/param.lua +68 -0
- package/project/.sdk/tm/lua/utility/prepare_auth.lua +39 -0
- package/project/.sdk/tm/lua/utility/prepare_body.lua +14 -0
- package/project/.sdk/tm/lua/utility/prepare_headers.lua +20 -0
- package/project/.sdk/tm/lua/utility/prepare_method.lua +17 -0
- package/project/.sdk/tm/lua/utility/prepare_params.lua +36 -0
- package/project/.sdk/tm/lua/utility/prepare_path.lua +19 -0
- package/project/.sdk/tm/lua/utility/prepare_query.lua +41 -0
- package/project/.sdk/tm/lua/utility/register.lua +71 -0
- package/project/.sdk/tm/lua/utility/result_basic.lua +32 -0
- package/project/.sdk/tm/lua/utility/result_body.lua +17 -0
- package/project/.sdk/tm/lua/utility/result_headers.lua +22 -0
- package/project/.sdk/tm/lua/utility/struct/struct.lua +3417 -0
- package/project/.sdk/tm/lua/utility/transform_request.lua +31 -0
- package/project/.sdk/tm/lua/utility/transform_response.lua +44 -0
- package/project/.sdk/tm/php/LICENSE +22 -0
- package/project/.sdk/tm/php/Makefile +10 -0
- package/project/.sdk/tm/php/core/Context.php +139 -0
- package/project/.sdk/tm/php/core/Control.php +18 -0
- package/project/.sdk/tm/php/core/Error.php +37 -0
- package/project/.sdk/tm/php/core/Helpers.php +25 -0
- package/project/.sdk/tm/php/core/Operation.php +36 -0
- package/project/.sdk/tm/php/core/Response.php +30 -0
- package/project/.sdk/tm/php/core/Result.php +35 -0
- package/project/.sdk/tm/php/core/Spec.php +38 -0
- package/project/.sdk/tm/php/core/UtilityType.php +89 -0
- package/project/.sdk/tm/php/feature/BaseFeature.php +37 -0
- package/project/.sdk/tm/php/feature/LogFeature.php +65 -0
- package/project/.sdk/tm/php/feature/TestFeature.php +193 -0
- package/project/.sdk/tm/php/src/feature/README.md +3 -0
- package/project/.sdk/tm/php/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/php/test/Runner.php +89 -0
- package/project/.sdk/tm/php/utility/Clean.php +12 -0
- package/project/.sdk/tm/php/utility/Done.php +26 -0
- package/project/.sdk/tm/php/utility/FeatureAdd.php +12 -0
- package/project/.sdk/tm/php/utility/FeatureHook.php +23 -0
- package/project/.sdk/tm/php/utility/FeatureInit.php +25 -0
- package/project/.sdk/tm/php/utility/Fetcher.php +101 -0
- package/project/.sdk/tm/php/utility/MakeContext.php +14 -0
- package/project/.sdk/tm/php/utility/MakeError.php +59 -0
- package/project/.sdk/tm/php/utility/MakeFetchDef.php +36 -0
- package/project/.sdk/tm/php/utility/MakeOptions.php +98 -0
- package/project/.sdk/tm/php/utility/MakePoint.php +87 -0
- package/project/.sdk/tm/php/utility/MakeRequest.php +57 -0
- package/project/.sdk/tm/php/utility/MakeResponse.php +43 -0
- package/project/.sdk/tm/php/utility/MakeResult.php +50 -0
- package/project/.sdk/tm/php/utility/MakeSpec.php +64 -0
- package/project/.sdk/tm/php/utility/MakeUrl.php +41 -0
- package/project/.sdk/tm/php/utility/Param.php +66 -0
- package/project/.sdk/tm/php/utility/PrepareAuth.php +33 -0
- package/project/.sdk/tm/php/utility/PrepareBody.php +15 -0
- package/project/.sdk/tm/php/utility/PrepareHeaders.php +18 -0
- package/project/.sdk/tm/php/utility/PrepareMethod.php +21 -0
- package/project/.sdk/tm/php/utility/PrepareParams.php +34 -0
- package/project/.sdk/tm/php/utility/PreparePath.php +20 -0
- package/project/.sdk/tm/php/utility/PrepareQuery.php +32 -0
- package/project/.sdk/tm/php/utility/Register.php +67 -0
- package/project/.sdk/tm/php/utility/ResultBasic.php +29 -0
- package/project/.sdk/tm/php/utility/ResultBody.php +17 -0
- package/project/.sdk/tm/php/utility/ResultHeaders.php +21 -0
- package/project/.sdk/tm/php/utility/TransformRequest.php +27 -0
- package/project/.sdk/tm/php/utility/TransformResponse.php +42 -0
- package/project/.sdk/tm/php/utility/struct/Struct.php +3431 -0
- package/project/.sdk/tm/py/Makefile +10 -0
- package/project/.sdk/tm/py/core/__init__.py +0 -0
- package/project/.sdk/tm/py/core/context.py +199 -0
- package/project/.sdk/tm/py/core/control.py +12 -0
- package/project/.sdk/tm/py/core/error.py +18 -0
- package/project/.sdk/tm/py/core/helpers.py +15 -0
- package/project/.sdk/tm/py/core/operation.py +37 -0
- package/project/.sdk/tm/py/core/response.py +34 -0
- package/project/.sdk/tm/py/core/result.py +44 -0
- package/project/.sdk/tm/py/core/spec.py +23 -0
- package/project/.sdk/tm/py/core/utility_type.py +82 -0
- package/project/.sdk/tm/py/entity/__init__.py +0 -0
- package/project/.sdk/tm/py/feature/__init__.py +0 -0
- package/project/.sdk/tm/py/feature/base_feature.py +61 -0
- package/project/.sdk/tm/py/feature/log_feature.py +84 -0
- package/project/.sdk/tm/py/feature/test_feature.py +164 -0
- package/project/.sdk/tm/py/src/feature/README.md +3 -0
- package/project/.sdk/tm/py/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/py/test/__init__.py +0 -0
- package/project/.sdk/tm/py/test/runner.py +77 -0
- package/project/.sdk/tm/py/utility/__init__.py +0 -0
- package/project/.sdk/tm/py/utility/clean.py +5 -0
- package/project/.sdk/tm/py/utility/done.py +14 -0
- package/project/.sdk/tm/py/utility/feature_add.py +6 -0
- package/project/.sdk/tm/py/utility/feature_hook.py +15 -0
- package/project/.sdk/tm/py/utility/feature_init.py +18 -0
- package/project/.sdk/tm/py/utility/fetcher.py +95 -0
- package/project/.sdk/tm/py/utility/make_context.py +7 -0
- package/project/.sdk/tm/py/utility/make_error.py +64 -0
- package/project/.sdk/tm/py/utility/make_fetch_def.py +37 -0
- package/project/.sdk/tm/py/utility/make_options.py +103 -0
- package/project/.sdk/tm/py/utility/make_point.py +74 -0
- package/project/.sdk/tm/py/utility/make_request.py +52 -0
- package/project/.sdk/tm/py/utility/make_response.py +36 -0
- package/project/.sdk/tm/py/utility/make_result.py +41 -0
- package/project/.sdk/tm/py/utility/make_spec.py +68 -0
- package/project/.sdk/tm/py/utility/make_url.py +34 -0
- package/project/.sdk/tm/py/utility/param.py +55 -0
- package/project/.sdk/tm/py/utility/prepare_auth.py +34 -0
- package/project/.sdk/tm/py/utility/prepare_body.py +11 -0
- package/project/.sdk/tm/py/utility/prepare_headers.py +17 -0
- package/project/.sdk/tm/py/utility/prepare_method.py +15 -0
- package/project/.sdk/tm/py/utility/prepare_params.py +28 -0
- package/project/.sdk/tm/py/utility/prepare_path.py +16 -0
- package/project/.sdk/tm/py/utility/prepare_query.py +33 -0
- package/project/.sdk/tm/py/utility/register.py +68 -0
- package/project/.sdk/tm/py/utility/result_basic.py +26 -0
- package/project/.sdk/tm/py/utility/result_body.py +13 -0
- package/project/.sdk/tm/py/utility/result_headers.py +17 -0
- package/project/.sdk/tm/py/utility/transform_request.py +27 -0
- package/project/.sdk/tm/py/utility/transform_response.py +39 -0
- package/project/.sdk/tm/py/utility/voxgig_struct/__init__.py +72 -0
- package/project/.sdk/tm/py/utility/voxgig_struct/voxgig_struct.py +2770 -0
- package/project/.sdk/tm/rb/Gemfile +4 -0
- package/project/.sdk/tm/rb/LICENSE +22 -0
- package/project/.sdk/tm/rb/Makefile +10 -0
- package/project/.sdk/tm/rb/core/context.rb +105 -0
- package/project/.sdk/tm/rb/core/control.rb +11 -0
- package/project/.sdk/tm/rb/core/error.rb +24 -0
- package/project/.sdk/tm/rb/core/helpers.rb +16 -0
- package/project/.sdk/tm/rb/core/operation.rb +26 -0
- package/project/.sdk/tm/rb/core/response.rb +20 -0
- package/project/.sdk/tm/rb/core/result.rb +23 -0
- package/project/.sdk/tm/rb/core/spec.rb +23 -0
- package/project/.sdk/tm/rb/core/utility_type.rb +32 -0
- package/project/.sdk/tm/rb/feature/base_feature.rb +30 -0
- package/project/.sdk/tm/rb/feature/log_feature.rb +50 -0
- package/project/.sdk/tm/rb/feature/test_feature.rb +154 -0
- package/project/.sdk/tm/rb/src/feature/README.md +3 -0
- package/project/.sdk/tm/rb/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/rb/test/runner.rb +65 -0
- package/project/.sdk/tm/rb/utility/clean.rb +4 -0
- package/project/.sdk/tm/rb/utility/done.rb +14 -0
- package/project/.sdk/tm/rb/utility/feature_add.rb +6 -0
- package/project/.sdk/tm/rb/utility/feature_hook.rb +11 -0
- package/project/.sdk/tm/rb/utility/feature_init.rb +16 -0
- package/project/.sdk/tm/rb/utility/fetcher.rb +67 -0
- package/project/.sdk/tm/rb/utility/make_context.rb +7 -0
- package/project/.sdk/tm/rb/utility/make_error.rb +44 -0
- package/project/.sdk/tm/rb/utility/make_fetch_def.rb +24 -0
- package/project/.sdk/tm/rb/utility/make_options.rb +57 -0
- package/project/.sdk/tm/rb/utility/make_point.rb +77 -0
- package/project/.sdk/tm/rb/utility/make_request.rb +44 -0
- package/project/.sdk/tm/rb/utility/make_response.rb +25 -0
- package/project/.sdk/tm/rb/utility/make_result.rb +33 -0
- package/project/.sdk/tm/rb/utility/make_spec.rb +50 -0
- package/project/.sdk/tm/rb/utility/make_url.rb +32 -0
- package/project/.sdk/tm/rb/utility/param.rb +48 -0
- package/project/.sdk/tm/rb/utility/prepare_auth.rb +26 -0
- package/project/.sdk/tm/rb/utility/prepare_body.rb +6 -0
- package/project/.sdk/tm/rb/utility/prepare_headers.rb +11 -0
- package/project/.sdk/tm/rb/utility/prepare_method.rb +5 -0
- package/project/.sdk/tm/rb/utility/prepare_params.rb +25 -0
- package/project/.sdk/tm/rb/utility/prepare_path.rb +13 -0
- package/project/.sdk/tm/rb/utility/prepare_query.rb +22 -0
- package/project/.sdk/tm/rb/utility/register.rb +63 -0
- package/project/.sdk/tm/rb/utility/result_basic.rb +23 -0
- package/project/.sdk/tm/rb/utility/result_body.rb +11 -0
- package/project/.sdk/tm/rb/utility/result_headers.rb +15 -0
- package/project/.sdk/tm/rb/utility/struct/voxgig_struct.rb +2256 -0
- package/project/.sdk/tm/rb/utility/transform_request.rb +15 -0
- package/project/.sdk/tm/rb/utility/transform_response.rb +23 -0
- package/src/cmp/Readme.ts +5 -5
- package/src/cmp/ReadmeEntity.ts +77 -25
- package/src/cmp/ReadmeExplanation.ts +333 -0
- package/src/cmp/ReadmeHowto.ts +28 -0
- package/src/cmp/ReadmeIntro.ts +10 -24
- package/src/cmp/ReadmeModel.ts +57 -88
- package/src/cmp/ReadmeOptions.ts +40 -11
- package/src/cmp/ReadmeQuick.ts +4 -1
- package/src/cmp/ReadmeRef.ts +1057 -40
- package/src/cmp/ReadmeTop.ts +213 -0
- package/src/sdkgen.ts +12 -0
- package/project/.sdk/tm/go/test/exists_test.go +0 -16
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
|
|
2
|
+
import * as Path from 'node:path'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
cmp, each, names, cmap,
|
|
6
|
+
List, File, Content, Copy, Folder, Fragment, Line, FeatureHook,
|
|
7
|
+
} from '@voxgig/sdkgen'
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
import type {
|
|
11
|
+
ModelEntity
|
|
12
|
+
} from '@voxgig/apidef'
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
import {
|
|
16
|
+
KIT,
|
|
17
|
+
getModelPath
|
|
18
|
+
} from '@voxgig/apidef'
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
import { Package } from './Package_rb'
|
|
22
|
+
import { Config } from './Config_rb'
|
|
23
|
+
import { MainEntity } from './MainEntity_rb'
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
const Main = cmp(async function Main(props: any) {
|
|
27
|
+
|
|
28
|
+
const { target } = props
|
|
29
|
+
const { model } = props.ctx$
|
|
30
|
+
|
|
31
|
+
const entity: ModelEntity = getModelPath(model, `main.${KIT}.entity`)
|
|
32
|
+
const feature = getModelPath(model, `main.${KIT}.feature`)
|
|
33
|
+
|
|
34
|
+
Package({ target })
|
|
35
|
+
|
|
36
|
+
// Copy tm/rb files with replacements
|
|
37
|
+
Copy({
|
|
38
|
+
from: 'tm/' + target.name,
|
|
39
|
+
exclude: [/src\//],
|
|
40
|
+
replace: {
|
|
41
|
+
...props.ctx$.stdrep,
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
// Generate main SDK file
|
|
46
|
+
File({ name: model.name + '_sdk.' + target.ext }, () => {
|
|
47
|
+
|
|
48
|
+
Fragment(
|
|
49
|
+
{
|
|
50
|
+
from: Path.normalize(__dirname + '/../../../src/cmp/rb/fragment/Main.fragment.rb'),
|
|
51
|
+
replace: {
|
|
52
|
+
...props.ctx$.stdrep,
|
|
53
|
+
|
|
54
|
+
'#BuildFeatures': ({ indent }: any) => {
|
|
55
|
+
each(feature, (feat: any) => {
|
|
56
|
+
const fname = feat.name.charAt(0).toUpperCase() + feat.name.slice(1)
|
|
57
|
+
Content({ indent }, ` # feature: ${feat.name}
|
|
58
|
+
`)
|
|
59
|
+
})
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
'#Feature-Hook': ({ name, indent }: any) => Content({ indent }, `
|
|
63
|
+
utility.feature_hook.call(@_rootctx, "${name}")
|
|
64
|
+
`),
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
// Entities - injected at SLOT
|
|
70
|
+
() => {
|
|
71
|
+
each(entity, (entity: ModelEntity) => {
|
|
72
|
+
const entitySDK = getModelPath(model, `main.${KIT}.entity.${entity.name}`)
|
|
73
|
+
const entprops = { target, entity, entitySDK }
|
|
74
|
+
MainEntity(entprops)
|
|
75
|
+
})
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
// Generate config module
|
|
80
|
+
Folder({ name: '.' }, () => {
|
|
81
|
+
Config({ target })
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
// Generate feature factory module
|
|
85
|
+
File({ name: 'features.' + target.ext }, () => {
|
|
86
|
+
Content(`# ${model.const.Name} SDK feature factory
|
|
87
|
+
|
|
88
|
+
require_relative 'feature/base_feature'
|
|
89
|
+
`)
|
|
90
|
+
|
|
91
|
+
each(feature, (feat: any) => {
|
|
92
|
+
if (feat.name !== 'base') {
|
|
93
|
+
const fname = feat.name.charAt(0).toUpperCase() + feat.name.slice(1)
|
|
94
|
+
Content(`require_relative 'feature/${feat.name}_feature'
|
|
95
|
+
`)
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
Content(`
|
|
100
|
+
|
|
101
|
+
module ${model.const.Name}Features
|
|
102
|
+
def self.make_feature(name)
|
|
103
|
+
case name
|
|
104
|
+
when "base"
|
|
105
|
+
${model.const.Name}BaseFeature.new
|
|
106
|
+
`)
|
|
107
|
+
|
|
108
|
+
each(feature, (feat: any) => {
|
|
109
|
+
if (feat.name !== 'base') {
|
|
110
|
+
const fname = feat.name.charAt(0).toUpperCase() + feat.name.slice(1)
|
|
111
|
+
Content(` when "${feat.name}"
|
|
112
|
+
${model.const.Name}${fname}Feature.new
|
|
113
|
+
`)
|
|
114
|
+
}
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
Content(` else
|
|
118
|
+
${model.const.Name}BaseFeature.new
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
`)
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
export {
|
|
129
|
+
Main
|
|
130
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
|
|
2
|
+
import {
|
|
3
|
+
Content,
|
|
4
|
+
File,
|
|
5
|
+
cmp,
|
|
6
|
+
each,
|
|
7
|
+
} from '@voxgig/sdkgen'
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
KIT,
|
|
12
|
+
Model,
|
|
13
|
+
getModelPath,
|
|
14
|
+
} from '@voxgig/apidef'
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
const Package = cmp(async function Package(props: any) {
|
|
18
|
+
const ctx$ = props.ctx$
|
|
19
|
+
const target = props.target
|
|
20
|
+
|
|
21
|
+
const model: Model = ctx$.model
|
|
22
|
+
|
|
23
|
+
const feature = getModelPath(model, `main.${KIT}.feature`)
|
|
24
|
+
|
|
25
|
+
// Generate Gemfile
|
|
26
|
+
File({ name: 'Gemfile' }, () => {
|
|
27
|
+
Content(`source "https://rubygems.org"
|
|
28
|
+
|
|
29
|
+
gemspec
|
|
30
|
+
|
|
31
|
+
`)
|
|
32
|
+
|
|
33
|
+
// Collect dependencies from features
|
|
34
|
+
each(feature, (f: any) => {
|
|
35
|
+
const rbDeps = f.deps?.rb
|
|
36
|
+
if (rbDeps) {
|
|
37
|
+
each(rbDeps, (dep: any) => {
|
|
38
|
+
if (dep.active) {
|
|
39
|
+
Content(`gem "${dep.key$}", "~> ${dep.version}"
|
|
40
|
+
`)
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
// Add target-level deps
|
|
47
|
+
const targetDeps = target.deps
|
|
48
|
+
if (targetDeps) {
|
|
49
|
+
each(targetDeps, (dep: any) => {
|
|
50
|
+
if (dep.active !== false) {
|
|
51
|
+
Content(`gem "${dep.key$}", "~> ${dep.version || '0.0'}"
|
|
52
|
+
`)
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
// Generate gemspec
|
|
59
|
+
File({ name: model.name + '_sdk.gemspec' }, () => {
|
|
60
|
+
Content(`Gem::Specification.new do |spec|
|
|
61
|
+
spec.name = "${model.name}-sdk"
|
|
62
|
+
spec.version = "0.0.1"
|
|
63
|
+
spec.authors = ["Voxgig"]
|
|
64
|
+
spec.summary = "${model.const.Name} SDK for Ruby"
|
|
65
|
+
spec.license = "MIT"
|
|
66
|
+
spec.homepage = "https://github.com/voxgig/${model.name}-sdk"
|
|
67
|
+
|
|
68
|
+
spec.files = Dir["lib/**/*.rb", "*.rb"]
|
|
69
|
+
spec.require_paths = ["."]
|
|
70
|
+
|
|
71
|
+
spec.required_ruby_version = ">= 3.0"
|
|
72
|
+
|
|
73
|
+
spec.add_dependency "json"
|
|
74
|
+
`)
|
|
75
|
+
|
|
76
|
+
// Collect dependencies from features
|
|
77
|
+
each(feature, (f: any) => {
|
|
78
|
+
const rbDeps = f.deps?.rb
|
|
79
|
+
if (rbDeps) {
|
|
80
|
+
each(rbDeps, (dep: any) => {
|
|
81
|
+
if (dep.active) {
|
|
82
|
+
Content(` spec.add_dependency "${dep.key$}", "~> ${dep.version}"
|
|
83
|
+
`)
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
// Add target-level deps
|
|
90
|
+
const targetDeps = target.deps
|
|
91
|
+
if (targetDeps) {
|
|
92
|
+
each(targetDeps, (dep: any) => {
|
|
93
|
+
if (dep.active !== false) {
|
|
94
|
+
Content(` spec.add_dependency "${dep.key$}", "~> ${dep.version || '0.0'}"
|
|
95
|
+
`)
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
Content(`
|
|
101
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
|
102
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
|
103
|
+
end
|
|
104
|
+
`)
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
export {
|
|
110
|
+
Package
|
|
111
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, Content } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const ReadmeExplanation = cmp(function ReadmeExplanation(props: any) {
|
|
6
|
+
const { target, ctx$: { model } } = props
|
|
7
|
+
|
|
8
|
+
Content(`### Data as hashes
|
|
9
|
+
|
|
10
|
+
The Ruby SDK uses plain Ruby hashes throughout rather than typed
|
|
11
|
+
objects. This mirrors the dynamic nature of the API and keeps the
|
|
12
|
+
SDK flexible — no code generation is needed when the API schema
|
|
13
|
+
changes.
|
|
14
|
+
|
|
15
|
+
Use \`Helpers.to_map()\` to safely validate that a value is a hash.
|
|
16
|
+
|
|
17
|
+
### Module structure
|
|
18
|
+
|
|
19
|
+
\`\`\`
|
|
20
|
+
rb/
|
|
21
|
+
├── ${model.name}_sdk.rb -- Main SDK module
|
|
22
|
+
├── config.rb -- Configuration
|
|
23
|
+
├── features.rb -- Feature factory
|
|
24
|
+
├── core/ -- Core types and context
|
|
25
|
+
├── entity/ -- Entity implementations
|
|
26
|
+
├── feature/ -- Built-in features (Base, Test, Log)
|
|
27
|
+
├── utility/ -- Utility functions and struct library
|
|
28
|
+
└── test/ -- Test suites
|
|
29
|
+
\`\`\`
|
|
30
|
+
|
|
31
|
+
The main module (\`${model.name}_sdk\`) exports the SDK class
|
|
32
|
+
and test helper. Import entity or utility modules directly only
|
|
33
|
+
when needed.
|
|
34
|
+
|
|
35
|
+
`)
|
|
36
|
+
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
export {
|
|
41
|
+
ReadmeExplanation
|
|
42
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, Content } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
|
|
6
|
+
const { target, ctx$: { model } } = props
|
|
7
|
+
|
|
8
|
+
Content(`### Make a direct HTTP request
|
|
9
|
+
|
|
10
|
+
For endpoints not covered by entity methods:
|
|
11
|
+
|
|
12
|
+
\`\`\`ruby
|
|
13
|
+
result, err = client.direct({
|
|
14
|
+
"path" => "/api/resource/{id}",
|
|
15
|
+
"method" => "GET",
|
|
16
|
+
"params" => { "id" => "example" },
|
|
17
|
+
})
|
|
18
|
+
raise err if err
|
|
19
|
+
|
|
20
|
+
if result["ok"]
|
|
21
|
+
puts result["status"] # 200
|
|
22
|
+
puts result["data"] # response body
|
|
23
|
+
end
|
|
24
|
+
\`\`\`
|
|
25
|
+
|
|
26
|
+
### Prepare a request without sending it
|
|
27
|
+
|
|
28
|
+
\`\`\`ruby
|
|
29
|
+
fetchdef, err = client.prepare({
|
|
30
|
+
"path" => "/api/resource/{id}",
|
|
31
|
+
"method" => "DELETE",
|
|
32
|
+
"params" => { "id" => "example" },
|
|
33
|
+
})
|
|
34
|
+
raise err if err
|
|
35
|
+
|
|
36
|
+
puts fetchdef["url"]
|
|
37
|
+
puts fetchdef["method"]
|
|
38
|
+
puts fetchdef["headers"]
|
|
39
|
+
\`\`\`
|
|
40
|
+
|
|
41
|
+
### Use test mode
|
|
42
|
+
|
|
43
|
+
Create a mock client for unit testing — no server required:
|
|
44
|
+
|
|
45
|
+
\`\`\`ruby
|
|
46
|
+
client = ${model.const.Name}SDK.test(nil, nil)
|
|
47
|
+
|
|
48
|
+
result, err = client.${model.const.Name}(nil).load(
|
|
49
|
+
{ "id" => "test01" }, nil
|
|
50
|
+
)
|
|
51
|
+
# result contains mock response data
|
|
52
|
+
\`\`\`
|
|
53
|
+
|
|
54
|
+
### Use a custom fetch function
|
|
55
|
+
|
|
56
|
+
Replace the HTTP transport with your own function:
|
|
57
|
+
|
|
58
|
+
\`\`\`ruby
|
|
59
|
+
mock_fetch = ->(url, init) {
|
|
60
|
+
return {
|
|
61
|
+
"status" => 200,
|
|
62
|
+
"statusText" => "OK",
|
|
63
|
+
"headers" => {},
|
|
64
|
+
"json" => ->() { { "id" => "mock01" } },
|
|
65
|
+
}, nil
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
client = ${model.const.Name}SDK.new({
|
|
69
|
+
"base" => "http://localhost:8080",
|
|
70
|
+
"system" => {
|
|
71
|
+
"fetch" => mock_fetch,
|
|
72
|
+
},
|
|
73
|
+
})
|
|
74
|
+
\`\`\`
|
|
75
|
+
|
|
76
|
+
### Run live tests
|
|
77
|
+
|
|
78
|
+
Create a \`.env.local\` file at the project root:
|
|
79
|
+
|
|
80
|
+
\`\`\`
|
|
81
|
+
${model.NAME}_TEST_LIVE=TRUE
|
|
82
|
+
${model.NAME}_APIKEY=<your-key>
|
|
83
|
+
\`\`\`
|
|
84
|
+
|
|
85
|
+
Then run:
|
|
86
|
+
|
|
87
|
+
\`\`\`bash
|
|
88
|
+
cd rb && ruby -Itest -e "Dir['test/*_test.rb'].each { |f| require_relative f }"
|
|
89
|
+
\`\`\`
|
|
90
|
+
|
|
91
|
+
`)
|
|
92
|
+
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
export {
|
|
97
|
+
ReadmeHowto
|
|
98
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, Content } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const ReadmeInstall = cmp(function ReadmeInstall(props: any) {
|
|
6
|
+
const { target, ctx$ } = props
|
|
7
|
+
const { model } = ctx$
|
|
8
|
+
|
|
9
|
+
Content(`\`\`\`bash
|
|
10
|
+
gem install ${model.name}-sdk
|
|
11
|
+
\`\`\`
|
|
12
|
+
|
|
13
|
+
Or add to your \`Gemfile\`:
|
|
14
|
+
|
|
15
|
+
\`\`\`ruby
|
|
16
|
+
gem "${model.name}-sdk"
|
|
17
|
+
\`\`\`
|
|
18
|
+
|
|
19
|
+
Then run:
|
|
20
|
+
|
|
21
|
+
\`\`\`bash
|
|
22
|
+
bundle install
|
|
23
|
+
\`\`\`
|
|
24
|
+
|
|
25
|
+
`)
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
ReadmeInstall
|
|
31
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, each, Content } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
KIT,
|
|
6
|
+
getModelPath,
|
|
7
|
+
} from '@voxgig/apidef'
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const ReadmeModel = cmp(function ReadmeModel(props: any) {
|
|
11
|
+
const { target, ctx$: { model } } = props
|
|
12
|
+
|
|
13
|
+
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
14
|
+
const entityList = each(entity).filter((e: any) => e.active !== false)
|
|
15
|
+
|
|
16
|
+
Content(`### ${model.const.Name}SDK
|
|
17
|
+
|
|
18
|
+
\`\`\`ruby
|
|
19
|
+
require_relative "${model.name}_sdk"
|
|
20
|
+
client = ${model.const.Name}SDK.new(options)
|
|
21
|
+
\`\`\`
|
|
22
|
+
|
|
23
|
+
Creates a new SDK client.
|
|
24
|
+
|
|
25
|
+
| Option | Type | Description |
|
|
26
|
+
| --- | --- | --- |
|
|
27
|
+
| \`apikey\` | \`String\` | API key for authentication. |
|
|
28
|
+
| \`base\` | \`String\` | Base URL of the API server. |
|
|
29
|
+
| \`prefix\` | \`String\` | URL path prefix prepended to all requests. |
|
|
30
|
+
| \`suffix\` | \`String\` | URL path suffix appended to all requests. |
|
|
31
|
+
| \`feature\` | \`Hash\` | Feature activation flags. |
|
|
32
|
+
| \`extend\` | \`Hash\` | Additional Feature instances to load. |
|
|
33
|
+
| \`system\` | \`Hash\` | System overrides (e.g. custom \`fetch\` lambda). |
|
|
34
|
+
|
|
35
|
+
### test
|
|
36
|
+
|
|
37
|
+
\`\`\`ruby
|
|
38
|
+
client = ${model.const.Name}SDK.test(testopts, sdkopts)
|
|
39
|
+
\`\`\`
|
|
40
|
+
|
|
41
|
+
Creates a test-mode client with mock transport. Both arguments may be \`nil\`.
|
|
42
|
+
|
|
43
|
+
### ${model.const.Name}SDK methods
|
|
44
|
+
|
|
45
|
+
| Method | Signature | Description |
|
|
46
|
+
| --- | --- | --- |
|
|
47
|
+
| \`options_map\` | \`() -> Hash\` | Deep copy of current SDK options. |
|
|
48
|
+
| \`get_utility\` | \`() -> Utility\` | Copy of the SDK utility object. |
|
|
49
|
+
| \`prepare\` | \`(fetchargs) -> [Hash, err]\` | Build an HTTP request definition without sending. |
|
|
50
|
+
| \`direct\` | \`(fetchargs) -> [Hash, err]\` | Build and send an HTTP request. |
|
|
51
|
+
`)
|
|
52
|
+
|
|
53
|
+
each(entityList, (ent: any) => {
|
|
54
|
+
Content(`| \`${ent.Name}\` | \`(data) -> ${ent.Name}Entity\` | Create a ${ent.Name} entity instance. |
|
|
55
|
+
`)
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
Content(`
|
|
59
|
+
### Entity interface
|
|
60
|
+
|
|
61
|
+
All entities share the same interface.
|
|
62
|
+
|
|
63
|
+
| Method | Signature | Description |
|
|
64
|
+
| --- | --- | --- |
|
|
65
|
+
| \`load\` | \`(reqmatch, ctrl) -> [any, err]\` | Load a single entity by match criteria. |
|
|
66
|
+
| \`list\` | \`(reqmatch, ctrl) -> [any, err]\` | List entities matching the criteria. |
|
|
67
|
+
| \`create\` | \`(reqdata, ctrl) -> [any, err]\` | Create a new entity. |
|
|
68
|
+
| \`update\` | \`(reqdata, ctrl) -> [any, err]\` | Update an existing entity. |
|
|
69
|
+
| \`remove\` | \`(reqmatch, ctrl) -> [any, err]\` | Remove an entity. |
|
|
70
|
+
| \`data_get\` | \`() -> Hash\` | Get entity data. |
|
|
71
|
+
| \`data_set\` | \`(data)\` | Set entity data. |
|
|
72
|
+
| \`match_get\` | \`() -> Hash\` | Get entity match criteria. |
|
|
73
|
+
| \`match_set\` | \`(match)\` | Set entity match criteria. |
|
|
74
|
+
| \`make\` | \`() -> Entity\` | Create a new instance with the same options. |
|
|
75
|
+
| \`get_name\` | \`() -> String\` | Return the entity name. |
|
|
76
|
+
|
|
77
|
+
### Result shape
|
|
78
|
+
|
|
79
|
+
Entity operations return \`[any, err]\`. The first value is a
|
|
80
|
+
\`Hash\` with these keys:
|
|
81
|
+
|
|
82
|
+
| Key | Type | Description |
|
|
83
|
+
| --- | --- | --- |
|
|
84
|
+
| \`ok\` | \`Boolean\` | \`true\` if the HTTP status is 2xx. |
|
|
85
|
+
| \`status\` | \`Integer\` | HTTP status code. |
|
|
86
|
+
| \`headers\` | \`Hash\` | Response headers. |
|
|
87
|
+
| \`data\` | \`any\` | Parsed JSON response body. |
|
|
88
|
+
|
|
89
|
+
On error, \`ok\` is \`false\` and \`err\` contains the error value.
|
|
90
|
+
|
|
91
|
+
`)
|
|
92
|
+
|
|
93
|
+
// Entities summary
|
|
94
|
+
Content(`### Entities
|
|
95
|
+
|
|
96
|
+
`)
|
|
97
|
+
each(entityList, (ent: any) => {
|
|
98
|
+
const fields = ent.fields || []
|
|
99
|
+
const opnames = Object.keys(ent.op || {})
|
|
100
|
+
const ops = ent.op || {}
|
|
101
|
+
const points = each(ops).map((op: any) =>
|
|
102
|
+
op.points ? each(op.points) : []
|
|
103
|
+
).flat()
|
|
104
|
+
const path = points.length > 0 ? (points[0] as any).orig || '' : ''
|
|
105
|
+
|
|
106
|
+
Content(`#### ${ent.Name}
|
|
107
|
+
|
|
108
|
+
| Field | Description |
|
|
109
|
+
| --- | --- |
|
|
110
|
+
`)
|
|
111
|
+
each(fields, (field: any) => {
|
|
112
|
+
Content(`| \`${field.name}\` | ${field.short || ''} |
|
|
113
|
+
`)
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
Content(`
|
|
117
|
+
Operations: ${opnames.map((n: string) => n.charAt(0).toUpperCase() + n.slice(1)).join(', ')}.
|
|
118
|
+
|
|
119
|
+
API path: \`${path}\`
|
|
120
|
+
|
|
121
|
+
`)
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
export {
|
|
128
|
+
ReadmeModel
|
|
129
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, each, Content } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
KIT,
|
|
6
|
+
getModelPath,
|
|
7
|
+
nom,
|
|
8
|
+
} from '@voxgig/apidef'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const ReadmeQuick = cmp(function ReadmeQuick(props: any) {
|
|
12
|
+
const { target, ctx$: { model } } = props
|
|
13
|
+
|
|
14
|
+
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
15
|
+
|
|
16
|
+
const exampleEntity = Object.values(entity).find((e: any) => e.active !== false) as any
|
|
17
|
+
const nestedEntity = Object.values(entity).find((e: any) =>
|
|
18
|
+
e.active !== false && e.ancestors && e.ancestors.length > 0
|
|
19
|
+
) as any
|
|
20
|
+
|
|
21
|
+
Content(`### 1. Create a client
|
|
22
|
+
|
|
23
|
+
\`\`\`ruby
|
|
24
|
+
require_relative "${model.name}_sdk"
|
|
25
|
+
|
|
26
|
+
client = ${model.const.Name}SDK.new({
|
|
27
|
+
"apikey" => ENV["${model.NAME}_APIKEY"],
|
|
28
|
+
})
|
|
29
|
+
\`\`\`
|
|
30
|
+
|
|
31
|
+
`)
|
|
32
|
+
|
|
33
|
+
if (exampleEntity) {
|
|
34
|
+
const eName = nom(exampleEntity, 'Name')
|
|
35
|
+
const opnames = Object.keys(exampleEntity.op || {})
|
|
36
|
+
|
|
37
|
+
if (opnames.includes('list')) {
|
|
38
|
+
Content(`### 2. List ${eName.toLowerCase()}s
|
|
39
|
+
|
|
40
|
+
\`\`\`ruby
|
|
41
|
+
result, err = client.${eName}(nil).list(nil, nil)
|
|
42
|
+
raise err if err
|
|
43
|
+
|
|
44
|
+
if result.is_a?(Array)
|
|
45
|
+
result.each do |item|
|
|
46
|
+
d = item.data_get
|
|
47
|
+
puts "#{d["id"]} #{d["name"]}"
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
\`\`\`
|
|
51
|
+
|
|
52
|
+
`)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (opnames.includes('load')) {
|
|
56
|
+
Content(`### 3. Load a ${eName.toLowerCase()}
|
|
57
|
+
|
|
58
|
+
\`\`\`ruby
|
|
59
|
+
result, err = client.${eName}(nil).load({ "id" => "example_id" }, nil)
|
|
60
|
+
raise err if err
|
|
61
|
+
puts result
|
|
62
|
+
\`\`\`
|
|
63
|
+
|
|
64
|
+
`)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (opnames.includes('create') || opnames.includes('update') || opnames.includes('remove')) {
|
|
68
|
+
Content(`### 4. Create, update, and remove
|
|
69
|
+
|
|
70
|
+
\`\`\`ruby
|
|
71
|
+
`)
|
|
72
|
+
if (opnames.includes('create')) {
|
|
73
|
+
Content(`# Create
|
|
74
|
+
created, _ = client.${eName}(nil).create({ "name" => "Example" }, nil)
|
|
75
|
+
|
|
76
|
+
`)
|
|
77
|
+
}
|
|
78
|
+
if (opnames.includes('update')) {
|
|
79
|
+
Content(`# Update
|
|
80
|
+
client.${eName}(nil).update({ "id" => created["id"], "name" => "Example-Renamed" }, nil)
|
|
81
|
+
|
|
82
|
+
`)
|
|
83
|
+
}
|
|
84
|
+
if (opnames.includes('remove')) {
|
|
85
|
+
Content(`# Remove
|
|
86
|
+
client.${eName}(nil).remove({ "id" => created["id"] }, nil)
|
|
87
|
+
`)
|
|
88
|
+
}
|
|
89
|
+
Content(`\`\`\`
|
|
90
|
+
|
|
91
|
+
`)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
export {
|
|
98
|
+
ReadmeQuick
|
|
99
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, Content } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const ReadmeTopHowto = cmp(function ReadmeTopHowto(props: any) {
|
|
6
|
+
const { target } = props
|
|
7
|
+
|
|
8
|
+
Content(`**Ruby:**
|
|
9
|
+
\`\`\`ruby
|
|
10
|
+
result, err = client.direct({
|
|
11
|
+
"path" => "/api/resource/{id}",
|
|
12
|
+
"method" => "GET",
|
|
13
|
+
"params" => { "id" => "example" },
|
|
14
|
+
})
|
|
15
|
+
\`\`\`
|
|
16
|
+
|
|
17
|
+
`)
|
|
18
|
+
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
ReadmeTopHowto
|
|
24
|
+
}
|