Add the user's jid to this contact's roster with a subscription state of
 'from.' This signals that this contact has approved a user's subscription.
176358
def add_subscription_from(jid)
      unless contact = contact(jid)
        contact = Contact.new(:jid => jid)
        @roster << contact
      end
      contact.subscribe_from
    end
74630
def update_subscription(netid, action, subscription_code, data_field=None):
    
    url = '/nws/v1/subscription.json'
    action = {
        'uwNetID': netid,
        'action': action,
        'subscriptionCode': str(subscription_code)
    }

    if isinstance(data_field, tuple) and len(data_field) == 2:
        action[data_field[0]] = str(data_field[1])

    body = {'actionList': [action]}
    response = post_resource(url, json.dumps(body))
    return _json_to_subscriptions(response)
646021
def subscribe_to_data(
        self,
        subscriber: Callable[[bytes], bool],
    ) -> None:
        
        self._data_subscribers.append(subscriber)
1215997
function subscribe(subscriber, immediate) {
        if (!~subscribers.indexOf(subscriber)) {
            subscribers.push(subscriber);
        }
        if (immediate) {
            subscriber(value);
        }
    }
628268
final void acknowledge(String subscription, List<String> ackIds) {

    AcknowledgeRequest request =
        AcknowledgeRequest.newBuilder().setSubscription(subscription).addAllAckIds(ackIds).build();
    acknowledge(request);
  }
177440
protected void requestOidAdd (String name, OidList list, int oid)
    {
        // if we're on the authoritative server, we update the set immediately
        boolean applyImmediately = isAuthoritative();
        if (applyImmediately) {
            list.add(oid);
        }
        postEvent(new ObjectAddedEvent(_oid, name, oid).setAlreadyApplied(applyImmediately));
    }
1086949
def add(contacts)
      contact_ids = [contacts].flatten.uniq.compact.map(&:id)
      response = Hubspot::Connection.post_json(ADD_CONTACT_PATH, params: { list_id: @id }, body: { vids: contact_ids })
      response['updated'].sort == contact_ids.sort
    end
1247940
def add_contact(self, segment_id, contact_id):
        

        response = self._client.session.post(
            '{url}/{segment_id}/contact/add/{contact_id}'.format(
                url=self.endpoint_url,
                segment_id=segment_id,
                contact_id=contact_id
            )
        )
        return self.process_response(response)
599837
def subscribed(self, user):
        
        for who, record in self.logs:
            if (record["field_name"] == "cc" and
                    user.email in record["added"]):
                return True
        return False
189757
def subscribe(self, user, verbose=None):
        
        if not self.email_enabled:
            raise EmailNotEnabledError("See settings.EMAIL_ENABLED")
        if not user.email:
            raise UserEmailError(f"User {user}'s email address is not defined.")
        response = requests.post(
            f"{self.api_url}/{self.address}/members",
            auth=("api", self.api_key),
            data={
                "subscribed": True,
                "address": user.email,
                "name": f"{user.first_name} {user.last_name}",
                "description": f'{user.userprofile.job_title or ""}',
                "upsert": "yes",
            },
        )
        if verbose:
            sys.stdout.write(
                f"Subscribing {user.email} to {self.address}. "
                f"Got response={response.status_code}.\n"
            )
        return response
975882
def has_in_subscriptions(self, subscription):
        
        assert isinstance(subscription, github.Repository.Repository), subscription
        status, headers, data = self._requester.requestJson(
            "GET",
            "/user/subscriptions/" + subscription._identity
        )
        return status == 204
1143558
public Subscription insertOrUpdate(Subscription subscription) {
        EntityManager entityManager = getEntityManager();
        EntityTransaction entityTransaction = null;

        try {
            entityTransaction = entityManager.getTransaction();
            entityTransaction.begin();
			Subscription persistedSubscription;
			if (subscription.getId() == null) {
				entityManager.persist(subscription);
				persistedSubscription = subscription;
			} else {
				persistedSubscription = entityManager.merge(subscription);
			}
			entityManager.flush();
            entityTransaction.commit();
            return persistedSubscription;
        } catch (Exception e) {
            if (entityTransaction != null && entityTransaction.isActive()) {
                entityTransaction.rollback();
            }
            throw e;
		} finally {
			entityManager.close();
		}
	}
280541
function autoSubscribe() {
    //re-add pending subscribers
    if (_pendingSubscribers.length > 0) {
      async.each(_pendingSubscribers, function(sub, callback) {
        debug('Add pending subscriber', sub);
        self.subscribeToTopic(sub.exchange, sub.queue, sub.filter, sub.subscriber, sub.opts, function(err) {
          if (err) {
            debug('Failed to add subscriber, keep it', sub);
          } else {
            //done, remove the item from the pending subscribers
            var idx = _pendingSubscribers.indexOf(sub);
            _pendingSubscribers.splice(idx, 1);
            debug('pending subsriber added, now there are ' + _pendingSubscribers.length + ' left');
          }
          return callback();
        });
      }, function() {
        debug('pending subscribers are added');
      });
    }
  }
786204
def add_membership(self, member, role=github.GithubObject.NotSet):
        
        assert isinstance(member, github.NamedUser.NamedUser), member
        assert role is github.GithubObject.NotSet or isinstance(
            role, (str, unicode)), role
        if role is not github.GithubObject.NotSet:
            assert role in ['member', 'maintainer']
            put_parameters = {
                "role": role,
            }
        else:
            put_parameters = {
                "role": "member",
            }
        headers, data = self._requester.requestJsonAndCheck(
            "PUT",
            self.url + "/memberships/" + member._identity,
            input=put_parameters
        )
342951
def add_members(self, group_jid, peer_jids: Union[str, List[str]]):
        
        log.info("[+] Adding some members to the group {}".format(group_jid))
        return self._send_xmpp_element(group_adminship.AddMembersRequest(group_jid, peer_jids))
1028074
def add_subscriber(self, connection_id, subscriptions,
                       last_known_block_id):
        
        with self._subscribers_cv:
            self._subscribers[connection_id] = \
                EventSubscriber(
                    connection_id, subscriptions, last_known_block_id)

        LOGGER.debug(
            'Added Subscriber %s for %s', connection_id, subscriptions)
140212
def invite_user(self, new_member, inviter=None, roster=None):
        """"""
        roster = roster or self.client.getRoster()
        jid = new_member['JID']

        logger.info('roster %s %s' % (jid, roster.getSubscription(jid)))
        if jid in roster.keys() and roster.getSubscription(jid) in ['both', 'to']:
            new_member['STATUS'] = 'ACTIVE'
            if inviter:
                self.send_message('%s is already a member' % (jid,), inviter)
        else:
            new_member['STATUS'] = 'INVITED'
            self.broadcast('inviting %s to the room' % (jid,))

            #Add nickname according to http://xmpp.org/extensions/xep-0172.html
            subscribe_presence = xmpp.dispatcher.Presence(to=jid, typ='subscribe')
            if 'NICK' in self.params:
                subscribe_presence.addChild(name='nick', namespace=xmpp.protocol.NS_NICK, payload=self.params['NICK'])
            self.client.send(subscribe_presence)

        if not self.is_member(new_member):
            new_member.setdefault('NICK', jid.split('@')[0])
            self.params['MEMBERS'].append(new_member)