-
Notifications
You must be signed in to change notification settings - Fork 6
/
interface.go
104 lines (86 loc) · 3.5 KB
/
interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package client
import (
"context"
"github.com/Clever/wag/samples/gen-go/models"
)
//go:generate $GOPATH/bin/mockgen -source=$GOFILE -destination=mock_client.go -package=client
// Client defines the methods available to clients of the swagger-test service.
type Client interface {
// GetAuthors makes a GET request to /authors
// Gets authors
// 200: *models.AuthorsResponse
// 400: *models.BadRequest
// 500: *models.InternalError
// default: client side HTTP errors, for example: context.DeadlineExceeded.
GetAuthors(ctx context.Context, i *models.GetAuthorsInput) (*models.AuthorsResponse, error)
NewGetAuthorsIter(ctx context.Context, i *models.GetAuthorsInput) (GetAuthorsIter, error)
// GetAuthorsWithPut makes a PUT request to /authors
// Gets authors, but needs to use the body so it's a PUT
// 200: *models.AuthorsResponse
// 400: *models.BadRequest
// 500: *models.InternalError
// default: client side HTTP errors, for example: context.DeadlineExceeded.
GetAuthorsWithPut(ctx context.Context, i *models.GetAuthorsWithPutInput) (*models.AuthorsResponse, error)
NewGetAuthorsWithPutIter(ctx context.Context, i *models.GetAuthorsWithPutInput) (GetAuthorsWithPutIter, error)
// GetBooks makes a GET request to /books
// Returns a list of books
// 200: []models.Book
// 400: *models.BadRequest
// 500: *models.InternalError
// default: client side HTTP errors, for example: context.DeadlineExceeded.
GetBooks(ctx context.Context, i *models.GetBooksInput) ([]models.Book, error)
NewGetBooksIter(ctx context.Context, i *models.GetBooksInput) (GetBooksIter, error)
// CreateBook makes a POST request to /books
// Creates a book
// 200: *models.Book
// 400: *models.BadRequest
// 500: *models.InternalError
// default: client side HTTP errors, for example: context.DeadlineExceeded.
CreateBook(ctx context.Context, i *models.Book) (*models.Book, error)
// PutBook makes a PUT request to /books
// Puts a book
// 200: *models.Book
// 400: *models.BadRequest
// 500: *models.InternalError
// default: client side HTTP errors, for example: context.DeadlineExceeded.
PutBook(ctx context.Context, i *models.Book) (*models.Book, error)
// GetBookByID makes a GET request to /books/{book_id}
// Returns a book
// 200: *models.Book
// 400: *models.BadRequest
// 401: *models.Unathorized
// 404: *models.Error
// 500: *models.InternalError
// default: client side HTTP errors, for example: context.DeadlineExceeded.
GetBookByID(ctx context.Context, i *models.GetBookByIDInput) (*models.Book, error)
// GetBookByID2 makes a GET request to /books2/{id}
// Retrieve a book
// 200: *models.Book
// 400: *models.BadRequest
// 404: *models.Error
// 500: *models.InternalError
// default: client side HTTP errors, for example: context.DeadlineExceeded.
GetBookByID2(ctx context.Context, id string) (*models.Book, error)
// HealthCheck makes a GET request to /health/check
//
// 200: nil
// 400: *models.BadRequest
// 500: *models.InternalError
// default: client side HTTP errors, for example: context.DeadlineExceeded.
HealthCheck(ctx context.Context) error
}
// GetAuthorsIter defines the methods available on GetAuthors iterators.
type GetAuthorsIter interface {
Next(*models.Author) bool
Err() error
}
// GetAuthorsWithPutIter defines the methods available on GetAuthorsWithPut iterators.
type GetAuthorsWithPutIter interface {
Next(*models.Author) bool
Err() error
}
// GetBooksIter defines the methods available on GetBooks iterators.
type GetBooksIter interface {
Next(*models.Book) bool
Err() error
}