client-call-clientstreaming.swift 1.2 KB

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