dynata / rex-sdk-php
This package is abandoned and no longer maintained.
No replacement package was suggested.
1.0.2
2022-08-29 14:37 UTC
Requires
- php: >=7.4
- ext-json: *
- guzzlehttp/guzzle: ^7.0
- phpdocumentor/reflection-docblock: ^5.3
- symfony/property-access: ^5.3
- symfony/serializer: ^5.3
Requires (Dev)
- phpstan/phpstan: ^1.1
- phpunit/phpunit: ^9
- squizlabs/php_codesniffer: 3.*
This package is auto-updated.
Last update: 2025-01-17 16:10:26 UTC
README
Warning
DEPRECATED
This repository is no longer supported.
rex-sdk-php
Package for building and interacting with the Dynata Respondent Exchange (REX)
Quickstart:
Note: if you do not have an "account_id" null can be used
Opportunity Registry
Instantiate a Registry Client
use Dynata\Rex\Core\Security\BasicCredentialsProvider; use Dynata\Rex\Core\Security\StringSigner; use Dynata\Rex\Registry\Registry; $interval = \DateInterval::createFromDateString('1 day'); $creds_provider = new BasicCredentialsProvider("REX_ACCESS_KEY", "REX_SECRET_KEY"); $string_signer = new StringSigner($creds_provider, $interval); $registy = new Registry("REX_REGISTRY_BASE_URL", $string_signer);
List Opportunity Notifications
$shardConfig = new ShardConfig(1, 1); $notification_payload = new ReceiveNotificationsInput(1, $shardConfig, "account_id"); $registry->recieveNotifications($notification_payload);
Acknowledge Notifications
$ack_notification_payload = new AckNotificationsInput("account_id", [1, 2 , 3]); $registry->ackNotifications($ack_notification_payload);
Get Opportunity
$registry->getOpportunity(['id'=> 1]);
List Project Opportunities
$list_project_opportunities_payload = new ListProjectOpportunitiesInput("account_id", 1); $registry->listProjectOpportunities($list_project_opportunities_payload);
Download Collection
$download_collection_payload = new DownloadCollectionInput("account_id", 1); $registry->downloadCollection($list_project_opportunities_payload);
Respondent Gateway
Instantiate a Gateway Client
use Dynata\Rex\Core\Security\BasicCredentialsProvider; use Dynata\Rex\Core\Security\StringSigner; $interval = \DateInterval::createFromDateString('1 day'); $creds_provider = new BasicCredentialsProvider("REX_ACCESS_KEY", "REX_SECRET_KEY"); $string_signer = new StringSigner($creds_provider, $interval); $gateway = new Gateway("REX_BASE_URL", $string_signer);
Create a context
$context = new CreateContextInput("unique_context_id", "account_id", "expiration", [ "ctx" => "a987dsglh34t435jkhsdg98u", "gender" => "male", "postal_code" => "60081", "birth_date" => "1959-10-05", "country" => "US" ] ); $gateway->createContext($context);
Get a context
$context = new GetContextInput("unique_context_id", "account_id"); $gatway->getContext($context);
Expire a context
$context = new ExpireContextInput("unique_context_id", "account_id"); $gatway->expireContext($context);
Create or Update a Respondent
$respondent = new PutRespondentInput( "unique_respondent_id", "en", "US", "female", "1999-09-09", "60081" ); $gatway->putRespondent($respondent);
Create or Update a Respondent Answers
$respondent = new PutRespondentAnwsersInput( "unique_respondent_id", "US", [ [ "id" => -9223372036854776000, "answers" => [ -9223372036854776000 ] ] ] ); $gatway->putRespondentAnswers($respondent);
List Attributes
$list_attributes = new ListAttributesInput(); $list_attributes->page_size = 1; $gateway->listAttributes($list_attributes);
Get Attribute Info
$get_attribute_info = new GetAttributeInfoInput(1); $gateway->getAttributeInfo($get_attribute_info);