/// <summary> /// Update a single callingNumber. /// </summary> /// <param name="callingNumberId">The callingNumberId of the target callingNumber.</param> /// <param name="options">Optional CallingNumberOptions instance to be used when updating an callingNumber.</param> /// <returns>The updated callingNumber matching the callingNumberId provided.</returns> /// <exception cref="PersyException">Thrown upon failed request.</exception> public CallingNumber update(string callingNumberId, CallingNumberOptions options) { string json = base.POST(String.Format("{0}/{1}", this.path, callingNumberId), options.toJson()); if (string.IsNullOrEmpty(json) == true) { throw new PersyException(String.Format("Failed to update CallingNumber {0} information", callingNumberId)); } return(CallingNumber.fromJson(json)); }
/// <summary> /// Create a new CallingNumber through the Persephony API /// </summary> /// <param name="options">Optional CallingNumberOptions instance to be used when creating an CallingNumber.</param> /// <param name="phoneNumber">The phoneNumber of the CallingNumber to create.</param> /// <returns>A CallingNumber object returned by Persephony that represents the CallingNumber that was created.</returns> /// <exception cref="PersyException">Thrown upon failed request.</exception> /// <see cref="CallingNumberOptions">CallingNumberOptions class.</see> public CallingNumber create(string phoneNumber, CallingNumberOptions options = null) { NewCallingNumber newPhone = new NewCallingNumber(phoneNumber, options); string json = base.POST(this.path, newPhone.toJson()); if (string.IsNullOrEmpty(json) == true) { throw new PersyException(String.Format("Failed to create CallingNumber with options {0}. PhoneNumber: {1}", ((options != null) ? options.toJson() : string.Empty), phoneNumber)); } return(CallingNumber.fromJson(json)); }