/// <summary> /// Sends a reminder for an agreement. /// </summary> /// <param name="agreementId">The agreement identifier, as returned by the agreement creation API or retrieved from the API to fetch agreements</param> /// <returns>AgreementInfo</returns> public async Task <ReminderCreationResult> SendReminders(ReminderCreationInfo info) { string serializedObject = JsonConvert.SerializeObject(info); using (StringContent content = new StringContent(serializedObject, Encoding.UTF8)) { content.Headers.Remove("Content-Type"); content.Headers.Add("Content-Type", "application/json"); HttpResponseMessage result = await client.PostAsync(apiEndpointVer + "/reminders", content).ConfigureAwait(false); if (result.IsSuccessStatusCode) { string response = await result.Content.ReadAsStringAsync().ConfigureAwait(false); ReminderCreationResult agreement = JsonConvert.DeserializeObject <ReminderCreationResult>(response); return(agreement); } else { string response = await result.Content.ReadAsStringAsync().ConfigureAwait(false); HandleError(result.StatusCode, response, false); return(null); } } }
/// <summary> /// Sends a reminder for an agreement. /// </summary> public virtual Task <ReminderCreationResult> SendReminderAsync(ReminderCreationInfo info) { var request = new RestRequest(Method.POST); request.JsonSerializer = new Serialization.NewtonSoftSerializer(); request.Resource = "reminders"; request.AddJsonBody(info); return(this.Sdk.ExecuteAsync <ReminderCreationResult>(request)); }
/// <summary> /// Sends a reminder for an agreement. Sends a reminder for an agreement. /// </summary> /// <param name="accessToken"> /// An <a href=\"#\" onclick=\"this.href=oauthDoc()\" /// oncontextmenu=\"this.href=oauthDoc()\" target=\"oauthDoc\">OAuth Access Token /// </a> with scopes:<ul><li style='list-style-type: square'><a href=\"#\ /// " onclick=\"this.href=oauthDoc('agreement_write')\" oncontextmenu=\" /// this.href=oauthDoc('agreement_write')\" target=\"oauthDoc\">agreement_write< /// /a></li></ul> /// </param> /// <param name="reminderCreationInfo">Information about the reminder.</param> /// <param name="xApiUser"> /// The userId or email of API caller using the account or group token in the format <b> /// userid:{userId} OR email:{email}.</b> If it is not specified, then the caller is inferred from the token. /// </param> /// <returns>ReminderCreationResult</returns> public ReminderCreationResult CreateReminder(string accessToken, ReminderCreationInfo reminderCreationInfo, string xApiUser) { // verify the required parameter 'accessToken' is set if (accessToken == null) { throw new ApiException(400, "Missing required parameter 'accessToken' when calling CreateReminder"); } // verify the required parameter 'reminderCreationInfo' is set if (reminderCreationInfo == null) { throw new ApiException(400, "Missing required parameter 'reminderCreationInfo' when calling CreateReminder"); } string path = "/reminders"; path = path.Replace("{format}", "json"); Dictionary <string, string> queryParams = new Dictionary <string, string>(); Dictionary <string, string> headerParams = new Dictionary <string, string>(); Dictionary <string, string> formParams = new Dictionary <string, string>(); Dictionary <string, FileParameter> fileParams = new Dictionary <string, FileParameter>(); string postBody = null; if (accessToken != null) { headerParams.Add("Access-Token", ApiClient.ParameterToString(accessToken)); // header parameter } if (xApiUser != null) { headerParams.Add("x-api-user", ApiClient.ParameterToString(xApiUser)); // header parameter } postBody = ApiClient.Serialize(reminderCreationInfo); // http body (model) parameter // authentication setting, if any string[] authSettings = { }; // make the HTTP request IRestResponse response = (IRestResponse)ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); if ((int)response.StatusCode >= 400) { throw new ApiException((int)response.StatusCode, "Error calling CreateReminder: " + response.Content, response.Content); } if ((int)response.StatusCode == 0) { throw new ApiException((int)response.StatusCode, "Error calling CreateReminder: " + response.ErrorMessage, response.ErrorMessage); } return((ReminderCreationResult)ApiClient.Deserialize(response.Content, typeof(ReminderCreationResult), response.Headers)); }