Update README with paging information.
@@ -90,6 +90,8 @@ The server interface defined in `gen-go/server/interface.go` has one method for
* Wag only supports defining a single 2XX response status code and doesn't support 3XX status codes.
* If the success response type has a data type associated with it then Wag generates an interface that takes a pointer to that data type as the first argument.
`func(...) (*SuccessType, error)`
+ * If the operation uses `x-paging`, then Wag generates the an interface that takes the type of the page ID parameter as the second return type.
+ `func(...) (*SuccessType, PageParamType, error)`
* If the success response type doesn't define a data type then Wag generates an interface with only an error response. A nil error tells the client that the request succeeded.
`func(...) error`
@@ -154,6 +156,29 @@ logger.FromContext(ctx).Info(...)
* If marked required will ensure that the input isn't the nil value. Headers cannot have pointer types since HTTP doesn't distinguish between empty and missing headers.
* If it doesn't have a default value specified, the default value will be the nil value for the type
+### Paging
+ * Wag can help implement paging on endpoints if you use the `x-paging`
+ configuration:
+ ```
+ /books:
+ operationId: getBooks
+ x-paging:
+ pageParameter: startingAfter
+ ```
+ * `pageParameter` should be set to the name of a parameter you define on the
+ operation that specifies a page ID. The parameter can be a query, header,
+ or path parameter (it may not be the only path parameter).
+ * You can also specify `resourcePath` if the array you want iterate over
+ isn't the top-level success return for the operation. (See `/authors` in
+ samples/swagger.yml.)
+ * The server interface will be amended with a 2nd success return type so that
+ your controller can provide the next page ID the client should fetch.
+ * The autogenerated Go client will include a `New<OperationID>Iter` function
+ that returns an iterator object that exposes a Next() function that will
+ return successive resources, requesting new pages as needed.
+ * The autogenerated JS client will include an `<operationID>Iter` function
+ that exposes `map`, `forEach`, and `toArray` functions to iterate over the
+ results, again requesting new pages as needed.
### Contexts
* The first argument to every Wag function is a `context.Context` (https://blog.golang.org/context). Contexts play a few important roles in Wag.
