sseClientStreamSections returns section templates for SSE client endpoints.
(data *httpcodegen.ServiceData)
| 134 | |
| 135 | // sseClientStreamSections returns section templates for SSE client endpoints. |
| 136 | func sseClientStreamSections(data *httpcodegen.ServiceData) []*codegen.SectionTemplate { |
| 137 | sections := make([]*codegen.SectionTemplate, 0) |
| 138 | for _, ed := range data.Endpoints { |
| 139 | if ed.SSE == nil { |
| 140 | continue |
| 141 | } |
| 142 | // Generate SSE client stream struct and methods |
| 143 | sections = append(sections, &codegen.SectionTemplate{ |
| 144 | Name: "jsonrpc-sse-client-stream", |
| 145 | Source: jsonrpcTemplates.Read(sseClientStreamT), |
| 146 | Data: ed, |
| 147 | }) |
| 148 | } |
| 149 | return sections |
| 150 | } |