@voxgig/sdkgen 4.53.0 → 4.54.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/action/doctor.js +4 -4
- package/dist/action/doctor.js.map +1 -1
- package/dist/cmp/AgentGuide.js +5 -0
- package/dist/cmp/AgentGuide.js.map +1 -1
- package/dist/cmp/AgentGuideTop.js +2 -0
- package/dist/cmp/AgentGuideTop.js.map +1 -1
- package/dist/cmp/Readme.js +4 -0
- package/dist/cmp/Readme.js.map +1 -1
- package/dist/cmp/ReadmeAgentSetup.d.ts +10 -0
- package/dist/cmp/ReadmeAgentSetup.js +131 -0
- package/dist/cmp/ReadmeAgentSetup.js.map +1 -0
- package/dist/cmp/ReadmeErrors.js +41 -21
- package/dist/cmp/ReadmeErrors.js.map +1 -1
- package/dist/cmp/ReadmeShell.d.ts +2 -0
- package/dist/cmp/ReadmeShell.js +25 -0
- package/dist/cmp/ReadmeShell.js.map +1 -0
- package/dist/cmp/ReadmeStation.js +6 -4
- package/dist/cmp/ReadmeStation.js.map +1 -1
- package/dist/cmp/ReadmeTop.js +2 -0
- package/dist/cmp/ReadmeTop.js.map +1 -1
- package/dist/cmp/Skill.d.ts +3 -0
- package/dist/cmp/Skill.js +145 -0
- package/dist/cmp/Skill.js.map +1 -0
- package/dist/helpers/naming.d.ts +3 -1
- package/dist/helpers/naming.js +17 -0
- package/dist/helpers/naming.js.map +1 -1
- package/dist/helpers/opExample.js +1 -1
- package/dist/helpers/opExample.js.map +1 -1
- package/dist/helpers/optional.d.ts +1 -0
- package/dist/helpers/optional.js +1 -0
- package/dist/helpers/optional.js.map +1 -1
- package/dist/helpers/text.d.ts +2 -1
- package/dist/helpers/text.js +23 -0
- package/dist/helpers/text.js.map +1 -1
- package/dist/sdkgen.d.ts +2 -2
- package/dist/sdkgen.js +5 -3
- package/dist/sdkgen.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/model/sdkgen.aontu +2 -0
- package/package.json +1 -1
- package/project/.sdk/model/target/c.aontu +3 -0
- package/project/.sdk/model/target/clojure.aontu +3 -0
- package/project/.sdk/model/target/cpp.aontu +3 -0
- package/project/.sdk/model/target/csharp.aontu +3 -0
- package/project/.sdk/model/target/elixir.aontu +3 -0
- package/project/.sdk/model/target/go.aontu +3 -0
- package/project/.sdk/model/target/java.aontu +3 -0
- package/project/.sdk/model/target/js.aontu +3 -0
- package/project/.sdk/model/target/kotlin.aontu +3 -0
- package/project/.sdk/model/target/lua.aontu +3 -0
- package/project/.sdk/model/target/ocaml.aontu +3 -0
- package/project/.sdk/model/target/perl.aontu +3 -0
- package/project/.sdk/model/target/php.aontu +3 -0
- package/project/.sdk/model/target/py-data.aontu +3 -0
- package/project/.sdk/model/target/py.aontu +3 -0
- package/project/.sdk/model/target/rb.aontu +3 -0
- package/project/.sdk/model/target/rust.aontu +3 -0
- package/project/.sdk/model/target/scala.aontu +3 -0
- package/project/.sdk/model/target/swift.aontu +3 -0
- package/project/.sdk/model/target/ts.aontu +3 -0
- package/project/.sdk/model/target/zig.aontu +3 -0
- package/project/.sdk/src/cmp/c/ReadmeEntity_c.ts +4 -4
- package/project/.sdk/src/cmp/c/ReadmeHowto_c.ts +3 -3
- package/project/.sdk/src/cmp/c/ReadmeQuick_c.ts +4 -4
- package/project/.sdk/src/cmp/c/ReadmeTopQuick_c.ts +5 -5
- package/project/.sdk/src/cmp/c/ReadmeTopTest_c.ts +4 -4
- package/project/.sdk/src/cmp/clojure/ReadmeEntity_clojure.ts +2 -2
- package/project/.sdk/src/cmp/clojure/ReadmeHowto_clojure.ts +3 -3
- package/project/.sdk/src/cmp/clojure/ReadmeTopQuick_clojure.ts +2 -2
- package/project/.sdk/src/cmp/clojure/ReadmeTopTest_clojure.ts +3 -3
- package/project/.sdk/src/cmp/cpp/ReadmeEntity_cpp.ts +3 -3
- package/project/.sdk/src/cmp/cpp/ReadmeQuick_cpp.ts +3 -3
- package/project/.sdk/src/cmp/cpp/ReadmeTopQuick_cpp.ts +5 -4
- package/project/.sdk/src/cmp/csharp/ReadmeTopQuick_csharp.ts +2 -2
- package/project/.sdk/src/cmp/elixir/ReadmeEntity_elixir.ts +2 -2
- package/project/.sdk/src/cmp/elixir/ReadmeHowto_elixir.ts +4 -4
- package/project/.sdk/src/cmp/elixir/ReadmeQuick_elixir.ts +4 -4
- package/project/.sdk/src/cmp/elixir/ReadmeRef_elixir.ts +2 -2
- package/project/.sdk/src/cmp/elixir/ReadmeTopQuick_elixir.ts +5 -5
- package/project/.sdk/src/cmp/elixir/ReadmeTopTest_elixir.ts +4 -4
- package/project/.sdk/src/cmp/go/ReadmeEntity_go.ts +3 -3
- package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +3 -3
- package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +3 -3
- package/project/.sdk/src/cmp/go/ReadmeTopQuick_go.ts +4 -4
- package/project/.sdk/src/cmp/java/ReadmeTopQuick_java.ts +2 -2
- package/project/.sdk/src/cmp/js/Package_js.ts +1 -1
- package/project/.sdk/src/cmp/js/ReadmeEntity_js.ts +2 -2
- package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +4 -4
- package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +3 -3
- package/project/.sdk/src/cmp/js/ReadmeTopQuick_js.ts +4 -4
- package/project/.sdk/src/cmp/js/ReadmeTopTest_js.ts +4 -4
- package/project/.sdk/src/cmp/kotlin/ReadmeTopQuick_kotlin.ts +2 -2
- package/project/.sdk/src/cmp/lua/ReadmeEntity_lua.ts +2 -2
- package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +3 -3
- package/project/.sdk/src/cmp/lua/ReadmeTopQuick_lua.ts +4 -4
- package/project/.sdk/src/cmp/ocaml/ReadmeEntity_ocaml.ts +3 -3
- package/project/.sdk/src/cmp/ocaml/ReadmeHowto_ocaml.ts +3 -3
- package/project/.sdk/src/cmp/ocaml/ReadmeQuick_ocaml.ts +3 -3
- package/project/.sdk/src/cmp/ocaml/ReadmeTopQuick_ocaml.ts +3 -3
- package/project/.sdk/src/cmp/perl/ReadmeEntity_perl.ts +3 -3
- package/project/.sdk/src/cmp/perl/ReadmeQuick_perl.ts +3 -3
- package/project/.sdk/src/cmp/perl/ReadmeTopQuick_perl.ts +4 -4
- package/project/.sdk/src/cmp/perl/ReadmeTopTest_perl.ts +2 -2
- package/project/.sdk/src/cmp/php/ReadmeEntity_php.ts +2 -2
- package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +3 -3
- package/project/.sdk/src/cmp/php/ReadmeTopQuick_php.ts +4 -4
- package/project/.sdk/src/cmp/php/ReadmeTopTest_php.ts +2 -2
- package/project/.sdk/src/cmp/py/ReadmeEntity_py.ts +2 -2
- package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +3 -3
- package/project/.sdk/src/cmp/py/ReadmeTopQuick_py.ts +4 -4
- package/project/.sdk/src/cmp/py/ReadmeTopTest_py.ts +3 -2
- package/project/.sdk/src/cmp/rb/ReadmeEntity_rb.ts +3 -3
- package/project/.sdk/src/cmp/rb/ReadmeHowto_rb.ts +3 -3
- package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +3 -3
- package/project/.sdk/src/cmp/rb/ReadmeTopQuick_rb.ts +4 -4
- package/project/.sdk/src/cmp/rb/ReadmeTopTest_rb.ts +3 -2
- package/project/.sdk/src/cmp/rust/ReadmeEntity_rust.ts +3 -3
- package/project/.sdk/src/cmp/rust/ReadmeQuick_rust.ts +3 -3
- package/project/.sdk/src/cmp/rust/ReadmeTopQuick_rust.ts +4 -4
- package/project/.sdk/src/cmp/scala/ReadmeTopQuick_scala.ts +2 -2
- package/project/.sdk/src/cmp/swift/ReadmeTopQuick_swift.ts +2 -2
- package/project/.sdk/src/cmp/ts/Package_ts.ts +1 -1
- package/project/.sdk/src/cmp/ts/ReadmeEntity_ts.ts +2 -2
- package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +4 -4
- package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +3 -3
- package/project/.sdk/src/cmp/ts/ReadmeTopQuick_ts.ts +4 -4
- package/project/.sdk/src/cmp/ts/ReadmeTopTest_ts.ts +4 -4
- package/project/.sdk/src/cmp/zig/ReadmeEntity_zig.ts +3 -3
- package/project/.sdk/src/cmp/zig/ReadmeHowto_zig.ts +3 -3
- package/project/.sdk/src/cmp/zig/ReadmeQuick_zig.ts +3 -3
- package/project/.sdk/src/cmp/zig/ReadmeTopQuick_zig.ts +4 -4
- package/project/.sdk/src/cmp/zig/ReadmeTopTest_zig.ts +3 -3
- package/project/.sdk/tm/c/Makefile +1 -1
- package/project/.sdk/tm/cpp/Makefile +1 -1
- package/project/.sdk/tm/csharp/Makefile +6 -1
- package/project/.sdk/tm/go/Makefile +1 -1
- package/project/.sdk/tm/java/Makefile +1 -1
- package/project/.sdk/tm/js/Makefile +3 -3
- package/project/.sdk/tm/kotlin/Makefile +1 -1
- package/project/.sdk/tm/lua/Makefile +1 -1
- package/project/.sdk/tm/perl/Makefile +1 -1
- package/project/.sdk/tm/php/Makefile +1 -1
- package/project/.sdk/tm/py/Makefile +1 -1
- package/project/.sdk/tm/py/pkg/utility/fetcher.py +14 -2
- package/project/.sdk/tm/py/test/test_primary_utility.py +4 -0
- package/project/.sdk/tm/py-data/Makefile +1 -1
- package/project/.sdk/tm/rb/Makefile +1 -1
- package/project/.sdk/tm/rust/Makefile +1 -1
- package/project/.sdk/tm/swift/Makefile +2 -3
- package/project/.sdk/tm/ts/Makefile +3 -3
- package/project/sdkgen-package.json +1 -1
- package/src/action/doctor.ts +4 -4
- package/src/cmp/AgentGuide.ts +6 -0
- package/src/cmp/AgentGuideTop.ts +3 -0
- package/src/cmp/Readme.ts +4 -0
- package/src/cmp/ReadmeAgentSetup.ts +159 -0
- package/src/cmp/ReadmeErrors.ts +43 -22
- package/src/cmp/ReadmeShell.ts +31 -0
- package/src/cmp/ReadmeStation.ts +6 -5
- package/src/cmp/ReadmeTop.ts +2 -0
- package/src/cmp/Skill.ts +168 -0
- package/src/helpers/naming.ts +20 -0
- package/src/helpers/opExample.ts +2 -2
- package/src/helpers/optional.ts +1 -0
- package/src/helpers/text.ts +25 -0
- package/src/sdkgen.ts +3 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, entityIdField, entityOps, goModule, listMatchArg, matchExampleItems, litString, requestExampleItems, sendsId, fact } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, entityIdField, entityOps, goModule, listMatchArg, matchExampleItems, litString, requestExampleItems, sendsId, fact, entityListVar } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -80,11 +80,11 @@ const ReadmeQuick = cmp(function ReadmeQuick(props: any) {
|
|
|
80
80
|
|
|
81
81
|
if (opnames.includes('list')) {
|
|
82
82
|
body.push(` // List ${eLower} records — the value is a []any of entities, one per record.`)
|
|
83
|
-
body.push(` ${eLower}
|
|
83
|
+
body.push(` ${entityListVar(eLower, 'go')}, err := client.${eName}(nil).List(${listMatchArg('go', exampleEntity)}, nil)`)
|
|
84
84
|
body.push(` if err != nil {`)
|
|
85
85
|
body.push(` panic(err)`)
|
|
86
86
|
body.push(` }`)
|
|
87
|
-
body.push(` for _, item := range ${eLower}
|
|
87
|
+
body.push(` for _, item := range ${entityListVar(eLower, 'go')}.([]any) {`)
|
|
88
88
|
body.push(` fmt.Println(item.(sdk.Entity).Data())`)
|
|
89
89
|
body.push(` }`)
|
|
90
90
|
body.push(``)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, entityIdField, entityOps, opRequestShape, goModule, listMatchArg, matchExampleItems, requiredItems, litString, fact } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, entityIdField, entityOps, opRequestShape, goModule, listMatchArg, matchExampleItems, requiredItems, litString, fact, entityListVar, entityItemsPhrase } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -54,12 +54,12 @@ if err != nil {
|
|
|
54
54
|
let hasCall = false
|
|
55
55
|
|
|
56
56
|
if (opnames.includes('list')) {
|
|
57
|
-
Content(`// List all ${eName
|
|
58
|
-
${eVar}
|
|
57
|
+
Content(`// List all ${entityItemsPhrase(eName)} (one entity per record; err is non-nil on failure)
|
|
58
|
+
${entityListVar(eVar, 'go')}, err := client.${eName}(nil).List(${listMatchArg('go', exampleEntity)}, nil)
|
|
59
59
|
if err != nil {
|
|
60
60
|
panic(err)
|
|
61
61
|
}
|
|
62
|
-
for _, ${eVar} := range ${eVar}
|
|
62
|
+
for _, ${eVar} := range ${entityListVar(eVar, 'go')}.([]any) {
|
|
63
63
|
fmt.Println(${eVar}.(sdk.Entity).Data())
|
|
64
64
|
}
|
|
65
65
|
`)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, opRequestShape
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, opRequestShape, javaMapOf, matchExampleItems, javaMapItems, entityOps, fact, entityItemsPhrase } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -70,7 +70,7 @@ ${fact(model.main[KIT], 'auth').secret ? `options.put("secret", System.getenv("$
|
|
|
70
70
|
const idF = entityIdField(exampleEntity)
|
|
71
71
|
|
|
72
72
|
if (opnames.includes('list')) {
|
|
73
|
-
Content(`// List all ${
|
|
73
|
+
Content(`// List all ${entityItemsPhrase(nom(exampleEntity, 'Name'))} (a list of entities, one per record; raises on error)
|
|
74
74
|
List<?> ${eVar}List = (List<?>) client.${accessor}(null).list(${javaListMatch(exampleEntity)}, null);
|
|
75
75
|
for (Object ${eVar}Item : ${eVar}List) {
|
|
76
76
|
System.out.println(((SdkEntity) ${eVar}Item).data());
|
|
@@ -79,7 +79,7 @@ const Package = cmp(async function Package(props: any) {
|
|
|
79
79
|
// What actually ships. Without `files`, `npm publish` packs the test
|
|
80
80
|
// suite and the build scaffolding too. The js target runs from `src`
|
|
81
81
|
// directly (no build step), so that and the docs are the whole package.
|
|
82
|
-
files: ['src', 'README.md', 'REFERENCE.md'],
|
|
82
|
+
files: ['src', '!src/**/AGENTS.md', '!src/**/CLAUDE.md', 'README.md', 'REFERENCE.md', 'SKILL.md'],
|
|
83
83
|
scripts: {
|
|
84
84
|
...(hasLiveScenarios(model) ? {
|
|
85
85
|
'test:live': 'node ' + npmScriptEnv(fact(model.main[KIT], 'env').live, 'TRUE') +
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, canonToType, entityIdField, safeVarName, exampleVarName, jsKey, entityOps, listMatchArg, matchExampleItems, requestExampleItems, fact } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, canonToType, entityIdField, safeVarName, exampleVarName, jsKey, entityOps, listMatchArg, matchExampleItems, requestExampleItems, fact, entityListVar } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -120,7 +120,7 @@ const ${eVar} = await client.${entity.Name}().load(${loadArg})
|
|
|
120
120
|
Content(`#### Example: List
|
|
121
121
|
|
|
122
122
|
\`\`\`js
|
|
123
|
-
const ${eVar}
|
|
123
|
+
const ${entityListVar(eVar, 'js')} = await client.${entity.Name}().list(${listMatchArg('js', entity)})
|
|
124
124
|
\`\`\`
|
|
125
125
|
|
|
126
126
|
`)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, entityIdField, entityDataIdField, pickExampleEntity, exampleVarName, jsKey, requiredItems, matchExampleItems, jsProp, requestExampleItems, envLocalAt, cdTarget, fact, directRoute } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, entityIdField, entityDataIdField, pickExampleEntity, exampleVarName, jsKey, requiredItems, matchExampleItems, jsProp, requestExampleItems, envLocalAt, cdTarget, fact, directRoute, entityListVar } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -59,9 +59,9 @@ const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
|
|
|
59
59
|
// A direct()-only SDK (no ops anywhere) shows a direct() test call instead
|
|
60
60
|
// and omits the stateful section (there is no op to retain state across).
|
|
61
61
|
const testModeExample = 'list' === primaryOp
|
|
62
|
-
? `const ${eVar}
|
|
63
|
-
// ${eVar}
|
|
64
|
-
console.log(${eVar}
|
|
62
|
+
? `const ${entityListVar(eVar, 'js')} = await client.${eName}().list(${testCallArg})
|
|
63
|
+
// ${entityListVar(eVar, 'js')} is an array of ${eName} entities, one per mock record
|
|
64
|
+
console.log(${entityListVar(eVar, 'js')}.map((${eVar}) => ${eVar}.data()))`
|
|
65
65
|
: primaryOp
|
|
66
66
|
? `const ${eVar} = await client.${eName}().${primaryOp}(${testCallArg})
|
|
67
67
|
// ${eVar} is the ${eName} entity; .data() reads its mock record
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, isAuthActive, packageName, envName, entityIdField, entityOps, safeVarName, exampleVarName, jsKey, matchArg, listMatchArg, matchExampleItems, requestExampleItems, sendsId, fact } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, isAuthActive, packageName, envName, entityIdField, entityOps, safeVarName, exampleVarName, jsKey, matchArg, listMatchArg, matchExampleItems, requestExampleItems, sendsId, fact, entityListVar } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -97,8 +97,8 @@ console.log(${eVar}.data())
|
|
|
97
97
|
### List ${eName} Records
|
|
98
98
|
|
|
99
99
|
\`\`\`js
|
|
100
|
-
const ${eVar}
|
|
101
|
-
for (const ${eVar} of ${eVar}
|
|
100
|
+
const ${entityListVar(eVar, 'js')} = await client.${eName}().list(${listMatchArg('js', exampleEntity)})
|
|
101
|
+
for (const ${eVar} of ${entityListVar(eVar, 'js')}) {
|
|
102
102
|
console.log(${eVar}.data())
|
|
103
103
|
}
|
|
104
104
|
\`\`\`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, packageName, envName, entityIdField, entityOps, opRequestShape, safeVarName, exampleVarName, jsKey, listMatchArg, matchExampleItems, fact } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, packageName, envName, entityIdField, entityOps, opRequestShape, safeVarName, exampleVarName, jsKey, listMatchArg, matchExampleItems, fact, entityListVar, entityItemsPhrase } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -43,9 +43,9 @@ const client = ${ctor}
|
|
|
43
43
|
let hasCall = false
|
|
44
44
|
|
|
45
45
|
if (opnames.includes('list')) {
|
|
46
|
-
Content(`// List all ${eName
|
|
47
|
-
const ${eVar}
|
|
48
|
-
for (const ${eVar} of ${eVar}
|
|
46
|
+
Content(`// List all ${entityItemsPhrase(eName)} (an array of entities, one per record)
|
|
47
|
+
const ${entityListVar(eVar, 'js')} = await client.${eName}().list(${listMatchArg('js', exampleEntity)})
|
|
48
|
+
for (const ${eVar} of ${entityListVar(eVar, 'js')}) {
|
|
49
49
|
console.log(${eVar}.data())
|
|
50
50
|
}
|
|
51
51
|
`)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, entityIdField, pickExampleEntity, safeVarName, exampleVarName, jsKey, requiredItems, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, entityIdField, pickExampleEntity, safeVarName, exampleVarName, jsKey, requiredItems, matchExampleItems, requestExampleItems, entityListVar } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -24,9 +24,9 @@ const client = ${model.const.Name}SDK.test()
|
|
|
24
24
|
|
|
25
25
|
if (exampleEntity && primaryOp) {
|
|
26
26
|
const eName = nom(exampleEntity, 'Name')
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
(
|
|
27
|
+
const eVar = 'list' === primaryOp
|
|
28
|
+
? entityListVar(exampleVarName(eName.toLowerCase(), 'js'), 'js')
|
|
29
|
+
: exampleVarName(eName.toLowerCase(), 'js')
|
|
30
30
|
const primaryOpDef = exampleEntity.op && exampleEntity.op[primaryOp]
|
|
31
31
|
const idF = entityIdField(exampleEntity)
|
|
32
32
|
let arg = ''
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, matchExampleItems, entityOps, fact } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, matchExampleItems, entityOps, fact, entityItemsPhrase } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -67,7 +67,7 @@ ${shown ? `import ${kotlinPackage(model)}.core.SdkEntity\n` : ''}
|
|
|
67
67
|
const idF = entityIdField(exampleEntity)
|
|
68
68
|
|
|
69
69
|
if (opnames.includes('list')) {
|
|
70
|
-
Content(`// List all ${
|
|
70
|
+
Content(`// List all ${entityItemsPhrase(nom(exampleEntity, 'Name'))} (a list of entities, one per record; raises on error)
|
|
71
71
|
val ${eVar}List = client.${accessor}(null).list(${kotlinListMatch(exampleEntity)}, null) as List<*>
|
|
72
72
|
for (${eVar}Item in ${eVar}List) {
|
|
73
73
|
println((${eVar}Item as SdkEntity).data())
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, canonToType, canonKey, canonScalarKey, entityIdField, safeVarName, exampleVarName, luaKey, entityOps, listMatchArg, matchExampleItems, litString, requestExampleItems, fact } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, canonToType, canonKey, canonScalarKey, entityIdField, safeVarName, exampleVarName, luaKey, entityOps, listMatchArg, matchExampleItems, litString, requestExampleItems, fact, entityListVar } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -131,7 +131,7 @@ local ${eVar}, err = client:${entity.Name}():load(${loadArg})
|
|
|
131
131
|
Content(`#### Example: List
|
|
132
132
|
|
|
133
133
|
\`\`\`lua
|
|
134
|
-
local ${eVar}
|
|
134
|
+
local ${entityListVar(eVar, 'lua')}, err = client:${entity.Name}():list(${listMatchArg('lua', entity)})
|
|
135
135
|
\`\`\`
|
|
136
136
|
|
|
137
137
|
`)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps, safeVarName, exampleVarName, luaKey, listMatchArg, matchExampleItems, requiredItems, litString, requestExampleItems, sendsId, fact, seriesList } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps, safeVarName, exampleVarName, luaKey, listMatchArg, matchExampleItems, requiredItems, litString, requestExampleItems, sendsId, fact, seriesList, entityListVar } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -105,10 +105,10 @@ array of entities, one per record — iterate it directly (there is no
|
|
|
105
105
|
wrapper), and read each record with \`data_get()\`.
|
|
106
106
|
|
|
107
107
|
\`\`\`lua
|
|
108
|
-
local ${eVar}
|
|
108
|
+
local ${entityListVar(eVar, 'lua')}, err = client:${eName}():list(${listMatchArg('lua', exampleEntity)})
|
|
109
109
|
if err then error(err) end
|
|
110
110
|
|
|
111
|
-
for _, item in ipairs(${eVar}
|
|
111
|
+
for _, item in ipairs(${entityListVar(eVar, 'lua')}) do
|
|
112
112
|
${printLine}
|
|
113
113
|
end
|
|
114
114
|
\`\`\`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, safeVarName, exampleVarName, luaKey, listMatchArg, matchExampleItems, litString, entityOps, fact } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, safeVarName, exampleVarName, luaKey, listMatchArg, matchExampleItems, litString, entityOps, fact, entityListVar, entityItemsPhrase } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -62,10 +62,10 @@ local client = ${ctor}
|
|
|
62
62
|
let hasCall = false
|
|
63
63
|
|
|
64
64
|
if (opnames.includes('list')) {
|
|
65
|
-
Content(`-- List all ${eName
|
|
66
|
-
local ${eVar}
|
|
65
|
+
Content(`-- List all ${entityItemsPhrase(eName)} (an array of entities, one per record; err on failure)
|
|
66
|
+
local ${entityListVar(eVar, 'lua')}, err = client:${eName}():list(${listMatchArg('lua', exampleEntity)})
|
|
67
67
|
if err then error(err) end
|
|
68
|
-
for _, ${eVar} in ipairs(${eVar}
|
|
68
|
+
for _, ${eVar} in ipairs(${entityListVar(eVar, 'lua')}) do
|
|
69
69
|
print(json.encode(${eVar}:data_get()))
|
|
70
70
|
end
|
|
71
71
|
`)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, canonKey, canonScalarKey, entityIdField, entityOps, matchExampleItems, requestExampleItems, fact } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, canonKey, canonScalarKey, entityIdField, entityOps, matchExampleItems, requestExampleItems, fact, entityListVar } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -152,8 +152,8 @@ let ${fn}_data = ${fn}.e_data_get ()
|
|
|
152
152
|
|
|
153
153
|
\`\`\`ocaml
|
|
154
154
|
(* One ENTITY per record. *)
|
|
155
|
-
let ${fn}
|
|
156
|
-
let ${fn}
|
|
155
|
+
let ${entityListVar(fn, 'ocaml')} = (Sdk_client.${fn} client Noval).e_list ${ocamlListMatch(entity)} Noval
|
|
156
|
+
let ${fn}_records = List.map (fun e -> e.e_data_get ()) ${entityListVar(fn, 'ocaml')}
|
|
157
157
|
\`\`\`
|
|
158
158
|
|
|
159
159
|
`)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, canonScalarKey, entityIdField, pickExampleEntity, matchExampleItems, requestExampleItems, cdTarget, directRoute } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, canonScalarKey, entityIdField, pickExampleEntity, matchExampleItems, requestExampleItems, cdTarget, directRoute, entityListVar } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -56,8 +56,8 @@ const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
|
|
|
56
56
|
const testModeExample = primaryOp
|
|
57
57
|
? ('list' === primaryOp
|
|
58
58
|
? `(* Entity ops resolve to the ENTITY (list: one per record) and raise on error. *)
|
|
59
|
-
let ${fn}
|
|
60
|
-
List.iter (fun e -> print_endline (stringify (e.e_data_get ()))) ${fn}
|
|
59
|
+
let ${entityListVar(fn, 'ocaml')} = (Sdk_client.${fn} client Noval).${field} ${testArg} Noval in
|
|
60
|
+
List.iter (fun e -> print_endline (stringify (e.e_data_get ()))) ${entityListVar(fn, 'ocaml')} (* the mock records *)`
|
|
61
61
|
: `(* Entity ops resolve to the ENTITY and raise on error. *)
|
|
62
62
|
let ${fn} = (Sdk_client.${fn} client Noval).${field} ${testArg} Noval in
|
|
63
63
|
print_endline (stringify (${fn}.e_data_get ())) (* the mock response record *)`)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps, matchExampleItems, requiredItems, requestExampleItems, sendsId, fact, seriesList } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps, matchExampleItems, requiredItems, requestExampleItems, sendsId, fact, seriesList, entityListVar } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -83,8 +83,8 @@ record with \`e_data_get\`.
|
|
|
83
83
|
|
|
84
84
|
\`\`\`ocaml
|
|
85
85
|
(try
|
|
86
|
-
let ${fn}
|
|
87
|
-
List.iter (fun e -> print_endline (stringify (e.e_data_get ()))) ${fn}
|
|
86
|
+
let ${entityListVar(fn, 'ocaml')} = (Sdk_client.${fn} client Noval).e_list ${ocamlListMatch(exampleEntity)} Noval in
|
|
87
|
+
List.iter (fun e -> print_endline (stringify (e.e_data_get ()))) ${entityListVar(fn, 'ocaml')}
|
|
88
88
|
with Sdk_error.E err -> Printf.eprintf "list failed: %s\\n" (Sdk_error.message err))
|
|
89
89
|
\`\`\`
|
|
90
90
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, matchExampleItems, entityOps, fact } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, matchExampleItems, entityOps, fact, entityListVar } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -59,8 +59,8 @@ let () =
|
|
|
59
59
|
|
|
60
60
|
if (opnames.includes('list')) {
|
|
61
61
|
Content(` (* List all ${fn} records (one ENTITY per record; raises on error) *)
|
|
62
|
-
let ${fn}
|
|
63
|
-
List.iter (fun e -> print_endline (stringify (e.e_data_get ()))) ${fn}
|
|
62
|
+
let ${entityListVar(fn, 'ocaml')} = (Sdk_client.${fn} client Noval).e_list ${ocamlListMatch(exampleEntity)} Noval in
|
|
63
|
+
List.iter (fun e -> print_endline (stringify (e.e_data_get ()))) ${entityListVar(fn, 'ocaml')};
|
|
64
64
|
`)
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, canonKey, canonScalarKey, entityIdField, entityOps, matchExampleItems, requestExampleItems, fact } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, canonKey, canonScalarKey, entityIdField, entityOps, matchExampleItems, requestExampleItems, fact, entityListVar } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -146,8 +146,8 @@ my $${eVar} = $client->${entity.Name}->load(${loadArg});
|
|
|
146
146
|
|
|
147
147
|
\`\`\`perl
|
|
148
148
|
# an arrayref of entities, one per record; data_get reads each record
|
|
149
|
-
my $${eVar}
|
|
150
|
-
print $_->data_get->{id}, "\\n" for @$${eVar}
|
|
149
|
+
my $${entityListVar(eVar, 'perl')} = $client->${entity.Name}->list${perlListArgs(entity)};
|
|
150
|
+
print $_->data_get->{id}, "\\n" for @$${entityListVar(eVar, 'perl')};
|
|
151
151
|
\`\`\`
|
|
152
152
|
|
|
153
153
|
`)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps, matchExampleItems, requiredItems, requestExampleItems, sendsId, fact, seriesList } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps, matchExampleItems, requiredItems, requestExampleItems, sendsId, fact, seriesList, entityListVar } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -83,12 +83,12 @@ my $client = ${ctor};
|
|
|
83
83
|
error; \`data_get\` reads each record.
|
|
84
84
|
|
|
85
85
|
\`\`\`perl
|
|
86
|
-
my $${eVar}
|
|
86
|
+
my $${entityListVar(eVar, 'perl')} = eval { $client->${eName}->list${perlListArgs(exampleEntity)} };
|
|
87
87
|
if (my $err = $@) {
|
|
88
88
|
print "list failed: $err\\n";
|
|
89
89
|
}
|
|
90
90
|
else {
|
|
91
|
-
for my $${eVar} (@$${eVar}
|
|
91
|
+
for my $${eVar} (@$${entityListVar(eVar, 'perl')}) {
|
|
92
92
|
print $${eVar}->data_get->{id}, "\\n";
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, matchExampleItems, entityOps, fact } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, matchExampleItems, entityOps, fact, entityListVar, entityItemsPhrase } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -59,9 +59,9 @@ my $client = ${ctor};
|
|
|
59
59
|
const idF = entityIdField(exampleEntity)
|
|
60
60
|
|
|
61
61
|
if (opnames.includes('list')) {
|
|
62
|
-
Content(`# List all ${eName
|
|
63
|
-
my $${eVar}
|
|
64
|
-
for my $${eVar} (@$${eVar}
|
|
62
|
+
Content(`# List all ${entityItemsPhrase(eName)} (an arrayref of entities, one per record; dies on error)
|
|
63
|
+
my $${entityListVar(eVar, 'perl')} = $client->${eName}->list${perlListArgs(exampleEntity)};
|
|
64
|
+
for my $${eVar} (@$${entityListVar(eVar, 'perl')}) {
|
|
65
65
|
print $${eVar}->data_get->{id}, "\\n";
|
|
66
66
|
}
|
|
67
67
|
`)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, requiredItems, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, requiredItems, matchExampleItems, requestExampleItems, entityListVar } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -62,7 +62,7 @@ my $client = ${model.const.Name}SDK->test(undef, undef);
|
|
|
62
62
|
arg = `{ ${chosen.map((it: any) => `${perlStringLiteral(it.name)} => ${perlLit(it.type)}`).join(', ')} }`
|
|
63
63
|
}
|
|
64
64
|
// A list() result is an arrayref — name the variable accordingly.
|
|
65
|
-
const eVar =
|
|
65
|
+
const eVar = 'list' === primaryOp ? entityListVar(eName.toLowerCase(), 'perl') : eName.toLowerCase()
|
|
66
66
|
Content(`my $${eVar} = $client->${eName}->${primaryOp}(${arg});
|
|
67
67
|
`)
|
|
68
68
|
if ('list' === primaryOp) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, canonToType, canonKey, canonScalarKey, entityIdField, phpEntityAccessor, entityOps, listMatchArg, matchExampleItems, litString, requestExampleItems, fact } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, canonToType, canonKey, canonScalarKey, entityIdField, phpEntityAccessor, entityOps, listMatchArg, matchExampleItems, litString, requestExampleItems, fact, entityListVar } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -132,7 +132,7 @@ $${entity.name} = $client->${phpEntityAccessor(entity.Name)}()->load(${loadArg})
|
|
|
132
132
|
|
|
133
133
|
\`\`\`php
|
|
134
134
|
// list() returns an array of ${entity.Name} entities, one per record (throws on error).
|
|
135
|
-
$${entity.name}
|
|
135
|
+
$${entityListVar(entity.name, 'php')} = $client->${phpEntityAccessor(entity.Name)}()->list(${listMatchArg('php', entity)});
|
|
136
136
|
\`\`\`
|
|
137
137
|
|
|
138
138
|
`)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps, phpEntityAccessor, listMatchArg, matchExampleItems, requiredItems, litString, requestExampleItems, sendsId, fact, seriesList } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps, phpEntityAccessor, listMatchArg, matchExampleItems, requiredItems, litString, requestExampleItems, sendsId, fact, seriesList, entityListVar } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -90,8 +90,8 @@ $client = ${ctor};
|
|
|
90
90
|
\`\`\`php
|
|
91
91
|
try {
|
|
92
92
|
// list() returns entity instances; data_get() reads each record.
|
|
93
|
-
$${eName.toLowerCase()}
|
|
94
|
-
foreach ($${eName.toLowerCase()}
|
|
93
|
+
$${entityListVar(eName.toLowerCase(), 'php')} = $client->${phpEntityAccessor(eName)}()->list(${listMatchArg('php', exampleEntity)});
|
|
94
|
+
foreach ($${entityListVar(eName.toLowerCase(), 'php')} as $record) {
|
|
95
95
|
$item = $record->data_get();
|
|
96
96
|
echo ${itemPrint} . "\\n";
|
|
97
97
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, phpEntityAccessor, listMatchArg, matchExampleItems, litString, entityOps, fact } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, phpEntityAccessor, listMatchArg, matchExampleItems, litString, entityOps, fact, entityListVar, entityItemsPhrase } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -58,9 +58,9 @@ $client = ${ctor};
|
|
|
58
58
|
let hasCall = false
|
|
59
59
|
|
|
60
60
|
if (opnames.includes('list')) {
|
|
61
|
-
Content(`// List all ${eName
|
|
62
|
-
$${eName.toLowerCase()}
|
|
63
|
-
print_r(array_map(fn($item) => $item->data_get(), $${eName.toLowerCase()}
|
|
61
|
+
Content(`// List all ${entityItemsPhrase(eName)} (an array of entities, one per record; throws on error)
|
|
62
|
+
$${entityListVar(eName.toLowerCase(), 'php')} = $client->${phpEntityAccessor(eName)}()->list(${listMatchArg('php', exampleEntity)});
|
|
63
|
+
print_r(array_map(fn($item) => $item->data_get(), $${entityListVar(eName.toLowerCase(), 'php')}));
|
|
64
64
|
`)
|
|
65
65
|
hasCall = true
|
|
66
66
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, phpEntityAccessor, seededList, litPair, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, phpEntityAccessor, seededList, litPair, matchExampleItems, requestExampleItems, entityListVar } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -59,7 +59,7 @@ const ReadmeTopTest = cmp(function ReadmeTopTest(props: any) {
|
|
|
59
59
|
}
|
|
60
60
|
// A list result is an array — name the variable accordingly. The fixture
|
|
61
61
|
// key is the model name, which the mock looks the entity up by.
|
|
62
|
-
const eVar =
|
|
62
|
+
const eVar = 'list' === primaryOp ? entityListVar(ename, 'php') : ename
|
|
63
63
|
Content(`\`\`\`php
|
|
64
64
|
// Seed fixture data so offline calls resolve without a live server.
|
|
65
65
|
$client = ${model.const.Name}SDK::test([
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, canonToType, canonKey, canonScalarKey, entityIdField, safeVarName, exampleVarName, entityOps, listMatchArg, matchExampleItems, litString, requestExampleItems, fact } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, canonToType, canonKey, canonScalarKey, entityIdField, safeVarName, exampleVarName, entityOps, listMatchArg, matchExampleItems, litString, requestExampleItems, fact, entityListVar } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -131,7 +131,7 @@ ${eVar} = client.${entity.Name}().load(${loadArg})
|
|
|
131
131
|
Content(`#### Example: List
|
|
132
132
|
|
|
133
133
|
\`\`\`python
|
|
134
|
-
${eVar}
|
|
134
|
+
${entityListVar(eVar, 'py')} = client.${entity.Name}().list(${listMatchArg('py', entity)})
|
|
135
135
|
\`\`\`
|
|
136
136
|
|
|
137
137
|
`)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps, safeVarName, exampleVarName, listMatchArg, matchExampleItems, requiredItems, litString, requestExampleItems, sendsId, fact, seriesList } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps, safeVarName, exampleVarName, listMatchArg, matchExampleItems, requiredItems, litString, requestExampleItems, sendsId, fact, seriesList, entityListVar } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -86,8 +86,8 @@ error; an entity's \`data_get()\` reads its record (a \`dict\`).
|
|
|
86
86
|
|
|
87
87
|
\`\`\`python
|
|
88
88
|
try:
|
|
89
|
-
${eVar}
|
|
90
|
-
for ${eVar} in ${eVar}
|
|
89
|
+
${entityListVar(eVar, 'py')} = client.${eName}().list(${listMatchArg('py', exampleEntity)})
|
|
90
|
+
for ${eVar} in ${entityListVar(eVar, 'py')}:
|
|
91
91
|
print(${eVar}.data_get())
|
|
92
92
|
except Exception as err:
|
|
93
93
|
print(f"list failed: {err}")
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, safeVarName, exampleVarName, listMatchArg, matchExampleItems, litString, entityOps, fact } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, safeVarName, exampleVarName, listMatchArg, matchExampleItems, litString, entityOps, fact, entityListVar, entityItemsPhrase } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -63,9 +63,9 @@ client = ${ctor}
|
|
|
63
63
|
let hasCall = false
|
|
64
64
|
|
|
65
65
|
if (opnames.includes('list')) {
|
|
66
|
-
Content(`# List all ${eName
|
|
67
|
-
${eVar}
|
|
68
|
-
for ${eVar} in ${eVar}
|
|
66
|
+
Content(`# List all ${entityItemsPhrase(eName)} (a list of entities, one per record; raises on error)
|
|
67
|
+
${entityListVar(eVar, 'py')} = client.${eName}().list(${listMatchArg('py', exampleEntity)})
|
|
68
|
+
for ${eVar} in ${entityListVar(eVar, 'py')}:
|
|
69
69
|
print(${eVar}.data_get())
|
|
70
70
|
`)
|
|
71
71
|
hasCall = true
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, safeVarName, exampleVarName, requiredItems, litPair, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, safeVarName, exampleVarName, requiredItems, litPair, matchExampleItems, requestExampleItems, entityListVar } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -58,7 +58,8 @@ client = ${model.const.Name}SDK.test()
|
|
|
58
58
|
// A list() result is a list — name the variable accordingly (the root
|
|
59
59
|
// README doc gate concatenates blocks, so reusing the singular name for
|
|
60
60
|
// a different type is a mypy assignment error).
|
|
61
|
-
const
|
|
61
|
+
const one = exampleVarName(eName.toLowerCase(), 'py')
|
|
62
|
+
const eVar = 'list' === primaryOp ? entityListVar(one, 'py') : one
|
|
62
63
|
Content(`${eVar} = client.${eName}().${primaryOp}(${arg})
|
|
63
64
|
print(${'list' === primaryOp ? '[item.data_get() for item in ' + eVar + ']' : eVar + '.data_get()'})
|
|
64
65
|
`)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, canonToType, canonKey, canonScalarKey, entityIdField, safeVarName, exampleVarName, entityOps, matchExampleItems, litString, requestExampleItems, fact } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, canonToType, canonKey, canonScalarKey, entityIdField, safeVarName, exampleVarName, entityOps, matchExampleItems, litString, requestExampleItems, fact, entityListVar } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -134,8 +134,8 @@ ${eVar} = client.${entity.Name}.load(${loadArg})
|
|
|
134
134
|
|
|
135
135
|
\`\`\`ruby
|
|
136
136
|
# list returns an Array of ${entity.Name} entities, one per record (raises on error).
|
|
137
|
-
${eVar}
|
|
138
|
-
${eVar}
|
|
137
|
+
${entityListVar(eVar, 'rb')} = client.${entity.Name}.list${rbListArgs(entity)}
|
|
138
|
+
${entityListVar(eVar, 'rb')}.each { |item| puts item.data_get }
|
|
139
139
|
\`\`\`
|
|
140
140
|
|
|
141
141
|
`)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, canonScalarKey, entityIdField, pickExampleEntity, exampleVarName, seededList, litPair, matchExampleItems, requestExampleItems, envLocalAt, cdTarget, fact, directRoute } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, canonScalarKey, entityIdField, pickExampleEntity, exampleVarName, seededList, litPair, matchExampleItems, requestExampleItems, envLocalAt, cdTarget, fact, directRoute, entityListVar } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -64,8 +64,8 @@ const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
|
|
|
64
64
|
const testModeExample = 'list' === primaryOp
|
|
65
65
|
? `# list returns an Array of ${eName} entities, one per mock record (raises on
|
|
66
66
|
# error); data_get reads each record.
|
|
67
|
-
${eVar}
|
|
68
|
-
${eVar}
|
|
67
|
+
${entityListVar(eVar, 'rb')} = client.${eName}.list(${testCallArg})
|
|
68
|
+
${entityListVar(eVar, 'rb')}.each { |item| puts item.data_get }`
|
|
69
69
|
: primaryOp
|
|
70
70
|
? `# Entity ops return the ENTITY (raises on error);
|
|
71
71
|
# data_get reads its mock record.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps, safeVarName, exampleVarName, matchExampleItems, requiredItems, litString, requestExampleItems, sendsId, fact, seriesList } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps, safeVarName, exampleVarName, matchExampleItems, requiredItems, litString, requestExampleItems, sendsId, fact, seriesList, entityListVar } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -94,8 +94,8 @@ client = ${ctor}
|
|
|
94
94
|
\`\`\`ruby
|
|
95
95
|
begin
|
|
96
96
|
# list returns an Array of ${eName} entities, one per record; data_get reads the record.
|
|
97
|
-
${eVar}
|
|
98
|
-
${eVar}
|
|
97
|
+
${entityListVar(eVar, 'rb')} = client.${eName}.list${rbListArgs(exampleEntity)}
|
|
98
|
+
${entityListVar(eVar, 'rb')}.each do |item|
|
|
99
99
|
record = item.data_get
|
|
100
100
|
puts "${itemPrint}"
|
|
101
101
|
end
|