client-call-clientstreaming.swift 1.3 KB

12345678910111213141516171819202122
  1. /// {{ method|methodDescriptorName }} (Client Streaming)
  2. {{ access }} protocol {{ .|call:file,service,method }}: ClientCallClientStreamingBase {
  3. /// Call this to send each message in the request stream. Nonblocking.
  4. func send(_ message: {{ method|input }}, errorHandler: @escaping (Error) -> Void) throws
  5. /// Call this to close the connection and wait for a response. Blocking.
  6. func closeAndReceive() throws -> {{ method|output }}
  7. /// Call this to close the connection and wait for a response. Nonblocking.
  8. func closeAndReceive(completion: @escaping ({{ method|output }}?, ClientError?) -> Void) throws
  9. }
  10. fileprivate final class {{ .|call:file,service,method }}Impl: ClientCallClientStreamingImpl<{{ method|input }}, {{ method|output }}>, {{ .|call:file,service,method }} {
  11. override class var method: String { return "{{ .|path:file,service,method }}" }
  12. }
  13. //-{% if generateTestStubs %}
  14. /// Simple fake implementation of {{ .|call:file,service,method }}
  15. /// stores sent values for later verification and finall returns a previously-defined result.
  16. class {{ .|call:file,service,method }}TestStub: ClientCallClientStreamingTestStub<{{ method|input }}, {{ method|output }}>, {{ .|call:file,service,method }} {
  17. override class var method: String { return "{{ .|path:file,service,method }}" }
  18. }
  19. //-{% endif %}