You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -83,12 +83,13 @@ As mentioned previously, You can configure an api in `Parent` or `Child` (nested
83
83
To create `Web Api` defined as `parent` or `nested` api, you need to implement from `WebApi<TResult>` class,
84
84
where `TResult` is `IApiResult` interface (or `ApiResult` base class) implementation and is the result that will be returned from executing the api.
85
85
86
-
Upon creating the web api class, you need to provide `GetUrl()` method implementation.
87
-
* Implement the `GetUrl(IRequestContext context, IApiResult parentApiResult)` method to return the constructed endpoint based on given parameters of the method.
86
+
Upon creating the web api class, you need to provide `GetUrl()` method implementation to return `Uri` instance.
87
+
* Implement the `GetUrl(IRequestContext context, IApiResult parentApiResult)` method to return the constructed endpoint using given parameters of the method.
88
88
* For `Parent Api`, only `IRequestContext` context parameter is passed to GetUrl() method to resolve the Url endpoint.
89
89
* For `Nested Api`, api result parameter (ie. `IApiResult` parentApiResult) from the parent api is additionally passed in to GetUrl() method along with IRequestContext context parameter.
90
-
* Optionally, override `GetHeaders()` method to provide any list of `request headers` for the api.
91
-
*`IApiResult` implementation exposes `Headers` property for any `response headers` received as part of the api response.
90
+
* Optionally, override `GetRequestHeaders()` method to provide a dictionary of `outgoing headers` for the api request.
91
+
* Optionally, override `GetResponseHeaders()` method to provide any list of `incoming headers` from the api response.
92
+
*`IApiResult` implementation exposes `Headers` property for subscribed `response headers` received as part of the api response.
92
93
93
94
`Important:`
94
95
- The api `endpoint` needs to be resolved before executing the api with `ApiEngine`.
@@ -104,12 +105,28 @@ public class CustomerApi : WebApi<CustomerResult>
104
105
{
105
106
}
106
107
108
+
// Override to construct the api endpoint.
107
109
protected override Uri GetUrl(IRequestContext context, IApiResult parentApiResult)
108
110
{
109
111
// Executes as root or level 1 api. parentApiResult should be null.
110
112
var customerContext = (CustomerContext)context;
111
113
112
-
return new Uri(string.Format(Endpoints.BaseAddress + Endpoints.Customer, customerContext.CustomerId));
114
+
return new Uri(string.Format(Endpoints.Customer, customerContext.CustomerId));
115
+
}
116
+
117
+
// Override to pass custom outgoing headers with the api request.
0 commit comments