2
2
3
3
Package for building and interacting with the Dynata Respondent Exchange (REX)
4
4
5
-
6
5
## Quickstart:
7
6
7
+ ### _ ** Opportunity Registry** _
8
8
9
+ ### Instantiate a Registry Client
9
10
10
- ### * __ Respondent Gateway__ *
11
- ### Instantiate a Gateway Client
11
+ ``` php
12
+ use Dynata\Rex\Core\Security\BasicCredentialsProvider;
13
+ use Dynata\Rex\Core\Security\StringSigner;
14
+ use Dynata\Rex\Registry\Registry;
15
+
16
+ $interval = \DateInterval::createFromDateString('1 day');
17
+ $creds_provider = new BasicCredentialsProvider("REX_ACCESS_KEY", "REX_SECRET_KEY");
18
+ $string_signer = new StringSigner($creds_provider, $interval);
19
+ $registy = new Registry("REX_REGISTRY_BASE_URL", $string_signer);
20
+ ```
21
+
22
+ ##### List Opportunities
23
+
24
+ ``` php
25
+ $shardConfig = new ShardConfig(1, 1);
26
+ $opportunity_payload = new ListOpportunitiesInput(1, $shardConfig, "account_id");
27
+ $registry->listOpportunities($opportunity_payload);
28
+ ```
29
+
30
+ ##### List Opportunities
31
+
32
+ ``` php
33
+ $shardConfig = new ShardConfig(1, 1);
34
+ $opportunity_payload = new ListOpportunitiesInput(1, $shardConfig, "account_id");
35
+ $registry->listOpportunities($opportunity_payload);
36
+ ```
37
+
38
+ ##### Acknowledge Opportunities
39
+
40
+ ``` php
41
+ $ack_opportunity_payload = new AckOpportunitiesInput("account_id", [1, 2 , 3]);
42
+ $registry->ackOpportunities($ack_opportunity_payload);
43
+ ```
44
+
45
+ ##### Get Opportunity
46
+
47
+ ``` php
48
+ $registry->getOpportunity(['id'=> 1]);
49
+ ```
50
+
51
+ ##### List Project Opportunities
52
+
53
+ ``` php
54
+ $list_project_opportunities_payload = new ListProjectOpportunitiesInput("account_id", 1);
55
+ $registry->listProjectOpportunities($list_project_opportunities_payload);
12
56
```
57
+
58
+ ##### Download Collection
59
+
60
+ ``` php
61
+ $download_collection_payload = new DownloadCollectionInput("account_id", 1);
62
+ $registry->downloadCollection($list_project_opportunities_payload);
63
+ ```
64
+
65
+ ### _ ** Respondent Gateway** _
66
+
67
+ ### Instantiate a Gateway Client
68
+
69
+ ``` php
13
70
use Dynata\Rex\Core\Security\BasicCredentialsProvider;
14
71
use Dynata\Rex\Core\Security\StringSigner;
15
72
@@ -21,8 +78,9 @@ $gateway = new Gateway("REX_BASE_URL", $string_signer);
21
78
```
22
79
23
80
##### Create a context
24
- ```
25
- $context = new CreateContextInput("unique_context_id", "account_id", "expiration",
81
+
82
+ ``` php
83
+ $context = new CreateContextInput("unique_context_id", "account_id", "expiration",
26
84
[
27
85
"ctx" => "a987dsglh34t435jkhsdg98u",
28
86
"gender" => "male",
@@ -35,19 +93,22 @@ $gateway->createContext($context);
35
93
```
36
94
37
95
##### Get a context
38
- ```
96
+
97
+ ``` php
39
98
$context = new GetContextInput("unique_context_id", "account_id");
40
99
$gatway->getContext($context);
41
100
```
42
101
43
102
##### Expire a context
44
- ```
103
+
104
+ ``` php
45
105
$context = new ExpireContextInput("unique_context_id", "account_id");
46
106
$gatway->expireContext($context);
47
107
```
48
108
49
109
##### Create or Update a Respondent
50
- ```
110
+
111
+ ``` php
51
112
$respondent = new PutRespondentInput(
52
113
"unique_respondent_id",
53
114
"en",
@@ -60,7 +121,8 @@ $gatway->putRespondent($respondent);
60
121
```
61
122
62
123
##### Create or Update a Respondent Answers
63
- ```
124
+
125
+ ``` php
64
126
$respondent = new PutRespondentAnwsersInput(
65
127
"unique_respondent_id",
66
128
"US",
@@ -77,61 +139,16 @@ $gatway->putRespondentAnswers($respondent);
77
139
```
78
140
79
141
##### Get Attributes
80
- ```
142
+
143
+ ``` php
81
144
$get_attributes = new GetAttributeInput();
82
145
$get_attributes->page_size = 1;
83
146
$gateway->getAttributes($get_attributes);
84
147
```
85
148
86
149
##### Get Attribute Info
87
- ```
150
+
151
+ ``` php
88
152
$get_attribute_info = new GetAttributeInfoInput(1);
89
153
$gateway->getAttributeInfo($get_attribute_info);
90
154
```
91
- ### * __ Opportunity Registry__ *
92
- ### Instantiate a Registry Client
93
-
94
- ```
95
- use Dynata\Rex\Core\Security\BasicCredentialsProvider;
96
- use Dynata\Rex\Core\Security\StringSigner;
97
- use Dynata\Rex\Registry\Registry;
98
-
99
- $interval = \DateInterval::createFromDateString('1 day');
100
- $creds_provider = new BasicCredentialsProvider("REX_ACCESS_KEY", "REX_SECRET_KEY");
101
- $string_signer = new StringSigner($creds_provider, $interval);
102
- $registy = new Registry("REX_REGISTRY_BASE_URL", $string_signer);
103
- ```
104
-
105
- ##### List Opportunities
106
- ```
107
- $shardConfig = new ShardConfig(1, 1);
108
- $opportunity_payload = new ListOpportunitiesInput(1, $shardConfig, "account_id");
109
- $registry->listOpportunities($opportunity_payload);
110
- ```
111
-
112
- ##### List Opportunities
113
- ```
114
- $shardConfig = new ShardConfig(1, 1);
115
- $opportunity_payload = new ListOpportunitiesInput(1, $shardConfig, "account_id");
116
- $registry->listOpportunities($opportunity_payload);
117
- ```
118
-
119
- ##### Acknowledge Opportunities
120
- ```
121
- $ack_opportunity_payload = new AckOpportunitiesInput("account_id", [1, 2 , 3]);
122
- $registry->ackOpportunities($ack_opportunity_payload);
123
- ```
124
- ##### Get Opportunity
125
- ```
126
- $registry->getOpportunity(['id'=> 1]);
127
- ```
128
- ##### List Project Opportunities
129
- ```
130
- $list_project_opportunities_payload = new ListProjectOpportunitiesInput("account_id", 1);
131
- $registry->listProjectOpportunities($list_project_opportunities_payload);
132
- ```
133
- ##### Download Collection
134
- ```
135
- $download_collection_payload = new DownloadCollectionInput("account_id", 1);
136
- $registry->downloadCollection($list_project_opportunities_payload);
137
- ```
0 commit comments