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

Commit 9f83514

Browse files
add examples for context to readme
1 parent 0d58673 commit 9f83514

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

README.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,51 @@ status.name
140140
status.value
141141
142142
# (<GatewayDispositionsEnum.TERMINATION: 2>, 1)
143-
```
143+
```
144+
145+
##### Create a context
146+
```
147+
context_id = 'super-unique-ctx-id'
148+
data = {
149+
'ctx': 'parent-context-id', # From survey link 'ctx' parameter
150+
'gender': 'male',
151+
'birth_data': '1999-09-09',
152+
'postal_code': '90210'
153+
}
154+
gateway.create_context(context_id, data)
155+
156+
# 'super-unique-ctx-id'
157+
```
158+
159+
##### Retrieve a context
160+
```
161+
gw.get_context('super-unique-ctx-id')
162+
163+
# {
164+
# 'id': 'super-unique-ctx-id',
165+
# 'items': {
166+
# 'ctx': 'parent-context-id',
167+
# 'gender': 'male',
168+
# 'birth_data': '1999-09-09',
169+
# 'postal_code': '90210'
170+
# }
171+
# }
172+
```
173+
174+
##### Expire a context
175+
```
176+
gw.expire_context('super-unique-ctx-id')
177+
178+
# {
179+
# 'id': 'super-unique-ctx-id',
180+
# 'items': {
181+
# 'ctx': 'parent-context-id',
182+
# 'gender': 'male',
183+
# 'birth_data': '1999-09-09',
184+
# 'postal_code': '90210'
185+
# },
186+
# 'expiration': '2021-11-30T16:10:44Z'
187+
# }
188+
```
189+
190+

0 commit comments

Comments
 (0)