Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

Commit 9c9c87c

Browse files
committed
code block php syntax
1 parent 87dfc5c commit 9c9c87c

File tree

1 file changed

+75
-58
lines changed

1 file changed

+75
-58
lines changed

README.md

+75-58
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,71 @@
22

33
Package for building and interacting with the Dynata Respondent Exchange (REX)
44

5-
65
## Quickstart:
76

7+
### _**Opportunity Registry**_
88

9+
### Instantiate a Registry Client
910

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);
1256
```
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
1370
use Dynata\Rex\Core\Security\BasicCredentialsProvider;
1471
use Dynata\Rex\Core\Security\StringSigner;
1572

@@ -21,8 +78,9 @@ $gateway = new Gateway("REX_BASE_URL", $string_signer);
2178
```
2279

2380
##### 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",
2684
[
2785
"ctx" => "a987dsglh34t435jkhsdg98u",
2886
"gender" => "male",
@@ -35,19 +93,22 @@ $gateway->createContext($context);
3593
```
3694

3795
##### Get a context
38-
```
96+
97+
```php
3998
$context = new GetContextInput("unique_context_id", "account_id");
4099
$gatway->getContext($context);
41100
```
42101

43102
##### Expire a context
44-
```
103+
104+
```php
45105
$context = new ExpireContextInput("unique_context_id", "account_id");
46106
$gatway->expireContext($context);
47107
```
48108

49109
##### Create or Update a Respondent
50-
```
110+
111+
```php
51112
$respondent = new PutRespondentInput(
52113
"unique_respondent_id",
53114
"en",
@@ -60,7 +121,8 @@ $gatway->putRespondent($respondent);
60121
```
61122

62123
##### Create or Update a Respondent Answers
63-
```
124+
125+
```php
64126
$respondent = new PutRespondentAnwsersInput(
65127
"unique_respondent_id",
66128
"US",
@@ -77,61 +139,16 @@ $gatway->putRespondentAnswers($respondent);
77139
```
78140

79141
##### Get Attributes
80-
```
142+
143+
```php
81144
$get_attributes = new GetAttributeInput();
82145
$get_attributes->page_size = 1;
83146
$gateway->getAttributes($get_attributes);
84147
```
85148

86149
##### Get Attribute Info
87-
```
150+
151+
```php
88152
$get_attribute_info = new GetAttributeInfoInput(1);
89153
$gateway->getAttributeInfo($get_attribute_info);
90154
```
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

Comments
 (0)