// AddContacts adds a maximum of 50 contacts to the group.
556003
func AddContacts(c *messagebird.Client, groupID string, contactIDs []string) error {
	if err := validateAddContacts(contactIDs); err != nil {
		return err
	}

	data := addContactsData(contactIDs)

	return c.Request(nil, http.MethodPut, path+"/"+groupID+"/"+contactPath, data)
}
510170
func (s *ContactsService) CreateContact(accountID string, contactAttributes Contact) (*contactResponse, error) {
	path := versioned(contactPath(accountID, 0))
	contactResponse := &contactResponse{}

	resp, err := s.client.post(path, contactAttributes, contactResponse)
	if err != nil {
		return nil, err
	}

	contactResponse.HttpResponse = resp
	return contactResponse, nil
}
19338
func (client *CMSClient) ListContactGroup(args *ListContactGroupArgs) (*ListContactGroupResponse, error) {
	response := &ListContactGroupResponse{}
	err := client.Invoke("ListContactGroup", args, response)
	if err != nil {
		return nil, err
	}
	return response, nil
}
97523
func (s *Simulation) AddNodesAndConnectFull(count int, opts ...AddNodeOption) (ids []enode.ID, err error) {
	if count < 2 {
		return nil, errors.New("count of nodes must be at least 2")
	}
	ids, err = s.AddNodes(count, opts...)
	if err != nil {
		return nil, err
	}
	err = s.Net.ConnectNodesFull(ids)
	if err != nil {
		return nil, err
	}
	return ids, nil
}
1199402
func (o HostNetworkSystem) AddPortGroup(ctx context.Context, portgrp types.HostPortGroupSpec) error {
	req := types.AddPortGroup{
		This:    o.Reference(),
		Portgrp: portgrp,
	}

	_, err := methods.AddPortGroup(ctx, o.c, &req)
	if err != nil {
		return err
	}

	return nil
}
634292
func NewConnectResults(results ...ConnectResult) ConnectAttemptResults {
	mapResults := make(map[Attempt]ConnectResult)
	for _, r := range results {
		mapResults[r.Attempt] = r
	}
	return mapResults
}
1206673
func (h *WebHook) NewConnectOptions() (runtime.Object, bool, string) {
	return &kapi.PodProxyOptions{}, true, "path"
}
606659
func (s *UpdateDomainContactInput) SetRegistrantContact(v *ContactDetail) *UpdateDomainContactInput {
	s.RegistrantContact = v
	return s
}
448727
func (s *SocketHub) AddConnection(ws *SocketWorker) {
	var ok bool

	s.so.RLock()
	ok = s.sockets[ws]
	s.so.RUnlock()

	if ok {
		return
	}

	s.so.Lock()
	s.sockets[ws] = true
	s.so.Unlock()

	go s.manageSocket(ws)
}
1228198
func (s *ContactsService) DeleteContact(accountID string, contactID int64) (*contactResponse, error) {
	path := versioned(contactPath(accountID, contactID))
	contactResponse := &contactResponse{}

	resp, err := s.client.delete(path, nil, nil)
	if err != nil {
		return nil, err
	}

	contactResponse.HttpResponse = resp
	return contactResponse, nil
}
518618
func (n *NotifyRouter) AddConnection(xp rpc.Transporter, ch chan error) ConnectionID {
	if n == nil {
		return 0
	}
	id := n.cm.AddConnection(xp, ch)
	n.setNotificationChannels(id, keybase1.NotificationChannels{})
	return id
}
133737
func (tp *TouchPeer) AddTouchListener(listener TouchListener) {
	simlog.FuncIn()
	tp.touchListeners = append(tp.touchListeners, listener)
	simlog.FuncOut()
}
399781
func (p *parser) addConcatenate() {
	// The first (| inside a Testgroup group goes directly to the group
	p.concatenation.addChild(p.unit)
	p.unit = nil
}
396156
func (cli *OpsGenieClient) Contact() (*OpsGenieContactClient, error) {
	cli.makeHTTPTransportSettings()

	contactClient := new(OpsGenieContactClient)
	contactClient.SetOpsGenieClient(*cli)

	if cli.opsGenieAPIURL == "" {
		contactClient.SetOpsGenieAPIUrl(endpointURL)
	}

	return contactClient, nil
}
673311
func sendContactUpdate() error {
	log.Debugf("Sending contact SyncMessage")

	lc, err := GetRegisteredContacts()
	if err != nil {
		return fmt.Errorf("could not get local contacts: %s", err)
	}

	var buf bytes.Buffer

	for _, c := range lc {
		cd := &textsecure.ContactDetails{
			Number: &c.Tel,
			Name:   &c.Name,
			// TODO: handle avatars
		}

		b, err := proto.Marshal(cd)
		if err != nil {
			log.Errorf("Failed to marshal contact details")
			continue
		}

		buf.Write(varint32(len(b)))
		buf.Write(b)
	}

	a, err := uploadAttachment(&buf, "application/octet-stream")
	if err != nil {
		return err
	}

	sm := &textsecure.SyncMessage{
		Contacts: &textsecure.SyncMessage_Contacts{
			Blob: &textsecure.AttachmentPointer{
				Id:          &a.id,
				ContentType: &a.ct,
				Key:         a.keys,
			},
		},
	}

	_, err = sendSyncMessage(sm)
	return err
}
1175709
func (s *UpdateDomainContactInput) SetAdminContact(v *ContactDetail) *UpdateDomainContactInput {
	s.AdminContact = v
	return s
}
406541
func addPolicyContracts(csMap map[string]*contrSpec, epg *epgSpec, policy *contivModel.Policy) error {

	for ruleName := range policy.LinkSets.Rules {
		rule := contivModel.FindRule(ruleName)
		if rule == nil {
			errStr := fmt.Sprintf("rule %v not found", ruleName)
			return errors.New(errStr)
		}

		if rule.FromIpAddress != "" || rule.FromNetwork != "" ||
			rule.ToIpAddress != "" || rule.ToNetwork != "" {
			log.Errorf("rule: %+v is invalid for ACI mode", rule)
			errStr := fmt.Sprintf("rule %s is invalid, only From/ToEndpointGroup may be specified in ACI mode", ruleName)
			return errors.New(errStr)
		}

		if rule.Action == "deny" {
			log.Debugf("==Ignoring deny rule %v", ruleName)
			continue
		}

		filter := filterInfo{Protocol: rule.Protocol, ServPort: strconv.Itoa(rule.Port)}
		cn := getContractName(policy.PolicyName, rule.FromEndpointGroup,
			rule.ToEndpointGroup)
		spec, found := csMap[cn]
		if !found {
			// add a link for this contract
			lKind := cProvide
			if rule.ToEndpointGroup != "" {
				lKind = cConsume
			}
			cLink := contrLink{LinkKind: lKind,
				ContractName: cn,
				ContractKind: cInternal,
			}
			epg.ContractLinks = append(epg.ContractLinks, cLink)

			spec = &contrSpec{Name: cn}
			csMap[cn] = spec
		}
		spec.Filters = append(spec.Filters, filter)
	}

	return nil
}