From 433290d74d87ef85bc6e4995e93959523b87181c Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Wed, 2 Oct 2024 11:11:30 -0400 Subject: [PATCH] agent-ui rest client generation; initial version endpoint call (#221) --- agent/agent-ui/package.json | 12 +- agent/agent-ui/pnpm-lock.yaml | 128 ++++ agent/agent-ui/src/api/.babelrc | 33 + agent/agent-ui/src/api/.gitignore | 130 ++++ .../src/api/.openapi-generator-ignore | 23 + .../agent-ui/src/api/.openapi-generator/FILES | 43 ++ .../src/api/.openapi-generator/VERSION | 1 + agent/agent-ui/src/api/.travis.yml | 5 + agent/agent-ui/src/api/README.md | 144 ++++ agent/agent-ui/src/api/docs/AccessDetail.md | 12 + .../src/api/docs/AccessPrivateResponse.md | 9 + agent/agent-ui/src/api/docs/AgentApi.md | 88 +++ agent/agent-ui/src/api/docs/ProtobufAny.md | 9 + agent/agent-ui/src/api/docs/RpcStatus.md | 11 + agent/agent-ui/src/api/docs/ShareDetail.md | 16 + .../src/api/docs/SharePrivateResponse.md | 9 + .../src/api/docs/SharePublicResponse.md | 10 + .../src/api/docs/ShareReservedResponse.md | 13 + agent/agent-ui/src/api/docs/StatusResponse.md | 10 + .../agent-ui/src/api/docs/VersionResponse.md | 9 + agent/agent-ui/src/api/git_push.sh | 57 ++ agent/agent-ui/src/api/mocha.opts | 1 + agent/agent-ui/src/api/package.json | 46 ++ agent/agent-ui/src/api/src/ApiClient.js | 691 ++++++++++++++++++ agent/agent-ui/src/api/src/api/AgentApi.js | 110 +++ agent/agent-ui/src/api/src/index.js | 132 ++++ .../src/api/src/model/AccessDetail.js | 123 ++++ .../api/src/model/AccessPrivateResponse.js | 87 +++ .../agent-ui/src/api/src/model/ProtobufAny.js | 91 +++ agent/agent-ui/src/api/src/model/RpcStatus.js | 108 +++ .../agent-ui/src/api/src/model/ShareDetail.js | 163 +++++ .../src/api/src/model/SharePrivateResponse.js | 87 +++ .../src/api/src/model/SharePublicResponse.js | 99 +++ .../api/src/model/ShareReservedResponse.js | 135 ++++ .../src/api/src/model/StatusResponse.js | 113 +++ .../src/api/src/model/VersionResponse.js | 87 +++ .../src/api/test/api/AgentApi.spec.js | 73 ++ .../src/api/test/model/AccessDetail.spec.js | 83 +++ .../test/model/AccessPrivateResponse.spec.js | 65 ++ .../src/api/test/model/ProtobufAny.spec.js | 65 ++ .../src/api/test/model/RpcStatus.spec.js | 77 ++ .../src/api/test/model/ShareDetail.spec.js | 107 +++ .../test/model/SharePrivateResponse.spec.js | 65 ++ .../test/model/SharePublicResponse.spec.js | 71 ++ .../test/model/ShareReservedResponse.spec.js | 89 +++ .../src/api/test/model/StatusResponse.spec.js | 71 ++ .../api/test/model/VersionResponse.spec.js | 65 ++ agent/agent-ui/src/app/page.js | 29 +- agent/agent.go | 14 +- bin/generate_rest.sh | 5 +- 50 files changed, 3712 insertions(+), 12 deletions(-) create mode 100644 agent/agent-ui/src/api/.babelrc create mode 100644 agent/agent-ui/src/api/.gitignore create mode 100644 agent/agent-ui/src/api/.openapi-generator-ignore create mode 100644 agent/agent-ui/src/api/.openapi-generator/FILES create mode 100644 agent/agent-ui/src/api/.openapi-generator/VERSION create mode 100644 agent/agent-ui/src/api/.travis.yml create mode 100644 agent/agent-ui/src/api/README.md create mode 100644 agent/agent-ui/src/api/docs/AccessDetail.md create mode 100644 agent/agent-ui/src/api/docs/AccessPrivateResponse.md create mode 100644 agent/agent-ui/src/api/docs/AgentApi.md create mode 100644 agent/agent-ui/src/api/docs/ProtobufAny.md create mode 100644 agent/agent-ui/src/api/docs/RpcStatus.md create mode 100644 agent/agent-ui/src/api/docs/ShareDetail.md create mode 100644 agent/agent-ui/src/api/docs/SharePrivateResponse.md create mode 100644 agent/agent-ui/src/api/docs/SharePublicResponse.md create mode 100644 agent/agent-ui/src/api/docs/ShareReservedResponse.md create mode 100644 agent/agent-ui/src/api/docs/StatusResponse.md create mode 100644 agent/agent-ui/src/api/docs/VersionResponse.md create mode 100644 agent/agent-ui/src/api/git_push.sh create mode 100644 agent/agent-ui/src/api/mocha.opts create mode 100644 agent/agent-ui/src/api/package.json create mode 100644 agent/agent-ui/src/api/src/ApiClient.js create mode 100644 agent/agent-ui/src/api/src/api/AgentApi.js create mode 100644 agent/agent-ui/src/api/src/index.js create mode 100644 agent/agent-ui/src/api/src/model/AccessDetail.js create mode 100644 agent/agent-ui/src/api/src/model/AccessPrivateResponse.js create mode 100644 agent/agent-ui/src/api/src/model/ProtobufAny.js create mode 100644 agent/agent-ui/src/api/src/model/RpcStatus.js create mode 100644 agent/agent-ui/src/api/src/model/ShareDetail.js create mode 100644 agent/agent-ui/src/api/src/model/SharePrivateResponse.js create mode 100644 agent/agent-ui/src/api/src/model/SharePublicResponse.js create mode 100644 agent/agent-ui/src/api/src/model/ShareReservedResponse.js create mode 100644 agent/agent-ui/src/api/src/model/StatusResponse.js create mode 100644 agent/agent-ui/src/api/src/model/VersionResponse.js create mode 100644 agent/agent-ui/src/api/test/api/AgentApi.spec.js create mode 100644 agent/agent-ui/src/api/test/model/AccessDetail.spec.js create mode 100644 agent/agent-ui/src/api/test/model/AccessPrivateResponse.spec.js create mode 100644 agent/agent-ui/src/api/test/model/ProtobufAny.spec.js create mode 100644 agent/agent-ui/src/api/test/model/RpcStatus.spec.js create mode 100644 agent/agent-ui/src/api/test/model/ShareDetail.spec.js create mode 100644 agent/agent-ui/src/api/test/model/SharePrivateResponse.spec.js create mode 100644 agent/agent-ui/src/api/test/model/SharePublicResponse.spec.js create mode 100644 agent/agent-ui/src/api/test/model/ShareReservedResponse.spec.js create mode 100644 agent/agent-ui/src/api/test/model/StatusResponse.spec.js create mode 100644 agent/agent-ui/src/api/test/model/VersionResponse.spec.js diff --git a/agent/agent-ui/package.json b/agent/agent-ui/package.json index 49a3f3f4..e51c1631 100644 --- a/agent/agent-ui/package.json +++ b/agent/agent-ui/package.json @@ -9,14 +9,16 @@ "lint": "next lint" }, "dependencies": { + "next": "14.2.13", "react": "^18", "react-dom": "^18", - "next": "14.2.13" + "superagent": "^10.1.0" }, "devDependencies": { - "postcss": "^8", - "tailwindcss": "^3.4.1", "eslint": "^8", - "eslint-config-next": "14.2.13" - } + "eslint-config-next": "14.2.13", + "postcss": "^8", + "tailwindcss": "^3.4.1" + }, + "proxy": "http://127.0.0.1:8888" } diff --git a/agent/agent-ui/pnpm-lock.yaml b/agent/agent-ui/pnpm-lock.yaml index 4f1ca146..e47802c7 100644 --- a/agent/agent-ui/pnpm-lock.yaml +++ b/agent/agent-ui/pnpm-lock.yaml @@ -17,6 +17,9 @@ importers: react-dom: specifier: ^18 version: 18.3.1(react@18.3.1) + superagent: + specifier: ^10.1.0 + version: 10.1.0 devDependencies: eslint: specifier: ^8 @@ -322,9 +325,15 @@ packages: resolution: {integrity: sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A==} engines: {node: '>= 0.4'} + asap@2.0.6: + resolution: {integrity: sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==} + ast-types-flow@0.0.8: resolution: {integrity: sha512-OH/2E5Fg20h2aPrbe+QL8JZQFko0YZaF+j4mnQ7BGhfavO7OpSLa8a0y9sBwomHdSbkhTS8TQNayBfnW5DwbvQ==} + asynckit@0.4.0: + resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + available-typed-arrays@1.0.7: resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==} engines: {node: '>= 0.4'} @@ -391,13 +400,23 @@ packages: color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + combined-stream@1.0.8: + resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} + engines: {node: '>= 0.8'} + commander@4.1.1: resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} engines: {node: '>= 6'} + component-emitter@1.3.1: + resolution: {integrity: sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ==} + concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + cookiejar@2.1.4: + resolution: {integrity: sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==} + cross-spawn@7.0.3: resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} engines: {node: '>= 8'} @@ -454,6 +473,13 @@ packages: resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} engines: {node: '>= 0.4'} + delayed-stream@1.0.0: + resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} + engines: {node: '>=0.4.0'} + + dezalgo@1.0.4: + resolution: {integrity: sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==} + didyoumean@1.2.2: resolution: {integrity: sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==} @@ -639,6 +665,9 @@ packages: fast-levenshtein@2.0.6: resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} + fast-safe-stringify@2.1.1: + resolution: {integrity: sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==} + fastq@1.17.1: resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} @@ -668,6 +697,13 @@ packages: resolution: {integrity: sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==} engines: {node: '>=14'} + form-data@4.0.0: + resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} + engines: {node: '>= 6'} + + formidable@3.5.1: + resolution: {integrity: sha512-WJWKelbRHN41m5dumb0/k8TeAx7Id/y3a+Z7QfhxP/htI9Js5zYaEDtG8uMgG0vM0lOlqnmjE99/kfpOYi/0Og==} + fs.realpath@1.0.0: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} @@ -761,6 +797,10 @@ packages: resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} engines: {node: '>= 0.4'} + hexoid@1.0.0: + resolution: {integrity: sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==} + engines: {node: '>=8'} + ignore@5.3.2: resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} engines: {node: '>= 4'} @@ -987,10 +1027,27 @@ packages: resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} engines: {node: '>= 8'} + methods@1.1.2: + resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==} + engines: {node: '>= 0.6'} + micromatch@4.0.8: resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} engines: {node: '>=8.6'} + mime-db@1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} + engines: {node: '>= 0.6'} + + mime-types@2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + engines: {node: '>= 0.6'} + + mime@2.6.0: + resolution: {integrity: sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==} + engines: {node: '>=4.0.0'} + hasBin: true + minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} @@ -1197,6 +1254,10 @@ packages: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} + qs@6.13.0: + resolution: {integrity: sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==} + engines: {node: '>=0.6'} + queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} @@ -1373,6 +1434,10 @@ packages: engines: {node: '>=16 || 14 >=14.17'} hasBin: true + superagent@10.1.0: + resolution: {integrity: sha512-JMmik7PbnXGlq7g528Gi6apHbVbTz2vrE3du6fuG4kIPSb2PnLoSOPvfjKn8aQYuJcBWAKW6ZG90qPPsE5jZxQ==} + engines: {node: '>=14.18.0'} + supports-color@7.2.0: resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} engines: {node: '>=8'} @@ -1815,8 +1880,12 @@ snapshots: is-array-buffer: 3.0.4 is-shared-array-buffer: 1.0.3 + asap@2.0.6: {} + ast-types-flow@0.0.8: {} + asynckit@0.4.0: {} + available-typed-arrays@1.0.7: dependencies: possible-typed-array-names: 1.0.0 @@ -1885,10 +1954,18 @@ snapshots: color-name@1.1.4: {} + combined-stream@1.0.8: + dependencies: + delayed-stream: 1.0.0 + commander@4.1.1: {} + component-emitter@1.3.1: {} + concat-map@0.0.1: {} + cookiejar@2.1.4: {} + cross-spawn@7.0.3: dependencies: path-key: 3.1.1 @@ -1960,6 +2037,13 @@ snapshots: has-property-descriptors: 1.0.2 object-keys: 1.1.1 + delayed-stream@1.0.0: {} + + dezalgo@1.0.4: + dependencies: + asap: 2.0.6 + wrappy: 1.0.2 + didyoumean@1.2.2: {} dlv@1.1.3: {} @@ -2303,6 +2387,8 @@ snapshots: fast-levenshtein@2.0.6: {} + fast-safe-stringify@2.1.1: {} + fastq@1.17.1: dependencies: reusify: 1.0.4 @@ -2337,6 +2423,18 @@ snapshots: cross-spawn: 7.0.3 signal-exit: 4.1.0 + form-data@4.0.0: + dependencies: + asynckit: 0.4.0 + combined-stream: 1.0.8 + mime-types: 2.1.35 + + formidable@3.5.1: + dependencies: + dezalgo: 1.0.4 + hexoid: 1.0.0 + once: 1.4.0 + fs.realpath@1.0.0: {} fsevents@2.3.3: @@ -2442,6 +2540,8 @@ snapshots: dependencies: function-bind: 1.1.2 + hexoid@1.0.0: {} + ignore@5.3.2: {} import-fresh@3.3.0: @@ -2655,11 +2755,21 @@ snapshots: merge2@1.4.1: {} + methods@1.1.2: {} + micromatch@4.0.8: dependencies: braces: 3.0.3 picomatch: 2.3.1 + mime-db@1.52.0: {} + + mime-types@2.1.35: + dependencies: + mime-db: 1.52.0 + + mime@2.6.0: {} + minimatch@3.1.2: dependencies: brace-expansion: 1.1.11 @@ -2859,6 +2969,10 @@ snapshots: punycode@2.3.1: {} + qs@6.13.0: + dependencies: + side-channel: 1.0.6 + queue-microtask@1.2.3: {} react-dom@18.3.1(react@18.3.1): @@ -3067,6 +3181,20 @@ snapshots: pirates: 4.0.6 ts-interface-checker: 0.1.13 + superagent@10.1.0: + dependencies: + component-emitter: 1.3.1 + cookiejar: 2.1.4 + debug: 4.3.7 + fast-safe-stringify: 2.1.1 + form-data: 4.0.0 + formidable: 3.5.1 + methods: 1.1.2 + mime: 2.6.0 + qs: 6.13.0 + transitivePeerDependencies: + - supports-color + supports-color@7.2.0: dependencies: has-flag: 4.0.0 diff --git a/agent/agent-ui/src/api/.babelrc b/agent/agent-ui/src/api/.babelrc new file mode 100644 index 00000000..c73df9d5 --- /dev/null +++ b/agent/agent-ui/src/api/.babelrc @@ -0,0 +1,33 @@ +{ + "presets": [ + "@babel/preset-env" + ], + "plugins": [ + "@babel/plugin-syntax-dynamic-import", + "@babel/plugin-syntax-import-meta", + "@babel/plugin-proposal-class-properties", + "@babel/plugin-proposal-json-strings", + [ + "@babel/plugin-proposal-decorators", + { + "legacy": true + } + ], + "@babel/plugin-proposal-function-sent", + "@babel/plugin-proposal-export-namespace-from", + "@babel/plugin-proposal-numeric-separator", + "@babel/plugin-proposal-throw-expressions", + "@babel/plugin-proposal-export-default-from", + "@babel/plugin-proposal-logical-assignment-operators", + "@babel/plugin-proposal-optional-chaining", + [ + "@babel/plugin-proposal-pipeline-operator", + { + "proposal": "minimal" + } + ], + "@babel/plugin-proposal-nullish-coalescing-operator", + "@babel/plugin-proposal-do-expressions", + "@babel/plugin-proposal-function-bind" + ] +} diff --git a/agent/agent-ui/src/api/.gitignore b/agent/agent-ui/src/api/.gitignore new file mode 100644 index 00000000..6a7d6d8e --- /dev/null +++ b/agent/agent-ui/src/api/.gitignore @@ -0,0 +1,130 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional stylelint cache +.stylelintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# vuepress v2.x temp and cache directory +.temp +.cache + +# Docusaurus cache and generated files +.docusaurus + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* \ No newline at end of file diff --git a/agent/agent-ui/src/api/.openapi-generator-ignore b/agent/agent-ui/src/api/.openapi-generator-ignore new file mode 100644 index 00000000..7484ee59 --- /dev/null +++ b/agent/agent-ui/src/api/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/agent/agent-ui/src/api/.openapi-generator/FILES b/agent/agent-ui/src/api/.openapi-generator/FILES new file mode 100644 index 00000000..69c72a77 --- /dev/null +++ b/agent/agent-ui/src/api/.openapi-generator/FILES @@ -0,0 +1,43 @@ +.babelrc +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +docs/AccessDetail.md +docs/AccessPrivateResponse.md +docs/AgentApi.md +docs/ProtobufAny.md +docs/RpcStatus.md +docs/ShareDetail.md +docs/SharePrivateResponse.md +docs/SharePublicResponse.md +docs/ShareReservedResponse.md +docs/StatusResponse.md +docs/VersionResponse.md +git_push.sh +mocha.opts +package.json +src/ApiClient.js +src/api/AgentApi.js +src/index.js +src/model/AccessDetail.js +src/model/AccessPrivateResponse.js +src/model/ProtobufAny.js +src/model/RpcStatus.js +src/model/ShareDetail.js +src/model/SharePrivateResponse.js +src/model/SharePublicResponse.js +src/model/ShareReservedResponse.js +src/model/StatusResponse.js +src/model/VersionResponse.js +test/api/AgentApi.spec.js +test/model/AccessDetail.spec.js +test/model/AccessPrivateResponse.spec.js +test/model/ProtobufAny.spec.js +test/model/RpcStatus.spec.js +test/model/ShareDetail.spec.js +test/model/SharePrivateResponse.spec.js +test/model/SharePublicResponse.spec.js +test/model/ShareReservedResponse.spec.js +test/model/StatusResponse.spec.js +test/model/VersionResponse.spec.js diff --git a/agent/agent-ui/src/api/.openapi-generator/VERSION b/agent/agent-ui/src/api/.openapi-generator/VERSION new file mode 100644 index 00000000..1985849f --- /dev/null +++ b/agent/agent-ui/src/api/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.7.0 diff --git a/agent/agent-ui/src/api/.travis.yml b/agent/agent-ui/src/api/.travis.yml new file mode 100644 index 00000000..0968f7a4 --- /dev/null +++ b/agent/agent-ui/src/api/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +cache: npm +node_js: + - "6" + - "6.1" diff --git a/agent/agent-ui/src/api/README.md b/agent/agent-ui/src/api/README.md new file mode 100644 index 00000000..39ddec6d --- /dev/null +++ b/agent/agent-ui/src/api/README.md @@ -0,0 +1,144 @@ +# agent_agent_grpc_agent_proto + +AgentAgentGrpcAgentProto - JavaScript client for agent_agent_grpc_agent_proto +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: version not set +- Package version: version not set +- Generator version: 7.7.0 +- Build package: org.openapitools.codegen.languages.JavascriptClientCodegen + +## Installation + +### For [Node.js](https://nodejs.org/) + +#### npm + +To publish the library as a [npm](https://www.npmjs.com/), please follow the procedure in ["Publishing npm packages"](https://docs.npmjs.com/getting-started/publishing-npm-packages). + +Then install it via: + +```shell +npm install agent_agent_grpc_agent_proto --save +``` + +Finally, you need to build the module: + +```shell +npm run build +``` + +##### Local development + +To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing `package.json` (and this README). Let's call this `JAVASCRIPT_CLIENT_DIR`. Then run: + +```shell +npm install +``` + +Next, [link](https://docs.npmjs.com/cli/link) it globally in npm with the following, also from `JAVASCRIPT_CLIENT_DIR`: + +```shell +npm link +``` + +To use the link you just defined in your project, switch to the directory you want to use your agent_agent_grpc_agent_proto from, and run: + +```shell +npm link /path/to/ +``` + +Finally, you need to build the module: + +```shell +npm run build +``` + +#### git + +If the library is hosted at a git repository, e.g.https://github.com/GIT_USER_ID/GIT_REPO_ID +then install it via: + +```shell + npm install GIT_USER_ID/GIT_REPO_ID --save +``` + +### For browser + +The library also works in the browser environment via npm and [browserify](http://browserify.org/). After following +the above steps with Node.js and installing browserify with `npm install -g browserify`, +perform the following (assuming *main.js* is your entry file): + +```shell +browserify main.js > bundle.js +``` + +Then include *bundle.js* in the HTML pages. + +### Webpack Configuration + +Using Webpack you may encounter the following error: "Module not found: Error: +Cannot resolve module", most certainly you should disable AMD loader. Add/merge +the following section to your webpack config: + +```javascript +module: { + rules: [ + { + parser: { + amd: false + } + } + ] +} +``` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following JS code: + +```javascript +var AgentAgentGrpcAgentProto = require('agent_agent_grpc_agent_proto'); + + +var api = new AgentAgentGrpcAgentProto.AgentApi() +var callback = function(error, data, response) { + if (error) { + console.error(error); + } else { + console.log('API called successfully. Returned data: ' + data); + } +}; +api.agentStatus(callback); + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AgentAgentGrpcAgentProto.AgentApi* | [**agentStatus**](docs/AgentApi.md#agentStatus) | **GET** /v1/agent/status | +*AgentAgentGrpcAgentProto.AgentApi* | [**agentVersion**](docs/AgentApi.md#agentVersion) | **GET** /v1/agent/version | + + +## Documentation for Models + + - [AgentAgentGrpcAgentProto.AccessDetail](docs/AccessDetail.md) + - [AgentAgentGrpcAgentProto.AccessPrivateResponse](docs/AccessPrivateResponse.md) + - [AgentAgentGrpcAgentProto.ProtobufAny](docs/ProtobufAny.md) + - [AgentAgentGrpcAgentProto.RpcStatus](docs/RpcStatus.md) + - [AgentAgentGrpcAgentProto.ShareDetail](docs/ShareDetail.md) + - [AgentAgentGrpcAgentProto.SharePrivateResponse](docs/SharePrivateResponse.md) + - [AgentAgentGrpcAgentProto.SharePublicResponse](docs/SharePublicResponse.md) + - [AgentAgentGrpcAgentProto.ShareReservedResponse](docs/ShareReservedResponse.md) + - [AgentAgentGrpcAgentProto.StatusResponse](docs/StatusResponse.md) + - [AgentAgentGrpcAgentProto.VersionResponse](docs/VersionResponse.md) + + +## Documentation for Authorization + +Endpoints do not require authorization. + diff --git a/agent/agent-ui/src/api/docs/AccessDetail.md b/agent/agent-ui/src/api/docs/AccessDetail.md new file mode 100644 index 00000000..9babf49c --- /dev/null +++ b/agent/agent-ui/src/api/docs/AccessDetail.md @@ -0,0 +1,12 @@ +# AgentAgentGrpcAgentProto.AccessDetail + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**frontendToken** | **String** | | [optional] +**token** | **String** | | [optional] +**bindAddress** | **String** | | [optional] +**responseHeaders** | **[String]** | | [optional] + + diff --git a/agent/agent-ui/src/api/docs/AccessPrivateResponse.md b/agent/agent-ui/src/api/docs/AccessPrivateResponse.md new file mode 100644 index 00000000..df24124f --- /dev/null +++ b/agent/agent-ui/src/api/docs/AccessPrivateResponse.md @@ -0,0 +1,9 @@ +# AgentAgentGrpcAgentProto.AccessPrivateResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**frontendToken** | **String** | | [optional] + + diff --git a/agent/agent-ui/src/api/docs/AgentApi.md b/agent/agent-ui/src/api/docs/AgentApi.md new file mode 100644 index 00000000..a22fb3cf --- /dev/null +++ b/agent/agent-ui/src/api/docs/AgentApi.md @@ -0,0 +1,88 @@ +# AgentAgentGrpcAgentProto.AgentApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**agentStatus**](AgentApi.md#agentStatus) | **GET** /v1/agent/status | +[**agentVersion**](AgentApi.md#agentVersion) | **GET** /v1/agent/version | + + + +## agentStatus + +> StatusResponse agentStatus() + + + +### Example + +```javascript +import AgentAgentGrpcAgentProto from 'agent_agent_grpc_agent_proto'; + +let apiInstance = new AgentAgentGrpcAgentProto.AgentApi(); +apiInstance.agentStatus((error, data, response) => { + if (error) { + console.error(error); + } else { + console.log('API called successfully. Returned data: ' + data); + } +}); +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**StatusResponse**](StatusResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## agentVersion + +> VersionResponse agentVersion() + + + +### Example + +```javascript +import AgentAgentGrpcAgentProto from 'agent_agent_grpc_agent_proto'; + +let apiInstance = new AgentAgentGrpcAgentProto.AgentApi(); +apiInstance.agentVersion((error, data, response) => { + if (error) { + console.error(error); + } else { + console.log('API called successfully. Returned data: ' + data); + } +}); +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**VersionResponse**](VersionResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/agent/agent-ui/src/api/docs/ProtobufAny.md b/agent/agent-ui/src/api/docs/ProtobufAny.md new file mode 100644 index 00000000..478df6a5 --- /dev/null +++ b/agent/agent-ui/src/api/docs/ProtobufAny.md @@ -0,0 +1,9 @@ +# AgentAgentGrpcAgentProto.ProtobufAny + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | | [optional] + + diff --git a/agent/agent-ui/src/api/docs/RpcStatus.md b/agent/agent-ui/src/api/docs/RpcStatus.md new file mode 100644 index 00000000..e35a3c05 --- /dev/null +++ b/agent/agent-ui/src/api/docs/RpcStatus.md @@ -0,0 +1,11 @@ +# AgentAgentGrpcAgentProto.RpcStatus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **Number** | | [optional] +**message** | **String** | | [optional] +**details** | [**[ProtobufAny]**](ProtobufAny.md) | | [optional] + + diff --git a/agent/agent-ui/src/api/docs/ShareDetail.md b/agent/agent-ui/src/api/docs/ShareDetail.md new file mode 100644 index 00000000..244ab1c2 --- /dev/null +++ b/agent/agent-ui/src/api/docs/ShareDetail.md @@ -0,0 +1,16 @@ +# AgentAgentGrpcAgentProto.ShareDetail + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**token** | **String** | | [optional] +**shareMode** | **String** | | [optional] +**backendMode** | **String** | | [optional] +**reserved** | **Boolean** | | [optional] +**frontendEndpoint** | **[String]** | | [optional] +**backendEndpoint** | **String** | | [optional] +**closed** | **Boolean** | | [optional] +**status** | **String** | | [optional] + + diff --git a/agent/agent-ui/src/api/docs/SharePrivateResponse.md b/agent/agent-ui/src/api/docs/SharePrivateResponse.md new file mode 100644 index 00000000..83e39499 --- /dev/null +++ b/agent/agent-ui/src/api/docs/SharePrivateResponse.md @@ -0,0 +1,9 @@ +# AgentAgentGrpcAgentProto.SharePrivateResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**token** | **String** | | [optional] + + diff --git a/agent/agent-ui/src/api/docs/SharePublicResponse.md b/agent/agent-ui/src/api/docs/SharePublicResponse.md new file mode 100644 index 00000000..27743d9b --- /dev/null +++ b/agent/agent-ui/src/api/docs/SharePublicResponse.md @@ -0,0 +1,10 @@ +# AgentAgentGrpcAgentProto.SharePublicResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**token** | **String** | | [optional] +**frontendEndpoints** | **[String]** | | [optional] + + diff --git a/agent/agent-ui/src/api/docs/ShareReservedResponse.md b/agent/agent-ui/src/api/docs/ShareReservedResponse.md new file mode 100644 index 00000000..89ccd00a --- /dev/null +++ b/agent/agent-ui/src/api/docs/ShareReservedResponse.md @@ -0,0 +1,13 @@ +# AgentAgentGrpcAgentProto.ShareReservedResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**token** | **String** | | [optional] +**backendMode** | **String** | | [optional] +**shareMode** | **String** | | [optional] +**frontendEndpoints** | **[String]** | | [optional] +**target** | **String** | | [optional] + + diff --git a/agent/agent-ui/src/api/docs/StatusResponse.md b/agent/agent-ui/src/api/docs/StatusResponse.md new file mode 100644 index 00000000..dffc0b09 --- /dev/null +++ b/agent/agent-ui/src/api/docs/StatusResponse.md @@ -0,0 +1,10 @@ +# AgentAgentGrpcAgentProto.StatusResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**accesses** | [**[AccessDetail]**](AccessDetail.md) | | [optional] +**shares** | [**[ShareDetail]**](ShareDetail.md) | | [optional] + + diff --git a/agent/agent-ui/src/api/docs/VersionResponse.md b/agent/agent-ui/src/api/docs/VersionResponse.md new file mode 100644 index 00000000..1ddafb96 --- /dev/null +++ b/agent/agent-ui/src/api/docs/VersionResponse.md @@ -0,0 +1,9 @@ +# AgentAgentGrpcAgentProto.VersionResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**v** | **String** | | [optional] + + diff --git a/agent/agent-ui/src/api/git_push.sh b/agent/agent-ui/src/api/git_push.sh new file mode 100644 index 00000000..f53a75d4 --- /dev/null +++ b/agent/agent-ui/src/api/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/agent/agent-ui/src/api/mocha.opts b/agent/agent-ui/src/api/mocha.opts new file mode 100644 index 00000000..90701180 --- /dev/null +++ b/agent/agent-ui/src/api/mocha.opts @@ -0,0 +1 @@ +--timeout 10000 diff --git a/agent/agent-ui/src/api/package.json b/agent/agent-ui/src/api/package.json new file mode 100644 index 00000000..7f29fb2b --- /dev/null +++ b/agent/agent-ui/src/api/package.json @@ -0,0 +1,46 @@ +{ + "name": "agent_agent_grpc_agent_proto", + "version": "version not set", + "description": "JS API client generated by OpenAPI Generator", + "license": "Unlicense", + "main": "dist/index.js", + "scripts": { + "build": "babel src -d dist", + "prepare": "npm run build", + "test": "mocha --require @babel/register --recursive" + }, + "browser": { + "fs": false + }, + "dependencies": { + "@babel/cli": "^7.0.0", + "superagent": "^5.3.0" + }, + "devDependencies": { + "@babel/core": "^7.0.0", + "@babel/plugin-proposal-class-properties": "^7.0.0", + "@babel/plugin-proposal-decorators": "^7.0.0", + "@babel/plugin-proposal-do-expressions": "^7.0.0", + "@babel/plugin-proposal-export-default-from": "^7.0.0", + "@babel/plugin-proposal-export-namespace-from": "^7.0.0", + "@babel/plugin-proposal-function-bind": "^7.0.0", + "@babel/plugin-proposal-function-sent": "^7.0.0", + "@babel/plugin-proposal-json-strings": "^7.0.0", + "@babel/plugin-proposal-logical-assignment-operators": "^7.0.0", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0", + "@babel/plugin-proposal-numeric-separator": "^7.0.0", + "@babel/plugin-proposal-optional-chaining": "^7.0.0", + "@babel/plugin-proposal-pipeline-operator": "^7.0.0", + "@babel/plugin-proposal-throw-expressions": "^7.0.0", + "@babel/plugin-syntax-dynamic-import": "^7.0.0", + "@babel/plugin-syntax-import-meta": "^7.0.0", + "@babel/preset-env": "^7.0.0", + "@babel/register": "^7.0.0", + "expect.js": "^0.3.1", + "mocha": "^8.0.1", + "sinon": "^7.2.0" + }, + "files": [ + "dist" + ] +} diff --git a/agent/agent-ui/src/api/src/ApiClient.js b/agent/agent-ui/src/api/src/ApiClient.js new file mode 100644 index 00000000..3a3e1074 --- /dev/null +++ b/agent/agent-ui/src/api/src/ApiClient.js @@ -0,0 +1,691 @@ +/** + * agent/agentGrpc/agent.proto + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + + +import superagent from "superagent"; +import querystring from "querystring"; + +/** +* @module ApiClient +* @version version not set +*/ + +/** +* Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an +* application to use this class directly - the *Api and model classes provide the public API for the service. The +* contents of this file should be regarded as internal but are documented for completeness. +* @alias module:ApiClient +* @class +*/ +class ApiClient { + /** + * The base URL against which to resolve every API call's (relative) path. + * Overrides the default value set in spec file if present + * @param {String} basePath + */ + constructor(basePath = 'http://localhost') { + /** + * The base URL against which to resolve every API call's (relative) path. + * @type {String} + * @default http://localhost + */ + this.basePath = basePath.replace(/\/+$/, ''); + + /** + * The authentication methods to be included for all API calls. + * @type {Array.} + */ + this.authentications = { + } + + /** + * The default HTTP headers to be included for all API calls. + * @type {Array.} + * @default {} + */ + this.defaultHeaders = { + 'User-Agent': 'OpenAPI-Generator/version not set/Javascript' + }; + + /** + * The default HTTP timeout for all API calls. + * @type {Number} + * @default 60000 + */ + this.timeout = 60000; + + /** + * If set to false an additional timestamp parameter is added to all API GET calls to + * prevent browser caching + * @type {Boolean} + * @default true + */ + this.cache = true; + + /** + * If set to true, the client will save the cookies from each server + * response, and return them in the next request. + * @default false + */ + this.enableCookies = false; + + /* + * Used to save and return cookies in a node.js (non-browser) setting, + * if this.enableCookies is set to true. + */ + if (typeof window === 'undefined') { + this.agent = new superagent.agent(); + } + + /* + * Allow user to override superagent agent + */ + this.requestAgent = null; + + /* + * Allow user to add superagent plugins + */ + this.plugins = null; + + } + + /** + * Returns a string representation for an actual parameter. + * @param param The actual parameter. + * @returns {String} The string representation of param. + */ + paramToString(param) { + if (param == undefined || param == null) { + return ''; + } + if (param instanceof Date) { + return param.toJSON(); + } + if (ApiClient.canBeJsonified(param)) { + return JSON.stringify(param); + } + + return param.toString(); + } + + /** + * Returns a boolean indicating if the parameter could be JSON.stringified + * @param param The actual parameter + * @returns {Boolean} Flag indicating if param can be JSON.stringified + */ + static canBeJsonified(str) { + if (typeof str !== 'string' && typeof str !== 'object') return false; + try { + const type = str.toString(); + return type === '[object Object]' + || type === '[object Array]'; + } catch (err) { + return false; + } + }; + + /** + * Builds full URL by appending the given path to the base URL and replacing path parameter place-holders with parameter values. + * NOTE: query parameters are not handled here. + * @param {String} path The path to append to the base URL. + * @param {Object} pathParams The parameter values to append. + * @param {String} apiBasePath Base path defined in the path, operation level to override the default one + * @returns {String} The encoded path with parameter values substituted. + */ + buildUrl(path, pathParams, apiBasePath) { + if (!path.match(/^\//)) { + path = '/' + path; + } + + var url = this.basePath + path; + + // use API (operation, path) base path if defined + if (apiBasePath !== null && apiBasePath !== undefined) { + url = apiBasePath + path; + } + + url = url.replace(/\{([\w-\.#]+)\}/g, (fullMatch, key) => { + var value; + if (pathParams.hasOwnProperty(key)) { + value = this.paramToString(pathParams[key]); + } else { + value = fullMatch; + } + + return encodeURIComponent(value); + }); + + return url; + } + + /** + * Checks whether the given content type represents JSON.
+ * JSON content type examples:
+ *
    + *
  • application/json
  • + *
  • application/json; charset=UTF8
  • + *
  • APPLICATION/JSON
  • + *
+ * @param {String} contentType The MIME content type to check. + * @returns {Boolean} true if contentType represents JSON, otherwise false. + */ + isJsonMime(contentType) { + return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i)); + } + + /** + * Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first. + * @param {Array.} contentTypes + * @returns {String} The chosen content type, preferring JSON. + */ + jsonPreferredMime(contentTypes) { + for (var i = 0; i < contentTypes.length; i++) { + if (this.isJsonMime(contentTypes[i])) { + return contentTypes[i]; + } + } + + return contentTypes[0]; + } + + /** + * Checks whether the given parameter value represents file-like content. + * @param param The parameter to check. + * @returns {Boolean} true if param represents a file. + */ + isFileParam(param) { + // fs.ReadStream in Node.js and Electron (but not in runtime like browserify) + if (typeof require === 'function') { + let fs; + try { + fs = require('fs'); + } catch (err) {} + if (fs && fs.ReadStream && param instanceof fs.ReadStream) { + return true; + } + } + + // Buffer in Node.js + if (typeof Buffer === 'function' && param instanceof Buffer) { + return true; + } + + // Blob in browser + if (typeof Blob === 'function' && param instanceof Blob) { + return true; + } + + // File in browser (it seems File object is also instance of Blob, but keep this for safe) + if (typeof File === 'function' && param instanceof File) { + return true; + } + + return false; + } + + /** + * Normalizes parameter values: + *
    + *
  • remove nils
  • + *
  • keep files and arrays
  • + *
  • format to string with `paramToString` for other cases
  • + *
+ * @param {Object.} params The parameters as object properties. + * @returns {Object.} normalized parameters. + */ + normalizeParams(params) { + var newParams = {}; + for (var key in params) { + if (params.hasOwnProperty(key) && params[key] != undefined && params[key] != null) { + var value = params[key]; + if (this.isFileParam(value) || Array.isArray(value)) { + newParams[key] = value; + } else { + newParams[key] = this.paramToString(value); + } + } + } + + return newParams; + } + + /** + * Builds a string representation of an array-type actual parameter, according to the given collection format. + * @param {Array} param An array parameter. + * @param {module:ApiClient.CollectionFormatEnum} collectionFormat The array element separator strategy. + * @returns {String|Array} A string representation of the supplied collection, using the specified delimiter. Returns + * param as is if collectionFormat is multi. + */ + buildCollectionParam(param, collectionFormat) { + if (param == null) { + return null; + } + switch (collectionFormat) { + case 'csv': + return param.map(this.paramToString, this).join(','); + case 'ssv': + return param.map(this.paramToString, this).join(' '); + case 'tsv': + return param.map(this.paramToString, this).join('\t'); + case 'pipes': + return param.map(this.paramToString, this).join('|'); + case 'multi': + //return the array directly as SuperAgent will handle it as expected + return param.map(this.paramToString, this); + case 'passthrough': + return param; + default: + throw new Error('Unknown collection format: ' + collectionFormat); + } + } + + /** + * Applies authentication headers to the request. + * @param {Object} request The request object created by a superagent() call. + * @param {Array.} authNames An array of authentication method names. + */ + applyAuthToRequest(request, authNames) { + authNames.forEach((authName) => { + var auth = this.authentications[authName]; + switch (auth.type) { + case 'basic': + if (auth.username || auth.password) { + request.auth(auth.username || '', auth.password || ''); + } + + break; + case 'bearer': + if (auth.accessToken) { + var localVarBearerToken = typeof auth.accessToken === 'function' + ? auth.accessToken() + : auth.accessToken + request.set({'Authorization': 'Bearer ' + localVarBearerToken}); + } + + break; + case 'apiKey': + if (auth.apiKey) { + var data = {}; + if (auth.apiKeyPrefix) { + data[auth.name] = auth.apiKeyPrefix + ' ' + auth.apiKey; + } else { + data[auth.name] = auth.apiKey; + } + + if (auth['in'] === 'header') { + request.set(data); + } else { + request.query(data); + } + } + + break; + case 'oauth2': + if (auth.accessToken) { + request.set({'Authorization': 'Bearer ' + auth.accessToken}); + } + + break; + default: + throw new Error('Unknown authentication type: ' + auth.type); + } + }); + } + + /** + * Deserializes an HTTP response body into a value of the specified type. + * @param {Object} response A SuperAgent response object. + * @param {(String|Array.|Object.|Function)} returnType The type to return. Pass a string for simple types + * or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To + * return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type: + * all properties on data will be converted to this type. + * @returns A value of the specified type. + */ + deserialize(response, returnType) { + if (response == null || returnType == null || response.status == 204) { + return null; + } + + // Rely on SuperAgent for parsing response body. + // See http://visionmedia.github.io/superagent/#parsing-response-bodies + var data = response.body; + if (data == null || (typeof data === 'object' && typeof data.length === 'undefined' && !Object.keys(data).length)) { + // SuperAgent does not always produce a body; use the unparsed response as a fallback + data = response.text; + } + + return ApiClient.convertToType(data, returnType); + } + + /** + * Callback function to receive the result of the operation. + * @callback module:ApiClient~callApiCallback + * @param {String} error Error message, if any. + * @param data The data returned by the service call. + * @param {String} response The complete HTTP response. + */ + + /** + * Invokes the REST service using the supplied settings and parameters. + * @param {String} path The base URL to invoke. + * @param {String} httpMethod The HTTP method to use. + * @param {Object.} pathParams A map of path parameters and their values. + * @param {Object.} queryParams A map of query parameters and their values. + * @param {Object.} headerParams A map of header parameters and their values. + * @param {Object.} formParams A map of form parameters and their values. + * @param {Object} bodyParam The value to pass as the request body. + * @param {Array.} authNames An array of authentication type names. + * @param {Array.} contentTypes An array of request MIME types. + * @param {Array.} accepts An array of acceptable response MIME types. + * @param {(String|Array|ObjectFunction)} returnType The required type to return; can be a string for simple types or the + * constructor for a complex type. + * @param {String} apiBasePath base path defined in the operation/path level to override the default one + * @param {module:ApiClient~callApiCallback} callback The callback function. + * @returns {Object} The SuperAgent request object. + */ + callApi(path, httpMethod, pathParams, + queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts, + returnType, apiBasePath, callback) { + + var url = this.buildUrl(path, pathParams, apiBasePath); + var request = superagent(httpMethod, url); + + if (this.plugins !== null) { + for (var index in this.plugins) { + if (this.plugins.hasOwnProperty(index)) { + request.use(this.plugins[index]) + } + } + } + + // apply authentications + this.applyAuthToRequest(request, authNames); + + // set query parameters + if (httpMethod.toUpperCase() === 'GET' && this.cache === false) { + queryParams['_'] = new Date().getTime(); + } + + request.query(this.normalizeParams(queryParams)); + + // set header parameters + request.set(this.defaultHeaders).set(this.normalizeParams(headerParams)); + + // set requestAgent if it is set by user + if (this.requestAgent) { + request.agent(this.requestAgent); + } + + // set request timeout + request.timeout(this.timeout); + + var contentType = this.jsonPreferredMime(contentTypes); + if (contentType) { + // Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746) + if(contentType != 'multipart/form-data') { + request.type(contentType); + } + } + + if (contentType === 'application/x-www-form-urlencoded') { + request.send(querystring.stringify(this.normalizeParams(formParams))); + } else if (contentType == 'multipart/form-data') { + var _formParams = this.normalizeParams(formParams); + for (var key in _formParams) { + if (_formParams.hasOwnProperty(key)) { + let _formParamsValue = _formParams[key]; + if (this.isFileParam(_formParamsValue)) { + // file field + request.attach(key, _formParamsValue); + } else if (Array.isArray(_formParamsValue) && _formParamsValue.length + && this.isFileParam(_formParamsValue[0])) { + // multiple files + _formParamsValue.forEach(file => request.attach(key, file)); + } else { + request.field(key, _formParamsValue); + } + } + } + } else if (bodyParam !== null && bodyParam !== undefined) { + if (!request.header['Content-Type']) { + request.type('application/json'); + } + request.send(bodyParam); + } + + var accept = this.jsonPreferredMime(accepts); + if (accept) { + request.accept(accept); + } + + if (returnType === 'Blob') { + request.responseType('blob'); + } else if (returnType === 'String') { + request.responseType('text'); + } + + // Attach previously saved cookies, if enabled + if (this.enableCookies){ + if (typeof window === 'undefined') { + this.agent._attachCookies(request); + } + else { + request.withCredentials(); + } + } + + request.end((error, response) => { + if (callback) { + var data = null; + if (!error) { + try { + data = this.deserialize(response, returnType); + if (this.enableCookies && typeof window === 'undefined'){ + this.agent._saveCookies(response); + } + } catch (err) { + error = err; + } + } + + callback(error, data, response); + } + }); + + return request; + } + + /** + * Parses an ISO-8601 string representation or epoch representation of a date value. + * @param {String} str The date value as a string. + * @returns {Date} The parsed date object. + */ + static parseDate(str) { + if (isNaN(str)) { + return new Date(str.replace(/(\d)(T)(\d)/i, '$1 $3')); + } + return new Date(+str); + } + + /** + * Converts a value to the specified type. + * @param {(String|Object)} data The data to convert, as a string or object. + * @param {(String|Array.|Object.|Function)} type The type to return. Pass a string for simple types + * or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To + * return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type: + * all properties on data will be converted to this type. + * @returns An instance of the specified type or null or undefined if data is null or undefined. + */ + static convertToType(data, type) { + if (data === null || data === undefined) + return data + + switch (type) { + case 'Boolean': + return Boolean(data); + case 'Integer': + return parseInt(data, 10); + case 'Number': + return parseFloat(data); + case 'String': + return String(data); + case 'Date': + return ApiClient.parseDate(String(data)); + case 'Blob': + return data; + default: + if (type === Object) { + // generic object, return directly + return data; + } else if (typeof type.constructFromObject === 'function') { + // for model type like User and enum class + return type.constructFromObject(data); + } else if (Array.isArray(type)) { + // for array type like: ['String'] + var itemType = type[0]; + + return data.map((item) => { + return ApiClient.convertToType(item, itemType); + }); + } else if (typeof type === 'object') { + // for plain object type like: {'String': 'Integer'} + var keyType, valueType; + for (var k in type) { + if (type.hasOwnProperty(k)) { + keyType = k; + valueType = type[k]; + break; + } + } + + var result = {}; + for (var k in data) { + if (data.hasOwnProperty(k)) { + var key = ApiClient.convertToType(k, keyType); + var value = ApiClient.convertToType(data[k], valueType); + result[key] = value; + } + } + + return result; + } else { + // for unknown type, return the data directly + return data; + } + } + } + + /** + * Gets an array of host settings + * @returns An array of host settings + */ + hostSettings() { + return [ + { + 'url': "", + 'description': "No description provided", + } + ]; + } + + getBasePathFromSettings(index, variables={}) { + var servers = this.hostSettings(); + + // check array index out of bound + if (index < 0 || index >= servers.length) { + throw new Error("Invalid index " + index + " when selecting the host settings. Must be less than " + servers.length); + } + + var server = servers[index]; + var url = server['url']; + + // go through variable and assign a value + for (var variable_name in server['variables']) { + if (variable_name in variables) { + let variable = server['variables'][variable_name]; + if ( !('enum_values' in variable) || variable['enum_values'].includes(variables[variable_name]) ) { + url = url.replace("{" + variable_name + "}", variables[variable_name]); + } else { + throw new Error("The variable `" + variable_name + "` in the host URL has invalid value " + variables[variable_name] + ". Must be " + server['variables'][variable_name]['enum_values'] + "."); + } + } else { + // use default value + url = url.replace("{" + variable_name + "}", server['variables'][variable_name]['default_value']) + } + } + return url; + } + + /** + * Constructs a new map or array model from REST data. + * @param data {Object|Array} The REST data. + * @param obj {Object|Array} The target object or array. + */ + static constructFromObject(data, obj, itemType) { + if (Array.isArray(data)) { + for (var i = 0; i < data.length; i++) { + if (data.hasOwnProperty(i)) + obj[i] = ApiClient.convertToType(data[i], itemType); + } + } else { + for (var k in data) { + if (data.hasOwnProperty(k)) + obj[k] = ApiClient.convertToType(data[k], itemType); + } + } + }; +} + +/** + * Enumeration of collection format separator strategies. + * @enum {String} + * @readonly + */ +ApiClient.CollectionFormatEnum = { + /** + * Comma-separated values. Value: csv + * @const + */ + CSV: ',', + + /** + * Space-separated values. Value: ssv + * @const + */ + SSV: ' ', + + /** + * Tab-separated values. Value: tsv + * @const + */ + TSV: '\t', + + /** + * Pipe(|)-separated values. Value: pipes + * @const + */ + PIPES: '|', + + /** + * Native array. Value: multi + * @const + */ + MULTI: 'multi' +}; + +/** +* The default API client implementation. +* @type {module:ApiClient} +*/ +ApiClient.instance = new ApiClient(); +export default ApiClient; diff --git a/agent/agent-ui/src/api/src/api/AgentApi.js b/agent/agent-ui/src/api/src/api/AgentApi.js new file mode 100644 index 00000000..28b8fca7 --- /dev/null +++ b/agent/agent-ui/src/api/src/api/AgentApi.js @@ -0,0 +1,110 @@ +/** + * agent/agentGrpc/agent.proto + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + + +import ApiClient from "../ApiClient"; +import RpcStatus from '../model/RpcStatus'; +import StatusResponse from '../model/StatusResponse'; +import VersionResponse from '../model/VersionResponse'; + +/** +* Agent service. +* @module api/AgentApi +* @version version not set +*/ +export default class AgentApi { + + /** + * Constructs a new AgentApi. + * @alias module:api/AgentApi + * @class + * @param {module:ApiClient} [apiClient] Optional API client implementation to use, + * default to {@link module:ApiClient#instance} if unspecified. + */ + constructor(apiClient) { + this.apiClient = apiClient || ApiClient.instance; + } + + + /** + * Callback function to receive the result of the agentStatus operation. + * @callback module:api/AgentApi~agentStatusCallback + * @param {String} error Error message, if any. + * @param {module:model/StatusResponse} data The data returned by the service call. + * @param {String} response The complete HTTP response. + */ + + /** + * @param {module:api/AgentApi~agentStatusCallback} callback The callback function, accepting three arguments: error, data, response + * data is of type: {@link module:model/StatusResponse} + */ + agentStatus(callback) { + let postBody = null; + + let pathParams = { + }; + let queryParams = { + }; + let headerParams = { + }; + let formParams = { + }; + + let authNames = []; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = StatusResponse; + return this.apiClient.callApi( + '/v1/agent/status', 'GET', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, null, callback + ); + } + + /** + * Callback function to receive the result of the agentVersion operation. + * @callback module:api/AgentApi~agentVersionCallback + * @param {String} error Error message, if any. + * @param {module:model/VersionResponse} data The data returned by the service call. + * @param {String} response The complete HTTP response. + */ + + /** + * @param {module:api/AgentApi~agentVersionCallback} callback The callback function, accepting three arguments: error, data, response + * data is of type: {@link module:model/VersionResponse} + */ + agentVersion(callback) { + let postBody = null; + + let pathParams = { + }; + let queryParams = { + }; + let headerParams = { + }; + let formParams = { + }; + + let authNames = []; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = VersionResponse; + return this.apiClient.callApi( + '/v1/agent/version', 'GET', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, null, callback + ); + } + + +} diff --git a/agent/agent-ui/src/api/src/index.js b/agent/agent-ui/src/api/src/index.js new file mode 100644 index 00000000..c8dba708 --- /dev/null +++ b/agent/agent-ui/src/api/src/index.js @@ -0,0 +1,132 @@ +/** + * agent/agentGrpc/agent.proto + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + + +import ApiClient from './ApiClient'; +import AccessDetail from './model/AccessDetail'; +import AccessPrivateResponse from './model/AccessPrivateResponse'; +import ProtobufAny from './model/ProtobufAny'; +import RpcStatus from './model/RpcStatus'; +import ShareDetail from './model/ShareDetail'; +import SharePrivateResponse from './model/SharePrivateResponse'; +import SharePublicResponse from './model/SharePublicResponse'; +import ShareReservedResponse from './model/ShareReservedResponse'; +import StatusResponse from './model/StatusResponse'; +import VersionResponse from './model/VersionResponse'; +import AgentApi from './api/AgentApi'; + + +/** +* JS API client generated by OpenAPI Generator.
+* The index module provides access to constructors for all the classes which comprise the public API. +*

+* An AMD (recommended!) or CommonJS application will generally do something equivalent to the following: +*

+* var AgentAgentGrpcAgentProto = require('index'); // See note below*.
+* var xxxSvc = new AgentAgentGrpcAgentProto.XxxApi(); // Allocate the API class we're going to use.
+* var yyyModel = new AgentAgentGrpcAgentProto.Yyy(); // Construct a model instance.
+* yyyModel.someProperty = 'someValue';
+* ...
+* var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
+* ...
+* 
+* *NOTE: For a top-level AMD script, use require(['index'], function(){...}) +* and put the application logic within the callback function. +*

+*

+* A non-AMD browser application (discouraged) might do something like this: +*

+* var xxxSvc = new AgentAgentGrpcAgentProto.XxxApi(); // Allocate the API class we're going to use.
+* var yyy = new AgentAgentGrpcAgentProto.Yyy(); // Construct a model instance.
+* yyyModel.someProperty = 'someValue';
+* ...
+* var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
+* ...
+* 
+*

+* @module index +* @version version not set +*/ +export { + /** + * The ApiClient constructor. + * @property {module:ApiClient} + */ + ApiClient, + + /** + * The AccessDetail model constructor. + * @property {module:model/AccessDetail} + */ + AccessDetail, + + /** + * The AccessPrivateResponse model constructor. + * @property {module:model/AccessPrivateResponse} + */ + AccessPrivateResponse, + + /** + * The ProtobufAny model constructor. + * @property {module:model/ProtobufAny} + */ + ProtobufAny, + + /** + * The RpcStatus model constructor. + * @property {module:model/RpcStatus} + */ + RpcStatus, + + /** + * The ShareDetail model constructor. + * @property {module:model/ShareDetail} + */ + ShareDetail, + + /** + * The SharePrivateResponse model constructor. + * @property {module:model/SharePrivateResponse} + */ + SharePrivateResponse, + + /** + * The SharePublicResponse model constructor. + * @property {module:model/SharePublicResponse} + */ + SharePublicResponse, + + /** + * The ShareReservedResponse model constructor. + * @property {module:model/ShareReservedResponse} + */ + ShareReservedResponse, + + /** + * The StatusResponse model constructor. + * @property {module:model/StatusResponse} + */ + StatusResponse, + + /** + * The VersionResponse model constructor. + * @property {module:model/VersionResponse} + */ + VersionResponse, + + /** + * The AgentApi service constructor. + * @property {module:api/AgentApi} + */ + AgentApi +}; diff --git a/agent/agent-ui/src/api/src/model/AccessDetail.js b/agent/agent-ui/src/api/src/model/AccessDetail.js new file mode 100644 index 00000000..db049b72 --- /dev/null +++ b/agent/agent-ui/src/api/src/model/AccessDetail.js @@ -0,0 +1,123 @@ +/** + * agent/agentGrpc/agent.proto + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; + +/** + * The AccessDetail model module. + * @module model/AccessDetail + * @version version not set + */ +class AccessDetail { + /** + * Constructs a new AccessDetail. + * @alias module:model/AccessDetail + */ + constructor() { + + AccessDetail.initialize(this); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj) { + } + + /** + * Constructs a AccessDetail from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/AccessDetail} obj Optional instance to populate. + * @return {module:model/AccessDetail} The populated AccessDetail instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new AccessDetail(); + + if (data.hasOwnProperty('frontendToken')) { + obj['frontendToken'] = ApiClient.convertToType(data['frontendToken'], 'String'); + } + if (data.hasOwnProperty('token')) { + obj['token'] = ApiClient.convertToType(data['token'], 'String'); + } + if (data.hasOwnProperty('bindAddress')) { + obj['bindAddress'] = ApiClient.convertToType(data['bindAddress'], 'String'); + } + if (data.hasOwnProperty('responseHeaders')) { + obj['responseHeaders'] = ApiClient.convertToType(data['responseHeaders'], ['String']); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to AccessDetail. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to AccessDetail. + */ + static validateJSON(data) { + // ensure the json data is a string + if (data['frontendToken'] && !(typeof data['frontendToken'] === 'string' || data['frontendToken'] instanceof String)) { + throw new Error("Expected the field `frontendToken` to be a primitive type in the JSON string but got " + data['frontendToken']); + } + // ensure the json data is a string + if (data['token'] && !(typeof data['token'] === 'string' || data['token'] instanceof String)) { + throw new Error("Expected the field `token` to be a primitive type in the JSON string but got " + data['token']); + } + // ensure the json data is a string + if (data['bindAddress'] && !(typeof data['bindAddress'] === 'string' || data['bindAddress'] instanceof String)) { + throw new Error("Expected the field `bindAddress` to be a primitive type in the JSON string but got " + data['bindAddress']); + } + // ensure the json data is an array + if (!Array.isArray(data['responseHeaders'])) { + throw new Error("Expected the field `responseHeaders` to be an array in the JSON data but got " + data['responseHeaders']); + } + + return true; + } + + +} + + + +/** + * @member {String} frontendToken + */ +AccessDetail.prototype['frontendToken'] = undefined; + +/** + * @member {String} token + */ +AccessDetail.prototype['token'] = undefined; + +/** + * @member {String} bindAddress + */ +AccessDetail.prototype['bindAddress'] = undefined; + +/** + * @member {Array.} responseHeaders + */ +AccessDetail.prototype['responseHeaders'] = undefined; + + + + + + +export default AccessDetail; + diff --git a/agent/agent-ui/src/api/src/model/AccessPrivateResponse.js b/agent/agent-ui/src/api/src/model/AccessPrivateResponse.js new file mode 100644 index 00000000..df4d96fe --- /dev/null +++ b/agent/agent-ui/src/api/src/model/AccessPrivateResponse.js @@ -0,0 +1,87 @@ +/** + * agent/agentGrpc/agent.proto + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; + +/** + * The AccessPrivateResponse model module. + * @module model/AccessPrivateResponse + * @version version not set + */ +class AccessPrivateResponse { + /** + * Constructs a new AccessPrivateResponse. + * @alias module:model/AccessPrivateResponse + */ + constructor() { + + AccessPrivateResponse.initialize(this); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj) { + } + + /** + * Constructs a AccessPrivateResponse from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/AccessPrivateResponse} obj Optional instance to populate. + * @return {module:model/AccessPrivateResponse} The populated AccessPrivateResponse instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new AccessPrivateResponse(); + + if (data.hasOwnProperty('frontendToken')) { + obj['frontendToken'] = ApiClient.convertToType(data['frontendToken'], 'String'); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to AccessPrivateResponse. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to AccessPrivateResponse. + */ + static validateJSON(data) { + // ensure the json data is a string + if (data['frontendToken'] && !(typeof data['frontendToken'] === 'string' || data['frontendToken'] instanceof String)) { + throw new Error("Expected the field `frontendToken` to be a primitive type in the JSON string but got " + data['frontendToken']); + } + + return true; + } + + +} + + + +/** + * @member {String} frontendToken + */ +AccessPrivateResponse.prototype['frontendToken'] = undefined; + + + + + + +export default AccessPrivateResponse; + diff --git a/agent/agent-ui/src/api/src/model/ProtobufAny.js b/agent/agent-ui/src/api/src/model/ProtobufAny.js new file mode 100644 index 00000000..dec26173 --- /dev/null +++ b/agent/agent-ui/src/api/src/model/ProtobufAny.js @@ -0,0 +1,91 @@ +/** + * agent/agentGrpc/agent.proto + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; + +/** + * The ProtobufAny model module. + * @module model/ProtobufAny + * @version version not set + */ +class ProtobufAny { + /** + * Constructs a new ProtobufAny. + * @alias module:model/ProtobufAny + * @extends Object + */ + constructor() { + + ProtobufAny.initialize(this); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj) { + } + + /** + * Constructs a ProtobufAny from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/ProtobufAny} obj Optional instance to populate. + * @return {module:model/ProtobufAny} The populated ProtobufAny instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ProtobufAny(); + + ApiClient.constructFromObject(data, obj, 'Object'); + + + if (data.hasOwnProperty('@type')) { + obj['@type'] = ApiClient.convertToType(data['@type'], 'String'); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to ProtobufAny. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ProtobufAny. + */ + static validateJSON(data) { + // ensure the json data is a string + if (data['@type'] && !(typeof data['@type'] === 'string' || data['@type'] instanceof String)) { + throw new Error("Expected the field `@type` to be a primitive type in the JSON string but got " + data['@type']); + } + + return true; + } + + +} + + + +/** + * @member {String} @type + */ +ProtobufAny.prototype['@type'] = undefined; + + + + + + +export default ProtobufAny; + diff --git a/agent/agent-ui/src/api/src/model/RpcStatus.js b/agent/agent-ui/src/api/src/model/RpcStatus.js new file mode 100644 index 00000000..66db9520 --- /dev/null +++ b/agent/agent-ui/src/api/src/model/RpcStatus.js @@ -0,0 +1,108 @@ +/** + * agent/agentGrpc/agent.proto + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; +import ProtobufAny from './ProtobufAny'; + +/** + * The RpcStatus model module. + * @module model/RpcStatus + * @version version not set + */ +class RpcStatus { + /** + * Constructs a new RpcStatus. + * @alias module:model/RpcStatus + */ + constructor() { + + RpcStatus.initialize(this); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj) { + } + + /** + * Constructs a RpcStatus from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/RpcStatus} obj Optional instance to populate. + * @return {module:model/RpcStatus} The populated RpcStatus instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new RpcStatus(); + + if (data.hasOwnProperty('code')) { + obj['code'] = ApiClient.convertToType(data['code'], 'Number'); + } + if (data.hasOwnProperty('message')) { + obj['message'] = ApiClient.convertToType(data['message'], 'String'); + } + if (data.hasOwnProperty('details')) { + obj['details'] = ApiClient.convertToType(data['details'], [ProtobufAny]); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to RpcStatus. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to RpcStatus. + */ + static validateJSON(data) { + // ensure the json data is a string + if (data['message'] && !(typeof data['message'] === 'string' || data['message'] instanceof String)) { + throw new Error("Expected the field `message` to be a primitive type in the JSON string but got " + data['message']); + } + // ensure the json data is an array + if (!Array.isArray(data['details'])) { + throw new Error("Expected the field `details` to be an array in the JSON data but got " + data['details']); + } + + return true; + } + + +} + + + +/** + * @member {Number} code + */ +RpcStatus.prototype['code'] = undefined; + +/** + * @member {String} message + */ +RpcStatus.prototype['message'] = undefined; + +/** + * @member {Array.} details + */ +RpcStatus.prototype['details'] = undefined; + + + + + + +export default RpcStatus; + diff --git a/agent/agent-ui/src/api/src/model/ShareDetail.js b/agent/agent-ui/src/api/src/model/ShareDetail.js new file mode 100644 index 00000000..84590fd0 --- /dev/null +++ b/agent/agent-ui/src/api/src/model/ShareDetail.js @@ -0,0 +1,163 @@ +/** + * agent/agentGrpc/agent.proto + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; + +/** + * The ShareDetail model module. + * @module model/ShareDetail + * @version version not set + */ +class ShareDetail { + /** + * Constructs a new ShareDetail. + * @alias module:model/ShareDetail + */ + constructor() { + + ShareDetail.initialize(this); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj) { + } + + /** + * Constructs a ShareDetail from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/ShareDetail} obj Optional instance to populate. + * @return {module:model/ShareDetail} The populated ShareDetail instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ShareDetail(); + + if (data.hasOwnProperty('token')) { + obj['token'] = ApiClient.convertToType(data['token'], 'String'); + } + if (data.hasOwnProperty('shareMode')) { + obj['shareMode'] = ApiClient.convertToType(data['shareMode'], 'String'); + } + if (data.hasOwnProperty('backendMode')) { + obj['backendMode'] = ApiClient.convertToType(data['backendMode'], 'String'); + } + if (data.hasOwnProperty('reserved')) { + obj['reserved'] = ApiClient.convertToType(data['reserved'], 'Boolean'); + } + if (data.hasOwnProperty('frontendEndpoint')) { + obj['frontendEndpoint'] = ApiClient.convertToType(data['frontendEndpoint'], ['String']); + } + if (data.hasOwnProperty('backendEndpoint')) { + obj['backendEndpoint'] = ApiClient.convertToType(data['backendEndpoint'], 'String'); + } + if (data.hasOwnProperty('closed')) { + obj['closed'] = ApiClient.convertToType(data['closed'], 'Boolean'); + } + if (data.hasOwnProperty('status')) { + obj['status'] = ApiClient.convertToType(data['status'], 'String'); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to ShareDetail. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ShareDetail. + */ + static validateJSON(data) { + // ensure the json data is a string + if (data['token'] && !(typeof data['token'] === 'string' || data['token'] instanceof String)) { + throw new Error("Expected the field `token` to be a primitive type in the JSON string but got " + data['token']); + } + // ensure the json data is a string + if (data['shareMode'] && !(typeof data['shareMode'] === 'string' || data['shareMode'] instanceof String)) { + throw new Error("Expected the field `shareMode` to be a primitive type in the JSON string but got " + data['shareMode']); + } + // ensure the json data is a string + if (data['backendMode'] && !(typeof data['backendMode'] === 'string' || data['backendMode'] instanceof String)) { + throw new Error("Expected the field `backendMode` to be a primitive type in the JSON string but got " + data['backendMode']); + } + // ensure the json data is an array + if (!Array.isArray(data['frontendEndpoint'])) { + throw new Error("Expected the field `frontendEndpoint` to be an array in the JSON data but got " + data['frontendEndpoint']); + } + // ensure the json data is a string + if (data['backendEndpoint'] && !(typeof data['backendEndpoint'] === 'string' || data['backendEndpoint'] instanceof String)) { + throw new Error("Expected the field `backendEndpoint` to be a primitive type in the JSON string but got " + data['backendEndpoint']); + } + // ensure the json data is a string + if (data['status'] && !(typeof data['status'] === 'string' || data['status'] instanceof String)) { + throw new Error("Expected the field `status` to be a primitive type in the JSON string but got " + data['status']); + } + + return true; + } + + +} + + + +/** + * @member {String} token + */ +ShareDetail.prototype['token'] = undefined; + +/** + * @member {String} shareMode + */ +ShareDetail.prototype['shareMode'] = undefined; + +/** + * @member {String} backendMode + */ +ShareDetail.prototype['backendMode'] = undefined; + +/** + * @member {Boolean} reserved + */ +ShareDetail.prototype['reserved'] = undefined; + +/** + * @member {Array.} frontendEndpoint + */ +ShareDetail.prototype['frontendEndpoint'] = undefined; + +/** + * @member {String} backendEndpoint + */ +ShareDetail.prototype['backendEndpoint'] = undefined; + +/** + * @member {Boolean} closed + */ +ShareDetail.prototype['closed'] = undefined; + +/** + * @member {String} status + */ +ShareDetail.prototype['status'] = undefined; + + + + + + +export default ShareDetail; + diff --git a/agent/agent-ui/src/api/src/model/SharePrivateResponse.js b/agent/agent-ui/src/api/src/model/SharePrivateResponse.js new file mode 100644 index 00000000..57be53e8 --- /dev/null +++ b/agent/agent-ui/src/api/src/model/SharePrivateResponse.js @@ -0,0 +1,87 @@ +/** + * agent/agentGrpc/agent.proto + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; + +/** + * The SharePrivateResponse model module. + * @module model/SharePrivateResponse + * @version version not set + */ +class SharePrivateResponse { + /** + * Constructs a new SharePrivateResponse. + * @alias module:model/SharePrivateResponse + */ + constructor() { + + SharePrivateResponse.initialize(this); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj) { + } + + /** + * Constructs a SharePrivateResponse from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/SharePrivateResponse} obj Optional instance to populate. + * @return {module:model/SharePrivateResponse} The populated SharePrivateResponse instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new SharePrivateResponse(); + + if (data.hasOwnProperty('token')) { + obj['token'] = ApiClient.convertToType(data['token'], 'String'); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to SharePrivateResponse. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to SharePrivateResponse. + */ + static validateJSON(data) { + // ensure the json data is a string + if (data['token'] && !(typeof data['token'] === 'string' || data['token'] instanceof String)) { + throw new Error("Expected the field `token` to be a primitive type in the JSON string but got " + data['token']); + } + + return true; + } + + +} + + + +/** + * @member {String} token + */ +SharePrivateResponse.prototype['token'] = undefined; + + + + + + +export default SharePrivateResponse; + diff --git a/agent/agent-ui/src/api/src/model/SharePublicResponse.js b/agent/agent-ui/src/api/src/model/SharePublicResponse.js new file mode 100644 index 00000000..cf1c724c --- /dev/null +++ b/agent/agent-ui/src/api/src/model/SharePublicResponse.js @@ -0,0 +1,99 @@ +/** + * agent/agentGrpc/agent.proto + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; + +/** + * The SharePublicResponse model module. + * @module model/SharePublicResponse + * @version version not set + */ +class SharePublicResponse { + /** + * Constructs a new SharePublicResponse. + * @alias module:model/SharePublicResponse + */ + constructor() { + + SharePublicResponse.initialize(this); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj) { + } + + /** + * Constructs a SharePublicResponse from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/SharePublicResponse} obj Optional instance to populate. + * @return {module:model/SharePublicResponse} The populated SharePublicResponse instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new SharePublicResponse(); + + if (data.hasOwnProperty('token')) { + obj['token'] = ApiClient.convertToType(data['token'], 'String'); + } + if (data.hasOwnProperty('frontendEndpoints')) { + obj['frontendEndpoints'] = ApiClient.convertToType(data['frontendEndpoints'], ['String']); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to SharePublicResponse. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to SharePublicResponse. + */ + static validateJSON(data) { + // ensure the json data is a string + if (data['token'] && !(typeof data['token'] === 'string' || data['token'] instanceof String)) { + throw new Error("Expected the field `token` to be a primitive type in the JSON string but got " + data['token']); + } + // ensure the json data is an array + if (!Array.isArray(data['frontendEndpoints'])) { + throw new Error("Expected the field `frontendEndpoints` to be an array in the JSON data but got " + data['frontendEndpoints']); + } + + return true; + } + + +} + + + +/** + * @member {String} token + */ +SharePublicResponse.prototype['token'] = undefined; + +/** + * @member {Array.} frontendEndpoints + */ +SharePublicResponse.prototype['frontendEndpoints'] = undefined; + + + + + + +export default SharePublicResponse; + diff --git a/agent/agent-ui/src/api/src/model/ShareReservedResponse.js b/agent/agent-ui/src/api/src/model/ShareReservedResponse.js new file mode 100644 index 00000000..357bf522 --- /dev/null +++ b/agent/agent-ui/src/api/src/model/ShareReservedResponse.js @@ -0,0 +1,135 @@ +/** + * agent/agentGrpc/agent.proto + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; + +/** + * The ShareReservedResponse model module. + * @module model/ShareReservedResponse + * @version version not set + */ +class ShareReservedResponse { + /** + * Constructs a new ShareReservedResponse. + * @alias module:model/ShareReservedResponse + */ + constructor() { + + ShareReservedResponse.initialize(this); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj) { + } + + /** + * Constructs a ShareReservedResponse from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/ShareReservedResponse} obj Optional instance to populate. + * @return {module:model/ShareReservedResponse} The populated ShareReservedResponse instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ShareReservedResponse(); + + if (data.hasOwnProperty('token')) { + obj['token'] = ApiClient.convertToType(data['token'], 'String'); + } + if (data.hasOwnProperty('backendMode')) { + obj['backendMode'] = ApiClient.convertToType(data['backendMode'], 'String'); + } + if (data.hasOwnProperty('shareMode')) { + obj['shareMode'] = ApiClient.convertToType(data['shareMode'], 'String'); + } + if (data.hasOwnProperty('frontendEndpoints')) { + obj['frontendEndpoints'] = ApiClient.convertToType(data['frontendEndpoints'], ['String']); + } + if (data.hasOwnProperty('target')) { + obj['target'] = ApiClient.convertToType(data['target'], 'String'); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to ShareReservedResponse. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to ShareReservedResponse. + */ + static validateJSON(data) { + // ensure the json data is a string + if (data['token'] && !(typeof data['token'] === 'string' || data['token'] instanceof String)) { + throw new Error("Expected the field `token` to be a primitive type in the JSON string but got " + data['token']); + } + // ensure the json data is a string + if (data['backendMode'] && !(typeof data['backendMode'] === 'string' || data['backendMode'] instanceof String)) { + throw new Error("Expected the field `backendMode` to be a primitive type in the JSON string but got " + data['backendMode']); + } + // ensure the json data is a string + if (data['shareMode'] && !(typeof data['shareMode'] === 'string' || data['shareMode'] instanceof String)) { + throw new Error("Expected the field `shareMode` to be a primitive type in the JSON string but got " + data['shareMode']); + } + // ensure the json data is an array + if (!Array.isArray(data['frontendEndpoints'])) { + throw new Error("Expected the field `frontendEndpoints` to be an array in the JSON data but got " + data['frontendEndpoints']); + } + // ensure the json data is a string + if (data['target'] && !(typeof data['target'] === 'string' || data['target'] instanceof String)) { + throw new Error("Expected the field `target` to be a primitive type in the JSON string but got " + data['target']); + } + + return true; + } + + +} + + + +/** + * @member {String} token + */ +ShareReservedResponse.prototype['token'] = undefined; + +/** + * @member {String} backendMode + */ +ShareReservedResponse.prototype['backendMode'] = undefined; + +/** + * @member {String} shareMode + */ +ShareReservedResponse.prototype['shareMode'] = undefined; + +/** + * @member {Array.} frontendEndpoints + */ +ShareReservedResponse.prototype['frontendEndpoints'] = undefined; + +/** + * @member {String} target + */ +ShareReservedResponse.prototype['target'] = undefined; + + + + + + +export default ShareReservedResponse; + diff --git a/agent/agent-ui/src/api/src/model/StatusResponse.js b/agent/agent-ui/src/api/src/model/StatusResponse.js new file mode 100644 index 00000000..ed4eaf51 --- /dev/null +++ b/agent/agent-ui/src/api/src/model/StatusResponse.js @@ -0,0 +1,113 @@ +/** + * agent/agentGrpc/agent.proto + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; +import AccessDetail from './AccessDetail'; +import ShareDetail from './ShareDetail'; + +/** + * The StatusResponse model module. + * @module model/StatusResponse + * @version version not set + */ +class StatusResponse { + /** + * Constructs a new StatusResponse. + * @alias module:model/StatusResponse + */ + constructor() { + + StatusResponse.initialize(this); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj) { + } + + /** + * Constructs a StatusResponse from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/StatusResponse} obj Optional instance to populate. + * @return {module:model/StatusResponse} The populated StatusResponse instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new StatusResponse(); + + if (data.hasOwnProperty('accesses')) { + obj['accesses'] = ApiClient.convertToType(data['accesses'], [AccessDetail]); + } + if (data.hasOwnProperty('shares')) { + obj['shares'] = ApiClient.convertToType(data['shares'], [ShareDetail]); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to StatusResponse. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to StatusResponse. + */ + static validateJSON(data) { + if (data['accesses']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['accesses'])) { + throw new Error("Expected the field `accesses` to be an array in the JSON data but got " + data['accesses']); + } + // validate the optional field `accesses` (array) + for (const item of data['accesses']) { + AccessDetail.validateJSON(item); + }; + } + if (data['shares']) { // data not null + // ensure the json data is an array + if (!Array.isArray(data['shares'])) { + throw new Error("Expected the field `shares` to be an array in the JSON data but got " + data['shares']); + } + // validate the optional field `shares` (array) + for (const item of data['shares']) { + ShareDetail.validateJSON(item); + }; + } + + return true; + } + + +} + + + +/** + * @member {Array.} accesses + */ +StatusResponse.prototype['accesses'] = undefined; + +/** + * @member {Array.} shares + */ +StatusResponse.prototype['shares'] = undefined; + + + + + + +export default StatusResponse; + diff --git a/agent/agent-ui/src/api/src/model/VersionResponse.js b/agent/agent-ui/src/api/src/model/VersionResponse.js new file mode 100644 index 00000000..c717d2c9 --- /dev/null +++ b/agent/agent-ui/src/api/src/model/VersionResponse.js @@ -0,0 +1,87 @@ +/** + * agent/agentGrpc/agent.proto + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; + +/** + * The VersionResponse model module. + * @module model/VersionResponse + * @version version not set + */ +class VersionResponse { + /** + * Constructs a new VersionResponse. + * @alias module:model/VersionResponse + */ + constructor() { + + VersionResponse.initialize(this); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj) { + } + + /** + * Constructs a VersionResponse from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/VersionResponse} obj Optional instance to populate. + * @return {module:model/VersionResponse} The populated VersionResponse instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new VersionResponse(); + + if (data.hasOwnProperty('v')) { + obj['v'] = ApiClient.convertToType(data['v'], 'String'); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to VersionResponse. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to VersionResponse. + */ + static validateJSON(data) { + // ensure the json data is a string + if (data['v'] && !(typeof data['v'] === 'string' || data['v'] instanceof String)) { + throw new Error("Expected the field `v` to be a primitive type in the JSON string but got " + data['v']); + } + + return true; + } + + +} + + + +/** + * @member {String} v + */ +VersionResponse.prototype['v'] = undefined; + + + + + + +export default VersionResponse; + diff --git a/agent/agent-ui/src/api/test/api/AgentApi.spec.js b/agent/agent-ui/src/api/test/api/AgentApi.spec.js new file mode 100644 index 00000000..8b1e7883 --- /dev/null +++ b/agent/agent-ui/src/api/test/api/AgentApi.spec.js @@ -0,0 +1,73 @@ +/** + * agent/agentGrpc/agent.proto + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.AgentAgentGrpcAgentProto); + } +}(this, function(expect, AgentAgentGrpcAgentProto) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new AgentAgentGrpcAgentProto.AgentApi(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('AgentApi', function() { + describe('agentStatus', function() { + it('should call agentStatus successfully', function(done) { + //uncomment below and update the code to test agentStatus + //instance.agentStatus(function(error) { + // if (error) throw error; + //expect().to.be(); + //}); + done(); + }); + }); + describe('agentVersion', function() { + it('should call agentVersion successfully', function(done) { + //uncomment below and update the code to test agentVersion + //instance.agentVersion(function(error) { + // if (error) throw error; + //expect().to.be(); + //}); + done(); + }); + }); + }); + +})); diff --git a/agent/agent-ui/src/api/test/model/AccessDetail.spec.js b/agent/agent-ui/src/api/test/model/AccessDetail.spec.js new file mode 100644 index 00000000..465a3167 --- /dev/null +++ b/agent/agent-ui/src/api/test/model/AccessDetail.spec.js @@ -0,0 +1,83 @@ +/** + * agent/agentGrpc/agent.proto + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.AgentAgentGrpcAgentProto); + } +}(this, function(expect, AgentAgentGrpcAgentProto) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new AgentAgentGrpcAgentProto.AccessDetail(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('AccessDetail', function() { + it('should create an instance of AccessDetail', function() { + // uncomment below and update the code to test AccessDetail + //var instance = new AgentAgentGrpcAgentProto.AccessDetail(); + //expect(instance).to.be.a(AgentAgentGrpcAgentProto.AccessDetail); + }); + + it('should have the property frontendToken (base name: "frontendToken")', function() { + // uncomment below and update the code to test the property frontendToken + //var instance = new AgentAgentGrpcAgentProto.AccessDetail(); + //expect(instance).to.be(); + }); + + it('should have the property token (base name: "token")', function() { + // uncomment below and update the code to test the property token + //var instance = new AgentAgentGrpcAgentProto.AccessDetail(); + //expect(instance).to.be(); + }); + + it('should have the property bindAddress (base name: "bindAddress")', function() { + // uncomment below and update the code to test the property bindAddress + //var instance = new AgentAgentGrpcAgentProto.AccessDetail(); + //expect(instance).to.be(); + }); + + it('should have the property responseHeaders (base name: "responseHeaders")', function() { + // uncomment below and update the code to test the property responseHeaders + //var instance = new AgentAgentGrpcAgentProto.AccessDetail(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/agent/agent-ui/src/api/test/model/AccessPrivateResponse.spec.js b/agent/agent-ui/src/api/test/model/AccessPrivateResponse.spec.js new file mode 100644 index 00000000..bcbbf7e7 --- /dev/null +++ b/agent/agent-ui/src/api/test/model/AccessPrivateResponse.spec.js @@ -0,0 +1,65 @@ +/** + * agent/agentGrpc/agent.proto + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.AgentAgentGrpcAgentProto); + } +}(this, function(expect, AgentAgentGrpcAgentProto) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new AgentAgentGrpcAgentProto.AccessPrivateResponse(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('AccessPrivateResponse', function() { + it('should create an instance of AccessPrivateResponse', function() { + // uncomment below and update the code to test AccessPrivateResponse + //var instance = new AgentAgentGrpcAgentProto.AccessPrivateResponse(); + //expect(instance).to.be.a(AgentAgentGrpcAgentProto.AccessPrivateResponse); + }); + + it('should have the property frontendToken (base name: "frontendToken")', function() { + // uncomment below and update the code to test the property frontendToken + //var instance = new AgentAgentGrpcAgentProto.AccessPrivateResponse(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/agent/agent-ui/src/api/test/model/ProtobufAny.spec.js b/agent/agent-ui/src/api/test/model/ProtobufAny.spec.js new file mode 100644 index 00000000..bd2ddb7c --- /dev/null +++ b/agent/agent-ui/src/api/test/model/ProtobufAny.spec.js @@ -0,0 +1,65 @@ +/** + * agent/agentGrpc/agent.proto + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.AgentAgentGrpcAgentProto); + } +}(this, function(expect, AgentAgentGrpcAgentProto) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new AgentAgentGrpcAgentProto.ProtobufAny(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('ProtobufAny', function() { + it('should create an instance of ProtobufAny', function() { + // uncomment below and update the code to test ProtobufAny + //var instance = new AgentAgentGrpcAgentProto.ProtobufAny(); + //expect(instance).to.be.a(AgentAgentGrpcAgentProto.ProtobufAny); + }); + + it('should have the property type (base name: "@type")', function() { + // uncomment below and update the code to test the property type + //var instance = new AgentAgentGrpcAgentProto.ProtobufAny(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/agent/agent-ui/src/api/test/model/RpcStatus.spec.js b/agent/agent-ui/src/api/test/model/RpcStatus.spec.js new file mode 100644 index 00000000..8f3b877f --- /dev/null +++ b/agent/agent-ui/src/api/test/model/RpcStatus.spec.js @@ -0,0 +1,77 @@ +/** + * agent/agentGrpc/agent.proto + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.AgentAgentGrpcAgentProto); + } +}(this, function(expect, AgentAgentGrpcAgentProto) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new AgentAgentGrpcAgentProto.RpcStatus(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('RpcStatus', function() { + it('should create an instance of RpcStatus', function() { + // uncomment below and update the code to test RpcStatus + //var instance = new AgentAgentGrpcAgentProto.RpcStatus(); + //expect(instance).to.be.a(AgentAgentGrpcAgentProto.RpcStatus); + }); + + it('should have the property code (base name: "code")', function() { + // uncomment below and update the code to test the property code + //var instance = new AgentAgentGrpcAgentProto.RpcStatus(); + //expect(instance).to.be(); + }); + + it('should have the property message (base name: "message")', function() { + // uncomment below and update the code to test the property message + //var instance = new AgentAgentGrpcAgentProto.RpcStatus(); + //expect(instance).to.be(); + }); + + it('should have the property details (base name: "details")', function() { + // uncomment below and update the code to test the property details + //var instance = new AgentAgentGrpcAgentProto.RpcStatus(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/agent/agent-ui/src/api/test/model/ShareDetail.spec.js b/agent/agent-ui/src/api/test/model/ShareDetail.spec.js new file mode 100644 index 00000000..c4f50df0 --- /dev/null +++ b/agent/agent-ui/src/api/test/model/ShareDetail.spec.js @@ -0,0 +1,107 @@ +/** + * agent/agentGrpc/agent.proto + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.AgentAgentGrpcAgentProto); + } +}(this, function(expect, AgentAgentGrpcAgentProto) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new AgentAgentGrpcAgentProto.ShareDetail(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('ShareDetail', function() { + it('should create an instance of ShareDetail', function() { + // uncomment below and update the code to test ShareDetail + //var instance = new AgentAgentGrpcAgentProto.ShareDetail(); + //expect(instance).to.be.a(AgentAgentGrpcAgentProto.ShareDetail); + }); + + it('should have the property token (base name: "token")', function() { + // uncomment below and update the code to test the property token + //var instance = new AgentAgentGrpcAgentProto.ShareDetail(); + //expect(instance).to.be(); + }); + + it('should have the property shareMode (base name: "shareMode")', function() { + // uncomment below and update the code to test the property shareMode + //var instance = new AgentAgentGrpcAgentProto.ShareDetail(); + //expect(instance).to.be(); + }); + + it('should have the property backendMode (base name: "backendMode")', function() { + // uncomment below and update the code to test the property backendMode + //var instance = new AgentAgentGrpcAgentProto.ShareDetail(); + //expect(instance).to.be(); + }); + + it('should have the property reserved (base name: "reserved")', function() { + // uncomment below and update the code to test the property reserved + //var instance = new AgentAgentGrpcAgentProto.ShareDetail(); + //expect(instance).to.be(); + }); + + it('should have the property frontendEndpoint (base name: "frontendEndpoint")', function() { + // uncomment below and update the code to test the property frontendEndpoint + //var instance = new AgentAgentGrpcAgentProto.ShareDetail(); + //expect(instance).to.be(); + }); + + it('should have the property backendEndpoint (base name: "backendEndpoint")', function() { + // uncomment below and update the code to test the property backendEndpoint + //var instance = new AgentAgentGrpcAgentProto.ShareDetail(); + //expect(instance).to.be(); + }); + + it('should have the property closed (base name: "closed")', function() { + // uncomment below and update the code to test the property closed + //var instance = new AgentAgentGrpcAgentProto.ShareDetail(); + //expect(instance).to.be(); + }); + + it('should have the property status (base name: "status")', function() { + // uncomment below and update the code to test the property status + //var instance = new AgentAgentGrpcAgentProto.ShareDetail(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/agent/agent-ui/src/api/test/model/SharePrivateResponse.spec.js b/agent/agent-ui/src/api/test/model/SharePrivateResponse.spec.js new file mode 100644 index 00000000..30535a34 --- /dev/null +++ b/agent/agent-ui/src/api/test/model/SharePrivateResponse.spec.js @@ -0,0 +1,65 @@ +/** + * agent/agentGrpc/agent.proto + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.AgentAgentGrpcAgentProto); + } +}(this, function(expect, AgentAgentGrpcAgentProto) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new AgentAgentGrpcAgentProto.SharePrivateResponse(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('SharePrivateResponse', function() { + it('should create an instance of SharePrivateResponse', function() { + // uncomment below and update the code to test SharePrivateResponse + //var instance = new AgentAgentGrpcAgentProto.SharePrivateResponse(); + //expect(instance).to.be.a(AgentAgentGrpcAgentProto.SharePrivateResponse); + }); + + it('should have the property token (base name: "token")', function() { + // uncomment below and update the code to test the property token + //var instance = new AgentAgentGrpcAgentProto.SharePrivateResponse(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/agent/agent-ui/src/api/test/model/SharePublicResponse.spec.js b/agent/agent-ui/src/api/test/model/SharePublicResponse.spec.js new file mode 100644 index 00000000..35cb6dc9 --- /dev/null +++ b/agent/agent-ui/src/api/test/model/SharePublicResponse.spec.js @@ -0,0 +1,71 @@ +/** + * agent/agentGrpc/agent.proto + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.AgentAgentGrpcAgentProto); + } +}(this, function(expect, AgentAgentGrpcAgentProto) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new AgentAgentGrpcAgentProto.SharePublicResponse(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('SharePublicResponse', function() { + it('should create an instance of SharePublicResponse', function() { + // uncomment below and update the code to test SharePublicResponse + //var instance = new AgentAgentGrpcAgentProto.SharePublicResponse(); + //expect(instance).to.be.a(AgentAgentGrpcAgentProto.SharePublicResponse); + }); + + it('should have the property token (base name: "token")', function() { + // uncomment below and update the code to test the property token + //var instance = new AgentAgentGrpcAgentProto.SharePublicResponse(); + //expect(instance).to.be(); + }); + + it('should have the property frontendEndpoints (base name: "frontendEndpoints")', function() { + // uncomment below and update the code to test the property frontendEndpoints + //var instance = new AgentAgentGrpcAgentProto.SharePublicResponse(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/agent/agent-ui/src/api/test/model/ShareReservedResponse.spec.js b/agent/agent-ui/src/api/test/model/ShareReservedResponse.spec.js new file mode 100644 index 00000000..5ff3f013 --- /dev/null +++ b/agent/agent-ui/src/api/test/model/ShareReservedResponse.spec.js @@ -0,0 +1,89 @@ +/** + * agent/agentGrpc/agent.proto + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.AgentAgentGrpcAgentProto); + } +}(this, function(expect, AgentAgentGrpcAgentProto) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new AgentAgentGrpcAgentProto.ShareReservedResponse(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('ShareReservedResponse', function() { + it('should create an instance of ShareReservedResponse', function() { + // uncomment below and update the code to test ShareReservedResponse + //var instance = new AgentAgentGrpcAgentProto.ShareReservedResponse(); + //expect(instance).to.be.a(AgentAgentGrpcAgentProto.ShareReservedResponse); + }); + + it('should have the property token (base name: "token")', function() { + // uncomment below and update the code to test the property token + //var instance = new AgentAgentGrpcAgentProto.ShareReservedResponse(); + //expect(instance).to.be(); + }); + + it('should have the property backendMode (base name: "backendMode")', function() { + // uncomment below and update the code to test the property backendMode + //var instance = new AgentAgentGrpcAgentProto.ShareReservedResponse(); + //expect(instance).to.be(); + }); + + it('should have the property shareMode (base name: "shareMode")', function() { + // uncomment below and update the code to test the property shareMode + //var instance = new AgentAgentGrpcAgentProto.ShareReservedResponse(); + //expect(instance).to.be(); + }); + + it('should have the property frontendEndpoints (base name: "frontendEndpoints")', function() { + // uncomment below and update the code to test the property frontendEndpoints + //var instance = new AgentAgentGrpcAgentProto.ShareReservedResponse(); + //expect(instance).to.be(); + }); + + it('should have the property target (base name: "target")', function() { + // uncomment below and update the code to test the property target + //var instance = new AgentAgentGrpcAgentProto.ShareReservedResponse(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/agent/agent-ui/src/api/test/model/StatusResponse.spec.js b/agent/agent-ui/src/api/test/model/StatusResponse.spec.js new file mode 100644 index 00000000..409de0a8 --- /dev/null +++ b/agent/agent-ui/src/api/test/model/StatusResponse.spec.js @@ -0,0 +1,71 @@ +/** + * agent/agentGrpc/agent.proto + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.AgentAgentGrpcAgentProto); + } +}(this, function(expect, AgentAgentGrpcAgentProto) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new AgentAgentGrpcAgentProto.StatusResponse(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('StatusResponse', function() { + it('should create an instance of StatusResponse', function() { + // uncomment below and update the code to test StatusResponse + //var instance = new AgentAgentGrpcAgentProto.StatusResponse(); + //expect(instance).to.be.a(AgentAgentGrpcAgentProto.StatusResponse); + }); + + it('should have the property accesses (base name: "accesses")', function() { + // uncomment below and update the code to test the property accesses + //var instance = new AgentAgentGrpcAgentProto.StatusResponse(); + //expect(instance).to.be(); + }); + + it('should have the property shares (base name: "shares")', function() { + // uncomment below and update the code to test the property shares + //var instance = new AgentAgentGrpcAgentProto.StatusResponse(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/agent/agent-ui/src/api/test/model/VersionResponse.spec.js b/agent/agent-ui/src/api/test/model/VersionResponse.spec.js new file mode 100644 index 00000000..0b95d175 --- /dev/null +++ b/agent/agent-ui/src/api/test/model/VersionResponse.spec.js @@ -0,0 +1,65 @@ +/** + * agent/agentGrpc/agent.proto + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: version not set + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.AgentAgentGrpcAgentProto); + } +}(this, function(expect, AgentAgentGrpcAgentProto) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new AgentAgentGrpcAgentProto.VersionResponse(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('VersionResponse', function() { + it('should create an instance of VersionResponse', function() { + // uncomment below and update the code to test VersionResponse + //var instance = new AgentAgentGrpcAgentProto.VersionResponse(); + //expect(instance).to.be.a(AgentAgentGrpcAgentProto.VersionResponse); + }); + + it('should have the property v (base name: "v")', function() { + // uncomment below and update the code to test the property v + //var instance = new AgentAgentGrpcAgentProto.VersionResponse(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/agent/agent-ui/src/app/page.js b/agent/agent-ui/src/app/page.js index a7d22b30..ad142bb5 100644 --- a/agent/agent-ui/src/app/page.js +++ b/agent/agent-ui/src/app/page.js @@ -1,7 +1,26 @@ +"use client"; + +import {useEffect, useState} from "react"; +import {AgentApi, ApiClient} from "@/api/src"; + export default function Home() { - return ( -
-

Agent

-
- ); + const [version, setVersion] = useState(""); + let api = new AgentApi(new ApiClient("http://localhost:8888")); + + useEffect(() => { + let mounted = true; + api.agentVersion((err, data) => { + console.log("error", err); + console.log("data", data); + if(mounted) { + setVersion(data.v); + } + }); + }, []); + + return ( +
+

Agent: {version}

+
+ ); } diff --git a/agent/agent.go b/agent/agent.go index 9b1b23e1..eb42ebec 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -99,7 +99,7 @@ func (a *Agent) gateway() { logrus.Fatalf("unable to register gateway: %v", err) } - if err := http.ListenAndServe(":8888", mux); err != nil { + if err := http.ListenAndServe(":8888", cors(mux)); err != nil { logrus.Error(err) } } @@ -177,3 +177,15 @@ type agentGrpcImpl struct { agentGrpc.UnimplementedAgentServer agent *Agent } + +func cors(h http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Access-Control-Allow-Origin", r.Header.Get("Origin")) + w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PATCH, DELETE") + w.Header().Set("Access-Control-Allow-Headers", "Accept, Content-Type, Content-Length, Accept-Encoding, Authorization, ResponseType, User-Agent") + if r.Method == "OPTIONS" { + return + } + h.ServeHTTP(w, r) + }) +} diff --git a/bin/generate_rest.sh b/bin/generate_rest.sh index 684131d0..18ae5d44 100755 --- a/bin/generate_rest.sh +++ b/bin/generate_rest.sh @@ -42,7 +42,7 @@ swagger generate server -P rest_model_zrok.Principal -f "$zrokSpec" -s rest_serv echo "...generating zrok client" swagger generate client -P rest_model_zrok.Principal -f "$zrokSpec" -c rest_client_zrok -t "$zrokDir" -m "rest_model_zrok" -echo "...generating js client" +echo "...generating web console js client" openapi -s specs/zrok.yml -o ui/src/api -l js echo "...generating ts client" @@ -52,3 +52,6 @@ echo "...generating python client" swagger-codegen generate -i specs/zrok.yml -o sdk/python/sdk/zrok -c $pythonConfig -l python git checkout rest_server_zrok/configure_zrok.go + +echo "...generating agent console js client" +openapi-generator-cli generate -i agent/agentGrpc/agent.swagger.json -o agent/agent-ui/src/api -g javascript \ No newline at end of file