@looker/sdk-codegen 21.7.4 → 21.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/lib/codeGen.d.ts +1 -1
  3. package/lib/codeGen.js +28 -154
  4. package/lib/codeGen.js.map +1 -1
  5. package/lib/codeGenerators.js +0 -16
  6. package/lib/codeGenerators.js.map +1 -1
  7. package/lib/csharp.gen.js +3 -71
  8. package/lib/csharp.gen.js.map +1 -1
  9. package/lib/declarationInfo.js +0 -7
  10. package/lib/declarationInfo.js.map +1 -1
  11. package/lib/esm/codeGen.js +48 -157
  12. package/lib/esm/codeGen.js.map +1 -1
  13. package/lib/esm/codeGenerators.js +28 -20
  14. package/lib/esm/codeGenerators.js.map +1 -1
  15. package/lib/esm/csharp.gen.js +19 -75
  16. package/lib/esm/csharp.gen.js.map +1 -1
  17. package/lib/esm/declarationInfo.js +10 -7
  18. package/lib/esm/declarationInfo.js.map +1 -1
  19. package/lib/esm/exampleInfo.js +24 -23
  20. package/lib/esm/exampleInfo.js.map +1 -1
  21. package/lib/esm/go.gen.js +18 -92
  22. package/lib/esm/go.gen.js.map +1 -1
  23. package/lib/esm/index.js +148 -13
  24. package/lib/esm/index.js.map +1 -1
  25. package/lib/esm/kotlin.gen.js +23 -118
  26. package/lib/esm/kotlin.gen.js.map +1 -1
  27. package/lib/esm/pseudo.gen.js +14 -24
  28. package/lib/esm/pseudo.gen.js.map +1 -1
  29. package/lib/esm/python.gen.js +19 -138
  30. package/lib/esm/python.gen.js.map +1 -1
  31. package/lib/esm/sdkModels.js +100 -432
  32. package/lib/esm/sdkModels.js.map +1 -1
  33. package/lib/esm/specConverter.js +58 -88
  34. package/lib/esm/specConverter.js.map +1 -1
  35. package/lib/esm/specDiff.js +36 -51
  36. package/lib/esm/specDiff.js.map +1 -1
  37. package/lib/esm/swift.gen.js +25 -137
  38. package/lib/esm/swift.gen.js.map +1 -1
  39. package/lib/esm/testUtils/index.js +17 -0
  40. package/lib/esm/testUtils/index.js.map +1 -0
  41. package/lib/esm/testUtils/testUtils.js +66 -0
  42. package/lib/esm/testUtils/testUtils.js.map +1 -0
  43. package/lib/esm/typescript.gen.js +24 -125
  44. package/lib/esm/typescript.gen.js.map +1 -1
  45. package/lib/exampleInfo.js +1 -31
  46. package/lib/exampleInfo.js.map +1 -1
  47. package/lib/go.gen.js +3 -87
  48. package/lib/go.gen.js.map +1 -1
  49. package/lib/index.js +0 -26
  50. package/lib/index.js.map +1 -1
  51. package/lib/kotlin.gen.js +7 -113
  52. package/lib/kotlin.gen.js.map +1 -1
  53. package/lib/pseudo.gen.js +3 -24
  54. package/lib/pseudo.gen.js.map +1 -1
  55. package/lib/python.gen.js +3 -133
  56. package/lib/python.gen.js.map +1 -1
  57. package/lib/sdkModels.js +8 -438
  58. package/lib/sdkModels.js.map +1 -1
  59. package/lib/specConverter.js +6 -106
  60. package/lib/specConverter.js.map +1 -1
  61. package/lib/specDiff.js +1 -56
  62. package/lib/specDiff.js.map +1 -1
  63. package/lib/swift.gen.js +3 -128
  64. package/lib/swift.gen.js.map +1 -1
  65. package/lib/testUtils/index.js +0 -2
  66. package/lib/testUtils/index.js.map +1 -1
  67. package/lib/testUtils/testUtils.js +1 -17
  68. package/lib/testUtils/testUtils.js.map +1 -1
  69. package/lib/typescript.gen.js +5 -117
  70. package/lib/typescript.gen.js.map +1 -1
  71. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/exampleInfo.ts"],"names":["permaLink","remote","hash","fileName","line","codeSearchLink","ideLink","parentPath","vscode","summarize","lode","call","sourceFile","summaries","summary","exampleLink","link","remoteOrigin","commitHash","permalink","description","tooltip","lineNumber","toString","extensionToLanguage","getLanguageExtensions","language","toLowerCase","findExampleLanguages","methodName","all","nuggets","result","Set","keys","Object","forEach","key","calls","add","Array","from","findExamples","operationId","exts","links","length","ext","push","sort","a","b","localeCompare"],"mappings":"AA8H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Q,KAAJ,CAAUD,GAAV,CAAJ,EAAoBL,MAAM,CAACO,GAAP,CAAWf,mBAAmB,CAACa,GAAD,CAA9B;AACrB,GAFD;AAGA,SAAOG,KAAK,CAACC,IAAN,CAAWT,MAAX,CAAP;AACD,CAZM;AAoBP,OAAO,IAAMU,YAAY,GAAG,CAC1BhC,IAD0B,EAE1BgB,QAF0B,EAG1BiB,WAH0B,KAIP;AACnB,MAAMb,GAAG,GAAGpB,IAAI,CAACqB,OAAL,CAAaY,WAAb,CAAZ;AACA,MAAMC,IAAI,GAAGnB,qBAAqB,CAACC,QAAD,CAAlC;AACA,MAAMmB,KAAqB,GAAG,EAA9B;;AAEA,MAAIf,GAAG,IAAIc,IAAI,CAACE,MAAL,GAAc,CAAzB,EAA4B;AAC1BF,IAAAA,IAAI,CAACR,OAAL,CAAcW,GAAD,IAAS;AACpB,UAAMT,KAAK,GAAGR,GAAG,CAACQ,KAAJ,CAAUS,GAAV,CAAd;;AACA,UAAIT,KAAJ,EAAW;AACTA,QAAAA,KAAK,CAACF,OAAN,CAAezB,IAAD,IAAqB;AACjC,cAAMK,IAAI,GAAGD,WAAW,CAACL,IAAD,EAAOC,IAAP,CAAxB;;AACA,cAAIK,IAAJ,EAAU;AACR6B,YAAAA,KAAK,CAACG,IAAN,CAAWjC,WAAW,CAACL,IAAD,EAAOC,IAAP,CAAtB;AACD;AACF,SALD;AAMD;AACF,KAVD;AAWD;;AACD,SAAOkC,KAAK,CAACI,IAAN,CAAW,CAACC,CAAD,EAAIC,CAAJ,KAAUD,CAAC,CAAC/B,SAAF,CAAYiC,aAAZ,CAA0BD,CAAC,CAAChC,SAA5B,CAArB,CAAP;AACD,CAvBM","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { KeyedCollection } from './sdkModels'\n\nexport interface ISDKCall {\n /** SDK variable name for the call found */\n sdk: string\n\n /** Name of the method/operationId */\n operationId: string\n\n /** Source code line number */\n line: number\n\n /** Source code column number where method name was found */\n column: number\n}\n\nexport interface IExampleLink {\n /** Either summary from .md documentation or the name of the source file */\n description: string\n /** permalink to file and line number */\n permalink: string\n /** text to show on hover */\n tooltip: string\n /** line number text */\n lineNumber: string\n}\n\nexport type SDKCalls = ISDKCall[]\n\nexport interface ISummary {\n /** relative file name */\n sourceFile: string\n /** summary extracted from md, rst, or other doc file */\n summary: string\n}\n\nexport type Summaries = KeyedCollection<ISummary>\n\nexport interface IFileCall {\n /** relative file name */\n sourceFile: string\n /** line number for source code call */\n line: number\n /** Optional column number for source code call. Maybe we don't need this datum */\n column?: number\n}\n\n/**\n { \"me\": {\n \".ts\": {\n [\n {\n \"hash\": \"TODO\",\n \"sourceFile\": \"foo.ts\",\n \"line\": 1,\n \"column\": 5,\n }\n ]\n }\n }\n}\n */\n\nexport type FileCalls = IFileCall[]\n\nexport type LanguageCalls = KeyedCollection<FileCalls>\n\nexport interface INugget {\n operationId: string\n calls: LanguageCalls\n}\n\nexport type Nuggets = KeyedCollection<INugget>\n\nexport interface IMine {\n commitHash: string\n remoteOrigin: string\n}\n\n/** All mined example data */\nexport interface IExampleMine extends IMine {\n summaries: Summaries\n nuggets: Nuggets\n}\n\n/** function type for formatting source code links */\nexport type SourceLink = (\n remote: string,\n hash: string,\n fileName: string,\n line: number\n) => string\n\n/**\n * Create a permalink for a github file with line number\n * @param remote https url for repository\n * @param hash commit hash\n * @param fileName name of file\n * @param line line number in file\n */\nexport const permaLink: SourceLink = (\n // https://github.com/looker-open-source/sdk-codegen/blob/bfca52d2c8ba85018f76548158fd1dd90aa1f64a/examples/typescript/customConfigReader.ts#L53\n remote: string,\n hash: string,\n fileName: string,\n line: number\n) => `${remote}/blob/${hash}/${fileName}#L${line}`\n\n/**\n * Create a permalink for a code search with commit hash and line number\n * @param remote https url for repository\n * @param hash commit hash\n * @param fileName name of file\n * @param line line number in file\n */\nexport const codeSearchLink: SourceLink = (\n remote: string,\n hash: string,\n fileName: string,\n line: number\n) => `${remote}/${fileName}?l=${line}&rcl=${hash}`\n\n/**\n * Create an IDE file link with line number\n * @param parentPath to fully qualify the source file\n * @param fileName full name of file\n * @param line line number in file\n */\nexport const ideLink = (\n // https://plugins.jetbrains.com/plugin/6027-remote-call\n // https://github.com/microsoft/vscode/issues/4883#issuecomment-270141535\n // pattern:\n parentPath: string,\n fileName: string,\n line: number\n) => {\n // const idea = 'http//localhost:8091'\n const vscode = 'vscode://'\n\n return `${vscode}${parentPath}/${fileName}:L:${line}`\n}\n\n/**\n * Gets the summary for an example file, or defaults to the file and line number\n * @param lode all mined example data\n * @param call specific call to summarize\n */\nexport const summarize = (lode: IExampleMine, call: IFileCall): string => {\n if (call.sourceFile in lode.summaries) {\n return lode.summaries[call.sourceFile].summary\n }\n // Default to file name if no summary is found\n return call.sourceFile\n}\n\n/**\n * Provides permalink and description for an example file call\n * @param lode all mined example data\n * @param call specific all to link\n */\nexport const exampleLink = (\n lode: IExampleMine,\n call: IFileCall\n): IExampleLink => {\n const link = permaLink(\n lode.remoteOrigin,\n lode.commitHash,\n call.sourceFile,\n call.line\n )\n\n return {\n permalink: link,\n description: summarize(lode, call),\n tooltip: `${call.sourceFile} line ${call.line}`,\n lineNumber: call.line.toString(),\n }\n}\n\n// TODO create one data set for extensionToLanguage and getLanguageExtensions\n/** map file extension to language name */\nexport const extensionToLanguage = {\n '.py': 'Python',\n '.ts': 'TypeScript',\n '.tsx': 'TypeScript',\n '.cs': 'C#',\n '.kt': 'Kotlin',\n '.swift': 'Swift',\n '.rb': 'Ruby',\n '.dart': 'Dart',\n '.go': 'Go',\n '.md': 'Markdown',\n '.java': 'Java',\n}\n\n/**\n * Return the recognized file extensions for the requested language\n * @param language\n */\nexport const getLanguageExtensions = (language: string): string[] => {\n switch (language.toLowerCase()) {\n case 'ts':\n case 'typescript':\n return ['.ts', 'tsx']\n case 'csharp':\n case 'c#':\n return ['.cs']\n case 'ruby':\n return ['.rb']\n case 'python':\n return ['.py']\n case 'swift':\n return ['.swift']\n case 'kotlin':\n return ['.kt']\n case 'dart':\n return ['.dart']\n case 'go':\n return ['.go']\n case 'java':\n return ['.java']\n default:\n return []\n }\n}\n\nexport const findExampleLanguages = (\n lode: IExampleMine,\n methodName: string\n) => {\n const all = lode.nuggets[methodName]\n if (!all) return []\n const result = new Set<string>()\n const keys = Object.keys(extensionToLanguage)\n keys.forEach((key) => {\n if (all.calls[key]) result.add(extensionToLanguage[key])\n })\n return Array.from(result)\n}\n\n/**\n * Searches for examples containing operationId usages in the given language\n * @param lode All example data\n * @param language Language example should be in\n * @param operationId Method's operationId to search for\n */\nexport const findExamples = (\n lode: IExampleMine,\n language: string,\n operationId: string\n): IExampleLink[] => {\n const all = lode.nuggets[operationId]\n const exts = getLanguageExtensions(language)\n const links: IExampleLink[] = []\n\n if (all && exts.length > 0) {\n exts.forEach((ext) => {\n const calls = all.calls[ext]\n if (calls) {\n calls.forEach((call: IFileCall) => {\n const link = exampleLink(lode, call)\n if (link) {\n links.push(exampleLink(lode, call))\n }\n })\n }\n })\n }\n return links.sort((a, b) => a.permalink.localeCompare(b.permalink))\n}\n"],"file":"exampleInfo.js"}
1
+ {"version":3,"file":"exampleInfo.js","names":["permaLink","remote","hash","fileName","line","codeSearchLink","ideLink","parentPath","vscode","summarize","lode","call","sourceFile","summaries","summary","exampleLink","link","remoteOrigin","commitHash","permalink","description","tooltip","lineNumber","toString","extensionToLanguage","getLanguageExtensions","language","toLowerCase","findExampleLanguages","methodName","all","nuggets","result","Set","keys","Object","forEach","key","calls","add","Array","from","findExamples","operationId","exts","links","length","ext","push","sort","a","b","localeCompare"],"sources":["../../src/exampleInfo.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { KeyedCollection } from './sdkModels'\n\nexport interface ISDKCall {\n /** SDK variable name for the call found */\n sdk: string\n\n /** Name of the method/operationId */\n operationId: string\n\n /** Source code line number */\n line: number\n\n /** Source code column number where method name was found */\n column: number\n}\n\nexport interface IExampleLink {\n /** Either summary from .md documentation or the name of the source file */\n description: string\n /** permalink to file and line number */\n permalink: string\n /** text to show on hover */\n tooltip: string\n /** line number text */\n lineNumber: string\n}\n\nexport type SDKCalls = ISDKCall[]\n\nexport interface ISummary {\n /** relative file name */\n sourceFile: string\n /** summary extracted from md, rst, or other doc file */\n summary: string\n}\n\nexport type Summaries = KeyedCollection<ISummary>\n\nexport interface IFileCall {\n /** relative file name */\n sourceFile: string\n /** line number for source code call */\n line: number\n /** Optional column number for source code call. Maybe we don't need this datum */\n column?: number\n}\n\n/**\n { \"me\": {\n \".ts\": {\n [\n {\n \"hash\": \"TODO\",\n \"sourceFile\": \"foo.ts\",\n \"line\": 1,\n \"column\": 5,\n }\n ]\n }\n }\n}\n */\n\nexport type FileCalls = IFileCall[]\n\nexport type LanguageCalls = KeyedCollection<FileCalls>\n\nexport interface INugget {\n operationId: string\n calls: LanguageCalls\n}\n\nexport type Nuggets = KeyedCollection<INugget>\n\nexport interface IMine {\n commitHash: string\n remoteOrigin: string\n}\n\n/** All mined example data */\nexport interface IExampleMine extends IMine {\n summaries: Summaries\n nuggets: Nuggets\n}\n\n/** function type for formatting source code links */\nexport type SourceLink = (\n remote: string,\n hash: string,\n fileName: string,\n line: number\n) => string\n\n/**\n * Create a permalink for a github file with line number\n * @param remote https url for repository\n * @param hash commit hash\n * @param fileName name of file\n * @param line line number in file\n */\nexport const permaLink: SourceLink = (\n // https://github.com/looker-open-source/sdk-codegen/blob/bfca52d2c8ba85018f76548158fd1dd90aa1f64a/examples/typescript/customConfigReader.ts#L53\n remote: string,\n hash: string,\n fileName: string,\n line: number\n) => `${remote}/blob/${hash}/${fileName}#L${line}`\n\n/**\n * Create a permalink for a code search with commit hash and line number\n * @param remote https url for repository\n * @param hash commit hash\n * @param fileName name of file\n * @param line line number in file\n */\nexport const codeSearchLink: SourceLink = (\n remote: string,\n hash: string,\n fileName: string,\n line: number\n) => `${remote}/${fileName}?l=${line}&rcl=${hash}`\n\n/**\n * Create an IDE file link with line number\n * @param parentPath to fully qualify the source file\n * @param fileName full name of file\n * @param line line number in file\n */\nexport const ideLink = (\n // https://plugins.jetbrains.com/plugin/6027-remote-call\n // https://github.com/microsoft/vscode/issues/4883#issuecomment-270141535\n // pattern:\n parentPath: string,\n fileName: string,\n line: number\n) => {\n // const idea = 'http//localhost:8091'\n const vscode = 'vscode://'\n\n return `${vscode}${parentPath}/${fileName}:L:${line}`\n}\n\n/**\n * Gets the summary for an example file, or defaults to the file and line number\n * @param lode all mined example data\n * @param call specific call to summarize\n */\nexport const summarize = (lode: IExampleMine, call: IFileCall): string => {\n if (call.sourceFile in lode.summaries) {\n return lode.summaries[call.sourceFile].summary\n }\n // Default to file name if no summary is found\n return call.sourceFile\n}\n\n/**\n * Provides permalink and description for an example file call\n * @param lode all mined example data\n * @param call specific all to link\n */\nexport const exampleLink = (\n lode: IExampleMine,\n call: IFileCall\n): IExampleLink => {\n const link = permaLink(\n lode.remoteOrigin,\n lode.commitHash,\n call.sourceFile,\n call.line\n )\n\n return {\n permalink: link,\n description: summarize(lode, call),\n tooltip: `${call.sourceFile} line ${call.line}`,\n lineNumber: call.line.toString(),\n }\n}\n\n// TODO create one data set for extensionToLanguage and getLanguageExtensions\n/** map file extension to language name */\nexport const extensionToLanguage = {\n '.py': 'Python',\n '.ts': 'TypeScript',\n '.tsx': 'TypeScript',\n '.cs': 'C#',\n '.kt': 'Kotlin',\n '.swift': 'Swift',\n '.rb': 'Ruby',\n '.dart': 'Dart',\n '.go': 'Go',\n '.md': 'Markdown',\n '.java': 'Java',\n}\n\n/**\n * Return the recognized file extensions for the requested language\n * @param language\n */\nexport const getLanguageExtensions = (language: string): string[] => {\n switch (language.toLowerCase()) {\n case 'ts':\n case 'typescript':\n return ['.ts', 'tsx']\n case 'csharp':\n case 'c#':\n return ['.cs']\n case 'ruby':\n return ['.rb']\n case 'python':\n return ['.py']\n case 'swift':\n return ['.swift']\n case 'kotlin':\n return ['.kt']\n case 'dart':\n return ['.dart']\n case 'go':\n return ['.go']\n case 'java':\n return ['.java']\n default:\n return []\n }\n}\n\nexport const findExampleLanguages = (\n lode: IExampleMine,\n methodName: string\n) => {\n const all = lode.nuggets[methodName]\n if (!all) return []\n const result = new Set<string>()\n const keys = Object.keys(extensionToLanguage)\n keys.forEach((key) => {\n if (all.calls[key]) result.add(extensionToLanguage[key])\n })\n return Array.from(result)\n}\n\n/**\n * Searches for examples containing operationId usages in the given language\n * @param lode All example data\n * @param language Language example should be in\n * @param operationId Method's operationId to search for\n */\nexport const findExamples = (\n lode: IExampleMine,\n language: string,\n operationId: string\n): IExampleLink[] => {\n const all = lode.nuggets[operationId]\n const exts = getLanguageExtensions(language)\n const links: IExampleLink[] = []\n\n if (all && exts.length > 0) {\n exts.forEach((ext) => {\n const calls = all.calls[ext]\n if (calls) {\n calls.forEach((call: IFileCall) => {\n const link = exampleLink(lode, call)\n if (link) {\n links.push(exampleLink(lode, call))\n }\n })\n }\n })\n }\n return links.sort((a, b) => a.permalink.localeCompare(b.permalink))\n}\n"],"mappings":";;;;;;AA8HO,IAAMA,SAAqB,GAAG,CAEnCC,MAAc,EACdC,IAAY,EACZC,QAAgB,EAChBC,IAAY,eACNH,MAAM,mBAASC,IAAI,cAAIC,QAAQ,eAAKC,IAAI,CAAE;AAAA;AAS3C,IAAMC,cAA0B,GAAG,CACxCJ,MAAc,EACdC,IAAY,EACZC,QAAgB,EAChBC,IAAY,eACNH,MAAM,cAAIE,QAAQ,gBAAMC,IAAI,kBAAQF,IAAI,CAAE;AAAA;AAQ3C,IAAMI,OAAO,GAAG,CAIrBC,UAAkB,EAClBJ,QAAgB,EAChBC,IAAY,KACT;EAEH,IAAMI,MAAM,GAAG,WAAW;EAE1B,iBAAUA,MAAM,SAAGD,UAAU,cAAIJ,QAAQ,gBAAMC,IAAI;AACrD,CAAC;AAAA;AAOM,IAAMK,SAAS,GAAG,CAACC,IAAkB,EAAEC,IAAe,KAAa;EACxE,IAAIA,IAAI,CAACC,UAAU,IAAIF,IAAI,CA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AAO,CAAEzB,IAAe,IAAK;UACjC,IAAMK,IAAI,GAAGD,WAAW,CAACL,IAAI,EAAEC,IAAI,CAAC;UACpC,IAAIK,IAAI,EAAE;YACR6B,KAAK,CAACG,IAAI,CAACjC,WAAW,CAACL,IAAI,EAAEC,IAAI,CAAC,CAAC;UACrC;QACF,CAAC,CAAC;MACJ;IACF,CAAC,CAAC;EACJ;EACA,OAAOkC,KAAK,CAACI,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC/B,SAAS,CAACiC,aAAa,CAACD,CAAC,CAAChC,SAAS,CAAC,CAAC;AACrE,CAAC;AAAA"}
package/lib/esm/go.gen.js CHANGED
@@ -1,31 +1,32 @@
1
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
-
3
- import { CodeGen, commentBlock } from './codeGen';
4
- import { EnumType, strBody } from './sdkModels';
5
-
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.GoGen = void 0;
7
+ var _codeGen = require("./codeGen");
8
+ var _sdkModels = require("./sdkModels");
9
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
11
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
12
  var align = (str, size) => {
7
13
  var num = size - str.length + 1;
8
14
  return str + ' '.repeat(num);
9
15
  };
10
-
11
16
  class AlignColumnWriter {
12
17
  constructor() {
13
18
  _defineProperty(this, "rows", []);
14
-
15
19
  _defineProperty(this, "sizes", []);
16
20
  }
17
-
18
21
  writeRow() {
19
22
  for (var _len = arguments.length, cols = new Array(_len), _key = 0; _key < _len; _key++) {
20
23
  cols[_key] = arguments[_key];
21
24
  }
22
-
23
25
  cols.forEach((value, index) => {
24
26
  this.sizes[index] = Math.max(this.sizes[index] || 0, value.length);
25
27
  });
26
28
  this.rows.push(cols);
27
29
  }
28
-
29
30
  toString() {
30
31
  var result = '';
31
32
  this.rows.forEach(row => {
@@ -37,76 +38,52 @@ class AlignColumnWriter {
37
38
  });
38
39
  return result;
39
40
  }
40
-
41
41
  }
42
-
43
- export class GoGen extends CodeGen {
42
+ class GoGen extends _codeGen.CodeGen {
44
43
  constructor(api, versions) {
45
44
  super(api, versions);
46
45
  this.api = api;
47
46
  this.versions = versions;
48
-
49
47
  _defineProperty(this, "codePath", './go');
50
-
51
48
  _defineProperty(this, "fileExtension", '.go');
52
-
53
49
  _defineProperty(this, "nullStr", 'nil');
54
-
55
50
  _defineProperty(this, "packagePath", '');
56
-
57
51
  _defineProperty(this, "commentStr", '// ');
58
-
59
52
  _defineProperty(this, "enumDelimiter", '\n');
60
-
61
53
  _defineProperty(this, "indentStr", ' ');
62
-
63
54
  _defineProperty(this, "endTypeStr", '}');
64
-
65
55
  _defineProperty(this, "codeQuote", "\"");
66
-
67
56
  _defineProperty(this, "useNamedParameters", false);
68
-
69
57
  _defineProperty(this, "needsRequestTypes", true);
70
-
71
58
  _defineProperty(this, "keywords", new Set(['break', 'default', 'func', 'interface', 'select', 'case', 'defer', 'go', 'map', 'struct', 'chan', 'else', 'goto', 'package', 'switch', 'const', 'fallthrough', 'if', 'range', 'type', 'continue', 'for', 'import', 'return', 'var']));
72
-
73
59
  this.packageName = "v".concat(this.apiVersion.substring(0, this.apiVersion.indexOf('.')));
74
60
  this.apiVersion = this.packageName;
75
61
  }
76
-
77
62
  supportsMultiApi() {
78
63
  return false;
79
64
  }
80
-
81
65
  reserve(name) {
82
66
  if (this.keywords.has(name)) {
83
67
  return "".concat(name, "0");
84
68
  }
85
-
86
69
  return name;
87
70
  }
88
-
89
71
  commentHeader(indent, text) {
90
72
  if (this.noComment) return '';
91
- return text ? "".concat(indent, "/*\n\n").concat(commentBlock(text, indent, ''), "\n").concat(indent, "*/\n") : '';
73
+ return text ? "".concat(indent, "/*\n\n").concat((0, _codeGen.commentBlock)(text, indent, ''), "\n").concat(indent, "*/\n") : '';
92
74
  }
93
-
94
75
  comment(indent, description) {
95
76
  if (this.noComment) return '';
96
- return commentBlock(description, indent, this.commentStr);
77
+ return (0, _codeGen.commentBlock)(description, indent, this.commentStr);
97
78
  }
98
-
99
79
  sdkFileName(baseFileName) {
100
80
  return this.fileName("".concat(this.sdkPath, "/").concat(this.packageName, "/").concat(baseFileName));
101
81
  }
102
-
103
82
  methodSignature(indent, method) {
104
83
  return this.methodHeaderDeclaration(indent, method, false);
105
84
  }
106
-
107
85
  methodHeaderDeclaration(indent, method) {
108
86
  var _method$description;
109
-
110
87
  var streamer = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
111
88
  var mapped = this.typeMap(method.type);
112
89
  var head = (_method$description = method.description) === null || _method$description === void 0 ? void 0 : _method$description.trim();
@@ -114,7 +91,6 @@ export class GoGen extends CodeGen {
114
91
  var fragment = '';
115
92
  var requestType = this.requestTypeName(method);
116
93
  var bump = indent + this.indentStr;
117
-
118
94
  if (requestType) {
119
95
  fragment = "request ".concat(requestType);
120
96
  } else {
@@ -123,50 +99,39 @@ export class GoGen extends CodeGen {
123
99
  if (args && args.length > 0) args.forEach(p => params.push(this.declareParameter(bump, method, p)));
124
100
  fragment = params.length > 0 ? "\n".concat(params.join(this.paramDelimiter)) : '';
125
101
  }
126
-
127
102
  if (method.responseIsBoth()) {
128
103
  headComment += "\n\n**Note**: Binary content may be returned by this method.\n";
129
104
  } else if (method.responseIsBinary()) {
130
105
  headComment += "\n\n**Note**: Binary content is returned by this method.\n";
131
106
  }
132
-
133
107
  if (method.deprecated) {
134
108
  headComment += '\n\nDeprecated: This method is deprecated.\n';
135
109
  }
136
-
137
110
  var callback = "callback: (readable: Readable) => Promise<".concat(mapped.name, ">,");
138
111
  var retType = mapped.name === 'Void' ? '' : "".concat(mapped.name, ", ");
139
112
  var header = this.comment('', headComment) + '\n' + "func (l *LookerSDK) ".concat(this.toCamelCaseCap(method.name), "(") + (streamer ? "\n".concat(bump).concat(callback) : '');
140
113
  return header + fragment + "".concat(fragment ? ',' : '', "\n").concat(bump, "options *rtl.ApiSettings) (").concat(retType, "error) {\n");
141
114
  }
142
-
143
115
  declareMethod(indent, method) {
144
116
  var bump = this.bumper(indent);
145
117
  return this.methodSignature(indent, method) + this.encodePathParams(bump, method) + this.httpCall(bump, method) + "\n}";
146
118
  }
147
-
148
119
  declareParameter(indent, method, param) {
149
- var type = param.location === strBody ? this.writeableType(param.type, method) || param.type : param.type;
120
+ var type = param.location === _sdkModels.strBody ? this.writeableType(param.type, method) || param.type : param.type;
150
121
  var mapped = this.typeMap(type);
151
122
  var pOpt = '';
152
-
153
- if (param.location === strBody) {
123
+ if (param.location === _sdkModels.strBody) {
154
124
  mapped.name = "".concat(mapped.name);
155
125
  }
156
-
157
126
  if (!param.required) {
158
127
  pOpt = mapped.default ? '' : '*';
159
128
  }
160
-
161
129
  return "".concat(indent).concat(this.toCamelCase(this.reserve(param.name)), " ").concat(pOpt).concat(mapped.name);
162
130
  }
163
-
164
131
  encodePathParams(indent, method) {
165
132
  var encodings = '';
166
-
167
133
  if (method.pathParams.length > 0) {
168
134
  var prefix = this.useRequest(method) ? 'request' : '';
169
-
170
135
  for (var param of method.pathParams) {
171
136
  if (param.doEncode()) {
172
137
  var name = this.accessor(param.name, prefix);
@@ -174,10 +139,8 @@ export class GoGen extends CodeGen {
174
139
  }
175
140
  }
176
141
  }
177
-
178
142
  return encodings;
179
143
  }
180
-
181
144
  httpCall(indent, method) {
182
145
  var request = this.useRequest(method) ? 'request' : '';
183
146
  var mapped = this.typeMap(method.type);
@@ -188,7 +151,6 @@ export class GoGen extends CodeGen {
188
151
  var result = mapped.name === 'Void' ? '' : 'result, ';
189
152
  return "" + resultDef + "".concat(indent, "err := l.session.Do(").concat(resultPointer, ", \"").concat(this.capitalize(method.httpMethod.toUpperCase()), "\", \"").concat(this.apiPath, "\", ").concat(this.httpPath(method.endpoint, request)) + "".concat(args ? ', ' + args : '', ")") + '\n' + "".concat(indent, "return ").concat(result, "err") + '\n';
190
153
  }
191
-
192
154
  httpArgs(indent, method) {
193
155
  var request = this.useRequest(method) ? 'request' : '';
194
156
  var result = this.argFill('', 'options');
@@ -196,27 +158,21 @@ export class GoGen extends CodeGen {
196
158
  result = this.argFill(result, this.argGroup(indent, method.queryArgs, request));
197
159
  return result;
198
160
  }
199
-
200
161
  argGroup(_indent, args, prefix) {
201
162
  if (!args || args.length === 0) return this.nullStr;
202
163
  var hash = [];
203
-
204
164
  for (var arg of args) {
205
165
  var reserved = this.reserve(arg);
206
-
207
166
  if (prefix) {
208
167
  hash.push("\"".concat(reserved, "\": ").concat(this.accessor(arg, prefix)));
209
168
  } else {
210
169
  hash.push("\"".concat(reserved, "\": ").concat(this.toCamelCase(reserved)));
211
170
  }
212
171
  }
213
-
214
172
  return "map[string]interface{}{".concat(hash.join(this.argDelimiter), "}");
215
173
  }
216
-
217
174
  httpPath(path, prefix) {
218
175
  prefix = prefix || '';
219
-
220
176
  if (path.indexOf('{') >= 0) {
221
177
  var vars = [];
222
178
  var str = path.replace(/({.*?})/g, group => {
@@ -226,49 +182,38 @@ export class GoGen extends CodeGen {
226
182
  var allVars = vars.join(', ');
227
183
  return allVars ? "fmt.Sprintf(\"".concat(str, "\", ").concat(allVars, ")") : "\"".concat(str, "\"");
228
184
  }
229
-
230
185
  return "\"".concat(path, "\"");
231
186
  }
232
-
233
187
  accessor(name, prefix) {
234
188
  var reserved = this.reserve(this.toCamelCase(name));
235
189
  if (!prefix) return reserved;
236
190
  return "".concat(prefix, ".").concat(this.toCamelCaseCap(name));
237
191
  }
238
-
239
192
  methodsEpilogue(_indent) {
240
193
  return '';
241
194
  }
242
-
243
195
  methodsPrologue(_indent) {
244
196
  return "\n// ".concat(this.warnEditing(), "\n\npackage ").concat(this.packageName, "\n\nimport (\n \"fmt\"\n \"github.com/looker-open-source/sdk-codegen/go/rtl\"\n \"net/url\"\n \"time\"\n)\n\ntype LookerSDK struct {\n session *rtl.AuthSession\n}\n\nfunc NewLookerSDK(session *rtl.AuthSession) *LookerSDK {\n return &LookerSDK{\n session: session,\n }\n}\n");
245
197
  }
246
-
247
198
  modelsPrologue(_indent) {
248
199
  var goImport = "\nimport (\n \"github.com/looker-open-source/sdk-codegen/go/rtl\"\n \"time\"\n)";
249
200
  return "\n// ".concat(this.warnEditing(), "\n\npackage ").concat(this.packageName, "\n").concat(goImport, "\n");
250
201
  }
251
-
252
202
  modelsEpilogue(_indent) {
253
203
  return '';
254
204
  }
255
-
256
205
  summary(_indent, _text) {
257
206
  return '';
258
207
  }
259
-
260
208
  typeSignature(indent, type) {
261
209
  return this.comment(indent, type.description) + '\n' + "".concat(indent, "type ").concat(type.name, " struct {\n");
262
210
  }
263
-
264
211
  beginRegion(indent, description) {
265
212
  return "".concat(indent, "// region ").concat(description);
266
213
  }
267
-
268
214
  endRegion(indent, description) {
269
215
  return "".concat(indent, "// endregion ").concat(description);
270
216
  }
271
-
272
217
  typeMap(type) {
273
218
  super.typeMap(type);
274
219
  var mt = this.nullStr;
@@ -342,17 +287,14 @@ export class GoGen extends CodeGen {
342
287
  name: 'Void'
343
288
  }
344
289
  };
345
-
346
290
  if (type.elementType) {
347
291
  var map = this.typeMap(type.elementType);
348
-
349
292
  switch (type.className) {
350
293
  case 'ArrayType':
351
294
  return {
352
295
  default: this.nullStr,
353
296
  name: "[]".concat(map.name)
354
297
  };
355
-
356
298
  case 'HashType':
357
299
  {
358
300
  var mapName = type.elementType.name === 'string' ? 'interface{}' : map.name;
@@ -361,23 +303,19 @@ export class GoGen extends CodeGen {
361
303
  name: 'map[string]' + "".concat(mapName)
362
304
  };
363
305
  }
364
-
365
306
  case 'DelimArrayType':
366
307
  return {
367
308
  default: this.nullStr,
368
309
  name: "rtl.Delim".concat(this.capitalize(map.name))
369
310
  };
370
-
371
311
  case 'EnumType':
372
312
  return {
373
313
  default: '',
374
314
  name: this.capitalize(type.name)
375
315
  };
376
316
  }
377
-
378
317
  throw new Error("Don't know how to handle: ".concat(JSON.stringify(type)));
379
318
  }
380
-
381
319
  if (type.name) {
382
320
  return ktTypes[type.name] || {
383
321
  default: this.nullStr,
@@ -387,13 +325,11 @@ export class GoGen extends CodeGen {
387
325
  throw new Error('Cannot output a nameless type.');
388
326
  }
389
327
  }
390
-
391
328
  declareType(indent, type) {
392
329
  var bump = this.bumper(indent);
393
330
  var writer = new AlignColumnWriter();
394
-
395
331
  try {
396
- if (type instanceof EnumType) {
332
+ if (type instanceof _sdkModels.EnumType) {
397
333
  var props = [];
398
334
  var propertyValues = '';
399
335
  var num = type;
@@ -411,21 +347,16 @@ export class GoGen extends CodeGen {
411
347
  } catch (_unused) {
412
348
  throw new Error(JSON.stringify(type, null, 2));
413
349
  }
414
-
415
350
  return this.typeSignature(indent, type) + writer.toString() + this.construct(indent, type) + "".concat(this.endTypeStr ? indent : '').concat(this.endTypeStr);
416
351
  }
417
-
418
352
  declareEnumValue(_indent, value, typename, writer) {
419
353
  var quote = typeof value === 'string' ? this.codeQuote : '';
420
354
  var name = "".concat(typename, "_").concat(this.toCamelCaseCap(value.toString()));
421
-
422
355
  if (writer) {
423
356
  writer.writeRow('const', name, typename || '', '=', "".concat(quote).concat(value).concat(quote));
424
357
  }
425
-
426
358
  return "const ".concat(name, " ").concat(typename, " = ").concat(quote).concat(value).concat(quote);
427
359
  }
428
-
429
360
  declareProperty(indent, property, writer) {
430
361
  var type = this.typeMap(property.type);
431
362
  var name = this.toCamelCaseCap(property.name);
@@ -433,25 +364,20 @@ export class GoGen extends CodeGen {
433
364
  var doc = property.description ? "".concat(this.comment(' ', property.description)) : '';
434
365
  var optionalJson = property.required ? '' : ',omitempty';
435
366
  var optionalPointer = property.required ? '' : '*';
436
-
437
367
  if (writer) {
438
368
  writer.writeRow("".concat(indent).concat(name), "".concat(optionalPointer).concat(typeName), "`json:\"".concat(property.name).concat(optionalJson, "\"`"), doc);
439
369
  }
440
-
441
370
  return "";
442
371
  }
443
-
444
372
  capitalize(str) {
445
373
  return str.charAt(0).toUpperCase() + str.slice(1);
446
374
  }
447
-
448
375
  toCamelCaseCap(str) {
449
376
  return this.capitalize(str.replace(/([-_][a-z])/g, group => group.toUpperCase().replace('-', '').replace('_', '')));
450
377
  }
451
-
452
378
  toCamelCase(str) {
453
379
  return str.replace(/([-_][a-z])/g, group => group.toUpperCase().replace('-', '').replace('_', ''));
454
380
  }
455
-
456
381
  }
382
+ exports.GoGen = GoGen;
457
383
  //# sourceMappingURL=go.gen.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/go.gen.ts"],"names":["CodeGen","commentBlock","EnumType","strBody","align","str","size","num","length","repeat","AlignColumnWriter","writeRow","cols","forEach","value","index","sizes","Math","max","rows","push","toString","result","row","rowSize","col","colIndex","trimRight","GoGen","constructor","api","versions","Set","packageName","apiVersion","substring","indexOf","supportsMultiApi","reserve","name","keywords","has","commentHeader","indent","text","noComment","comment","description","commentStr","sdkFileName","baseFileName","fileName","sdkPath","methodSignature","method","methodHeaderDeclaration","streamer","mapped","typeMap","type","head","trim","headComment","httpMethod","endpoint","fragment","requestType","requestTypeName","bump","indentStr","params","args","allParams","p","declareParameter","join","paramDelimiter","responseIsBoth","responseIsBinary","deprecated","callback","retType","header","toCamelCaseCap","declareMethod","bumper","encodePathParams","httpCall","param","location","writeableType","pOpt","required","default","toCamelCase","encodings","pathParams","prefix","useRequest","doEncode","accessor","request","httpArgs","resultDef","resultPointer","capitalize","toUpperCase","apiPath","httpPath","argFill","bodyArg","nullStr","argGroup","queryArgs","_indent","hash","arg","reserved","argDelimiter","path","vars","replace","group","allVars","methodsEpilogue","methodsPrologue","warnEditing","modelsPrologue","goImport","modelsEpilogue","summary","_text","typeSignature","beginRegion","endRegion","mt","ktTypes","any","boolean","byte","date","datetime","double","float","int32","int64","integer","number","object","password","string","uri","url","void","elementType","map","className","mapName","Error","JSON","stringify","declareType","writer","props","propertyValues","typeName","values","declareEnumValue","enumDelimiter","typeProperties","prop","declareProperty","construct","endTypeStr","typename","quote","codeQuote","property","doc","optionalJson","optionalPointer","charAt","slice"],"mappings":";;AA2BA,SAASA,OAAT,EAAkBC,YAAlB,QAAsC,WAAtC;AAUA,SAASC,QAAT,EAAmBC,OAAnB,QAAkC,aAAlC;;AAEA,IAAMC,KAAK,GAAG,CAACC,GAAD,EAAcC,IAAd,KAAuC;AACnD,MAAMC,GAAG,GAAGD,IAAI,GAAGD,GAAG,CAACG,MAAX,GAAoB,CAAhC;AACA,SAAOH,GAAG,GAAG,IAAII,MAAJ,CAAWF,GAAX,CAAb;AACD,CAHD;;AAQA,MAAMG,iBAAN,CAAwB;AAAA;AAAA,kCACU,EADV;;AAAA,mCAEI,EAFJ;AAAA;;AAItBC,EAAAA,QAAQ,GAAoB;AAAA,sCAAhBC,IAAgB;AAAhBA,MAAAA,IAAgB;AAAA;;AAC1BA,IAAAA,IAAI,CAACC,OAAL,CAAa,CAACC,KAAD,EAAQC,KAAR,KAAkB;AAC7B,WAAKC,KAAL,CAAWD,KAAX,IAAoBE,IAAI,CAACC,GAAL,CAAS,KAAKF,KAAL,CAAWD,KAAX,KAAqB,CAA9B,EAAiCD,KAAK,CAACN,MAAvC,CAApB;AACD,KAFD;AAGA,SAAKW,IAAL,CAAUC,IAAV,CAAeR,IAAf;AACD;;AAEDS,EAAAA,QAAQ,GAAW;AACjB,QAAIC,MAAM,GAAG,EAAb;AACA,SAAKH,IAAL,CAAUN,OAAV,CAAmBU,GAAD,IAAS;AACzB,UAAMC,OAAO,GAAGD,GAAG,CAACf,MAApB;AACAe,MAAAA,GAAG,CAACV,OAAJ,CAAY,CAACY,GAAD,EAAMC,QAA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A,OAArC,CAA6C,GAA7C,EAAkD,EAAlD,CADK,CAAP;AAGD;;AAzfgC","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { IMappedType, IVersionInfo } from './codeGen'\nimport { CodeGen, commentBlock } from './codeGen'\nimport type {\n ApiModel,\n Arg,\n EnumValueType,\n IMethod,\n IParameter,\n IProperty,\n IType,\n} from './sdkModels'\nimport { EnumType, strBody } from './sdkModels'\n\nconst align = (str: string, size: number): string => {\n const num = size - str.length + 1\n return str + ' '.repeat(num)\n}\n\n/**\n * AlignColumnWriter writes text aligned by column width, it is used to keep the go struct formatting consistent.\n */\nclass AlignColumnWriter {\n private rows: Array<string[]> = []\n private sizes: number[] = []\n\n writeRow(...cols: string[]) {\n cols.forEach((value, index) => {\n this.sizes[index] = Math.max(this.sizes[index] || 0, value.length)\n })\n this.rows.push(cols)\n }\n\n toString(): string {\n let result = ''\n this.rows.forEach((row) => {\n const rowSize = row.length\n row.forEach((col, colIndex) => {\n result +=\n rowSize - 1 === colIndex ? col : align(col, this.sizes[colIndex])\n })\n result = result.trimRight() + '\\n'\n })\n return result\n }\n}\n\n/**\n * Go generator\n */\nexport class GoGen extends CodeGen {\n codePath = './go'\n fileExtension = '.go'\n nullStr = 'nil'\n packagePath = ''\n commentStr = '// '\n\n enumDelimiter = '\\n'\n indentStr = ' '\n endTypeStr = '}'\n codeQuote = `\"`\n\n useNamedParameters = false\n needsRequestTypes = true\n\n keywords = new Set<string>([\n 'break',\n 'default',\n 'func',\n 'interface',\n 'select',\n 'case',\n 'defer',\n 'go',\n 'map',\n 'struct',\n 'chan',\n 'else',\n 'goto',\n 'package',\n 'switch',\n 'const',\n 'fallthrough',\n 'if',\n 'range',\n 'type',\n 'continue',\n 'for',\n 'import',\n 'return',\n 'var',\n ])\n\n constructor(public api: ApiModel, public versions?: IVersionInfo) {\n super(api, versions)\n this.packageName = `v${this.apiVersion.substring(\n 0,\n this.apiVersion.indexOf('.')\n )}`\n this.apiVersion = this.packageName\n }\n\n supportsMultiApi(): boolean {\n return false\n }\n\n reserve(name: string) {\n if (this.keywords.has(name)) {\n return `${name}0`\n }\n return name\n }\n\n commentHeader(indent: string, text: string | undefined) {\n if (this.noComment) return ''\n return text\n ? `${indent}/*\\n\\n${commentBlock(text, indent, '')}\\n${indent}*/\\n`\n : ''\n }\n\n comment(indent: string, description: string) {\n if (this.noComment) return ''\n return commentBlock(description, indent, this.commentStr)\n }\n\n sdkFileName(baseFileName: string) {\n return this.fileName(`${this.sdkPath}/${this.packageName}/${baseFileName}`)\n }\n\n methodSignature(indent: string, method: IMethod): string {\n return this.methodHeaderDeclaration(indent, method, false)\n }\n\n methodHeaderDeclaration(indent: string, method: IMethod, streamer = false) {\n const mapped = this.typeMap(method.type)\n const head = method.description?.trim()\n let headComment =\n (head ? `${head}\\n\\n` : '') +\n `${method.httpMethod} ${method.endpoint} -> ${mapped.name}`\n let fragment = ''\n const requestType = this.requestTypeName(method)\n const bump = indent + this.indentStr\n\n if (requestType) {\n fragment = `request ${requestType}`\n } else {\n const params: string[] = []\n const args = method.allParams // get the params in signature order\n if (args && args.length > 0)\n args.forEach((p) => params.push(this.declareParameter(bump, method, p)))\n fragment =\n params.length > 0 ? `\\n${params.join(this.paramDelimiter)}` : ''\n }\n if (method.responseIsBoth()) {\n headComment += `\\n\\n**Note**: Binary content may be returned by this method.\\n`\n } else if (method.responseIsBinary()) {\n headComment += `\\n\\n**Note**: Binary content is returned by this method.\\n`\n }\n if (method.deprecated) {\n headComment += '\\n\\nDeprecated: This method is deprecated.\\n'\n }\n const callback = `callback: (readable: Readable) => Promise<${mapped.name}>,`\n const retType = mapped.name === 'Void' ? '' : `${mapped.name}, `\n const header =\n this.comment('', headComment) +\n '\\n' +\n `func (l *LookerSDK) ${this.toCamelCaseCap(method.name)}(` +\n (streamer ? `\\n${bump}${callback}` : '')\n\n return (\n header +\n fragment +\n `${\n fragment ? ',' : ''\n }\\n${bump}options *rtl.ApiSettings) (${retType}error) {\\n`\n )\n }\n\n declareMethod(indent: string, method: IMethod) {\n const bump = this.bumper(indent)\n return (\n this.methodSignature(indent, method) +\n this.encodePathParams(bump, method) +\n this.httpCall(bump, method) +\n `\\n}`\n )\n }\n\n declareParameter(indent: string, method: IMethod, param: IParameter) {\n const type =\n param.location === strBody\n ? this.writeableType(param.type, method) || param.type\n : param.type\n const mapped = this.typeMap(type)\n let pOpt = ''\n if (param.location === strBody) {\n mapped.name = `${mapped.name}`\n }\n if (!param.required) {\n pOpt = mapped.default ? '' : '*'\n }\n return (\n // so it turns out Go doesn't like parameter comments. Go figure https://stackoverflow.com/a/67878816\n // this.commentHeader(indent, this.paramComment(param, mapped)) +\n `${indent}${this.toCamelCase(this.reserve(param.name))} ${pOpt}${\n mapped.name\n }`\n )\n }\n\n encodePathParams(indent: string, method: IMethod) {\n let encodings = ''\n if (method.pathParams.length > 0) {\n const prefix = this.useRequest(method) ? 'request' : ''\n for (const param of method.pathParams) {\n if (param.doEncode()) {\n const name = this.accessor(param.name, prefix)\n\n encodings += `${indent}${name} = url.PathEscape(${name})\\n`\n }\n }\n }\n return encodings\n }\n\n httpCall(indent: string, method: IMethod) {\n const request = this.useRequest(method) ? 'request' : ''\n const mapped = this.typeMap(method.type)\n const bump = indent + this.indentStr\n const args = this.httpArgs(bump, method)\n // const errors = this.errorResponses(indent, method)\n const resultDef =\n mapped.name === 'Void' ? '' : `${indent}var result ${mapped.name}\\n`\n const resultPointer = mapped.name === 'Void' ? 'nil' : `&result`\n const result = mapped.name === 'Void' ? '' : 'result, '\n return (\n `` +\n resultDef +\n `${indent}err := l.session.Do(${resultPointer}, \"${this.capitalize(\n method.httpMethod.toUpperCase()\n )}\", \"${this.apiPath}\", ${this.httpPath(method.endpoint, request)}` +\n `${args ? ', ' + args : ''})` +\n '\\n' +\n `${indent}return ${result}err` +\n '\\n'\n )\n }\n\n // build the http argument list from back to front, so trailing undefined arguments\n // can be omitted. Path arguments are resolved as part of the path parameter to general\n // purpose API method call\n // e.g.\n // {queryArgs...}, bodyArg, {headerArgs...}, {cookieArgs...}\n // {queryArgs...}, null, null, {cookieArgs...}\n // null, bodyArg\n // {queryArgs...}\n httpArgs(indent: string, method: IMethod) {\n const request = this.useRequest(method) ? 'request' : ''\n // add options at the end of the request calls. this will cause all other arguments to be\n // filled in but there's no way to avoid this for passing in the last optional parameter.\n // Fortunately, this code bloat is minimal and also hidden from the consumer.\n let result = this.argFill('', 'options')\n // let result = this.argFill('', this.argGroup(indent, method.cookieArgs, request))\n // result = this.argFill(result, this.argGroup(indent, method.headerArgs, request))\n result = this.argFill(\n result,\n method.bodyArg ? this.accessor(method.bodyArg, request) : this.nullStr\n )\n result = this.argFill(\n result,\n this.argGroup(indent, method.queryArgs, request)\n )\n return result\n }\n\n argGroup(_indent: string, args: Arg[], prefix?: string) {\n if (!args || args.length === 0) return this.nullStr\n const hash: string[] = []\n for (const arg of args) {\n const reserved = this.reserve(arg)\n if (prefix) {\n hash.push(`\"${reserved}\": ${this.accessor(arg, prefix)}`)\n } else {\n hash.push(`\"${reserved}\": ${this.toCamelCase(reserved)}`)\n }\n }\n return `map[string]interface{}{${hash.join(this.argDelimiter)}}`\n }\n\n httpPath(path: string, prefix?: string) {\n prefix = prefix || ''\n if (path.indexOf('{') >= 0) {\n const vars: Array<string> = []\n const str = path.replace(/({.*?})/g, (group) => {\n vars.push(\n this.accessor(group.replace('{', '').replace('}', ''), prefix)\n )\n return '%v'\n })\n const allVars = vars.join(', ')\n return allVars ? `fmt.Sprintf(\"${str}\", ${allVars})` : `\"${str}\"`\n }\n return `\"${path}\"`\n }\n\n /**\n * Determine the type of accessor needed for the symbol name\n *\n * If the prefix is defined:\n * If the name is special, use array accessor\n * If the name is simple, use dotted notation\n *\n * With no prefix, return the \"reserved\" version of the name, which may be the same as name\n *\n * @param name variable to access\n * @param prefix optional prefix for accessor\n * @returns one of 4 possible accessor patterns\n */\n accessor(name: string, prefix?: string) {\n const reserved = this.reserve(this.toCamelCase(name))\n if (!prefix) return reserved\n return `${prefix}.${this.toCamelCaseCap(name)}`\n // if (reserved === name) return `${prefix}.${name}`\n // return `${prefix}[${reserved}]`\n }\n\n methodsEpilogue(_indent: string): string {\n return ''\n }\n\n methodsPrologue(_indent: string): string {\n return `\n// ${this.warnEditing()}\n\npackage ${this.packageName}\n\nimport (\n \"fmt\"\n \"github.com/looker-open-source/sdk-codegen/go/rtl\"\n \"net/url\"\n \"time\"\n)\n\ntype LookerSDK struct {\n session *rtl.AuthSession\n}\n\nfunc NewLookerSDK(session *rtl.AuthSession) *LookerSDK {\n return &LookerSDK{\n session: session,\n }\n}\n`\n }\n\n modelsPrologue(_indent: string) {\n const goImport = `\nimport (\n \"github.com/looker-open-source/sdk-codegen/go/rtl\"\n \"time\"\n)`\n\n return `\n// ${this.warnEditing()}\n\npackage ${this.packageName}\n${goImport}\n`\n }\n\n modelsEpilogue(_indent: string): string {\n return ''\n }\n\n summary(_indent: string, _text: string | undefined): string {\n return ''\n }\n\n typeSignature(indent: string, type: IType): string {\n return (\n this.comment(indent, type.description) +\n '\\n' +\n `${indent}type ${type.name} struct {\\n`\n )\n }\n\n beginRegion(indent: string, description: string): string {\n return `${indent}// region ${description}`\n }\n\n endRegion(indent: string, description: string): string {\n return `${indent}// endregion ${description}`\n }\n\n typeMap(type: IType): IMappedType {\n super.typeMap(type)\n const mt = this.nullStr\n const ktTypes: Record<string, IMappedType> = {\n any: { default: mt, name: 'interface{}' },\n boolean: { default: mt, name: 'bool' },\n byte: { default: mt, name: 'byte' },\n date: { default: mt, name: 'time.Time' },\n datetime: { default: mt, name: 'time.Time' },\n double: { default: mt, name: 'float64' },\n float: { default: mt, name: 'float32' },\n int32: { default: mt, name: 'int32' },\n int64: { default: mt, name: 'int64' },\n integer: { default: mt, name: 'int' },\n number: { default: mt, name: 'float64' },\n object: { default: mt, name: 'interface{}' },\n password: { default: mt, name: 'string' },\n string: { default: mt, name: 'string' },\n uri: { default: mt, name: 'url.URL' },\n url: { default: mt, name: 'url.URL' },\n void: { default: mt, name: 'Void' }, // todo: check how to handle Void\n }\n\n if (type.elementType) {\n // This is a structure with nested types\n const map = this.typeMap(type.elementType)\n switch (type.className) {\n case 'ArrayType':\n return { default: this.nullStr, name: `[]${map.name}` }\n case 'HashType': {\n const mapName =\n type.elementType.name === 'string' ? 'interface{}' : map.name // TODO fix bad API spec, like MergeQuery vis_config\n // TODO figure out this bizarre string template error either in IntelliJ or TypeScript\n // return {name: `Map<String,${map.name}>`, default: '{}'}\n return {\n default: this.nullStr,\n name: 'map[string]' + `${mapName}`,\n }\n }\n case 'DelimArrayType':\n return {\n default: this.nullStr,\n name: `rtl.Delim${this.capitalize(map.name)}`,\n }\n case 'EnumType':\n return { default: '', name: this.capitalize(type.name) }\n }\n throw new Error(`Don't know how to handle: ${JSON.stringify(type)}`)\n }\n\n if (type.name) {\n return (\n ktTypes[type.name] || { default: this.nullStr, name: `${type.name}` }\n )\n } else {\n throw new Error('Cannot output a nameless type.')\n }\n }\n\n declareType(indent: string, type: IType) {\n const bump = this.bumper(indent)\n\n const writer = new AlignColumnWriter()\n\n try {\n if (type instanceof EnumType) {\n // enum has special handling\n const props: string[] = []\n let propertyValues = ''\n const num = type as EnumType\n const typeName = this.capitalize(type.name)\n props.push(`type ${typeName} string`) // todo: handle other types than string\n num.values.forEach((value) => {\n // props.push(this.declareEnumValue(bump, value, typeName))\n this.declareEnumValue(bump, value, typeName, writer)\n })\n props.push(writer.toString())\n propertyValues = props.join(this.enumDelimiter)\n\n return propertyValues\n } else {\n this.typeProperties(type).forEach((prop) =>\n // props.push(this.declareProperty(bump, prop))\n this.declareProperty(bump, prop, writer)\n )\n // propertyValues = props.join(this.propDelimiter)\n }\n } catch {\n throw new Error(JSON.stringify(type, null, 2))\n }\n return (\n this.typeSignature(indent, type) +\n writer.toString() +\n this.construct(indent, type) +\n `${this.endTypeStr ? indent : ''}${this.endTypeStr}`\n )\n }\n\n declareEnumValue(\n _indent: string,\n value: EnumValueType,\n typename?: string,\n writer?: AlignColumnWriter\n ) {\n const quote = typeof value === 'string' ? this.codeQuote : ''\n const name = `${typename}_${this.toCamelCaseCap(value.toString())}`\n if (writer) {\n writer.writeRow(\n 'const',\n name,\n typename || '',\n '=',\n `${quote}${value}${quote}`\n )\n }\n return `const ${name} ${typename} = ${quote}${value}${quote}`\n }\n\n declareProperty(\n indent: string,\n property: IProperty,\n writer?: AlignColumnWriter\n ): string {\n const type = this.typeMap(property.type)\n const name = this.toCamelCaseCap(property.name)\n const typeName = type.name\n\n const doc = property.description\n ? `${this.comment(' ', property.description)}`\n : ''\n\n const optionalJson = property.required ? '' : ',omitempty'\n const optionalPointer = property.required ? '' : '*'\n\n if (writer) {\n writer.writeRow(\n `${indent}${name}`,\n `${optionalPointer}${typeName}`,\n `\\`json:\"${property.name}${optionalJson}\"\\``,\n doc\n )\n }\n return ``\n }\n\n capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1)\n }\n\n toCamelCaseCap(str: string): string {\n return this.capitalize(\n str.replace(/([-_][a-z])/g, (group) =>\n group.toUpperCase().replace('-', '').replace('_', '')\n )\n )\n }\n\n toCamelCase(str: string): string {\n return str.replace(/([-_][a-z])/g, (group) =>\n group.toUpperCase().replace('-', '').replace('_', '')\n )\n }\n}\n"],"file":"go.gen.js"}
1
+ {"version":3,"file":"go.gen.js","names":["align","str","size","num","length","repeat","AlignColumnWriter","writeRow","cols","forEach","value","index","sizes","Math","max","rows","push","toString","result","row","rowSize","col","colIndex","trimRight","GoGen","CodeGen","constructor","api","versions","Set","packageName","apiVersion","substring","indexOf","supportsMultiApi","reserve","name","keywords","has","commentHeader","indent","text","noComment","commentBlock","comment","description","commentStr","sdkFileName","baseFileName","fileName","sdkPath","methodSignature","method","methodHeaderDeclaration","streamer","mapped","typeMap","type","head","trim","headComment","httpMethod","endpoint","fragment","requestType","requestTypeName","bump","indentStr","params","args","allParams","p","declareParameter","join","paramDelimiter","responseIsBoth","responseIsBinary","deprecated","callback","retType","header","toCamelCaseCap","declareMethod","bumper","encodePathParams","httpCall","param","location","strBody","writeableType","pOpt","required","default","toCamelCase","encodings","pathParams","prefix","useRequest","doEncode","accessor","request","httpArgs","resultDef","resultPointer","capitalize","toUpperCase","apiPath","httpPath","argFill","bodyArg","nullStr","argGroup","queryArgs","_indent","hash","arg","reserved","argDelimiter","path","vars","replace","group","allVars","methodsEpilogue","methodsPrologue","warnEditing","modelsPrologue","goImport","modelsEpilogue","summary","_text","typeSignature","beginRegion","endRegion","mt","ktTypes","any","boolean","byte","date","datetime","double","float","int32","int64","integer","number","object","password","string","uri","url","void","elementType","map","className","mapName","Error","JSON","stringify","declareType","writer","EnumType","props","propertyValues","typeName","values","declareEnumValue","enumDelimiter","typeProperties","prop","declareProperty","construct","endTypeStr","typename","quote","codeQuote","property","doc","optionalJson","optionalPointer","charAt","slice"],"sources":["../../src/go.gen.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { IMappedType, IVersionInfo } from './codeGen'\nimport { CodeGen, commentBlock } from './codeGen'\nimport type {\n ApiModel,\n Arg,\n EnumValueType,\n IMethod,\n IParameter,\n IProperty,\n IType,\n} from './sdkModels'\nimport { EnumType, strBody } from './sdkModels'\n\nconst align = (str: string, size: number): string => {\n const num = size - str.length + 1\n return str + ' '.repeat(num)\n}\n\n/**\n * AlignColumnWriter writes text aligned by column width, it is used to keep the go struct formatting consistent.\n */\nclass AlignColumnWriter {\n private rows: Array<string[]> = []\n private sizes: number[] = []\n\n writeRow(...cols: string[]) {\n cols.forEach((value, index) => {\n this.sizes[index] = Math.max(this.sizes[index] || 0, value.length)\n })\n this.rows.push(cols)\n }\n\n toString(): string {\n let result = ''\n this.rows.forEach((row) => {\n const rowSize = row.length\n row.forEach((col, colIndex) => {\n result +=\n rowSize - 1 === colIndex ? col : align(col, this.sizes[colIndex])\n })\n result = result.trimRight() + '\\n'\n })\n return result\n }\n}\n\n/**\n * Go generator\n */\nexport class GoGen extends CodeGen {\n codePath = './go'\n fileExtension = '.go'\n nullStr = 'nil'\n packagePath = ''\n commentStr = '// '\n\n enumDelimiter = '\\n'\n indentStr = ' '\n endTypeStr = '}'\n codeQuote = `\"`\n\n useNamedParameters = false\n needsRequestTypes = true\n\n keywords = new Set<string>([\n 'break',\n 'default',\n 'func',\n 'interface',\n 'select',\n 'case',\n 'defer',\n 'go',\n 'map',\n 'struct',\n 'chan',\n 'else',\n 'goto',\n 'package',\n 'switch',\n 'const',\n 'fallthrough',\n 'if',\n 'range',\n 'type',\n 'continue',\n 'for',\n 'import',\n 'return',\n 'var',\n ])\n\n constructor(public api: ApiModel, public versions?: IVersionInfo) {\n super(api, versions)\n this.packageName = `v${this.apiVersion.substring(\n 0,\n this.apiVersion.indexOf('.')\n )}`\n this.apiVersion = this.packageName\n }\n\n supportsMultiApi(): boolean {\n return false\n }\n\n reserve(name: string) {\n if (this.keywords.has(name)) {\n return `${name}0`\n }\n return name\n }\n\n commentHeader(indent: string, text: string | undefined) {\n if (this.noComment) return ''\n return text\n ? `${indent}/*\\n\\n${commentBlock(text, indent, '')}\\n${indent}*/\\n`\n : ''\n }\n\n comment(indent: string, description: string) {\n if (this.noComment) return ''\n return commentBlock(description, indent, this.commentStr)\n }\n\n sdkFileName(baseFileName: string) {\n return this.fileName(`${this.sdkPath}/${this.packageName}/${baseFileName}`)\n }\n\n methodSignature(indent: string, method: IMethod): string {\n return this.methodHeaderDeclaration(indent, method, false)\n }\n\n methodHeaderDeclaration(indent: string, method: IMethod, streamer = false) {\n const mapped = this.typeMap(method.type)\n const head = method.description?.trim()\n let headComment =\n (head ? `${head}\\n\\n` : '') +\n `${method.httpMethod} ${method.endpoint} -> ${mapped.name}`\n let fragment = ''\n const requestType = this.requestTypeName(method)\n const bump = indent + this.indentStr\n\n if (requestType) {\n fragment = `request ${requestType}`\n } else {\n const params: string[] = []\n const args = method.allParams // get the params in signature order\n if (args && args.length > 0)\n args.forEach((p) => params.push(this.declareParameter(bump, method, p)))\n fragment =\n params.length > 0 ? `\\n${params.join(this.paramDelimiter)}` : ''\n }\n if (method.responseIsBoth()) {\n headComment += `\\n\\n**Note**: Binary content may be returned by this method.\\n`\n } else if (method.responseIsBinary()) {\n headComment += `\\n\\n**Note**: Binary content is returned by this method.\\n`\n }\n if (method.deprecated) {\n headComment += '\\n\\nDeprecated: This method is deprecated.\\n'\n }\n const callback = `callback: (readable: Readable) => Promise<${mapped.name}>,`\n const retType = mapped.name === 'Void' ? '' : `${mapped.name}, `\n const header =\n this.comment('', headComment) +\n '\\n' +\n `func (l *LookerSDK) ${this.toCamelCaseCap(method.name)}(` +\n (streamer ? `\\n${bump}${callback}` : '')\n\n return (\n header +\n fragment +\n `${\n fragment ? ',' : ''\n }\\n${bump}options *rtl.ApiSettings) (${retType}error) {\\n`\n )\n }\n\n declareMethod(indent: string, method: IMethod) {\n const bump = this.bumper(indent)\n return (\n this.methodSignature(indent, method) +\n this.encodePathParams(bump, method) +\n this.httpCall(bump, method) +\n `\\n}`\n )\n }\n\n declareParameter(indent: string, method: IMethod, param: IParameter) {\n const type =\n param.location === strBody\n ? this.writeableType(param.type, method) || param.type\n : param.type\n const mapped = this.typeMap(type)\n let pOpt = ''\n if (param.location === strBody) {\n mapped.name = `${mapped.name}`\n }\n if (!param.required) {\n pOpt = mapped.default ? '' : '*'\n }\n return (\n // so it turns out Go doesn't like parameter comments. Go figure https://stackoverflow.com/a/67878816\n // this.commentHeader(indent, this.paramComment(param, mapped)) +\n `${indent}${this.toCamelCase(this.reserve(param.name))} ${pOpt}${\n mapped.name\n }`\n )\n }\n\n encodePathParams(indent: string, method: IMethod) {\n let encodings = ''\n if (method.pathParams.length > 0) {\n const prefix = this.useRequest(method) ? 'request' : ''\n for (const param of method.pathParams) {\n if (param.doEncode()) {\n const name = this.accessor(param.name, prefix)\n\n encodings += `${indent}${name} = url.PathEscape(${name})\\n`\n }\n }\n }\n return encodings\n }\n\n httpCall(indent: string, method: IMethod) {\n const request = this.useRequest(method) ? 'request' : ''\n const mapped = this.typeMap(method.type)\n const bump = indent + this.indentStr\n const args = this.httpArgs(bump, method)\n // const errors = this.errorResponses(indent, method)\n const resultDef =\n mapped.name === 'Void' ? '' : `${indent}var result ${mapped.name}\\n`\n const resultPointer = mapped.name === 'Void' ? 'nil' : `&result`\n const result = mapped.name === 'Void' ? '' : 'result, '\n return (\n `` +\n resultDef +\n `${indent}err := l.session.Do(${resultPointer}, \"${this.capitalize(\n method.httpMethod.toUpperCase()\n )}\", \"${this.apiPath}\", ${this.httpPath(method.endpoint, request)}` +\n `${args ? ', ' + args : ''})` +\n '\\n' +\n `${indent}return ${result}err` +\n '\\n'\n )\n }\n\n // build the http argument list from back to front, so trailing undefined arguments\n // can be omitted. Path arguments are resolved as part of the path parameter to general\n // purpose API method call\n // e.g.\n // {queryArgs...}, bodyArg, {headerArgs...}, {cookieArgs...}\n // {queryArgs...}, null, null, {cookieArgs...}\n // null, bodyArg\n // {queryArgs...}\n httpArgs(indent: string, method: IMethod) {\n const request = this.useRequest(method) ? 'request' : ''\n // add options at the end of the request calls. this will cause all other arguments to be\n // filled in but there's no way to avoid this for passing in the last optional parameter.\n // Fortunately, this code bloat is minimal and also hidden from the consumer.\n let result = this.argFill('', 'options')\n // let result = this.argFill('', this.argGroup(indent, method.cookieArgs, request))\n // result = this.argFill(result, this.argGroup(indent, method.headerArgs, request))\n result = this.argFill(\n result,\n method.bodyArg ? this.accessor(method.bodyArg, request) : this.nullStr\n )\n result = this.argFill(\n result,\n this.argGroup(indent, method.queryArgs, request)\n )\n return result\n }\n\n argGroup(_indent: string, args: Arg[], prefix?: string) {\n if (!args || args.length === 0) return this.nullStr\n const hash: string[] = []\n for (const arg of args) {\n const reserved = this.reserve(arg)\n if (prefix) {\n hash.push(`\"${reserved}\": ${this.accessor(arg, prefix)}`)\n } else {\n hash.push(`\"${reserved}\": ${this.toCamelCase(reserved)}`)\n }\n }\n return `map[string]interface{}{${hash.join(this.argDelimiter)}}`\n }\n\n httpPath(path: string, prefix?: string) {\n prefix = prefix || ''\n if (path.indexOf('{') >= 0) {\n const vars: Array<string> = []\n const str = path.replace(/({.*?})/g, (group) => {\n vars.push(\n this.accessor(group.replace('{', '').replace('}', ''), prefix)\n )\n return '%v'\n })\n const allVars = vars.join(', ')\n return allVars ? `fmt.Sprintf(\"${str}\", ${allVars})` : `\"${str}\"`\n }\n return `\"${path}\"`\n }\n\n /**\n * Determine the type of accessor needed for the symbol name\n *\n * If the prefix is defined:\n * If the name is special, use array accessor\n * If the name is simple, use dotted notation\n *\n * With no prefix, return the \"reserved\" version of the name, which may be the same as name\n *\n * @param name variable to access\n * @param prefix optional prefix for accessor\n * @returns one of 4 possible accessor patterns\n */\n accessor(name: string, prefix?: string) {\n const reserved = this.reserve(this.toCamelCase(name))\n if (!prefix) return reserved\n return `${prefix}.${this.toCamelCaseCap(name)}`\n // if (reserved === name) return `${prefix}.${name}`\n // return `${prefix}[${reserved}]`\n }\n\n methodsEpilogue(_indent: string): string {\n return ''\n }\n\n methodsPrologue(_indent: string): string {\n return `\n// ${this.warnEditing()}\n\npackage ${this.packageName}\n\nimport (\n \"fmt\"\n \"github.com/looker-open-source/sdk-codegen/go/rtl\"\n \"net/url\"\n \"time\"\n)\n\ntype LookerSDK struct {\n session *rtl.AuthSession\n}\n\nfunc NewLookerSDK(session *rtl.AuthSession) *LookerSDK {\n return &LookerSDK{\n session: session,\n }\n}\n`\n }\n\n modelsPrologue(_indent: string) {\n const goImport = `\nimport (\n \"github.com/looker-open-source/sdk-codegen/go/rtl\"\n \"time\"\n)`\n\n return `\n// ${this.warnEditing()}\n\npackage ${this.packageName}\n${goImport}\n`\n }\n\n modelsEpilogue(_indent: string): string {\n return ''\n }\n\n summary(_indent: string, _text: string | undefined): string {\n return ''\n }\n\n typeSignature(indent: string, type: IType): string {\n return (\n this.comment(indent, type.description) +\n '\\n' +\n `${indent}type ${type.name} struct {\\n`\n )\n }\n\n beginRegion(indent: string, description: string): string {\n return `${indent}// region ${description}`\n }\n\n endRegion(indent: string, description: string): string {\n return `${indent}// endregion ${description}`\n }\n\n typeMap(type: IType): IMappedType {\n super.typeMap(type)\n const mt = this.nullStr\n const ktTypes: Record<string, IMappedType> = {\n any: { default: mt, name: 'interface{}' },\n boolean: { default: mt, name: 'bool' },\n byte: { default: mt, name: 'byte' },\n date: { default: mt, name: 'time.Time' },\n datetime: { default: mt, name: 'time.Time' },\n double: { default: mt, name: 'float64' },\n float: { default: mt, name: 'float32' },\n int32: { default: mt, name: 'int32' },\n int64: { default: mt, name: 'int64' },\n integer: { default: mt, name: 'int' },\n number: { default: mt, name: 'float64' },\n object: { default: mt, name: 'interface{}' },\n password: { default: mt, name: 'string' },\n string: { default: mt, name: 'string' },\n uri: { default: mt, name: 'url.URL' },\n url: { default: mt, name: 'url.URL' },\n void: { default: mt, name: 'Void' }, // todo: check how to handle Void\n }\n\n if (type.elementType) {\n // This is a structure with nested types\n const map = this.typeMap(type.elementType)\n switch (type.className) {\n case 'ArrayType':\n return { default: this.nullStr, name: `[]${map.name}` }\n case 'HashType': {\n const mapName =\n type.elementType.name === 'string' ? 'interface{}' : map.name // TODO fix bad API spec, like MergeQuery vis_config\n // TODO figure out this bizarre string template error either in IntelliJ or TypeScript\n // return {name: `Map<String,${map.name}>`, default: '{}'}\n return {\n default: this.nullStr,\n name: 'map[string]' + `${mapName}`,\n }\n }\n case 'DelimArrayType':\n return {\n default: this.nullStr,\n name: `rtl.Delim${this.capitalize(map.name)}`,\n }\n case 'EnumType':\n return { default: '', name: this.capitalize(type.name) }\n }\n throw new Error(`Don't know how to handle: ${JSON.stringify(type)}`)\n }\n\n if (type.name) {\n return (\n ktTypes[type.name] || { default: this.nullStr, name: `${type.name}` }\n )\n } else {\n throw new Error('Cannot output a nameless type.')\n }\n }\n\n declareType(indent: string, type: IType) {\n const bump = this.bumper(indent)\n\n const writer = new AlignColumnWriter()\n\n try {\n if (type instanceof EnumType) {\n // enum has special handling\n const props: string[] = []\n let propertyValues = ''\n const num = type as EnumType\n const typeName = this.capitalize(type.name)\n props.push(`type ${typeName} string`) // todo: handle other types than string\n num.values.forEach((value) => {\n // props.push(this.declareEnumValue(bump, value, typeName))\n this.declareEnumValue(bump, value, typeName, writer)\n })\n props.push(writer.toString())\n propertyValues = props.join(this.enumDelimiter)\n\n return propertyValues\n } else {\n this.typeProperties(type).forEach((prop) =>\n // props.push(this.declareProperty(bump, prop))\n this.declareProperty(bump, prop, writer)\n )\n // propertyValues = props.join(this.propDelimiter)\n }\n } catch {\n throw new Error(JSON.stringify(type, null, 2))\n }\n return (\n this.typeSignature(indent, type) +\n writer.toString() +\n this.construct(indent, type) +\n `${this.endTypeStr ? indent : ''}${this.endTypeStr}`\n )\n }\n\n declareEnumValue(\n _indent: string,\n value: EnumValueType,\n typename?: string,\n writer?: AlignColumnWriter\n ) {\n const quote = typeof value === 'string' ? this.codeQuote : ''\n const name = `${typename}_${this.toCamelCaseCap(value.toString())}`\n if (writer) {\n writer.writeRow(\n 'const',\n name,\n typename || '',\n '=',\n `${quote}${value}${quote}`\n )\n }\n return `const ${name} ${typename} = ${quote}${value}${quote}`\n }\n\n declareProperty(\n indent: string,\n property: IProperty,\n writer?: AlignColumnWriter\n ): string {\n const type = this.typeMap(property.type)\n const name = this.toCamelCaseCap(property.name)\n const typeName = type.name\n\n const doc = property.description\n ? `${this.comment(' ', property.description)}`\n : ''\n\n const optionalJson = property.required ? '' : ',omitempty'\n const optionalPointer = property.required ? '' : '*'\n\n if (writer) {\n writer.writeRow(\n `${indent}${name}`,\n `${optionalPointer}${typeName}`,\n `\\`json:\"${property.name}${optionalJson}\"\\``,\n doc\n )\n }\n return ``\n }\n\n capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1)\n }\n\n toCamelCaseCap(str: string): string {\n return this.capitalize(\n str.replace(/([-_][a-z])/g, (group) =>\n group.toUpperCase().replace('-', '').replace('_', '')\n )\n )\n }\n\n toCamelCase(str: string): string {\n return str.replace(/([-_][a-z])/g, (group) =>\n group.toUp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