From 2c77a1de5083ed76d44262ea37879e160d7572e2 Mon Sep 17 00:00:00 2001 From: Nathan Hart Date: Thu, 14 Nov 2019 13:22:43 -0600 Subject: [PATCH] Update README.md Adding a brief description of path bound objects to the readme --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index b3cf2cf39..3c7991777 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,19 @@ If the name of your parameter doesn't match the name in the URL path, use the Task> GroupList([AliasAs("id")] int groupId); ``` +A request url can also bind replacement blocks to a custom object + +```csharp +[Get("/group/{request.groupId}/users/{request.userId}")] +Task> GroupList(UserGroupRequest request); + +class UserGroupRequest{ + int groupId { get;set; } + int userId { get;set; } +} + +``` + Parameters that are not specified as a URL substitution will automatically be used as query parameters. This is different than Retrofit, where all parameters must be explicitly specified. @@ -104,6 +117,7 @@ Task> Search(string page); Search("admin/products"); >>> "/search/admin/products" ``` + ### Dynamic Querystring Parameters If you specify an `object` as a query parameter, all public properties which are not null are used as query parameters.