clientStructWSSections return section templates that generate WebSocket related struct type definitions for the client.
(data *ServiceData)
| 381 | // clientStructWSSections return section templates that generate WebSocket |
| 382 | // related struct type definitions for the client. |
| 383 | func clientStructWSSections(data *ServiceData) []*codegen.SectionTemplate { |
| 384 | var sections []*codegen.SectionTemplate |
| 385 | sections = append(sections, &codegen.SectionTemplate{ |
| 386 | Name: "client-websocket-conn-configurer-struct", |
| 387 | Source: httpTemplates.Read(websocketConnConfigurerStructT), |
| 388 | Data: data, |
| 389 | FuncMap: map[string]any{"isWebSocketEndpoint": IsWebSocketEndpoint}, |
| 390 | }) |
| 391 | for _, e := range data.Endpoints { |
| 392 | if e.ClientWebSocket != nil { |
| 393 | sections = append(sections, &codegen.SectionTemplate{ |
| 394 | Name: "client-websocket-struct-type", |
| 395 | Source: httpTemplates.Read(websocketStructTypeT), |
| 396 | Data: e.ClientWebSocket, |
| 397 | }) |
| 398 | } |
| 399 | } |
| 400 | return sections |
| 401 | } |
| 402 | |
| 403 | // clientWSSections returns section templates that contain client WebSocket |
| 404 | // specific code for the given service. |
no test coverage detected