private void ExecIsSubscribed(KiiSubscribable target, KiiHttpClientFactory factory, KiiCheckSubscriptionCallback callback) { if (callback == null) { throw new ArgumentNullException("KiiCheckSubscriptionCallback must not be null"); } if (target == null) { callback(target, false, new ArgumentNullException("KiiSubscribable must not be null")); return; } Utils.CheckInitialize(true); KiiHttpClient client = factory.Create(ToUrl(target), Kii.AppId, Kii.AppKey, KiiHttpMethod.GET); KiiCloudEngine.SetAuthBearer(client); client.SendRequest((ApiResponse response, Exception e) => { if (e != null) { if (e is NotFoundException) { callback(target, false, null); } else { callback(target, false, e); } } else { callback(target, response.IsSuccess(), e); } }); }
/// <summary> /// Checks whether the target is already subscribed by current user or not. /// </summary> /// <remarks></remarks> /// <param name="target">to be checked for subscription existence.</param> /// <param name="callback"> /// Callback delegate. If exception is null, execution is succeeded. /// </param> /// <exception cref='ArgumentNullException'> /// Is thrown when an argument is null. /// </exception> /// <exception cref='CloudException'> /// Is thrown when server sends error response. /// </exception> public void IsSubscribed(KiiSubscribable target, KiiCheckSubscriptionCallback callback) { this.ExecIsSubscribed(target, Kii.AsyncHttpClientFactory, callback); }