cwmiller / broadworks-connector

Simple library for connecting to BroadWorks OCI-P API
MIT License
8 stars 5 forks source link

UserServiceAssignListRequest #42

Closed TwinMist closed 5 years ago

TwinMist commented 5 years ago

Hi if VOICE_MESSAGING_USER is a variable ie $ServiceName how would you create the request? $serviceName = array(UserService::$ServiceName()); Uncaught Error: Function name must be a string $serviceName = array(UserService::$ServiceName); Uncaught Error: Access to undeclared static property: UserService::$serviceName

$serviceName = array(UserService::VOICE_MESSAGING_USER()); $request = (new UserServiceAssignListRequest()) ->setUserId($userId) ->setServiceName($serviceName);

many thanks

TwinMist commented 5 years ago

Any idea how to pass a array of services to assign. Thanks

cwmiller commented 5 years ago

If you're trying to convert a string to an enum, pass the string to the enum type's constructor. i.e.


$userServiceName = 'VOICE_MESSAGING_USER';
$userService = new UserService($userServiceName);

$request = (new UserServiceAssignListRequest())
->setUserId($userId)
->setServiceName([$userService]);
TwinMist commented 5 years ago

Sorry what I meant was what about if the array has a number of services in it? Or do u have to do them one by one. Many thanks

TwinMist commented 5 years ago

hi using the above method $unboundedPositiveInt = new UnboundedPositiveInt(); if ($total === 'Unlimited') { $unboundedPositiveInt->setUnlimited(true); } else { $unboundedPositiveInt->setQuantity($total); }

$ServiceName = 'ACCOUNT_AUTHORIZATION_CODES'; $GroupService = new GroupService($ServiceName); $request = (new ServiceProviderServiceModifyAuthorizationListRequest()) ->setServiceProviderId($serviceProviderId) ->setgroupServiceAuthorization([ (new GroupServiceAuthorization()) ->setServiceName([$GroupService]) ->setAuthorizedQuantity($unboundedPositiveInt)

]);

getting error Uncaught UnexpectedValueException: Value 'ACCOUNT_AUTHORIZATION_CODES' is not part of the enum CWM\BroadWorksConnector\Ocip\Models\GroupService in

same is happening with ServiceProviderServicePackAddRequest are you able to test and let me know if you are able to send the request.

any ideas? Many many thanks for all your help.

cwmiller commented 5 years ago

Sorry what I meant was what about if the array has a number of services in it? Or do u have to do them one by one.

You should be able to include multiple instances of UserService in the array to setServiceName

Uncaught UnexpectedValueException: Value 'ACCOUNT_AUTHORIZATION_CODES' is not part of the enum CWM\BroadWorksConnector\Ocip\Models\GroupService in

That's because the value for ACCOUNT_AUTHORIZATION_CODES is actually "Account/Authorization Codes". You're better off using $GroupService = GroupService::ACCOUNT_AUTHORIZATION_CODES() to create the enum instances.

TwinMist commented 5 years ago

hi, are you able to give me an example of how to include multiple instance within a array using enum instances and how you would add this to the request many thanks