/// <summary> /// Read an image via its URL and save that as a userimage for this account /// </summary> /// <param name="url">a full url to an image</param> /// <param name="rating">The rating of the image (g, pg, r, x)</param> /// <returns>If the method call is successful, the result will be returned using the SaveResponse property of the /// <see cref="Gravatar.NET.GravatarServiceResponse"/> instance returned by this method</returns> public GravatarServiceResponse SaveUrl(string url, GravatarImageRating rating) { var request = GetSaveUrlMethodRequest(url, rating); var response = ExecuteGravatarMethod(request); return(response); }
/// <summary> /// Save binary image data as a userimage for this account /// </summary> /// <param name="data">The image data in bytes</param> /// <param name="rating">The rating of the image (g, pg, r, x)</param> /// <returns>If the method call is successful, the result will be returned using the SaveResponse property of the /// <see cref="Gravatar.NET.GravatarServiceResponse"/> instance returned by this method</returns> public GravatarServiceResponse SaveData(byte[] data, GravatarImageRating rating) { var request = GetSaveDataMethodRequest(data, rating); var response = ExecuteGravatarMethod(request); return(response); }
private GravatarServiceRequest GetSaveUrlMethodRequest(string url, GravatarImageRating rating) { return(new GravatarServiceRequest { Email = Email, MethodName = GravatarConstants.METHOD_SAVE_URL, Parameters = new List <GravatarParameter> { GravatarParameter.NewStringParamter(ParUrl, url), GravatarParameter.NewIntegerParameter(ParRating, (int)rating), GravatarParameter.NewStringParamter(ParPassword, Password) } }); }
private GravatarServiceRequest GetSaveDataMethodRequest(byte[] data, GravatarImageRating rating) { return(new GravatarServiceRequest { Email = Email, MethodName = GravatarConstants.METHOD_SAVE_DATA, Parameters = new List <GravatarParameter> { GravatarParameter.NewStringParamter(ParData, Convert.ToBase64String(data)), GravatarParameter.NewIntegerParameter(ParRating, (int)rating), GravatarParameter.NewStringParamter(ParPassword, Password) } }); }
/// <summary> /// <para>Rating of avatar's image that represents audience restrictions.</para> /// </summary> /// <param name="widget">Widget to call method on.</param> /// <param name="rating">Rating of image.</param> /// <returns>Reference to provided <paramref name="widget"/>.</returns> /// <exception cref="ArgumentNullException">If <paramref name="widget"/> is a <c>null</c> reference.</exception> /// <seealso cref="Rating(IGravatarImageUrlWidget, string)"/> public static IGravatarImageUrlWidget Rating(this IGravatarImageUrlWidget widget, GravatarImageRating rating) { Assertion.NotNull(widget); return widget.Rating(rating.ToString().ToLowerInvariant()); }
/// <summary> /// <para>Rating of avatar's image that represents audience restrictions.</para> /// </summary> /// <param name="widget">Widget to call method on.</param> /// <param name="rating">Rating of image.</param> /// <returns>Reference to provided <paramref name="widget"/>.</returns> /// <exception cref="ArgumentNullException">If <paramref name="widget"/> is a <c>null</c> reference.</exception> /// <seealso cref="Rating(IGravatarImageUrlWidget, string)"/> public static IGravatarImageUrlWidget Rating(this IGravatarImageUrlWidget widget, GravatarImageRating rating) { Assertion.NotNull(widget); return(widget.Rating(rating.ToString().ToLowerInvariant())); }
/// <summary> /// Read an image via its URL and save that as a userimage for this account - called asynchronously /// </summary> /// <param name="url">a full url to an image</param> /// <param name="rating">The rating of the image (g, pg, r, x)</param> /// <param name="callback">The callback activated when action finishes</param> /// <param name="state">Custom parameter to callback</param> /// <returns>If the method call is successful, the result will be returned using the SaveResponse property of the /// <see cref="Gravatar.NET.GravatarServiceResponse"/> instance returned by this method /// The response is returned to the callback method</returns> public void SaveUrlAsync(string url, GravatarImageRating rating, GravatarCallBack callback, object state) { var request = GetSaveUrlMethodRequest(url, rating); ExecuteGravatarMethodAsync(request, callback, state); }
/// <summary> /// Save binary image data as a userimage for this account - called asynchronously /// </summary> /// <param name="data">The image data in bytes</param> /// <param name="rating">The rating of the image (g, pg, r, x)</param> /// <param name="callback">The callback activated when action finishes</param> /// <param name="state">Custom parameter to callback</param> /// <returns>If the method call is successful, the result will be returned using the SaveResponse property of the /// <see cref="Gravatar.NET.GravatarServiceResponse"/> instance returned by this method /// The response is returned to the callback method</returns> public void SaveDataAsync(byte[] data, GravatarImageRating rating, GravatarCallBack callback, object state) { var request = GetSaveDataMethodRequest(data, rating); ExecuteGravatarMethodAsync(request, callback, state); }
private GravatarServiceRequest GetSaveUrlMethodRequest(string url, GravatarImageRating rating) { return new GravatarServiceRequest { Email = Email, MethodName = GravatarConstants.METHOD_SAVE_URL, Parameters = new List<GravatarParameter> { GravatarParameter.NewStringParamter(ParUrl, url), GravatarParameter.NewIntegerParameter(ParRating, (int)rating), GravatarParameter.NewStringParamter(ParPassword ,Password) } }; }
private GravatarServiceRequest GetSaveDataMethodRequest(byte[] data, GravatarImageRating rating) { return new GravatarServiceRequest { Email = Email, MethodName = GravatarConstants.METHOD_SAVE_DATA, Parameters = new List<GravatarParameter> { GravatarParameter.NewStringParamter(ParData, Convert.ToBase64String(data)), GravatarParameter.NewIntegerParameter(ParRating, (int)rating), GravatarParameter.NewStringParamter(ParPassword, Password) } }; }
/// <summary> /// Read an image via its URL and save that as a userimage for this account /// </summary> /// <param name="url">a full url to an image</param> /// <param name="rating">The rating of the image (g, pg, r, x)</param> /// <returns>If the method call is successful, the result will be returned using the SaveResponse property of the /// <see cref="Gravatar.NET.GravatarServiceResponse"/> instance returned by this method</returns> public GravatarServiceResponse SaveUrl(string url, GravatarImageRating rating) { var request = GetSaveUrlMethodRequest(url, rating); var response = ExecuteGravatarMethod(request); return response; }
/// <summary> /// Save binary image data as a userimage for this account /// </summary> /// <param name="data">The image data in bytes</param> /// <param name="rating">The rating of the image (g, pg, r, x)</param> /// <returns>If the method call is successful, the result will be returned using the SaveResponse property of the /// <see cref="Gravatar.NET.GravatarServiceResponse"/> instance returned by this method</returns> public GravatarServiceResponse SaveData(byte[] data, GravatarImageRating rating) { var request = GetSaveDataMethodRequest(data, rating); var response = ExecuteGravatarMethod(request); return response; }