/// <summary> /// Perform a stored procedure call. /// </summary> /// <param name="procedureName">The function name to call</param> /// <param name="parameters">The parameters to pass to the function call</param> /// <returns></returns> public static Task <BaseResponse> Rpc(string procedureName, Dictionary <string, object> parameters, StatelessClientOptions options) { // Build Uri var builder = new UriBuilder($"{options.BaseUrl}/rpc/{procedureName}"); var canonicalUri = builder.Uri.ToString(); var serializerSettings = StatelessClient.SerializerSettings(options); // Prepare parameters var data = JsonConvert.DeserializeObject <Dictionary <string, string> >(JsonConvert.SerializeObject(parameters, serializerSettings)); // Prepare headers var headers = Helpers.PrepareRequestHeaders(HttpMethod.Post, new Dictionary <string, string>(options.Headers), options); // Send request var request = Helpers.MakeRequest(HttpMethod.Post, canonicalUri, serializerSettings, data, headers); return(request); }
/// <summary> /// Returns a Table Query Builder instance for a defined model - representative of `USE $TABLE` /// </summary> /// <typeparam name="T">Custom Model derived from `BaseModel`</typeparam> /// <returns></returns> public static Table <T> Table <T>(StatelessClientOptions options) where T : BaseModel, new() => new Table <T>(options.BaseUrl, options, SerializerSettings(options));