/// <summary> /// Creates a pingback subscription. When the events happen, the url will be sent a POST request with the pertinent data. /// </summary> /// <param name="drop">The drop.</param> /// <param name="url">The url.</param> /// <param name="events"> The events. </param> /// <returns></returns> public Subscription CreatePingbackSubscription(Drop drop, string url, AssetEvents events) { return this.ServiceAdapter.CreatePingbackSubscription(drop, url, events); }
/// <summary>Creates a pingback subscription. When the events happen, the url will be sent a POST request with the /// pertinent data.</summary> /// <param name="url">A <see cref="string"> type specifying the url to send the pingback to</param> /// <param name="events">The events that a pingback should be sent for. Multiple events can be specifed by using the /// bitwise OR operator. /// <example><code>AssetEvents.AssetCreated | AssetEvents.AssetDeleted</code></example> /// </param> /// <returns>A <see cref="Subscription"> object of the newly created pingback subscription</returns> /// <exception cref="System.NullReferenceException">Thrown when the Drop object is not set to an instance of Drop</exception> public Subscription CreatePingbackSubscription(string url, AssetEvents events) { return ServiceProxy.Instance.CreatePingbackSubscription (this, url, events); }
/// <summary> /// Creates a pingback subscription. When the events happen, the url will be sent a POST request with the pertinent data. /// </summary> /// <param name="drop">The drop.</param> /// <param name="url">The url.</param> /// <param name="events"> The events. </param> /// <returns></returns> public Subscription CreatePingbackSubscription(Drop drop, string url, AssetEvents events) { if (drop == null) throw new ArgumentNullException("drop", "The given drop can't be null"); Subscription s = null; Hashtable parameters = new Hashtable(); parameters.Add("type", "pingback"); parameters.Add("url", url); parameters.Add("asset_created", ((events & AssetEvents.AssetCreated) == AssetEvents.AssetCreated).ToString().ToLower()); parameters.Add("asset_udpated", ((events & AssetEvents.AssetUpdated) == AssetEvents.AssetUpdated).ToString().ToLower()); parameters.Add("asset_deleted", ((events & AssetEvents.AssetDeleted) == AssetEvents.AssetDeleted).ToString().ToLower()); parameters.Add("job_started", ((events & AssetEvents.JobStarted) == AssetEvents.JobStarted).ToString().ToLower()); parameters.Add("job_complete", ((events & AssetEvents.JobComplete) == AssetEvents.JobComplete).ToString().ToLower()); parameters.Add("job_progress", ((events & AssetEvents.JobProgress) == AssetEvents.JobProgress).ToString().ToLower()); HttpWebRequest request = this.CreatePostRequest(this.CreateSubscriptionsUrl(drop.Name), parameters); CompleteRequest(request, delegate(HttpWebResponse response) { ReadResponse(response, delegate(XmlDocument doc) { XmlNode node = doc.SelectSingleNode("/subscription"); s = this.CreateAndMapSubscription(drop, node); }); }); return s; }