/// <summary> /// Displays a notification. /// </summary> /// <param name="uid">(Optional)A unique identifier for the notification so the sending application can track events related to it and update it if required. </param> /// <param name="classId">(Optional)The identifier of the class to use.</param> /// <param name="title">(Optional)Notification title.</param> /// <param name="text">(Optional) Notification body text.</param> /// <param name="timeout">(Optional)The amount of time, in seconds, the notification should remain on screen.</param> /// <param name="icon">(Optional) The icon to use, see the notes below for details of supported formats.</param> /// <param name="iconBase64">(Optional) Base64-encoded bytes to be used as the icon.</param> /// <param name="sound">(Optional) The path to a sound file to play.</param> /// <param name="callback">(Optional) Callback to be invoked when the user clicks on the main body area of the notification.</param> /// <param name="priority">(Optional) The urgency of the notification, <see cref="SnarlMessagePriority"/> and Priorities in the Developer Guide for more information on how Snarl deals with different priorities. </param> /// <param name="sensitivity">(Optional) The sensitivity of the notification. See the Sensitivity section in the Developer Guide for more information.</param> /// <param name="value-percent">(Optional) A decimal percent value to be included with the notification. Certain styles can display this value as a meter or other visual representation. See Custom Values in the Developer Guide for more information.</param> /// <param name="action">Optional) Actions to add to the notification - <see cref="ActionCollection"/> and see Action section in the Developer Guide for more information.</param> /// <remarks><see cref="https://sites.google.com/site/snarlapp/developers/api-reference#TOC-notify"/></remarks> public Int32 Notify(String uId = null, String classId = null, String title = null, String text = null, Int32? timeout = null, String icon = null, String iconBase64 = null, String sound = null, String callback = null, String callbackLabel = null, SnarlMessagePriority? priority = null, String sensitivity = null, decimal? valuePercent = null, SnarlAction[] actions = null) { if (appSignature == null) throw new InvalidOperationException("AppSignature is null - the applications is properly not registered correctly with Snarl."); // Build parameter list int paramListSize = 15 + (actions != null ? actions.Length : 0); SnarlParameterList spl = new SnarlParameterList(paramListSize); spl.Add("app-sig", appSignature); spl.Add("password", password); spl.Add("uid", uId); spl.Add("id", classId); spl.Add("title", title); spl.Add("text", text); spl.Add("timeout", timeout); spl.Add("icon", icon); spl.Add("icon-base64", iconBase64); spl.Add("sound", sound); spl.Add("callback", callback); spl.Add("callback-label", callbackLabel); spl.Add("priority", (Int32?)priority); spl.Add("sensitivity", sensitivity); spl.Add("value-percent", sensitivity); spl.Add(actions); return DoRequest(SnarlRequests.Notify, spl); }
public SnarlParameterList Add(SnarlAction[] actions) { if (actions != null) { foreach (var a in actions) { String action = a.Label + "," + a.Callback; list.Add(new KeyValuePair<String, String>("action", action)); } } return this; }