Cancel subscription and return the subscription object.

        Deleting a subscription causes the subscription status to changed to 'canceled'.
        The updated subscription object is returned.
495164
def delete(self, subscription_id, data=None):
        
        if not subscription_id or not subscription_id.startswith(self.RESOURCE_ID_PREFIX):
            raise IdentifierError(
                "Invalid subscription ID: '{id}'. A subscription ID should start with '{prefix}'.".format(
                    id=subscription_id, prefix=self.RESOURCE_ID_PREFIX)
            )
        result = super(CustomerSubscriptions, self).delete(subscription_id, data)
        return self.get_resource_object(result)
194095
public void _cancel(int id) {
        if ( doOnSubscribe != null ) {
            doOnSubscribe.add(() -> _cancel(id));
        } else
            subscribers.remove(id);
    }
923302
def unsubscribe(self, message, handler):
        '''
        
        '''
        with self._lock:
            self._subscribers[message].remove(WeakCallable(handler))
662517
def cancel(self, subscription_id, data={}, **kwargs):
        
        url = "{}/{}/cancel".format(self.base_url, subscription_id)
        return self.post_url(url, data, **kwargs)
316600
function remove()
    {

        if (!$this->subscribed()) {
            throw new Exception('No subscription');
        }

        try {

            $response = $this->_platform->delete('/restapi/v1.0/subscription/' . $this->_subscription['id']);

            $this->reset();

            $this->dispatch(self::EVENT_REMOVE_SUCCESS, new SuccessEvent($response));

            return $response;

        } catch (Exception $e) {

            $this->reset();
            $this->dispatch(self::EVENT_REMOVE_ERROR, new ErrorEvent($e));
            throw $e;

        }

    }
1184522
def unsubscribe(self, user, verbose=None):
        
        if not self.email_enabled:
            raise EmailNotEnabledError("See settings.EMAIL_ENABLED")
        response = requests.put(
            f"{self.api_url}/{self.address}/members/{user.email}",
            auth=("api", self.api_key),
            data={"subscribed": False},
        )
        if verbose:
            sys.stdout.write(
                f"Unsubscribing {user.email} from {self.address}. "
                f"Got response={response.status_code}.\n"
            )
        return response
245998
def delete_subscription(self, subscription_id):
        
        self._validate_uuid(subscription_id)

        url = "/notification/v1/subscription/{}".format(subscription_id)
        response = NWS_DAO().deleteURL(url, self._write_headers())

        if response.status != 204:
            raise DataFailureException(url, response.status, response.data)

        return response.status
954077
def unregister(self, device, callback):
        
        if not device:
            logger.error("Received an invalid device: %r", device)
            return

        logger.debug("Removing subscription for {}".format(device.name))
        self._callbacks[device].remove(callback)
        self._devices[device.vera_device_id].remove(device)
666108
def remove(self, parameters):
        

        # Verify that we already know our assigned subscription_id
        assert self.subscription_id != -1

        if not parameters:
            return

        options = web_pb2.ParameterSubscriptionRequest()
        options.subscriptionId = self.subscription_id
        options.id.extend(_build_named_object_ids(parameters))

        self._manager.send('unsubscribe', options)
42915
def delete(self):
        # type: () -> None
        
        response = self._client._request('DELETE', self._client._build_url('service', service_id=self.id))

        if response.status_code != requests.codes.no_content:  # pragma: no cover
            raise APIError("Could not delete service: {} with id {}".format(self.name, self.id))
834744
def delete(self):
        
        if self._on_delete is not None:
            return self._on_delete(self)

        return self._query.delete()
1311825
def unsubscribe(self, subscriber: 'Subscriber') -> None:
        
        # here is a special implementation which is replacing the more
        # obvious one: self._subscriptions.remove(subscriber) - this will not
        # work because list.remove(x) is doing comparision for equality.
        # Applied to publishers this will return another publisher instead of
        # a boolean result
        for i, _s in enumerate(self._subscriptions):
            if _s is subscriber:
                self._subscriptions.pop(i)
                return
        raise SubscriptionError('Subscriber is not registered')
875617
function(client, subscriptions, channel, callback, done_callback) {
    if (subscriptions[channel]===undefined)
        return;
    subscriptions[channel].splice(subscriptions[channel].indexOf(callback), 1);
    if (subscriptions[channel].length===0) {
        delete subscriptions[channel];
        client.unsubscribe(channel, function() {
            // If there is a done_callback defined, execute it
            if (done_callback!==undefined) done_callback();
        });
    }
}
1292262
def cancel(self):
        
        if self.done():
            return False

        self._client.cancel_operation(self._operation.name)
        return True
814343
def delete(self):
        
        counter, counter_dict = 0, {}
        for obj in self:
            result = obj.delete()
            if result is not None:
                current_counter, current_counter_dict = result
                counter += current_counter
                counter_dict.update(current_counter_dict)
        if counter:
            return counter, counter_dict
177632
def delete_subscription(self, subscription_id):
        
        return self.client._delete(self.url + 'subscriptions/{}'.format(subscription_id), headers=self.get_headers())
1162867
def cancelUpdate(self):
        
        key = '/library/sections/%s/refresh' % self.key
        self._server.query(key, method=self._server._session.delete)