예제 #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 async Task <Capability <T> > CapabilityByMethod <T>(string method
                                                               , CancellationTokenSource cancel = null)
 {
     return(await Capability <T>(
                RequestGenerator.Jsonize(method),
                BasicParser.AsCapability <T>, cancel).ConfigureAwait(false));
 }
예제 #2
0
 /// <summary>
 /// GetMethodTypes v1.0
 /// </summary>
 /// <param name="version">Version of the API set to retrieve. Empty string means all.</param>
 /// <returns></returns>
 public async Task <List <MethodType> > GetMethodTypesAsync(string version = ""
                                                            , CancellationTokenSource cancel = null)
 {
     return(await Single <List <MethodType> >(
                RequestGenerator.Jsonize("getMethodTypes", version),
                CustomParser.AsMethodTypes, cancel).ConfigureAwait(false));
 }
예제 #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 async Task <T> ObjectByMethod <T>(string method, ApiVersion version = ApiVersion.V1_0
                                             , CancellationTokenSource cancel  = null)
 {
     return(await Single <T>(
                RequestGenerator.Jsonize(method, version),
                BasicParser.AsObject <T>, cancel).ConfigureAwait(false));
 }
예제 #4
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));
 }
예제 #5
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);
 }
예제 #6
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));
 }
예제 #7
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));
 }
예제 #8
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));
 }