Create a group.

@param       $notificationKeyName
@param array $registrationIds

@return null|string notification_key
434601
public function createGroup($notificationKeyName, array $registrationIds)
    {
        $request = new GroupRequest(self::CREATE, $notificationKeyName, null, $registrationIds);

        $response = $this->client->request('post', $this->url, $request->build());

        return $this->getNotificationToken($response);
    }
894099
public function getIds($notifications)
    {
        return array_map(function($notification) {
            if ($notification instanceof NotificationContract) {
                return $notification->getKey();
            } else {
                return $notification;
            }
        }, $notifications);
    }
49081
public function createNotification($message, $userId = '1')
    {
        $notification = $this->getEntityManager()->getEntity('Notification');
        $notification->set(array(
            'type' => 'message',
            'data' => array(
                'userId' => $userId,
            ),
            'userId' => $userId,
            'message' => $message
        ));
        $this->getEntityManager()->saveEntity($notification);
    }
521592
public function addAll(array $messages, $groupName = null) {
		foreach ($messages as $message) {
			$this->add($message, $groupName);
		}
	}
342118
public IdentityOperationResult createMembership(String userId, String groupId) {
    checkAuthorization(Permissions.CREATE, Resources.GROUP_MEMBERSHIP, groupId);
    UserEntity user = findUserById(userId);
    GroupEntity group = findGroupById(groupId);
    MembershipEntity membership = new MembershipEntity();
    membership.setUser(user);
    membership.setGroup(group);
    getDbEntityManager().insert(membership);
    createDefaultMembershipAuthorizations(userId, groupId);
    return new IdentityOperationResult(null, IdentityOperationResult.OPERATION_CREATE);
  }
1261042
public function getRegistrationById($registrationId)
    {
        /** @var Registration $registration */
        foreach ($this->registrations as $registration) {
            if ($registration->getId() === $registrationId) {
                return $registration;
            }
        }

        return false;
    }
883563
public void createGroup(String groupId) throws Exception {
		if (getElementPosition(groupId) == -1) {
			QueryControllerGroup group = new QueryControllerGroup(groupId);
			entities.add(group);
			fireElementAdded(group);
		}
		else {
			throw new Exception("The name is already taken, either by a query group or a query item");
		}
	}
1074991
public function push(array $tokens = [], array $notifications = [], array $params = [])
    {
        if (!$tokens || !$notifications) {
            return null;
        }

        $adapterParams = [];
        $deviceParams  = [];
        $messageParams = [];
        if (isset($params) && !empty($params)) {
            if (isset($params['adapter'])) {
                $adapterParams = $params['adapter'];
            }

            if (isset($params['device'])) {
                $deviceParams = $params['device'];
            }

            if (isset($params['message'])) {
                $messageParams = $params['message'];
            }

            //because we have now notification and data separated
            if (isset($params['notificationData'])) {
                $messageParams['notificationData'] = $params['notificationData'];
            }
        }

        $adapterParams['apiKey'] = $this->apiKey;

        if (!$this->apiKey) {
            throw new \RuntimeException('Android api key must be set');
        }

        // Development one by default (without argument).
        /** @var PushManager $pushManager */
        $pushManager = new PushManager($this->environment);

        // Then declare an adapter.
        $gcmAdapter = new GcmAdapter($adapterParams);

        // Set the device(s) to push the notification to.
        $devices = new DeviceCollection([]);

        //devices
        foreach ($tokens as $token) {
            $devices->add(new Device($token, $deviceParams));
        }

        foreach ($notifications as $notificationText) {
            // Then, create the push skel.
            $message = new Message($notificationText, $messageParams);

            // Finally, create and add the push to the manager, and push it!
            $push = new Push($gcmAdapter, $devices, $message);
            $pushManager->add($push);
        }

        // Returns a collection of notified devices
        $pushes = $pushManager->push();

        $this->response = $gcmAdapter->getResponse();

        return $this->response;
    }
