resources.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. package tst
  2. import (
  3. "fmt"
  4. "strings"
  5. . "git.eugeniocarvalho.dev/eugeniucarvalho/apicodegen/common" // . "git.eugeniocarvalho.dev/eugeniucarvalho/apicodegen/gen"
  6. TS "git.eugeniocarvalho.dev/eugeniucarvalho/gg/generators/typescript"
  7. )
  8. var (
  9. FormatMap map[string]string
  10. // TemplatesMethods = map[string]func(p *Project, method *Method) (*G.Statement, error){
  11. // "post": GenCreateStmts,
  12. // "put": GenUpdateStmts,
  13. // "delete": GenDeleteStmts,
  14. // "get_one": GenGetStmtsOne,
  15. // "get_list": GenGetStmtsList,
  16. // }
  17. angularServiceOption = []TS.CodeInterface{}
  18. angularServiceOptionMap = map[string]string{}
  19. )
  20. func GenResources(p *Project) {
  21. var (
  22. // angularServiceStmtName string
  23. angularResourceName string
  24. ServiceStmt = "ServiceStmt"
  25. // angularServiceMethods []TS.CodeInterface
  26. angularServiceStmtMethods []TS.CodeInterface
  27. )
  28. // imports(module)
  29. // module.Line().Export().Class().Id(ServiceStmt).Block(
  30. // TS.Public().Id("Url").Call(TS.Raw("u: string, options:{}")).Op(":").String().Block(
  31. // TS.Raw(""),
  32. // ),
  33. // ).Line()
  34. module.Line().Raw(`
  35. export type HttpOptions = {
  36. headers?: HttpHeaders;
  37. params?: any;
  38. withCredentials?: boolean;
  39. id?: string;
  40. } & {
  41. [prop: string]: any;
  42. };
  43. export class ServiceStmt {
  44. // constructor(protected api: `).Id(ApiClassName(p)).Raw(`) {}
  45. constructor(protected api: ApiInterface) {}
  46. public Url(u: string, opts: {}): string {
  47. (u.match(/{(\w+)}/gm)||[]).map(argExpression => {
  48. const
  49. prop = argExpression.replace(/({|})/gm,''),
  50. value = opts[prop];
  51. if (!value) { throw Error(`).Raw("`Url params '${prop}' is required`").Raw(`);}
  52. u = u.replace(argExpression, value);
  53. });
  54. return u;
  55. }
  56. _event<T = any>(url, opt: HttpOptions): Observable<EventSourcePolyfill> {
  57. opt = this.api.options(opt);
  58. const _url = new URL(this.Url(url, opt)), { params = null } = opt;
  59. if (params) {
  60. params.map.forEach((values, prop) => values.map(value => _url.searchParams.append(prop, value)));
  61. }
  62. return new Observable(o => o.next(new EventSourcePolyfill(
  63. _url.toString(),
  64. { heartbeatTimeout: 86400000, headers: { Authorization: this.api.Auth.Token() } },
  65. ))).pipe(take(1));
  66. }
  67. _get<T = any>(url, opt: HttpOptions):Observable<T> {
  68. opt = this.api.options(opt);
  69. return this.api.http.get<any>(this.Url(url, opt), opt).pipe(take(1));
  70. }
  71. _put<T = any>(url, entity: any, opt: HttpOptions):Observable<T> {
  72. opt = this.api.options(opt);
  73. return this.api.http.put<any>(this.Url(url, opt), entity, opt).pipe(take(1));
  74. }
  75. _patch<T = any>(url, entity: any, opt: HttpOptions):Observable<T> {
  76. opt = this.api.options(opt);
  77. return this.api.http.patch<any>(this.Url(url, opt), entity, opt).pipe(take(1));
  78. }
  79. _post<T = any>(url, entity: any, opt: HttpOptions):Observable<T> {
  80. opt = this.api.options(opt);
  81. return this.api.http.post<any>(this.Url(url, opt), entity, opt).pipe(take(1));
  82. }
  83. _delete<T = any>(url, opt: HttpOptions) {
  84. opt = this.api.options(opt);
  85. return this.api.http.delete<any>(this.Url(url, opt), opt).pipe(take(1));
  86. }
  87. }`).Line()
  88. for _, resource := range p.Resources {
  89. FormatMap = map[string]string{}
  90. // angularServiceMethods = []TS.CodeInterface{}
  91. angularServiceStmtMethods = []TS.CodeInterface{}
  92. angularResourceName = strings.Title(resource.ID) + "Service"
  93. module.Comment(resource.Description).Line()
  94. // angularServiceMethods = append(angularServiceMethods, TS.Constructor(
  95. // TS.Protected().Id("api").Op(":").Id(ApiClassName(p)),
  96. // ).Block(
  97. // // TS.This().Dot("Url").Op("="),
  98. // ))
  99. // angularServiceStmtMethods = append(angularServiceStmtMethods, TS.Public().Id("Url").Op(":").String())
  100. // angularServiceStmtMethods = append(angularServiceStmtMethods, TS.Constructor(
  101. // TS.Protected().Id("api").Op(":").Id(ApiClassName(p)),
  102. // TS.Protected().Id("options").Op(":").Id("ServiceOptions"),
  103. // ).Block(
  104. // // TS.Raw("this.url").Op("=").Lit(p.UrlFromMethod()).Endl(),
  105. // TS.Raw("super();"),
  106. // TS.Raw("if (this.options == null)").Block(
  107. // // TS.Raw("this.options = new ServiceOptions();"),
  108. // TS.Raw("this.options = {};"),
  109. // ),
  110. // // TS.Super().Call(TS.Id("options")),
  111. // ))
  112. // angularServiceStmtName = angularResourceName + "Stmt"
  113. // angularServiceMethods = append(angularServiceMethods, TS.Id("Options").Params(
  114. // TS.Id("options?").Op(":").Id("ServiceOptions"),
  115. // ).Op(":").Id(angularServiceStmtName).Block(
  116. // TS.Return().New().Id(angularServiceStmtName).Call(
  117. // TS.Id("this.api"),
  118. // TS.Id("options"),
  119. // ),
  120. // ).Line())
  121. // angularServiceStmtMethods = append(angularServiceStmtMethods, TS.Line().Raw(`
  122. // options(opts?: HttpOptions): this {
  123. // opts && Object.assign(this.opts, opts)
  124. // return this;
  125. // }`).Line())
  126. for _, method := range resource.Methods {
  127. // if method.Template == "implement" {
  128. // continue
  129. // }
  130. GenAngularMethodStmt(
  131. p,
  132. resource,
  133. method,
  134. &angularServiceStmtMethods,
  135. angularResourceName,
  136. )
  137. // Vai ser usado no metodo de construcao da classe chamado em createAngularService
  138. for paramName, param := range method.Parameters {
  139. // fmt.Println("param >>>>>>>>>", resource.ID, method.ID, paramName)
  140. if _, find := angularServiceOptionMap[paramName]; find {
  141. continue
  142. }
  143. angularServiceOptionMap[paramName] = param.Location
  144. angularServiceOption = append(angularServiceOption,
  145. TS.Comment(param.Description).Id(paramName+"?").Op(":").Id(TS.ConvType(param.Type)).Endl(),
  146. )
  147. }
  148. }
  149. module.Line().Export().Class().Id(
  150. angularResourceName,
  151. // ).Extends().Id(fmt.Sprintf("%s<%s>",ServiceStmt, resource.Entity )).Block(
  152. ).Extends().Id(fmt.Sprintf("%s",ServiceStmt )).Block(
  153. angularServiceStmtMethods...,
  154. ).Line()
  155. // module.Line().Export().Class().Id(
  156. // angularResourceName,
  157. // ).Block(
  158. // angularServiceMethods...,
  159. // ).Line()
  160. }
  161. // Cria o arquivo de servido da api
  162. createAngularService(p, module)
  163. // Fim do laco de recurso
  164. // Salva o arquivo do modulo
  165. }
  166. func ApiClassName(p *Project) string {
  167. return p.Name + "Api"
  168. }
  169. func createAngularService(p *Project, module *TS.File) error {
  170. // var (
  171. // service = Ts.NewFile("api.service.ts")
  172. // )
  173. // Define a class que representa uma resposta da api
  174. // "Class gerencia todos os serviços da api.",
  175. module.Export().Interface().Id("ServiceResponse<T = any>").Block(
  176. TS.Raw("resultSizeEstimate: number;"),
  177. TS.Raw("nextPageToken: string;"),
  178. TS.Raw("entity?:T;"),
  179. TS.Raw("itens?:T[];"),
  180. )
  181. // Define todos os parametros atribuiveis as opcoes de uma requisicao da api
  182. module.Line().Export().Interface().Id("ServiceOptions").BlockFun(func(g *TS.Group) {
  183. g.Stmts = angularServiceOption
  184. })
  185. //
  186. createClientClass(p, module)
  187. //
  188. createAuthClass(p, module)
  189. module.Line().Comment("Objeto acessivel pelo usuario para realizar requisicoes à api.").Raw(`
  190. @Injectable({ providedIn: 'root' })
  191. // @Injectable()
  192. export class `).Raw(ApiClassName(p)).Raw(` {
  193. public Client: Client;
  194. // public BASE_URL = environment.BASE_URL;
  195. public Auth: Auth;
  196. // public queryParams: any = {};
  197. public poolReady = [];
  198. public httpOptions = {
  199. headers: new HttpHeaders({
  200. 'Content-Type': 'application/json',
  201. 'Accept': 'application/json'
  202. }),
  203. withCredentials: true,
  204. };
  205. constructor(
  206. public http: HttpClient,
  207. // public route: ActivatedRoute,
  208. // public router: Router,
  209. // @Inject(ApiOptionsParams) public apiOptions: `).Raw(ApiClassName(p) + "Options").Raw(`,
  210. public apiOptions: `).Raw(ApiClassName(p) + "Options").Raw(`,
  211. ) {
  212. console.log('apiOptions `).Raw(ApiClassName(p)).Raw(`',apiOptions);
  213. // this.route.queryParams.subscribe(params => { this.queryParams = params; });
  214. this.Client = new Client(this);
  215. if (Boolean(window[oauthWindowProp])) {
  216. this.Auth = window[oauthWindowProp];
  217. } else {
  218. this.Auth = window[oauthWindowProp] = new Auth(this);
  219. }
  220. }
  221. onready(fn: () => void) {
  222. this.Auth.onAuthorize$.pipe(filter(grant => Boolean(grant))).subscribe(fn);
  223. // if (this.Auth.grant) {
  224. // fn();
  225. // } else {
  226. // this.poolReady.push(fn);
  227. // }
  228. }
  229. // options(opts?: HttpOptions): HttpOptions {
  230. // console.log({ ...this.httpOptions.headers });
  231. // opts = Object.assign(
  232. // {
  233. // headers: new HttpHeaders({
  234. // ...this.httpOptions.headers,
  235. // }),
  236. // params: {},
  237. // },
  238. // opts
  239. // );
  240. // // const headers = {
  241. // // Authorization: this.Auth.Token(),
  242. // // };
  243. // opts.headers.set("Authorization", this.Auth.Token());
  244. // //this.copyHeader(this.httpOptions.headers, headers);
  245. // //this.copyHeader(opts.headers, headers);
  246. // const params = opts.params;
  247. // // Converte a query para base64
  248. // if (params.q) {
  249. // params.q = window.btoa(unescape(encodeURIComponent(params.q)));
  250. // }
  251. // // delete opts.headers;
  252. // // delete opts.params;
  253. // // const options = Object.assign(
  254. // // {
  255. // // headers: new HttpHeaders(headers),
  256. // // params: new HttpParams({ fromObject: params }),
  257. // // },
  258. // // opts
  259. // // );
  260. // // const options = Object.assign({
  261. // // headers: new HttpHeaders(hopts),
  262. // // params: {}
  263. // // }, opts);
  264. // // // Converte a query para base64
  265. // // if (options.params.q) {
  266. // // options.params.q = window.btoa(unescape(encodeURIComponent(options.params.q)));
  267. // // }
  268. // return opts;
  269. // }
  270. options(opts?: HttpOptions): HttpOptions {
  271. opts = Object.assign({
  272. headers: new HttpHeaders(),
  273. params: {},
  274. }, opts);
  275. const headers = {
  276. 'Authorization': this.Auth.Token()
  277. };
  278. this.copyHeader(this.httpOptions.headers, headers);
  279. this.copyHeader(opts.headers, headers);
  280. const params = opts.params;
  281. // Converte a query para base64
  282. if (params.q) {
  283. params.q = window.btoa(unescape(encodeURIComponent(params.q)));
  284. }
  285. delete opts.headers;
  286. delete opts.params;
  287. const options = Object.assign({
  288. headers: new HttpHeaders(headers),
  289. params: new HttpParams({ fromObject: params }),
  290. }, opts);
  291. // const options = Object.assign({
  292. // headers: new HttpHeaders(hopts),
  293. // params: {}
  294. // }, opts);
  295. // // Converte a query para base64
  296. // if (options.params.q) {
  297. // options.params.q = window.btoa(unescape(encodeURIComponent(options.params.q)));
  298. // }
  299. return options;
  300. }
  301. copyHeader(headers, hopts) {
  302. if (!headers) { return; }
  303. headers.keys().map(key => { hopts[key] = headers.get(key); });
  304. }
  305. }`)
  306. // .Injetable("{providedIn: 'root'}").Export().Class().Id(ApiClassName(p)).Block(
  307. // TS.Public().Id("Client").Op(":").Id("Client").Endl(),
  308. // TS.Public().Id("baseURL").Op("=").Lit(p.BaseURL).Endl(),
  309. // TS.Public().Id("Auth").Op(":").Id("Auth").Endl(),
  310. // TS.Public().Id("httpOptions").Id("=").Block(
  311. // TS.Id("headers").Op(":").Raw("new HttpHeaders").Call(TS.Block(
  312. // TS.Raw("'Content-Type': 'application/json',"),
  313. // TS.Raw("'Accept': 'application/json'"),
  314. // )),
  315. // ).Endl(),
  316. // // TS.Public().Id("http").Op(":").Id("HttpClient").Endl(),
  317. // TS.Constructor(
  318. // TS.Public().Id("http").Op(":").Id("HttpClient"),
  319. // ).Block(
  320. // TS.This().Dot("Client").Op("=").New().Id("Client").Call(TS.This()).Endl(),
  321. // // TS.Id("this.http").Op("=").New().Id("Client").Call(TS.This()).Endl(),
  322. // ),
  323. // TS.Id("Options").Params(
  324. // TS.Id("opts").Op(":").Id("ServiceOptions"),
  325. // ).Op(":").Id("{headers: HttpHeaders,params: any}").Block(
  326. // TS.Return().Block(
  327. // TS.Raw("headers: this.httpOptions.headers,"),
  328. // // TS.Raw("params : opts.Params()"),
  329. // TS.Raw("params : opts"),
  330. // ),
  331. // ),
  332. // ).Line()
  333. module.Line().Raw(`
  334. export function ApiOptionsProvider(options) {
  335. console.log('ApiOptionsProvider', options);
  336. return options;
  337. }
  338. @NgModule({
  339. imports: [
  340. CommonModule,
  341. HttpClientModule,
  342. ]
  343. })
  344. `).Export().
  345. Class().
  346. Id(p.Name + "ApiModule").
  347. Block(
  348. TS.Raw(`
  349. static forRoot( options?: `).Raw(ApiClassName(p) + "Options").Raw(` ) : ModuleWithProviders {
  350. // static forRoot( options?:any ) : ModuleWithProviders {
  351. return({
  352. ngModule: `).Raw(p.Name + "ApiModule").Raw(`,
  353. providers: [
  354. {
  355. provide: ApiOptionsParams,
  356. useValue: options,
  357. },
  358. {
  359. provide: `).Raw(ApiClassName(p) + "Options").Raw(`,
  360. useFactory: ApiOptionsProvider,
  361. deps:[ApiOptionsParams]
  362. }
  363. ]
  364. });
  365. }
  366. `),
  367. ).
  368. Line()
  369. return nil
  370. }
  371. // createClientClass cria a classe de cliente que guarda a referencia para todos os servicos da api
  372. func createClientClass(p *Project, file *TS.File) {
  373. var (
  374. angularResourceName string
  375. angularClientStmts = []TS.CodeInterface{}
  376. angularClientConstructor = []TS.CodeInterface{}
  377. )
  378. for _, resource := range p.Resources {
  379. angularResourceName = strings.Title(resource.ID) + "Service"
  380. angularClientStmts = append(
  381. angularClientStmts,
  382. TS.Public().Id(strings.Title(resource.ID)).Op(":").Id(angularResourceName).Endl(),
  383. )
  384. angularClientConstructor = append(
  385. angularClientConstructor,
  386. TS.This().Dot(strings.Title(resource.ID)).Op("=").New().Id(angularResourceName).Call(TS.Id("api")).Endl(),
  387. )
  388. }
  389. angularClientConstructor = append(
  390. angularClientConstructor,
  391. TS.Raw("this.Generic = new ServiceStmt").Call(TS.Id("api")).Endl(),
  392. )
  393. // angularClientStmts = append(
  394. // angularClientStmts,
  395. // TS.Raw(`public onready = new EventEmitter<any>();`),
  396. // )
  397. angularClientStmts = append(
  398. angularClientStmts,
  399. TS.Public().Id("Generic: ServiceStmt").Endl(),
  400. )
  401. angularClientStmts = append(
  402. angularClientStmts,
  403. TS.Constructor(
  404. TS.Protected().Id("api").Op(":").Id("ApiInterface"),
  405. ).Block(angularClientConstructor...),
  406. )
  407. file.Line().Comment(
  408. "Class gerencia todos os serviços da api.",
  409. ).Export().Class().Id("Client").Block(angularClientStmts...)
  410. }
  411. func GenAngularMethodStmt(p *Project, r *Resource, method *Method, methods *[]TS.CodeInterface, angularResourceName string) {
  412. var (
  413. typ string
  414. params = []TS.CodeInterface{}
  415. paramsHttp = []TS.CodeInterface{}
  416. // id = method.ID
  417. // ret = TS.Id("Observable")
  418. param = "entity"
  419. template string
  420. templateValue interface{}
  421. defined bool
  422. )
  423. if templateValue, defined = method.Custom["ts.template.method"]; defined {
  424. template = templateValue.(string)
  425. } else {
  426. template = method.HttpMethod
  427. }
  428. template = strings.ToLower(template)
  429. switch template {
  430. case "post":
  431. typ = "post"
  432. params = append(params, TS.Id(param).Op(":").Id(method.Entity))
  433. // ret.TypeAliase(method.Entity)
  434. case "filter":
  435. typ = "get"
  436. // ret.TypeAliase(method.Entity)
  437. param = ""
  438. // params = append(params, TS.Id(param).Op(":").String())
  439. case "get":
  440. typ = "get"
  441. // ret.TypeAliase(method.Entity)
  442. param = ""
  443. case "put":
  444. typ = "put"
  445. // ret.TypeAliase(method.Entity)
  446. params = append(params, TS.Id(param).Op(":").Id(method.Entity).Op("|").String())
  447. case "delete":
  448. typ = "delete"
  449. // ret.TypeAliase(method.Entity)
  450. // params = append(params, TS.Id(param).Op(":").Id(method.Entity).Op("|").String())
  451. case "patch":
  452. typ = "patch"
  453. params = append(params, TS.Id(param).Op(":").Id(method.Entity).Op("|").String())
  454. // ret.TypeAliase(method.Entity)
  455. // params = append(params, TS.Id(param).Op(":").Id(method.Entity).Op("|").String())
  456. case "sse":
  457. typ = "event"
  458. default:
  459. panic(fmt.Sprintf("Method '%s' template not defined!", template))
  460. }
  461. path := method.Path
  462. for _, parameter := range method.Parameters {
  463. alias := getCustom(parameter.Custom, "ts.api.alias")
  464. if aliasString, ok := alias.(string);ok {
  465. path = strings.ReplaceAll(
  466. path,
  467. fmt.Sprintf("{%s}", parameter.ID),
  468. fmt.Sprintf("{%s}", aliasString),
  469. )
  470. }
  471. }
  472. // paramsHttp = append(paramsHttp, TS.Raw("this.Url(url, opt.params)"))
  473. paramsHttp = append(paramsHttp, TS.Raw(fmt.Sprintf("`${this.api.apiOptions.BASE_URL}%s`", path)))
  474. switch typ {
  475. case "post", "put", "patch":
  476. paramsHttp = append(paramsHttp, TS.Id("entity"))
  477. }
  478. params = append(params, TS.Id("opt?: HttpOptions"))
  479. paramsHttp = append(paramsHttp, TS.Id("opt"))
  480. response := strings.Replace(method.Response, "*", "",-1)
  481. if response == "" {
  482. response = method.Entity
  483. }
  484. // *methods = append(*methods, TS.Id(method.ID).Params(params...).Op(":").Id("Observable<ServiceResponse>").Block(
  485. *methods = append(*methods, TS.Id(method.ID).Params(params...).Block(
  486. // TS.Raw("let opt = this.api.Options(this.options)").Endl(),
  487. // TS.Raw("let url = ").Lit(p.GetUrlFromMethod(method)).Endl(),
  488. // TS.Raw("let url = ").Raw(fmt.Sprintf("`${this.api.BASE_URL}%s`", method.Path)).Endl(),
  489. TS.Line().Raw(
  490. fmt.Sprintf(
  491. "return this._%s<%s>",
  492. typ,
  493. response,
  494. ),
  495. ).Call(paramsHttp...).Endl(),
  496. // TS.Line().Raw(fmt.Sprintf("return this._%s", typ )).Call(paramsHttp...).Endl(),
  497. ).Line())
  498. }
  499. // func GenAngularMethod(p *Project, r *Resource, method *Method, methods *[]TS.CodeInterface, angularResourceName string) {
  500. // params := []TS.CodeInterface{}
  501. // param := "entity"
  502. // methodId := method.ID
  503. // callOptionsParam := ""
  504. // switch strings.ToLower(method.HttpMethod) {
  505. // case "post":
  506. // params = append(params, TS.Id(param).Op(":").Id(method.Entity))
  507. // case "filter":
  508. // // methodId = "get"
  509. // param = ""
  510. // case "get":
  511. // param = ""
  512. // // params = append(params, TS.Id(param).Op(":").String())
  513. // case "get_list":
  514. // param = ""
  515. // // params = append(params, TS.Id(param).Op(":").Id(method.Entity).Op("|").String())
  516. // case "patch":
  517. // param = ""
  518. // params = append(params, TS.Id(param).Op(":").Id(method.Entity))
  519. // // params = append(params, TS.Id(param).Op(":").Id(method.Entity).Op("|").String())
  520. // case "put":
  521. // params = append(params, TS.Id(param).Op(":").Id(method.Entity))
  522. // callOptionsParam = "{id: entity.id}"
  523. // case "delete":
  524. // // params = append(params, TS.Id(param).Op(":").Id(method.Entity).Op("|").String())
  525. // params = append(params, TS.Id(param).Op(":").Id(method.Entity))
  526. // callOptionsParam = "{id: entity.id}"
  527. // param = ""
  528. // default:
  529. // panic(fmt.Sprintf("O método http '%s' para o recurso %s não foi definido!", method.HttpMethod, method.ID))
  530. // }
  531. // // *methods = append(*methods, TS.Id(method.ID).Params(params...).Op(":").Id("Observable<ServiceResponse>").Block(
  532. // *methods = append(*methods, TS.Id(method.ID).Params(params...).Op(":").Id("Observable<ServiceResponse>").Block(
  533. // TS.Return().This().Dot("options").Call(TS.Raw(callOptionsParam)).Dot(methodId).Call(TS.Id(param)).Endl(),
  534. // ).Line())
  535. // }