()
| 468 | } |
| 469 | |
| 470 | func comprehensiveWebSocketDSL() { |
| 471 | var UserType = ResultType("User", func() { |
| 472 | Attributes(func() { |
| 473 | Attribute("id", String) |
| 474 | Attribute("name", String) |
| 475 | Attribute("email", String, func() { |
| 476 | Format("email") |
| 477 | }) |
| 478 | }) |
| 479 | Required("id", "name") |
| 480 | View("default", func() { |
| 481 | Attribute("id") |
| 482 | Attribute("name") |
| 483 | Attribute("email") |
| 484 | }) |
| 485 | View("tiny", func() { |
| 486 | Attribute("id") |
| 487 | }) |
| 488 | }) |
| 489 | |
| 490 | Service("TestService", func() { |
| 491 | Method("ServerStreaming", func() { |
| 492 | StreamingResult(UserType) |
| 493 | HTTP(func() { |
| 494 | GET("/server-stream") |
| 495 | }) |
| 496 | }) |
| 497 | |
| 498 | Method("ClientStreaming", func() { |
| 499 | StreamingPayload(func() { |
| 500 | Attribute("data", String, func() { |
| 501 | MinLength(1) |
| 502 | }) |
| 503 | Required("data") |
| 504 | }) |
| 505 | Result(String) |
| 506 | HTTP(func() { |
| 507 | GET("/client-stream") |
| 508 | }) |
| 509 | }) |
| 510 | |
| 511 | Method("BidirectionalStreaming", func() { |
| 512 | StreamingPayload(UserType) |
| 513 | StreamingResult(UserType) |
| 514 | HTTP(func() { |
| 515 | GET("/bidirectional") |
| 516 | }) |
| 517 | }) |
| 518 | |
| 519 | Method("RegularMethod", func() { |
| 520 | Payload(String) |
| 521 | Result(String) |
| 522 | HTTP(func() { |
| 523 | POST("/regular") |
| 524 | }) |
| 525 | }) |
| 526 | }) |
| 527 | } |
nothing calls this directly
no test coverage detected