248592
public function store_notifications( $queue_id, array $notifications, Strategy $strategy = null ) {

		$all = get_option( $this->bucket, array() );

		$found = empty( $all ) ? false : true;

		if ( empty( $notifications ) ) {
			return $this->clear_notifications( $queue_id );
		}

		$all[ $queue_id ] = array(
			'notifications' => $notifications
		);

		if ( isset( $strategy ) ) {
			$all[ $queue_id ]['strategy'] = $strategy;
		}

		if ( $found ) {
			return update_option( $this->bucket, $all );
		} else {
			return add_option( $this->bucket, $all, '', 'no' );
		}
	}
1135633
protected function getUserAccountName(NotificationInterface $notification, $keyInData = 'uid')
    {
        $names = [];
        $count = 0;

        if (isset($notification[$keyInData])) {

            $uidList  = $notification[$keyInData];
            $count    = count($uidList);

            if (!is_array($uidList)) {
                $uidList = [$uidList];
            }

            $names = array_map('format_username', user_load_multiple($uidList));
        }

        if (empty($names)) {
            return;
        }

        if ($count) {
            return $this->getTitleString($names, $count);
        }
    }
396616
private function registerGroupChange($custId, $groupIdOld, $groupIdNew)
    {
        $data = new EChangeGroup();
        $data->setCustomerRef($custId);
        $data->setGroupOld($groupIdOld);
        $data->setGroupNew($groupIdNew);
        $dateChanged = $this->hlpDate->getUtcNowForDb();
        $data->setDateChanged($dateChanged);
        $this->daoChangeGroup->create($data);
    }
730458
protected function getRecipientIDs(NotificationEntity $notification)
    {
        $result = [];
        $notificationData = $notification->getNotificationData();
        $result[] = $notificationData['requestedBy'];
        $group = $this->getGroupsHelper()->getGlobalAdministrators();
        $result = array_merge($result, $group->getGroupMemberIDs());

        return $result;
    }
427017
def linkify_with_notificationways(self, notificationways):
        
        for i in self:
            if not hasattr(i, 'notificationways'):
                continue
            new_notificationways = []
            for nw_name in strip_and_uniq(i.notificationways):
                notifway = notificationways.find_by_name(nw_name)
                if notifway is not None:
                    new_notificationways.append(notifway.uuid)
                else:
                    err = "The 'notificationways' of the %s '%s' named '%s' is unknown!" %\
                          (i.__class__.my_type, i.get_name(), nw_name)
                    i.add_error(err)
            # Get the list, but first make elements unique
            i.notificationways = list(set(new_notificationways))

            # Update the contact host/service notification commands properties
            i.get_notification_commands(notificationways, 'host', command_name=True)
            i.get_notification_commands(notificationways, 'service', command_name=True)
1365548
private function createNotification(\ArrayIterator $recipients, MessageInterface $message)
    {
        $message = clone $message;
        $message->setRecipientDeviceCollection($recipients);

        $handlers = $this->getPayloadHandlers();

        foreach ($handlers as $handler) {
            if ($handler->isSupported($message)) {
                $notificationId = uniqid();
                $handler
                    ->setNotificationId($notificationId)
                    ->setMessage($message);

                $packedPayload  = $this->handlePayload($handler);
                $customData     = $handler->getCustomNotificationData();

                $notification = new Notification();
                $notification
                    ->setIdentifier($notificationId)
                    ->setType($message->getMessageType())
                    ->setRecipients($recipients)
                    ->setPayload($packedPayload)
                    ->setCustomNotificationData($customData)
                ;
                return $notification;
            }
        }

        throw new DomainException(
            sprintf(
                'Unhandled message type %s',
                $message->getMessageType()
            )
        );
    }
1083889
def NameGroups(data_arr,id_key):
		
		new_data_arr = []
		for data in data_arr:
			try:
				data_arr[id_key] = clc._GROUP_MAPPING[data[id_key]]
			except:
				pass
			new_data_arr.append(data)
		if clc.args:  clc.v1.output.Status("ERROR",2,"Group name conversion not yet implemented")
		return(new_data_arr)
523701
@Override
	public List<CommerceNotificationQueueEntry> findByGroupId(long groupId) {
		return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
	}
244416
def CreateGroup(self, GroupName):
        
        groups = self.CustomGroups
        self._DoCommand('CREATE GROUP %s' % tounicode(GroupName))
        for g in self.CustomGroups:
            if g not in groups and g.DisplayName == GroupName:
                return g
        raise SkypeError(0, 'Group creating failed')