@xyd-js/opencli2go 0.1.0-build.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/LICENSE +21 -0
- package/README.md +63 -0
- package/__fixtures__/-2.complex.openai/admin__organization__admin-api-keys__create/input.json +73 -0
- package/__fixtures__/-2.complex.openai/admin__organization__admin-api-keys__create/output.go +51 -0
- package/__fixtures__/-2.complex.openai/admin__organization__admin-api-keys__create/recorded.json +19 -0
- package/__fixtures__/-2.complex.openai/admin__organization__admin-api-keys__delete/input.json +61 -0
- package/__fixtures__/-2.complex.openai/admin__organization__admin-api-keys__delete/output.go +37 -0
- package/__fixtures__/-2.complex.openai/admin__organization__admin-api-keys__delete/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/admin__organization__admin-api-keys__list/input.json +97 -0
- package/__fixtures__/-2.complex.openai/admin__organization__admin-api-keys__list/output.go +59 -0
- package/__fixtures__/-2.complex.openai/admin__organization__admin-api-keys__list/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/admin__organization__admin-api-keys__retrieve/input.json +97 -0
- package/__fixtures__/-2.complex.openai/admin__organization__admin-api-keys__retrieve/output.go +59 -0
- package/__fixtures__/-2.complex.openai/admin__organization__admin-api-keys__retrieve/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/admin__organization__audit-logs__list/input.json +254 -0
- package/__fixtures__/-2.complex.openai/admin__organization__audit-logs__list/output.go +104 -0
- package/__fixtures__/-2.complex.openai/admin__organization__audit-logs__list/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/admin__organization__certificates__activate/input.json +90 -0
- package/__fixtures__/-2.complex.openai/admin__organization__certificates__activate/output.go +59 -0
- package/__fixtures__/-2.complex.openai/admin__organization__certificates__activate/recorded.json +19 -0
- package/__fixtures__/-2.complex.openai/admin__organization__certificates__create/input.json +90 -0
- package/__fixtures__/-2.complex.openai/admin__organization__certificates__create/output.go +59 -0
- package/__fixtures__/-2.complex.openai/admin__organization__certificates__create/recorded.json +19 -0
- package/__fixtures__/-2.complex.openai/admin__organization__certificates__deactivate/input.json +90 -0
- package/__fixtures__/-2.complex.openai/admin__organization__certificates__deactivate/output.go +59 -0
- package/__fixtures__/-2.complex.openai/admin__organization__certificates__deactivate/recorded.json +19 -0
- package/__fixtures__/-2.complex.openai/admin__organization__certificates__delete/input.json +62 -0
- package/__fixtures__/-2.complex.openai/admin__organization__certificates__delete/output.go +37 -0
- package/__fixtures__/-2.complex.openai/admin__organization__certificates__delete/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/admin__organization__certificates__list/input.json +100 -0
- package/__fixtures__/-2.complex.openai/admin__organization__certificates__list/output.go +62 -0
- package/__fixtures__/-2.complex.openai/admin__organization__certificates__list/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/admin__organization__certificates__retrieve/input.json +100 -0
- package/__fixtures__/-2.complex.openai/admin__organization__certificates__retrieve/output.go +62 -0
- package/__fixtures__/-2.complex.openai/admin__organization__certificates__retrieve/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/admin__organization__certificates__update/input.json +90 -0
- package/__fixtures__/-2.complex.openai/admin__organization__certificates__update/output.go +59 -0
- package/__fixtures__/-2.complex.openai/admin__organization__certificates__update/recorded.json +19 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__create/input.json +74 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__create/output.go +52 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__create/recorded.json +19 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__delete/input.json +62 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__delete/output.go +37 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__delete/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__list/input.json +100 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__list/output.go +62 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__list/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__retrieve/input.json +100 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__retrieve/output.go +62 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__retrieve/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__roles__create/input.json +94 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__roles__create/output.go +59 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__roles__create/recorded.json +21 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__roles__delete/input.json +78 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__roles__delete/output.go +43 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__roles__delete/recorded.json +17 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__roles__list/input.json +118 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__roles__list/output.go +68 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__roles__list/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__roles__retrieve/input.json +118 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__roles__retrieve/output.go +68 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__roles__retrieve/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__update/input.json +74 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__update/output.go +52 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__update/recorded.json +19 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__users__create/input.json +94 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__users__create/output.go +59 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__users__create/recorded.json +21 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__users__delete/input.json +78 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__users__delete/output.go +43 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__users__delete/recorded.json +17 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__users__list/input.json +118 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__users__list/output.go +68 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__users__list/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__users__retrieve/input.json +118 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__users__retrieve/output.go +68 -0
- package/__fixtures__/-2.complex.openai/admin__organization__groups__users__retrieve/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/admin__organization__invites__create/input.json +115 -0
- package/__fixtures__/-2.complex.openai/admin__organization__invites__create/output.go +67 -0
- package/__fixtures__/-2.complex.openai/admin__organization__invites__create/recorded.json +22 -0
- package/__fixtures__/-2.complex.openai/admin__organization__invites__delete/input.json +62 -0
- package/__fixtures__/-2.complex.openai/admin__organization__invites__delete/output.go +37 -0
- package/__fixtures__/-2.complex.openai/admin__organization__invites__delete/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/admin__organization__invites__list/input.json +81 -0
- package/__fixtures__/-2.complex.openai/admin__organization__invites__list/output.go +55 -0
- package/__fixtures__/-2.complex.openai/admin__organization__invites__list/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/admin__organization__invites__retrieve/input.json +81 -0
- package/__fixtures__/-2.complex.openai/admin__organization__invites__retrieve/output.go +55 -0
- package/__fixtures__/-2.complex.openai/admin__organization__invites__retrieve/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__api-keys__delete/input.json +78 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__api-keys__delete/output.go +43 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__api-keys__delete/recorded.json +17 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__api-keys__list/input.json +99 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__api-keys__list/output.go +61 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__api-keys__list/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__api-keys__retrieve/input.json +99 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__api-keys__retrieve/output.go +61 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__api-keys__retrieve/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__archive/input.json +106 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__archive/output.go +76 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__archive/recorded.json +19 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__certificates__list/input.json +118 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__certificates__list/output.go +68 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__certificates__list/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__create/input.json +106 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__create/output.go +76 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__create/recorded.json +19 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__groups__create/input.json +112 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__groups__create/output.go +67 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__groups__create/recorded.json +24 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__groups__delete/input.json +78 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__groups__delete/output.go +43 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__groups__delete/recorded.json +17 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__groups__list/input.json +118 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__groups__list/output.go +68 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__groups__list/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__groups__retrieve/input.json +118 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__groups__retrieve/output.go +68 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__groups__retrieve/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__list/input.json +91 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__list/output.go +62 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__list/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__rate-limits__list-rate-limits/input.json +114 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__rate-limits__list-rate-limits/output.go +68 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__rate-limits__list-rate-limits/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__rate-limits__update-rate-limit/input.json +183 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__rate-limits__update-rate-limit/output.go +94 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__rate-limits__update-rate-limit/recorded.json +18 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__retrieve/input.json +91 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__retrieve/output.go +62 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__retrieve/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__service-accounts__create/input.json +94 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__service-accounts__create/output.go +59 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__service-accounts__create/recorded.json +21 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__service-accounts__delete/input.json +78 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__service-accounts__delete/output.go +43 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__service-accounts__delete/recorded.json +17 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__service-accounts__list/input.json +99 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__service-accounts__list/output.go +61 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__service-accounts__list/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__service-accounts__retrieve/input.json +99 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__service-accounts__retrieve/output.go +61 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__service-accounts__retrieve/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__service-accounts__update/input.json +94 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__service-accounts__update/output.go +59 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__service-accounts__update/recorded.json +21 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__update/input.json +106 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__update/output.go +76 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__update/recorded.json +19 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__users__create/input.json +126 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__users__create/output.go +83 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__users__create/recorded.json +21 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__users__delete/input.json +78 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__users__delete/output.go +43 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__users__delete/recorded.json +17 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__users__list/input.json +99 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__users__list/output.go +61 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__users__list/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__users__retrieve/input.json +99 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__users__retrieve/output.go +61 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__users__retrieve/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__users__update/input.json +126 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__users__update/output.go +83 -0
- package/__fixtures__/-2.complex.openai/admin__organization__projects__users__update/recorded.json +21 -0
- package/__fixtures__/-2.complex.openai/admin__organization__roles__create/input.json +111 -0
- package/__fixtures__/-2.complex.openai/admin__organization__roles__create/output.go +72 -0
- package/__fixtures__/-2.complex.openai/admin__organization__roles__create/recorded.json +22 -0
- package/__fixtures__/-2.complex.openai/admin__organization__roles__delete/input.json +62 -0
- package/__fixtures__/-2.complex.openai/admin__organization__roles__delete/output.go +37 -0
- package/__fixtures__/-2.complex.openai/admin__organization__roles__delete/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/admin__organization__roles__list/input.json +100 -0
- package/__fixtures__/-2.complex.openai/admin__organization__roles__list/output.go +62 -0
- package/__fixtures__/-2.complex.openai/admin__organization__roles__list/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/admin__organization__roles__retrieve/input.json +100 -0
- package/__fixtures__/-2.complex.openai/admin__organization__roles__retrieve/output.go +62 -0
- package/__fixtures__/-2.complex.openai/admin__organization__roles__retrieve/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/admin__organization__roles__update/input.json +111 -0
- package/__fixtures__/-2.complex.openai/admin__organization__roles__update/output.go +72 -0
- package/__fixtures__/-2.complex.openai/admin__organization__roles__update/recorded.json +22 -0
- package/__fixtures__/-2.complex.openai/admin__organization__users__delete/input.json +62 -0
- package/__fixtures__/-2.complex.openai/admin__organization__users__delete/output.go +37 -0
- package/__fixtures__/-2.complex.openai/admin__organization__users__delete/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/admin__organization__users__list/input.json +99 -0
- package/__fixtures__/-2.complex.openai/admin__organization__users__list/output.go +62 -0
- package/__fixtures__/-2.complex.openai/admin__organization__users__list/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/admin__organization__users__retrieve/input.json +99 -0
- package/__fixtures__/-2.complex.openai/admin__organization__users__retrieve/output.go +62 -0
- package/__fixtures__/-2.complex.openai/admin__organization__users__retrieve/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/admin__organization__users__roles__create/input.json +94 -0
- package/__fixtures__/-2.complex.openai/admin__organization__users__roles__create/output.go +59 -0
- package/__fixtures__/-2.complex.openai/admin__organization__users__roles__create/recorded.json +21 -0
- package/__fixtures__/-2.complex.openai/admin__organization__users__roles__delete/input.json +78 -0
- package/__fixtures__/-2.complex.openai/admin__organization__users__roles__delete/output.go +43 -0
- package/__fixtures__/-2.complex.openai/admin__organization__users__roles__delete/recorded.json +17 -0
- package/__fixtures__/-2.complex.openai/admin__organization__users__roles__list/input.json +118 -0
- package/__fixtures__/-2.complex.openai/admin__organization__users__roles__list/output.go +68 -0
- package/__fixtures__/-2.complex.openai/admin__organization__users__roles__list/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/admin__organization__users__roles__retrieve/input.json +118 -0
- package/__fixtures__/-2.complex.openai/admin__organization__users__roles__retrieve/output.go +68 -0
- package/__fixtures__/-2.complex.openai/admin__organization__users__roles__retrieve/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/admin__organization__users__update/input.json +135 -0
- package/__fixtures__/-2.complex.openai/admin__organization__users__update/output.go +94 -0
- package/__fixtures__/-2.complex.openai/admin__organization__users__update/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/audio__speech__create/input.json +186 -0
- package/__fixtures__/-2.complex.openai/audio__speech__create/output.go +106 -0
- package/__fixtures__/-2.complex.openai/audio__speech__create/recorded.json +25 -0
- package/__fixtures__/-2.complex.openai/audio__transcriptions__create/input.json +277 -0
- package/__fixtures__/-2.complex.openai/audio__transcriptions__create/output.go +143 -0
- package/__fixtures__/-2.complex.openai/audio__transcriptions__create/recorded.json +22 -0
- package/__fixtures__/-2.complex.openai/audio__translations__create/input.json +147 -0
- package/__fixtures__/-2.complex.openai/audio__translations__create/output.go +86 -0
- package/__fixtures__/-2.complex.openai/audio__translations__create/recorded.json +22 -0
- package/__fixtures__/-2.complex.openai/batches__cancel/input.json +149 -0
- package/__fixtures__/-2.complex.openai/batches__cancel/output.go +86 -0
- package/__fixtures__/-2.complex.openai/batches__cancel/recorded.json +24 -0
- package/__fixtures__/-2.complex.openai/batches__create/input.json +149 -0
- package/__fixtures__/-2.complex.openai/batches__create/output.go +86 -0
- package/__fixtures__/-2.complex.openai/batches__create/recorded.json +24 -0
- package/__fixtures__/-2.complex.openai/batches__list/input.json +76 -0
- package/__fixtures__/-2.complex.openai/batches__list/output.go +50 -0
- package/__fixtures__/-2.complex.openai/batches__list/recorded.json +13 -0
- package/__fixtures__/-2.complex.openai/batches__retrieve/input.json +76 -0
- package/__fixtures__/-2.complex.openai/batches__retrieve/output.go +50 -0
- package/__fixtures__/-2.complex.openai/batches__retrieve/recorded.json +13 -0
- package/__fixtures__/-2.complex.openai/beta__assistants__create/input.json +223 -0
- package/__fixtures__/-2.complex.openai/beta__assistants__create/output.go +158 -0
- package/__fixtures__/-2.complex.openai/beta__assistants__create/recorded.json +18 -0
- package/__fixtures__/-2.complex.openai/beta__assistants__delete/input.json +57 -0
- package/__fixtures__/-2.complex.openai/beta__assistants__delete/output.go +32 -0
- package/__fixtures__/-2.complex.openai/beta__assistants__delete/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/beta__assistants__list/input.json +110 -0
- package/__fixtures__/-2.complex.openai/beta__assistants__list/output.go +64 -0
- package/__fixtures__/-2.complex.openai/beta__assistants__list/recorded.json +13 -0
- package/__fixtures__/-2.complex.openai/beta__assistants__retrieve/input.json +110 -0
- package/__fixtures__/-2.complex.openai/beta__assistants__retrieve/output.go +64 -0
- package/__fixtures__/-2.complex.openai/beta__assistants__retrieve/recorded.json +13 -0
- package/__fixtures__/-2.complex.openai/beta__assistants__update/input.json +223 -0
- package/__fixtures__/-2.complex.openai/beta__assistants__update/output.go +158 -0
- package/__fixtures__/-2.complex.openai/beta__assistants__update/recorded.json +18 -0
- package/__fixtures__/-2.complex.openai/beta__chatkit__sessions__cancel/input.json +140 -0
- package/__fixtures__/-2.complex.openai/beta__chatkit__sessions__cancel/output.go +101 -0
- package/__fixtures__/-2.complex.openai/beta__chatkit__sessions__cancel/recorded.json +22 -0
- package/__fixtures__/-2.complex.openai/beta__chatkit__sessions__create/input.json +140 -0
- package/__fixtures__/-2.complex.openai/beta__chatkit__sessions__create/output.go +101 -0
- package/__fixtures__/-2.complex.openai/beta__chatkit__sessions__create/recorded.json +22 -0
- package/__fixtures__/-2.complex.openai/beta__chatkit__threads__delete/input.json +62 -0
- package/__fixtures__/-2.complex.openai/beta__chatkit__threads__delete/output.go +37 -0
- package/__fixtures__/-2.complex.openai/beta__chatkit__threads__delete/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/beta__chatkit__threads__list/input.json +65 -0
- package/__fixtures__/-2.complex.openai/beta__chatkit__threads__list/output.go +40 -0
- package/__fixtures__/-2.complex.openai/beta__chatkit__threads__list/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/beta__chatkit__threads__list-items/input.json +65 -0
- package/__fixtures__/-2.complex.openai/beta__chatkit__threads__list-items/output.go +40 -0
- package/__fixtures__/-2.complex.openai/beta__chatkit__threads__list-items/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/beta__chatkit__threads__retrieve/input.json +65 -0
- package/__fixtures__/-2.complex.openai/beta__chatkit__threads__retrieve/output.go +40 -0
- package/__fixtures__/-2.complex.openai/beta__chatkit__threads__retrieve/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/beta__threads__create/input.json +100 -0
- package/__fixtures__/-2.complex.openai/beta__threads__create/output.go +68 -0
- package/__fixtures__/-2.complex.openai/beta__threads__create/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/beta__threads__create-and-run/input.json +100 -0
- package/__fixtures__/-2.complex.openai/beta__threads__create-and-run/output.go +68 -0
- package/__fixtures__/-2.complex.openai/beta__threads__create-and-run/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/beta__threads__delete/input.json +57 -0
- package/__fixtures__/-2.complex.openai/beta__threads__delete/output.go +32 -0
- package/__fixtures__/-2.complex.openai/beta__threads__delete/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/beta__threads__messages__create/input.json +140 -0
- package/__fixtures__/-2.complex.openai/beta__threads__messages__create/output.go +88 -0
- package/__fixtures__/-2.complex.openai/beta__threads__messages__create/recorded.json +23 -0
- package/__fixtures__/-2.complex.openai/beta__threads__messages__delete/input.json +73 -0
- package/__fixtures__/-2.complex.openai/beta__threads__messages__delete/output.go +38 -0
- package/__fixtures__/-2.complex.openai/beta__threads__messages__delete/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/beta__threads__messages__list/input.json +143 -0
- package/__fixtures__/-2.complex.openai/beta__threads__messages__list/output.go +77 -0
- package/__fixtures__/-2.complex.openai/beta__threads__messages__list/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/beta__threads__messages__retrieve/input.json +143 -0
- package/__fixtures__/-2.complex.openai/beta__threads__messages__retrieve/output.go +77 -0
- package/__fixtures__/-2.complex.openai/beta__threads__messages__retrieve/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/beta__threads__messages__update/input.json +140 -0
- package/__fixtures__/-2.complex.openai/beta__threads__messages__update/output.go +88 -0
- package/__fixtures__/-2.complex.openai/beta__threads__messages__update/recorded.json +23 -0
- package/__fixtures__/-2.complex.openai/beta__threads__retrieve/input.json +60 -0
- package/__fixtures__/-2.complex.openai/beta__threads__retrieve/output.go +35 -0
- package/__fixtures__/-2.complex.openai/beta__threads__retrieve/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/beta__threads__runs__cancel/input.json +304 -0
- package/__fixtures__/-2.complex.openai/beta__threads__runs__cancel/output.go +189 -0
- package/__fixtures__/-2.complex.openai/beta__threads__runs__cancel/recorded.json +19 -0
- package/__fixtures__/-2.complex.openai/beta__threads__runs__create/input.json +304 -0
- package/__fixtures__/-2.complex.openai/beta__threads__runs__create/output.go +189 -0
- package/__fixtures__/-2.complex.openai/beta__threads__runs__create/recorded.json +19 -0
- package/__fixtures__/-2.complex.openai/beta__threads__runs__list/input.json +128 -0
- package/__fixtures__/-2.complex.openai/beta__threads__runs__list/output.go +70 -0
- package/__fixtures__/-2.complex.openai/beta__threads__runs__list/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/beta__threads__runs__retrieve/input.json +128 -0
- package/__fixtures__/-2.complex.openai/beta__threads__runs__retrieve/output.go +70 -0
- package/__fixtures__/-2.complex.openai/beta__threads__runs__retrieve/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/beta__threads__runs__steps__list/input.json +165 -0
- package/__fixtures__/-2.complex.openai/beta__threads__runs__steps__list/output.go +83 -0
- package/__fixtures__/-2.complex.openai/beta__threads__runs__steps__list/recorded.json +17 -0
- package/__fixtures__/-2.complex.openai/beta__threads__runs__steps__retrieve/input.json +165 -0
- package/__fixtures__/-2.complex.openai/beta__threads__runs__steps__retrieve/output.go +83 -0
- package/__fixtures__/-2.complex.openai/beta__threads__runs__steps__retrieve/recorded.json +17 -0
- package/__fixtures__/-2.complex.openai/beta__threads__runs__submit-tool-outputs/input.json +304 -0
- package/__fixtures__/-2.complex.openai/beta__threads__runs__submit-tool-outputs/output.go +189 -0
- package/__fixtures__/-2.complex.openai/beta__threads__runs__submit-tool-outputs/recorded.json +19 -0
- package/__fixtures__/-2.complex.openai/beta__threads__runs__update/input.json +304 -0
- package/__fixtures__/-2.complex.openai/beta__threads__runs__update/output.go +189 -0
- package/__fixtures__/-2.complex.openai/beta__threads__runs__update/recorded.json +19 -0
- package/__fixtures__/-2.complex.openai/beta__threads__update/input.json +100 -0
- package/__fixtures__/-2.complex.openai/beta__threads__update/output.go +68 -0
- package/__fixtures__/-2.complex.openai/beta__threads__update/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/chat__completions__create/input.json +600 -0
- package/__fixtures__/-2.complex.openai/chat__completions__create/output.go +372 -0
- package/__fixtures__/-2.complex.openai/chat__completions__create/recorded.json +22 -0
- package/__fixtures__/-2.complex.openai/chat__completions__delete/input.json +62 -0
- package/__fixtures__/-2.complex.openai/chat__completions__delete/output.go +37 -0
- package/__fixtures__/-2.complex.openai/chat__completions__delete/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/chat__completions__list/input.json +130 -0
- package/__fixtures__/-2.complex.openai/chat__completions__list/output.go +76 -0
- package/__fixtures__/-2.complex.openai/chat__completions__list/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/chat__completions__messages__list/input.json +118 -0
- package/__fixtures__/-2.complex.openai/chat__completions__messages__list/output.go +68 -0
- package/__fixtures__/-2.complex.openai/chat__completions__messages__list/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/chat__completions__retrieve/input.json +130 -0
- package/__fixtures__/-2.complex.openai/chat__completions__retrieve/output.go +76 -0
- package/__fixtures__/-2.complex.openai/chat__completions__retrieve/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/chat__completions__update/input.json +600 -0
- package/__fixtures__/-2.complex.openai/chat__completions__update/output.go +372 -0
- package/__fixtures__/-2.complex.openai/chat__completions__update/recorded.json +22 -0
- package/__fixtures__/-2.complex.openai/completions__create/input.json +332 -0
- package/__fixtures__/-2.complex.openai/completions__create/output.go +191 -0
- package/__fixtures__/-2.complex.openai/completions__create/recorded.json +21 -0
- package/__fixtures__/-2.complex.openai/containers__create/input.json +161 -0
- package/__fixtures__/-2.complex.openai/containers__create/output.go +92 -0
- package/__fixtures__/-2.complex.openai/containers__create/recorded.json +18 -0
- package/__fixtures__/-2.complex.openai/containers__delete/input.json +57 -0
- package/__fixtures__/-2.complex.openai/containers__delete/output.go +32 -0
- package/__fixtures__/-2.complex.openai/containers__delete/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/containers__files__content__retrieve/input.json +76 -0
- package/__fixtures__/-2.complex.openai/containers__files__content__retrieve/output.go +43 -0
- package/__fixtures__/-2.complex.openai/containers__files__content__retrieve/recorded.json +17 -0
- package/__fixtures__/-2.complex.openai/containers__files__create/input.json +102 -0
- package/__fixtures__/-2.complex.openai/containers__files__create/output.go +60 -0
- package/__fixtures__/-2.complex.openai/containers__files__create/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/containers__files__delete/input.json +71 -0
- package/__fixtures__/-2.complex.openai/containers__files__delete/output.go +38 -0
- package/__fixtures__/-2.complex.openai/containers__files__delete/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/containers__files__list/input.json +112 -0
- package/__fixtures__/-2.complex.openai/containers__files__list/output.go +63 -0
- package/__fixtures__/-2.complex.openai/containers__files__list/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/containers__files__retrieve/input.json +112 -0
- package/__fixtures__/-2.complex.openai/containers__files__retrieve/output.go +63 -0
- package/__fixtures__/-2.complex.openai/containers__files__retrieve/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/containers__list/input.json +110 -0
- package/__fixtures__/-2.complex.openai/containers__list/output.go +64 -0
- package/__fixtures__/-2.complex.openai/containers__list/recorded.json +13 -0
- package/__fixtures__/-2.complex.openai/containers__retrieve/input.json +110 -0
- package/__fixtures__/-2.complex.openai/containers__retrieve/output.go +64 -0
- package/__fixtures__/-2.complex.openai/containers__retrieve/recorded.json +13 -0
- package/__fixtures__/-2.complex.openai/conversations__create/input.json +81 -0
- package/__fixtures__/-2.complex.openai/conversations__create/output.go +61 -0
- package/__fixtures__/-2.complex.openai/conversations__create/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/conversations__delete/input.json +57 -0
- package/__fixtures__/-2.complex.openai/conversations__delete/output.go +32 -0
- package/__fixtures__/-2.complex.openai/conversations__delete/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/conversations__items__create/input.json +120 -0
- package/__fixtures__/-2.complex.openai/conversations__items__create/output.go +64 -0
- package/__fixtures__/-2.complex.openai/conversations__items__create/recorded.json +20 -0
- package/__fixtures__/-2.complex.openai/conversations__items__delete/input.json +73 -0
- package/__fixtures__/-2.complex.openai/conversations__items__delete/output.go +38 -0
- package/__fixtures__/-2.complex.openai/conversations__items__delete/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/conversations__items__list/input.json +141 -0
- package/__fixtures__/-2.complex.openai/conversations__items__list/output.go +70 -0
- package/__fixtures__/-2.complex.openai/conversations__items__list/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/conversations__items__retrieve/input.json +141 -0
- package/__fixtures__/-2.complex.openai/conversations__items__retrieve/output.go +70 -0
- package/__fixtures__/-2.complex.openai/conversations__items__retrieve/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/conversations__retrieve/input.json +60 -0
- package/__fixtures__/-2.complex.openai/conversations__retrieve/output.go +35 -0
- package/__fixtures__/-2.complex.openai/conversations__retrieve/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/conversations__update/input.json +81 -0
- package/__fixtures__/-2.complex.openai/conversations__update/output.go +61 -0
- package/__fixtures__/-2.complex.openai/conversations__update/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/embeddings__create/input.json +139 -0
- package/__fixtures__/-2.complex.openai/embeddings__create/output.go +86 -0
- package/__fixtures__/-2.complex.openai/embeddings__create/recorded.json +21 -0
- package/__fixtures__/-2.complex.openai/files__content/input.json +110 -0
- package/__fixtures__/-2.complex.openai/files__content/output.go +64 -0
- package/__fixtures__/-2.complex.openai/files__content/recorded.json +13 -0
- package/__fixtures__/-2.complex.openai/files__create/input.json +111 -0
- package/__fixtures__/-2.complex.openai/files__create/output.go +67 -0
- package/__fixtures__/-2.complex.openai/files__create/recorded.json +21 -0
- package/__fixtures__/-2.complex.openai/files__delete/input.json +57 -0
- package/__fixtures__/-2.complex.openai/files__delete/output.go +32 -0
- package/__fixtures__/-2.complex.openai/files__delete/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/files__list/input.json +110 -0
- package/__fixtures__/-2.complex.openai/files__list/output.go +64 -0
- package/__fixtures__/-2.complex.openai/files__list/recorded.json +13 -0
- package/__fixtures__/-2.complex.openai/files__retrieve/input.json +110 -0
- package/__fixtures__/-2.complex.openai/files__retrieve/output.go +64 -0
- package/__fixtures__/-2.complex.openai/files__retrieve/recorded.json +13 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__checkpoints__permissions__create/input.json +97 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__checkpoints__permissions__create/output.go +59 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__checkpoints__permissions__create/recorded.json +21 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__checkpoints__permissions__delete/input.json +78 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__checkpoints__permissions__delete/output.go +43 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__checkpoints__permissions__delete/recorded.json +17 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__checkpoints__permissions__retrieve/input.json +133 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__checkpoints__permissions__retrieve/output.go +75 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__checkpoints__permissions__retrieve/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__jobs__cancel/input.json +206 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__jobs__cancel/output.go +128 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__jobs__cancel/recorded.json +22 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__jobs__checkpoints__list/input.json +99 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__jobs__checkpoints__list/output.go +61 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__jobs__checkpoints__list/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__jobs__create/input.json +206 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__jobs__create/output.go +128 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__jobs__create/recorded.json +22 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__jobs__list/input.json +98 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__jobs__list/output.go +62 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__jobs__list/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__jobs__list-events/input.json +98 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__jobs__list-events/output.go +62 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__jobs__list-events/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__jobs__pause/input.json +206 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__jobs__pause/output.go +128 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__jobs__pause/recorded.json +22 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__jobs__resume/input.json +206 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__jobs__resume/output.go +128 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__jobs__resume/recorded.json +22 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__jobs__retrieve/input.json +98 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__jobs__retrieve/output.go +62 -0
- package/__fixtures__/-2.complex.openai/fine-tuning__jobs__retrieve/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/models__delete/input.json +57 -0
- package/__fixtures__/-2.complex.openai/models__delete/output.go +32 -0
- package/__fixtures__/-2.complex.openai/models__delete/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/models__list/input.json +42 -0
- package/__fixtures__/-2.complex.openai/models__list/output.go +30 -0
- package/__fixtures__/-2.complex.openai/models__list/recorded.json +13 -0
- package/__fixtures__/-2.complex.openai/models__retrieve/input.json +42 -0
- package/__fixtures__/-2.complex.openai/models__retrieve/output.go +30 -0
- package/__fixtures__/-2.complex.openai/models__retrieve/recorded.json +13 -0
- package/__fixtures__/-2.complex.openai/moderations__create/input.json +85 -0
- package/__fixtures__/-2.complex.openai/moderations__create/output.go +64 -0
- package/__fixtures__/-2.complex.openai/moderations__create/recorded.json +18 -0
- package/__fixtures__/-2.complex.openai/realtime__calls__accept/input.json +90 -0
- package/__fixtures__/-2.complex.openai/realtime__calls__accept/output.go +64 -0
- package/__fixtures__/-2.complex.openai/realtime__calls__accept/recorded.json +19 -0
- package/__fixtures__/-2.complex.openai/realtime__calls__hangup/input.json +90 -0
- package/__fixtures__/-2.complex.openai/realtime__calls__hangup/output.go +64 -0
- package/__fixtures__/-2.complex.openai/realtime__calls__hangup/recorded.json +19 -0
- package/__fixtures__/-2.complex.openai/realtime__calls__refer/input.json +90 -0
- package/__fixtures__/-2.complex.openai/realtime__calls__refer/output.go +64 -0
- package/__fixtures__/-2.complex.openai/realtime__calls__refer/recorded.json +19 -0
- package/__fixtures__/-2.complex.openai/realtime__calls__reject/input.json +90 -0
- package/__fixtures__/-2.complex.openai/realtime__calls__reject/output.go +64 -0
- package/__fixtures__/-2.complex.openai/realtime__calls__reject/recorded.json +19 -0
- package/__fixtures__/-2.complex.openai/realtime__client-secrets__create/input.json +88 -0
- package/__fixtures__/-2.complex.openai/realtime__client-secrets__create/output.go +68 -0
- package/__fixtures__/-2.complex.openai/realtime__client-secrets__create/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/responses__cancel/input.json +498 -0
- package/__fixtures__/-2.complex.openai/responses__cancel/output.go +342 -0
- package/__fixtures__/-2.complex.openai/responses__cancel/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/responses__compact/input.json +498 -0
- package/__fixtures__/-2.complex.openai/responses__compact/output.go +342 -0
- package/__fixtures__/-2.complex.openai/responses__compact/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/responses__create/input.json +498 -0
- package/__fixtures__/-2.complex.openai/responses__create/output.go +342 -0
- package/__fixtures__/-2.complex.openai/responses__create/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/responses__delete/input.json +57 -0
- package/__fixtures__/-2.complex.openai/responses__delete/output.go +32 -0
- package/__fixtures__/-2.complex.openai/responses__delete/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/responses__input-items__list/input.json +141 -0
- package/__fixtures__/-2.complex.openai/responses__input-items__list/output.go +70 -0
- package/__fixtures__/-2.complex.openai/responses__input-items__list/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/responses__input-tokens__count/input.json +226 -0
- package/__fixtures__/-2.complex.openai/responses__input-tokens__count/output.go +161 -0
- package/__fixtures__/-2.complex.openai/responses__input-tokens__count/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/responses__retrieve/input.json +125 -0
- package/__fixtures__/-2.complex.openai/responses__retrieve/output.go +68 -0
- package/__fixtures__/-2.complex.openai/responses__retrieve/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/skills__content__retrieve/input.json +62 -0
- package/__fixtures__/-2.complex.openai/skills__content__retrieve/output.go +37 -0
- package/__fixtures__/-2.complex.openai/skills__content__retrieve/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/skills__create/input.json +68 -0
- package/__fixtures__/-2.complex.openai/skills__create/output.go +51 -0
- package/__fixtures__/-2.complex.openai/skills__create/recorded.json +18 -0
- package/__fixtures__/-2.complex.openai/skills__delete/input.json +57 -0
- package/__fixtures__/-2.complex.openai/skills__delete/output.go +32 -0
- package/__fixtures__/-2.complex.openai/skills__delete/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/skills__list/input.json +95 -0
- package/__fixtures__/-2.complex.openai/skills__list/output.go +57 -0
- package/__fixtures__/-2.complex.openai/skills__list/recorded.json +13 -0
- package/__fixtures__/-2.complex.openai/skills__retrieve/input.json +95 -0
- package/__fixtures__/-2.complex.openai/skills__retrieve/output.go +57 -0
- package/__fixtures__/-2.complex.openai/skills__retrieve/recorded.json +13 -0
- package/__fixtures__/-2.complex.openai/skills__update/input.json +68 -0
- package/__fixtures__/-2.complex.openai/skills__update/output.go +51 -0
- package/__fixtures__/-2.complex.openai/skills__update/recorded.json +18 -0
- package/__fixtures__/-2.complex.openai/skills__versions__content__retrieve/input.json +78 -0
- package/__fixtures__/-2.complex.openai/skills__versions__content__retrieve/output.go +43 -0
- package/__fixtures__/-2.complex.openai/skills__versions__content__retrieve/recorded.json +17 -0
- package/__fixtures__/-2.complex.openai/skills__versions__create/input.json +99 -0
- package/__fixtures__/-2.complex.openai/skills__versions__create/output.go +65 -0
- package/__fixtures__/-2.complex.openai/skills__versions__create/recorded.json +20 -0
- package/__fixtures__/-2.complex.openai/skills__versions__delete/input.json +73 -0
- package/__fixtures__/-2.complex.openai/skills__versions__delete/output.go +38 -0
- package/__fixtures__/-2.complex.openai/skills__versions__delete/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/skills__versions__list/input.json +113 -0
- package/__fixtures__/-2.complex.openai/skills__versions__list/output.go +63 -0
- package/__fixtures__/-2.complex.openai/skills__versions__list/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/skills__versions__retrieve/input.json +113 -0
- package/__fixtures__/-2.complex.openai/skills__versions__retrieve/output.go +63 -0
- package/__fixtures__/-2.complex.openai/skills__versions__retrieve/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/uploads__cancel/input.json +145 -0
- package/__fixtures__/-2.complex.openai/uploads__cancel/output.go +83 -0
- package/__fixtures__/-2.complex.openai/uploads__cancel/recorded.json +27 -0
- package/__fixtures__/-2.complex.openai/uploads__complete/input.json +145 -0
- package/__fixtures__/-2.complex.openai/uploads__complete/output.go +83 -0
- package/__fixtures__/-2.complex.openai/uploads__complete/recorded.json +27 -0
- package/__fixtures__/-2.complex.openai/uploads__create/input.json +145 -0
- package/__fixtures__/-2.complex.openai/uploads__create/output.go +83 -0
- package/__fixtures__/-2.complex.openai/uploads__create/recorded.json +27 -0
- package/__fixtures__/-2.complex.openai/uploads__parts__create/input.json +89 -0
- package/__fixtures__/-2.complex.openai/uploads__parts__create/output.go +54 -0
- package/__fixtures__/-2.complex.openai/uploads__parts__create/recorded.json +20 -0
- package/__fixtures__/-2.complex.openai/vector-stores__create/input.json +149 -0
- package/__fixtures__/-2.complex.openai/vector-stores__create/output.go +95 -0
- package/__fixtures__/-2.complex.openai/vector-stores__create/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/vector-stores__delete/input.json +57 -0
- package/__fixtures__/-2.complex.openai/vector-stores__delete/output.go +32 -0
- package/__fixtures__/-2.complex.openai/vector-stores__delete/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/vector-stores__file-batches__cancel/input.json +140 -0
- package/__fixtures__/-2.complex.openai/vector-stores__file-batches__cancel/output.go +83 -0
- package/__fixtures__/-2.complex.openai/vector-stores__file-batches__cancel/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/vector-stores__file-batches__create/input.json +140 -0
- package/__fixtures__/-2.complex.openai/vector-stores__file-batches__create/output.go +83 -0
- package/__fixtures__/-2.complex.openai/vector-stores__file-batches__create/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/vector-stores__file-batches__list-files/input.json +76 -0
- package/__fixtures__/-2.complex.openai/vector-stores__file-batches__list-files/output.go +41 -0
- package/__fixtures__/-2.complex.openai/vector-stores__file-batches__list-files/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/vector-stores__file-batches__retrieve/input.json +76 -0
- package/__fixtures__/-2.complex.openai/vector-stores__file-batches__retrieve/output.go +41 -0
- package/__fixtures__/-2.complex.openai/vector-stores__file-batches__retrieve/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/vector-stores__files__content/input.json +149 -0
- package/__fixtures__/-2.complex.openai/vector-stores__files__content/output.go +77 -0
- package/__fixtures__/-2.complex.openai/vector-stores__files__content/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/vector-stores__files__create/input.json +120 -0
- package/__fixtures__/-2.complex.openai/vector-stores__files__create/output.go +77 -0
- package/__fixtures__/-2.complex.openai/vector-stores__files__create/recorded.json +20 -0
- package/__fixtures__/-2.complex.openai/vector-stores__files__delete/input.json +73 -0
- package/__fixtures__/-2.complex.openai/vector-stores__files__delete/output.go +38 -0
- package/__fixtures__/-2.complex.openai/vector-stores__files__delete/recorded.json +16 -0
- package/__fixtures__/-2.complex.openai/vector-stores__files__list/input.json +149 -0
- package/__fixtures__/-2.complex.openai/vector-stores__files__list/output.go +77 -0
- package/__fixtures__/-2.complex.openai/vector-stores__files__list/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/vector-stores__files__retrieve/input.json +149 -0
- package/__fixtures__/-2.complex.openai/vector-stores__files__retrieve/output.go +77 -0
- package/__fixtures__/-2.complex.openai/vector-stores__files__retrieve/recorded.json +15 -0
- package/__fixtures__/-2.complex.openai/vector-stores__files__update/input.json +120 -0
- package/__fixtures__/-2.complex.openai/vector-stores__files__update/output.go +77 -0
- package/__fixtures__/-2.complex.openai/vector-stores__files__update/recorded.json +20 -0
- package/__fixtures__/-2.complex.openai/vector-stores__list/input.json +110 -0
- package/__fixtures__/-2.complex.openai/vector-stores__list/output.go +64 -0
- package/__fixtures__/-2.complex.openai/vector-stores__list/recorded.json +13 -0
- package/__fixtures__/-2.complex.openai/vector-stores__retrieve/input.json +110 -0
- package/__fixtures__/-2.complex.openai/vector-stores__retrieve/output.go +64 -0
- package/__fixtures__/-2.complex.openai/vector-stores__retrieve/recorded.json +13 -0
- package/__fixtures__/-2.complex.openai/vector-stores__search/input.json +149 -0
- package/__fixtures__/-2.complex.openai/vector-stores__search/output.go +95 -0
- package/__fixtures__/-2.complex.openai/vector-stores__search/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/vector-stores__update/input.json +149 -0
- package/__fixtures__/-2.complex.openai/vector-stores__update/output.go +95 -0
- package/__fixtures__/-2.complex.openai/vector-stores__update/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/videos__create/input.json +144 -0
- package/__fixtures__/-2.complex.openai/videos__create/output.go +85 -0
- package/__fixtures__/-2.complex.openai/videos__create/recorded.json +18 -0
- package/__fixtures__/-2.complex.openai/videos__create-character/input.json +144 -0
- package/__fixtures__/-2.complex.openai/videos__create-character/output.go +85 -0
- package/__fixtures__/-2.complex.openai/videos__create-character/recorded.json +18 -0
- package/__fixtures__/-2.complex.openai/videos__delete/input.json +57 -0
- package/__fixtures__/-2.complex.openai/videos__delete/output.go +32 -0
- package/__fixtures__/-2.complex.openai/videos__delete/recorded.json +14 -0
- package/__fixtures__/-2.complex.openai/videos__download-content/input.json +95 -0
- package/__fixtures__/-2.complex.openai/videos__download-content/output.go +57 -0
- package/__fixtures__/-2.complex.openai/videos__download-content/recorded.json +13 -0
- package/__fixtures__/-2.complex.openai/videos__edit/input.json +144 -0
- package/__fixtures__/-2.complex.openai/videos__edit/output.go +85 -0
- package/__fixtures__/-2.complex.openai/videos__edit/recorded.json +18 -0
- package/__fixtures__/-2.complex.openai/videos__extend/input.json +144 -0
- package/__fixtures__/-2.complex.openai/videos__extend/output.go +85 -0
- package/__fixtures__/-2.complex.openai/videos__extend/recorded.json +18 -0
- package/__fixtures__/-2.complex.openai/videos__get-character/input.json +95 -0
- package/__fixtures__/-2.complex.openai/videos__get-character/output.go +57 -0
- package/__fixtures__/-2.complex.openai/videos__get-character/recorded.json +13 -0
- package/__fixtures__/-2.complex.openai/videos__list/input.json +95 -0
- package/__fixtures__/-2.complex.openai/videos__list/output.go +57 -0
- package/__fixtures__/-2.complex.openai/videos__list/recorded.json +13 -0
- package/__fixtures__/-2.complex.openai/videos__remix/input.json +144 -0
- package/__fixtures__/-2.complex.openai/videos__remix/output.go +85 -0
- package/__fixtures__/-2.complex.openai/videos__remix/recorded.json +18 -0
- package/__fixtures__/-2.complex.openai/videos__retrieve/input.json +95 -0
- package/__fixtures__/-2.complex.openai/videos__retrieve/output.go +57 -0
- package/__fixtures__/-2.complex.openai/videos__retrieve/recorded.json +13 -0
- package/__fixtures__/1.basic/input.json +74 -0
- package/__fixtures__/1.basic/output/cmd/sample-api/main.go +24 -0
- package/__fixtures__/1.basic/output/go.mod +3 -0
- package/__fixtures__/1.basic/output/internal/runtime/config.go +23 -0
- package/__fixtures__/1.basic/output/internal/runtime/runtime.go +64 -0
- package/__fixtures__/1.basic/output/pkg/cmd/models.go +49 -0
- package/__fixtures__/2.crud/input.json +281 -0
- package/__fixtures__/2.crud/output/cmd/widgets-api/main.go +23 -0
- package/__fixtures__/2.crud/output/go.mod +3 -0
- package/__fixtures__/2.crud/output/internal/runtime/config.go +23 -0
- package/__fixtures__/2.crud/output/internal/runtime/runtime.go +64 -0
- package/__fixtures__/2.crud/output/pkg/cmd/widgets.go +178 -0
- package/__fixtures__/3.nested/input.json +196 -0
- package/__fixtures__/3.nested/output/cmd/stores-api/main.go +23 -0
- package/__fixtures__/3.nested/output/go.mod +3 -0
- package/__fixtures__/3.nested/output/internal/runtime/config.go +19 -0
- package/__fixtures__/3.nested/output/internal/runtime/runtime.go +64 -0
- package/__fixtures__/3.nested/output/pkg/cmd/stores.go +120 -0
- package/__fixtures__/4.body-flatten/input.json +153 -0
- package/__fixtures__/4.body-flatten/output/cmd/chat-api/main.go +23 -0
- package/__fixtures__/4.body-flatten/output/go.mod +3 -0
- package/__fixtures__/4.body-flatten/output/internal/runtime/config.go +23 -0
- package/__fixtures__/4.body-flatten/output/internal/runtime/runtime.go +64 -0
- package/__fixtures__/4.body-flatten/output/pkg/cmd/chat.go +90 -0
- package/__tests__/docs.test.ts +109 -0
- package/__tests__/e2e/harness.ts +304 -0
- package/__tests__/e2e/openai.test.ts +11 -0
- package/__tests__/opencli2go.test.ts +27 -0
- package/__tests__/utils.ts +80 -0
- package/biome.json +25 -0
- package/dist/index.cjs +630 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +26 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +592 -0
- package/dist/index.js.map +1 -0
- package/index.ts +1 -0
- package/package.json +27 -0
- package/src/command.ts +58 -0
- package/src/flags.ts +26 -0
- package/src/golit.ts +81 -0
- package/src/handler.ts +151 -0
- package/src/index.ts +3 -0
- package/src/main.ts +30 -0
- package/src/model.ts +147 -0
- package/src/naming.ts +44 -0
- package/src/project.ts +36 -0
- package/src/runtime.ts +134 -0
- package/src/types.ts +13 -0
- package/src/write.ts +10 -0
- package/tsconfig.json +18 -0
- package/tsup.config.ts +19 -0
- package/vitest.config.ts +8 -0
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xyd-js/opencli2go",
|
|
3
|
+
"version": "0.1.0-build.0",
|
|
4
|
+
"description": "Generate a buildable Go CLI (urfave/cli v3) from an OpenCLI document with the x-openapi request binding",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@xyd-js/opencli": "0.1.0-build.0"
|
|
9
|
+
},
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@types/node": "^20.9.0",
|
|
12
|
+
"rimraf": "^3.0.2",
|
|
13
|
+
"tsup": "^8.3.0",
|
|
14
|
+
"typescript": "^5.6.2",
|
|
15
|
+
"vitest": "^2.1.1",
|
|
16
|
+
"@xyd-js/openapi": "0.0.0-canary-4287eee-20260630010340",
|
|
17
|
+
"@xyd-js/openapi2opencli": "0.0.0-canary-4287eee-20260630010340"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"clean": "rimraf dist",
|
|
21
|
+
"prebuild": "pnpm clean",
|
|
22
|
+
"build": "tsup",
|
|
23
|
+
"test": "vitest",
|
|
24
|
+
"ci:test": "vitest run",
|
|
25
|
+
"format": "bunx biome check --write src"
|
|
26
|
+
}
|
|
27
|
+
}
|
package/src/command.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Command } from '@xyd-js/opencli';
|
|
2
|
+
|
|
3
|
+
import { Imports, goBool, goFile, goSlice, goStr, goStruct, lit, type GoVal } from './golit';
|
|
4
|
+
import { renderFlags } from './flags';
|
|
5
|
+
import { renderHandler } from './handler';
|
|
6
|
+
import { buildLeafModel } from './model';
|
|
7
|
+
import { pascalCase, splitWords } from './naming';
|
|
8
|
+
|
|
9
|
+
const CLI = 'github.com/urfave/cli/v3';
|
|
10
|
+
|
|
11
|
+
function renderCommand(
|
|
12
|
+
command: Command,
|
|
13
|
+
pathNames: string[],
|
|
14
|
+
module: string,
|
|
15
|
+
imports: Imports,
|
|
16
|
+
handlers: string[],
|
|
17
|
+
): GoVal {
|
|
18
|
+
imports.add(CLI);
|
|
19
|
+
const fields: [string, GoVal][] = [['Name', goStr(command.name)]];
|
|
20
|
+
if (command.aliases?.length) fields.push(['Aliases', goSlice('string', command.aliases.map(goStr))]);
|
|
21
|
+
if (command.description) fields.push(['Usage', goStr(command.description)]);
|
|
22
|
+
if (command.hidden) fields.push(['Hidden', goBool(true)]);
|
|
23
|
+
|
|
24
|
+
if (command.commands?.length) {
|
|
25
|
+
const subs = command.commands.map((sub) =>
|
|
26
|
+
renderCommand(sub, [...pathNames, sub.name], module, imports, handlers),
|
|
27
|
+
);
|
|
28
|
+
fields.push(['Commands', goSlice('*cli.Command', subs)]);
|
|
29
|
+
} else if (command['x-openapi']) {
|
|
30
|
+
const flags = renderFlags(buildLeafModel(command).flags);
|
|
31
|
+
if (flags.length) fields.push(['Flags', goSlice('cli.Flag', flags)]);
|
|
32
|
+
const handler = renderHandler(pathNames, command, module, imports);
|
|
33
|
+
fields.push(['Action', lit(handler.name)]);
|
|
34
|
+
handlers.push(handler.code);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return goStruct('cli.Command', fields, true);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface ResourceFile {
|
|
41
|
+
path: string;
|
|
42
|
+
content: string;
|
|
43
|
+
constructor: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Render one `pkg/cmd/<resource>.go` file for a top-level command + its subtree. */
|
|
47
|
+
export function renderResourceFile(topCommand: Command, module: string): ResourceFile {
|
|
48
|
+
const imports = new Imports();
|
|
49
|
+
const handlers: string[] = [];
|
|
50
|
+
const struct = renderCommand(topCommand, [topCommand.name], module, imports, handlers);
|
|
51
|
+
|
|
52
|
+
const ctorName = `New${pascalCase(topCommand.name)}Command`;
|
|
53
|
+
const ctor = `func ${ctorName}() *cli.Command {\n\treturn ${struct(1)}\n}`;
|
|
54
|
+
const content = goFile('cmd', imports, [ctor, ...handlers]);
|
|
55
|
+
|
|
56
|
+
const fileBase = splitWords(topCommand.name).join('') || 'command';
|
|
57
|
+
return { path: `pkg/cmd/${fileBase}.go`, content, constructor: ctorName };
|
|
58
|
+
}
|
package/src/flags.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { goBool, goSlice, goStr, goStruct, type GoVal } from './golit';
|
|
2
|
+
import type { FlagModel, GoType } from './model';
|
|
3
|
+
|
|
4
|
+
const FLAG_TYPE: Record<GoType, string> = {
|
|
5
|
+
bool: 'BoolFlag',
|
|
6
|
+
int: 'IntFlag',
|
|
7
|
+
float: 'FloatFlag',
|
|
8
|
+
slice: 'StringSliceFlag',
|
|
9
|
+
string: 'StringFlag',
|
|
10
|
+
json: 'StringFlag',
|
|
11
|
+
file: 'StringFlag',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function renderFlag(f: FlagModel): GoVal {
|
|
15
|
+
const type = `cli.${FLAG_TYPE[f.goType]}`;
|
|
16
|
+
const fields: [string, GoVal][] = [['Name', goStr(f.flagName)]];
|
|
17
|
+
if (f.aliases.length) fields.push(['Aliases', goSlice('string', f.aliases.map(goStr))]);
|
|
18
|
+
if (f.description) fields.push(['Usage', goStr(f.description)]);
|
|
19
|
+
if (f.required) fields.push(['Required', goBool(true)]);
|
|
20
|
+
if (f.hidden) fields.push(['Hidden', goBool(true)]);
|
|
21
|
+
return goStruct(type, fields, true);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function renderFlags(flags: FlagModel[]): GoVal[] {
|
|
25
|
+
return flags.map(renderFlag);
|
|
26
|
+
}
|
package/src/golit.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// Tiny Go-source string helpers (fern's CLI-generator style): just enough to
|
|
2
|
+
// render struct/slice literals with correct indentation — not a full AST.
|
|
3
|
+
|
|
4
|
+
const TAB = '\t';
|
|
5
|
+
const pad = (n: number) => TAB.repeat(n);
|
|
6
|
+
|
|
7
|
+
/** A value renderer: its first line is emitted inline; nested lines indent to `indent`. */
|
|
8
|
+
export type GoVal = (indent: number) => string;
|
|
9
|
+
|
|
10
|
+
/** A pre-rendered scalar (identifier, number, bool, expression). */
|
|
11
|
+
export const lit = (s: string): GoVal => () => s;
|
|
12
|
+
|
|
13
|
+
/** A Go double-quoted string literal (JSON escaping is valid Go for our content). */
|
|
14
|
+
export const goStr = (s: string): GoVal => () => JSON.stringify(s);
|
|
15
|
+
|
|
16
|
+
export const goBool = (b: boolean): GoVal => () => String(b);
|
|
17
|
+
export const goInt = (n: number): GoVal => () => String(n);
|
|
18
|
+
|
|
19
|
+
/** A struct literal: `Type{ Field: value, ... }` (prefix `&` when pointer). */
|
|
20
|
+
export function goStruct(type: string, fields: [string, GoVal][], pointer = false): GoVal {
|
|
21
|
+
return (indent: number) => {
|
|
22
|
+
const head = `${pointer ? '&' : ''}${type}{`;
|
|
23
|
+
if (fields.length === 0) return `${head}}`;
|
|
24
|
+
let out = `${head}\n`;
|
|
25
|
+
for (const [k, v] of fields) {
|
|
26
|
+
out += `${pad(indent + 1)}${k}: ${v(indent + 1)},\n`;
|
|
27
|
+
}
|
|
28
|
+
out += `${pad(indent)}}`;
|
|
29
|
+
return out;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** A slice literal: `[]Elem{ a, b, ... }`. */
|
|
34
|
+
export function goSlice(elemType: string, elems: GoVal[]): GoVal {
|
|
35
|
+
return (indent: number) => {
|
|
36
|
+
if (elems.length === 0) return `[]${elemType}{}`;
|
|
37
|
+
let out = `[]${elemType}{\n`;
|
|
38
|
+
for (const e of elems) {
|
|
39
|
+
out += `${pad(indent + 1)}${e(indent + 1)},\n`;
|
|
40
|
+
}
|
|
41
|
+
out += `${pad(indent)}}`;
|
|
42
|
+
return out;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Render a top-level declaration value (indent 0). */
|
|
47
|
+
export function render(v: GoVal): string {
|
|
48
|
+
return v(0);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Tracks the import paths a file needs. Qualifiers are implied by the emitted code. */
|
|
52
|
+
export class Imports {
|
|
53
|
+
private paths = new Set<string>();
|
|
54
|
+
|
|
55
|
+
add(...importPaths: string[]): this {
|
|
56
|
+
for (const p of importPaths) this.paths.add(p);
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
get size(): number {
|
|
61
|
+
return this.paths.size;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
render(): string {
|
|
65
|
+
if (this.paths.size === 0) return '';
|
|
66
|
+
const all = [...this.paths];
|
|
67
|
+
const std = all.filter((p) => !p.split('/')[0].includes('.')).sort();
|
|
68
|
+
const ext = all.filter((p) => p.split('/')[0].includes('.')).sort();
|
|
69
|
+
const groups = [std, ext].filter((g) => g.length > 0);
|
|
70
|
+
const block = groups.map((g) => g.map((p) => `${TAB}${JSON.stringify(p)}`).join('\n')).join('\n\n');
|
|
71
|
+
return `import (\n${block}\n)`;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Assemble a complete Go file: package clause + imports + declarations. */
|
|
76
|
+
export function goFile(pkg: string, imports: Imports, decls: string[]): string {
|
|
77
|
+
const parts = [`package ${pkg}`];
|
|
78
|
+
if (imports.size > 0) parts.push(imports.render());
|
|
79
|
+
parts.push(...decls);
|
|
80
|
+
return `${parts.join('\n\n')}\n`;
|
|
81
|
+
}
|
package/src/handler.ts
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import type { Command } from '@xyd-js/opencli';
|
|
2
|
+
|
|
3
|
+
import type { Imports } from './golit';
|
|
4
|
+
import { buildLeafModel, type GoType, type LeafModel } from './model';
|
|
5
|
+
import { pascalCase } from './naming';
|
|
6
|
+
|
|
7
|
+
const CLI = 'github.com/urfave/cli/v3';
|
|
8
|
+
const q = (s: string) => JSON.stringify(s);
|
|
9
|
+
|
|
10
|
+
function readExpr(flagName: string, t: GoType): string {
|
|
11
|
+
switch (t) {
|
|
12
|
+
case 'bool':
|
|
13
|
+
return `cmd.Bool(${q(flagName)})`;
|
|
14
|
+
case 'int':
|
|
15
|
+
return `cmd.Int(${q(flagName)})`;
|
|
16
|
+
case 'float':
|
|
17
|
+
return `cmd.Float(${q(flagName)})`;
|
|
18
|
+
case 'slice':
|
|
19
|
+
return `cmd.StringSlice(${q(flagName)})`;
|
|
20
|
+
default:
|
|
21
|
+
return `cmd.String(${q(flagName)})`; // string | json | file
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function pathExpr(model: LeafModel, imports: Imports): string {
|
|
26
|
+
const segs = model.path.split(/(\{[^}]+\})/).filter((s) => s !== '');
|
|
27
|
+
const parts: string[] = [];
|
|
28
|
+
let lit = '';
|
|
29
|
+
for (const seg of segs) {
|
|
30
|
+
const m = seg.match(/^\{(.+)\}$/);
|
|
31
|
+
if (m) {
|
|
32
|
+
if (lit) {
|
|
33
|
+
parts.push(q(lit));
|
|
34
|
+
lit = '';
|
|
35
|
+
}
|
|
36
|
+
const a = model.pathArgs.find((p) => p.wireName === m[1]);
|
|
37
|
+
parts.push(`url.PathEscape(${a ? a.goVar : '""'})`);
|
|
38
|
+
imports.add('net/url');
|
|
39
|
+
} else {
|
|
40
|
+
lit += seg;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (lit) parts.push(q(lit));
|
|
44
|
+
return parts.length ? parts.join(' + ') : '""';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Render the handler func for a leaf command from its x-openapi binding. */
|
|
48
|
+
export function renderHandler(
|
|
49
|
+
pathNames: string[],
|
|
50
|
+
command: Command,
|
|
51
|
+
module: string,
|
|
52
|
+
imports: Imports,
|
|
53
|
+
): { name: string; code: string } {
|
|
54
|
+
const model = buildLeafModel(command);
|
|
55
|
+
const name = `handle${pathNames.map(pascalCase).join('')}`;
|
|
56
|
+
imports.add('context', CLI, `${module}/internal/runtime`);
|
|
57
|
+
|
|
58
|
+
const lines: string[] = [];
|
|
59
|
+
const push = (s = '') => lines.push(s);
|
|
60
|
+
|
|
61
|
+
// Path params (positional args) — only declare the ones the path actually uses.
|
|
62
|
+
const pe = pathExpr(model, imports);
|
|
63
|
+
for (const a of model.pathArgs) {
|
|
64
|
+
if (pe.includes(`url.PathEscape(${a.goVar})`)) push(`${a.goVar} := cmd.Args().Get(${a.idx})`);
|
|
65
|
+
}
|
|
66
|
+
push(`path := ${pe}`);
|
|
67
|
+
|
|
68
|
+
// Query params.
|
|
69
|
+
const queryFlags = model.flags.filter((f) => f.location === 'query');
|
|
70
|
+
if (queryFlags.length) {
|
|
71
|
+
imports.add('net/url');
|
|
72
|
+
push('query := url.Values{}');
|
|
73
|
+
for (const f of queryFlags) {
|
|
74
|
+
const read = readExpr(f.flagName, f.goType);
|
|
75
|
+
let val = read;
|
|
76
|
+
if (f.goType !== 'string') {
|
|
77
|
+
val = `fmt.Sprint(${read})`;
|
|
78
|
+
imports.add('fmt');
|
|
79
|
+
}
|
|
80
|
+
push(`if cmd.IsSet(${q(f.flagName)}) {`);
|
|
81
|
+
push(`\tquery.Set(${q(f.wireName)}, ${val})`);
|
|
82
|
+
push('}');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Header / cookie params.
|
|
87
|
+
const headerFlags = model.flags.filter((f) => f.location === 'header' || f.location === 'cookie');
|
|
88
|
+
if (headerFlags.length) {
|
|
89
|
+
imports.add('net/http');
|
|
90
|
+
push('headers := http.Header{}');
|
|
91
|
+
for (const f of headerFlags) {
|
|
92
|
+
const read = readExpr(f.flagName, f.goType);
|
|
93
|
+
let val = read;
|
|
94
|
+
if (f.goType !== 'string') {
|
|
95
|
+
val = `fmt.Sprint(${read})`;
|
|
96
|
+
imports.add('fmt');
|
|
97
|
+
}
|
|
98
|
+
push(`if cmd.IsSet(${q(f.flagName)}) {`);
|
|
99
|
+
push(`\theaders.Set(${q(f.wireName)}, ${val})`);
|
|
100
|
+
push('}');
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Body.
|
|
105
|
+
if (model.hasBody) {
|
|
106
|
+
imports.add('encoding/json');
|
|
107
|
+
if (model.bodyStyle === 'json' && model.bodyJsonOption) {
|
|
108
|
+
push('var bodyBytes []byte');
|
|
109
|
+
push(`if cmd.IsSet(${q(model.bodyJsonOption)}) {`);
|
|
110
|
+
push(`\tbodyBytes = []byte(cmd.String(${q(model.bodyJsonOption)}))`);
|
|
111
|
+
push('}');
|
|
112
|
+
} else {
|
|
113
|
+
push('body := map[string]any{}');
|
|
114
|
+
for (const f of model.flags.filter((x) => x.location === 'body')) {
|
|
115
|
+
push(`if cmd.IsSet(${q(f.flagName)}) {`);
|
|
116
|
+
if (f.goType === 'json') {
|
|
117
|
+
// Accept either JSON (objects/arrays) or a bare scalar: a string|object
|
|
118
|
+
// union field is commonly given a plain value, and an unparseable value
|
|
119
|
+
// must not abort the whole request.
|
|
120
|
+
push(`\traw := cmd.String(${q(f.flagName)})`);
|
|
121
|
+
push('\tvar v any');
|
|
122
|
+
push('\tif err := json.Unmarshal([]byte(raw), &v); err != nil {');
|
|
123
|
+
push('\t\tv = raw');
|
|
124
|
+
push('\t}');
|
|
125
|
+
push(`\tbody[${q(f.wireName)}] = v`);
|
|
126
|
+
} else {
|
|
127
|
+
push(`\tbody[${q(f.wireName)}] = ${readExpr(f.flagName, f.goType)}`);
|
|
128
|
+
}
|
|
129
|
+
push('}');
|
|
130
|
+
}
|
|
131
|
+
push('bodyBytes, err := json.Marshal(body)');
|
|
132
|
+
push('if err != nil {');
|
|
133
|
+
push('\treturn err');
|
|
134
|
+
push('}');
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Assemble the request.
|
|
139
|
+
push('req := runtime.Request{');
|
|
140
|
+
push(`\tMethod: ${q(model.method)},`);
|
|
141
|
+
push('\tPath: path,');
|
|
142
|
+
if (queryFlags.length) push('\tQuery: query,');
|
|
143
|
+
if (headerFlags.length) push('\tHeaders: headers,');
|
|
144
|
+
if (model.hasBody) push('\tBody: bodyBytes,');
|
|
145
|
+
push('}');
|
|
146
|
+
push('return runtime.Do(ctx, req)');
|
|
147
|
+
|
|
148
|
+
const body = lines.map((l) => `\t${l}`).join('\n');
|
|
149
|
+
const code = `func ${name}(ctx context.Context, cmd *cli.Command) error {\n${body}\n}`;
|
|
150
|
+
return { name, code };
|
|
151
|
+
}
|
package/src/index.ts
ADDED
package/src/main.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { OpencliSpecJson } from '@xyd-js/opencli';
|
|
2
|
+
|
|
3
|
+
import { Imports, goFile, goSlice, goStr, goStruct, lit, type GoVal } from './golit';
|
|
4
|
+
|
|
5
|
+
const CLI = 'github.com/urfave/cli/v3';
|
|
6
|
+
|
|
7
|
+
/** Render `cmd/<bin>/main.go`. */
|
|
8
|
+
export function renderMain(
|
|
9
|
+
spec: OpencliSpecJson,
|
|
10
|
+
binName: string,
|
|
11
|
+
module: string,
|
|
12
|
+
constructors: string[],
|
|
13
|
+
): string {
|
|
14
|
+
const imports = new Imports().add('context', 'log', 'os', CLI, `${module}/pkg/cmd`);
|
|
15
|
+
|
|
16
|
+
const fields: [string, GoVal][] = [['Name', goStr(binName)]];
|
|
17
|
+
const usage = spec.info?.summary || spec.info?.description;
|
|
18
|
+
if (usage) fields.push(['Usage', goStr(usage)]);
|
|
19
|
+
if (spec.info?.version) fields.push(['Version', goStr(spec.info.version)]);
|
|
20
|
+
fields.push(['Commands', goSlice('*cli.Command', constructors.map((c) => lit(`cmd.${c}()`)))]);
|
|
21
|
+
|
|
22
|
+
const app = goStruct('cli.Command', fields, true);
|
|
23
|
+
const body = `\tapp := ${app(1)}
|
|
24
|
+
\tif err := app.Run(context.Background(), os.Args); err != nil {
|
|
25
|
+
\t\tlog.Fatal(err)
|
|
26
|
+
\t}`;
|
|
27
|
+
const fn = `func main() {\n${body}\n}`;
|
|
28
|
+
|
|
29
|
+
return goFile('main', imports, [fn]);
|
|
30
|
+
}
|
package/src/model.ts
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { Command, Option, XOpenApiCommand } from '@xyd-js/opencli';
|
|
2
|
+
|
|
3
|
+
import { goVar } from './naming';
|
|
4
|
+
|
|
5
|
+
export type GoType = 'string' | 'int' | 'float' | 'bool' | 'slice' | 'json' | 'file';
|
|
6
|
+
|
|
7
|
+
export interface PathArg {
|
|
8
|
+
goVar: string;
|
|
9
|
+
wireName: string;
|
|
10
|
+
idx: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface FlagModel {
|
|
14
|
+
flagName: string;
|
|
15
|
+
wireName: string;
|
|
16
|
+
location: 'query' | 'header' | 'cookie' | 'body';
|
|
17
|
+
goType: GoType;
|
|
18
|
+
required: boolean;
|
|
19
|
+
hidden: boolean;
|
|
20
|
+
aliases: string[];
|
|
21
|
+
description?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface LeafModel {
|
|
25
|
+
method: string; // uppercase HTTP method
|
|
26
|
+
path: string;
|
|
27
|
+
pathArgs: PathArg[];
|
|
28
|
+
flags: FlagModel[];
|
|
29
|
+
hasBody: boolean;
|
|
30
|
+
bodyStyle?: string; // 'flatten' | 'json' | 'multipart'
|
|
31
|
+
bodyJsonOption?: string; // flag name when the whole body is one JSON option (style=json)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function fromToken(from: string | undefined, kind: 'option' | 'argument'): string | undefined {
|
|
35
|
+
if (!from) return undefined;
|
|
36
|
+
const [k, ...rest] = from.split(':');
|
|
37
|
+
return k === kind ? rest.join(':') : undefined;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function encodingToGoType(encoding: string | undefined): GoType | undefined {
|
|
41
|
+
switch (encoding) {
|
|
42
|
+
case 'integer':
|
|
43
|
+
return 'int';
|
|
44
|
+
case 'number':
|
|
45
|
+
return 'float';
|
|
46
|
+
case 'boolean':
|
|
47
|
+
return 'bool';
|
|
48
|
+
case 'array':
|
|
49
|
+
return 'slice';
|
|
50
|
+
case 'json':
|
|
51
|
+
return 'json';
|
|
52
|
+
case 'file':
|
|
53
|
+
return 'file';
|
|
54
|
+
case 'string':
|
|
55
|
+
return 'string';
|
|
56
|
+
default:
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function optionGoType(opt: Option, encoding?: string): GoType {
|
|
62
|
+
if (!opt.arguments || opt.arguments.length === 0) return 'bool';
|
|
63
|
+
const fromEncoding = encodingToGoType(encoding);
|
|
64
|
+
if (fromEncoding) return fromEncoding;
|
|
65
|
+
const arg = opt.arguments[0];
|
|
66
|
+
if (arg.arity) return 'slice';
|
|
67
|
+
switch (arg.name) {
|
|
68
|
+
case 'integer':
|
|
69
|
+
return 'int';
|
|
70
|
+
case 'number':
|
|
71
|
+
return 'float';
|
|
72
|
+
case 'boolean':
|
|
73
|
+
return 'bool';
|
|
74
|
+
case 'json':
|
|
75
|
+
return 'json';
|
|
76
|
+
default:
|
|
77
|
+
return 'string';
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Build the normalized request model for a leaf command from its x-openapi binding. */
|
|
82
|
+
export function buildLeafModel(command: Command): LeafModel {
|
|
83
|
+
const x = command['x-openapi'] as XOpenApiCommand;
|
|
84
|
+
const params = x.params || [];
|
|
85
|
+
const body = x.body;
|
|
86
|
+
|
|
87
|
+
const pathArgs: PathArg[] = (command.arguments || []).map((arg, idx) => {
|
|
88
|
+
const param = params.find((p) => p.in === 'path' && fromToken(p.from, 'argument') === arg.name);
|
|
89
|
+
return { goVar: goVar(arg.name), wireName: param?.name ?? arg.name, idx };
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
const bodyPropByOption = new Map<string, string>(); // flagName -> encoding
|
|
93
|
+
const bodyWireByOption = new Map<string, string>(); // flagName -> wire name
|
|
94
|
+
for (const prop of body?.properties || []) {
|
|
95
|
+
const flag = fromToken(prop.from, 'option');
|
|
96
|
+
if (flag) {
|
|
97
|
+
bodyPropByOption.set(flag, prop.encoding || 'string');
|
|
98
|
+
bodyWireByOption.set(flag, prop.name);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const flags: FlagModel[] = [];
|
|
103
|
+
for (const opt of command.options || []) {
|
|
104
|
+
const paramEntry = params.find((p) => fromToken(p.from, 'option') === opt.name && p.in !== 'path');
|
|
105
|
+
let location: FlagModel['location'];
|
|
106
|
+
let wireName: string;
|
|
107
|
+
let encoding: string | undefined;
|
|
108
|
+
|
|
109
|
+
if (paramEntry) {
|
|
110
|
+
location = paramEntry.in as FlagModel['location'];
|
|
111
|
+
wireName = paramEntry.name;
|
|
112
|
+
} else if (bodyPropByOption.has(opt.name)) {
|
|
113
|
+
location = 'body';
|
|
114
|
+
wireName = bodyWireByOption.get(opt.name) ?? opt.name;
|
|
115
|
+
encoding = bodyPropByOption.get(opt.name);
|
|
116
|
+
} else {
|
|
117
|
+
location = 'query';
|
|
118
|
+
wireName = opt.name;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
flags.push({
|
|
122
|
+
flagName: opt.name,
|
|
123
|
+
wireName,
|
|
124
|
+
location,
|
|
125
|
+
goType: optionGoType(opt, encoding),
|
|
126
|
+
required: opt.required === true,
|
|
127
|
+
hidden: opt.hidden === true,
|
|
128
|
+
aliases: opt.aliases || [],
|
|
129
|
+
description: opt.description,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const bodyStyle = body?.style;
|
|
134
|
+
const bodyJsonOption =
|
|
135
|
+
bodyStyle === 'json' ? fromToken(body?.from, 'option') ?? flags.find((f) => f.location === 'body')?.flagName : undefined;
|
|
136
|
+
const hasBody = !!body && (bodyStyle === 'json' || flags.some((f) => f.location === 'body'));
|
|
137
|
+
|
|
138
|
+
return {
|
|
139
|
+
method: (x.method || 'get').toUpperCase(),
|
|
140
|
+
path: x.path,
|
|
141
|
+
pathArgs,
|
|
142
|
+
flags,
|
|
143
|
+
hasBody,
|
|
144
|
+
bodyStyle,
|
|
145
|
+
bodyJsonOption,
|
|
146
|
+
};
|
|
147
|
+
}
|
package/src/naming.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** Split an identifier (camel/snake/kebab/space) into lowercase words. */
|
|
2
|
+
export function splitWords(input: string): string[] {
|
|
3
|
+
return input
|
|
4
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
5
|
+
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')
|
|
6
|
+
.split(/[\s_\-./]+/)
|
|
7
|
+
.map((w) => w.trim().toLowerCase())
|
|
8
|
+
.filter(Boolean);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** PascalCase, e.g. "chat-completions" → "ChatCompletions". */
|
|
12
|
+
export function pascalCase(input: string): string {
|
|
13
|
+
return splitWords(input)
|
|
14
|
+
.map((w) => w.charAt(0).toUpperCase() + w.slice(1))
|
|
15
|
+
.join('');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** lowerCamelCase Go variable name, e.g. "store-id" → "storeID". */
|
|
19
|
+
export function goVar(input: string): string {
|
|
20
|
+
const pascal = pascalCase(input);
|
|
21
|
+
if (!pascal) return 'arg';
|
|
22
|
+
let name = pascal.charAt(0).toLowerCase() + pascal.slice(1);
|
|
23
|
+
// Common Go initialism cleanup for ergonomics.
|
|
24
|
+
name = name.replace(/Id\b/g, 'ID').replace(/Url\b/g, 'URL').replace(/Api\b/g, 'API');
|
|
25
|
+
// Avoid Go keywords.
|
|
26
|
+
if (GO_KEYWORDS.has(name)) name = `${name}_`;
|
|
27
|
+
return name;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Slug for a binary / module name. */
|
|
31
|
+
export function slug(input: string): string {
|
|
32
|
+
return splitWords(input).join('-').replace(/[^a-z0-9-]/g, '');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** SCREAMING_SNAKE_CASE env-var prefix. */
|
|
36
|
+
export function screamingSnakeCase(input: string): string {
|
|
37
|
+
return splitWords(input).join('_').toUpperCase().replace(/[^A-Z0-9_]/g, '');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const GO_KEYWORDS = new Set([
|
|
41
|
+
'break', 'case', 'chan', 'const', 'continue', 'default', 'defer', 'else', 'fallthrough',
|
|
42
|
+
'for', 'func', 'go', 'goto', 'if', 'import', 'interface', 'map', 'package', 'range',
|
|
43
|
+
'return', 'select', 'struct', 'switch', 'type', 'var',
|
|
44
|
+
]);
|
package/src/project.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { OpencliSpecJson } from '@xyd-js/opencli';
|
|
2
|
+
|
|
3
|
+
import { renderResourceFile } from './command';
|
|
4
|
+
import { renderMain } from './main';
|
|
5
|
+
import { slug } from './naming';
|
|
6
|
+
import { configGo, runtimeGo } from './runtime';
|
|
7
|
+
import type { Opencli2GoOptions } from './types';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Generate a buildable Go CLI project (urfave/cli v3) from an OpenCLI document.
|
|
11
|
+
* Pure: returns a virtual file map `{ relativePath: contents }`.
|
|
12
|
+
*/
|
|
13
|
+
export function opencli2go(spec: OpencliSpecJson, options: Opencli2GoOptions = {}): Record<string, string> {
|
|
14
|
+
const binName = options.binName ?? (slug(spec.info?.title || 'cli') || 'cli');
|
|
15
|
+
const module = options.modulePath ?? `example.com/${binName}`;
|
|
16
|
+
const goVersion = options.goVersion ?? '1.22';
|
|
17
|
+
const baseURL = options.baseURL ?? spec['x-openapi']?.servers?.[0] ?? '';
|
|
18
|
+
|
|
19
|
+
const files: Record<string, string> = {};
|
|
20
|
+
|
|
21
|
+
files['go.mod'] = `module ${module}\n\ngo ${goVersion}\n`;
|
|
22
|
+
|
|
23
|
+
const constructors: string[] = [];
|
|
24
|
+
for (const top of spec.commands || []) {
|
|
25
|
+
const resource = renderResourceFile(top, module);
|
|
26
|
+
files[resource.path] = resource.content;
|
|
27
|
+
constructors.push(resource.constructor);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
files[`cmd/${binName}/main.go`] = renderMain(spec, binName, module, constructors);
|
|
31
|
+
|
|
32
|
+
files['internal/runtime/runtime.go'] = runtimeGo();
|
|
33
|
+
files['internal/runtime/config.go'] = configGo(spec, binName, baseURL);
|
|
34
|
+
|
|
35
|
+
return files;
|
|
36
|
+
}
|