Beispiel #1
0
 /// <summary>
 /// For APIs whose response can be treated as a Capability("result":[current, [candidate0, candidate1, ...]]) and which have no request parameter.
 /// </summary>
 /// <typeparam name="T">Type of the response Capability</typeparam>
 /// <param name="method">Name of the API</param>
 /// <returns></returns>
 protected Task <Capability <T> > CapabilityByMethod <T>(string method
                                                         , CancellationTokenSource cancel = null)
 {
     return(Capability(RequestGenerator.Jsonize(method), BasicParser.AsCapability <T>, cancel));
 }
Beispiel #2
0
 /// <summary>
 /// For APIs which have no response parameter and no request parameter.
 /// </summary>
 /// <param name="method">Name of the API</param>
 /// <param name="version">Version of the API</param>
 /// <returns></returns>
 protected async Task NoValueByMethod(string method, ApiVersion version = ApiVersion.V1_0
                                      , CancellationTokenSource cancel  = null)
 {
     await NoValue(RequestGenerator.Jsonize(method, version), cancel).ConfigureAwait(false);
 }
Beispiel #3
0
 /// <summary>
 /// For APIs whose response is an object which can be deserialized and which have no request parameter.
 /// </summary>
 /// <typeparam name="T">Type of the response object</typeparam>
 /// <param name="method">Name of the API</param>
 /// <param name="version">Version of the API</param>
 /// <returns></returns>
 protected Task <T> ObjectByMethod <T>(string method, ApiVersion version = ApiVersion.V1_0
                                       , CancellationTokenSource cancel  = null)
 {
     return(Single(RequestGenerator.Jsonize(method, version), BasicParser.AsObject <T>, cancel));
 }
Beispiel #4
0
 /// <summary>
 /// GetMethodTypes v1.0
 /// </summary>
 /// <param name="version">Version of the API set to retrieve. Empty string means all.</param>
 /// <returns></returns>
 public Task <List <MethodType> > GetMethodTypesAsync(string version = "", CancellationTokenSource cancel = null)
 {
     return(Single(RequestGenerator.Jsonize("getMethodTypes", version), CustomParser.AsMethodTypes, cancel));
 }
Beispiel #5
0
 /// <summary>
 /// For APIs whose response is an array of a single type and which have no request parameter.
 /// </summary>
 /// <typeparam name="T">Type of the response array members</typeparam>
 /// <param name="method">Name of the API</param>
 /// <param name="version">Version of the API</param>
 /// <returns></returns>
 protected Task <List <T> > PrimitiveListByMethod <T>(string method, ApiVersion version = ApiVersion.V1_0
                                                      , CancellationTokenSource cancel  = null)
 {
     return(List(RequestGenerator.Jsonize(method, version), BasicParser.AsPrimitiveList <T>, cancel));
 }