Skip to content

Commit afa71c2

Browse files
committed
sync examples
1 parent be76815 commit afa71c2

File tree

1 file changed

+295
-0
lines changed

1 file changed

+295
-0
lines changed

sync_test.go

Lines changed: 295 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,295 @@
1+
package gontentful
2+
3+
const publishEntry = `
4+
{
5+
"sys": {
6+
"type": "Array"
7+
},
8+
"items": [
9+
{
10+
"sys": {
11+
"space": {
12+
"sys": {
13+
"type": "Link",
14+
"linkType": "Space",
15+
"id": "dbq0oal15rwl"
16+
}
17+
},
18+
"id": "7qpbdz6NUtWA6kS72QJeuB",
19+
"type": "Entry",
20+
"createdAt": "2019-03-22T02:06:40.875Z",
21+
"updatedAt": "2019-03-30T14:22:39.139Z",
22+
"environment": {
23+
"sys": {
24+
"id": "master",
25+
"type": "Link",
26+
"linkType": "Environment"
27+
}
28+
},
29+
"revision": 2,
30+
"contentType": {
31+
"sys": {
32+
"type": "Link",
33+
"linkType": "ContentType",
34+
"id": "article"
35+
}
36+
}
37+
},
38+
"fields": {
39+
"slug": {
40+
"en": "kptest"
41+
},
42+
"title": {
43+
"en": "kptest",
44+
"en-SE": "kptest_en-se"
45+
},
46+
"content": {
47+
"en": "kptest content sa\n"
48+
},
49+
"backgroundImage": {
50+
"en": {
51+
"sys": {
52+
"type": "Link",
53+
"linkType": "Entry",
54+
"id": "355FyGlXxKoSOmasQgAysa"
55+
}
56+
}
57+
}
58+
}
59+
},
60+
{
61+
"sys": {
62+
"space": {
63+
"sys": {
64+
"type": "Link",
65+
"linkType": "Space",
66+
"id": "dbq0oal15rwl"
67+
}
68+
},
69+
"id": "1jwUI9Z4BgWOS4CKy4a4uK",
70+
"type": "Entry",
71+
"createdAt": "2018-03-27T11:48:21.542Z",
72+
"updatedAt": "2019-03-30T14:52:21.555Z",
73+
"environment": {
74+
"sys": {
75+
"id": "master",
76+
"type": "Link",
77+
"linkType": "Environment"
78+
}
79+
},
80+
"revision": 12,
81+
"contentType": {
82+
"sys": {
83+
"type": "Link",
84+
"linkType": "ContentType",
85+
"id": "product"
86+
}
87+
}
88+
},
89+
"fields": {
90+
"name": {
91+
"en": "dreamz"
92+
},
93+
"type": {
94+
"en": "casino"
95+
},
96+
"markets": {
97+
"en": [
98+
{
99+
"sys": {
100+
"type": "Link",
101+
"linkType": "Entry",
102+
"id": "2riJx4PYhe6io0u8ycMsiC"
103+
}
104+
},
105+
{
106+
"sys": {
107+
"type": "Link",
108+
"linkType": "Entry",
109+
"id": "6DLWPqwxq0w4EqMOAI6E04"
110+
}
111+
},
112+
{
113+
"sys": {
114+
"type": "Link",
115+
"linkType": "Entry",
116+
"id": "1M0ki6hpBqoQm26Mc8aw6m"
117+
}
118+
},
119+
{
120+
"sys": {
121+
"type": "Link",
122+
"linkType": "Entry",
123+
"id": "1QnuR9TiRK8YW2OOMWyWOA"
124+
}
125+
},
126+
{
127+
"sys": {
128+
"type": "Link",
129+
"linkType": "Entry",
130+
"id": "2GEQZiRNOMeC6MYiAYwca8"
131+
}
132+
},
133+
{
134+
"sys": {
135+
"type": "Link",
136+
"linkType": "Entry",
137+
"id": "562WWL4h7q226Swwskciqi"
138+
}
139+
},
140+
{
141+
"sys": {
142+
"type": "Link",
143+
"linkType": "Entry",
144+
"id": "3MdX8Nxp8QsMY8OQMcWsWG"
145+
}
146+
},
147+
{
148+
"sys": {
149+
"type": "Link",
150+
"linkType": "Entry",
151+
"id": "3QdbpFbes0QWiC220cUOQg"
152+
}
153+
},
154+
{
155+
"sys": {
156+
"type": "Link",
157+
"linkType": "Entry",
158+
"id": "6zbClN1OjmYYUiiG6k4qOQ"
159+
}
160+
}
161+
]
162+
},
163+
"defaultLocale": {
164+
"en": {
165+
"sys": {
166+
"type": "Link",
167+
"linkType": "Entry",
168+
"id": "2JbSbu7w2s6oAmwaAkQaqu"
169+
}
170+
}
171+
},
172+
"baseCurrency": {
173+
"en": {
174+
"sys": {
175+
"type": "Link",
176+
"linkType": "Entry",
177+
"id": "44JAeD9p28s8kYwaasU28G"
178+
}
179+
}
180+
},
181+
"showMarketSelector": {
182+
"en": true
183+
},
184+
"apiKeys": {
185+
"en": {
186+
"olark": "2462-416-10-4830",
187+
"segment": {
188+
"sources": {
189+
"web": {
190+
"sourceId": "fQANQAOd5N",
191+
"writeKey": "vRky9oDzaPXDh4jsXsfvRN43NX95VfAI"
192+
}
193+
}
194+
},
195+
"tagmanager": "GTM-PQ7R5BF",
196+
"webfontConfig": {
197+
"google": {
198+
"families": [
199+
"Material+Icons"
200+
]
201+
}
202+
}
203+
}
204+
}
205+
}
206+
}
207+
],
208+
"nextSyncUrl": "http://cdn.contentful.com/spaces/dbq0oal15rwl/environments/master/sync?sync_token=w5ZGw6JFwqZmVcKsE8Kow4grw45QdyZIGzAkwoDDrCVxHFjCmMKVw5Zew7h7B3sWw5LChsKfOsK1w50ERwTDuTx_woMOwpPClsOdw4YLwoDDniU9CXE_wpLCrwkFRcOjBsOBOSTCp8KUDsK4wp5Gw4VFTA"
209+
}`
210+
211+
const unpublishEntry = `
212+
{
213+
"sys": {
214+
"type": "Array"
215+
},
216+
"items": [
217+
{
218+
"sys": {
219+
"type": "DeletedEntry",
220+
"id": "7qpbdz6NUtWA6kS72QJeuB",
221+
"space": {
222+
"sys": {
223+
"type": "Link",
224+
"linkType": "Space",
225+
"id": "dbq0oal15rwl"
226+
}
227+
},
228+
"environment": {
229+
"sys": {
230+
"id": "master",
231+
"type": "Link",
232+
"linkType": "Environment"
233+
}
234+
},
235+
"revision": 2,
236+
"createdAt": "2019-03-30T14:24:21.037Z",
237+
"updatedAt": "2019-03-30T14:24:21.037Z",
238+
"deletedAt": "2019-03-30T14:24:21.037Z"
239+
}
240+
}
241+
],
242+
"nextSyncUrl": "http://cdn.contentful.com/spaces/dbq0oal15rwl/environments/master/sync?sync_token=w5ZGw6JFwqZmVcKsE8Kow4grw45QdyY4Lyk1w4hlHcOywoxkwpPDqsKeah9rAcOzQFpqU2zCllXCjMOewoVqwpwewqTCocK7wo3DosObNMOkw4fDnzAzG8KUSUx7wok7Z8OqdGg3w6DDlMKOw4PCtgHClMKgwqE"
243+
}`
244+
245+
const publishAsset = `
246+
{
247+
"sys": {
248+
"type": "Array"
249+
},
250+
"items": [
251+
{
252+
"sys": {
253+
"space": {
254+
"sys": {
255+
"type": "Link",
256+
"linkType": "Space",
257+
"id": "dbq0oal15rwl"
258+
}
259+
},
260+
"id": "3KKHzDRm3C6QekKoOGWGea",
261+
"type": "Asset",
262+
"createdAt": "2018-09-13T15:20:01.840Z",
263+
"updatedAt": "2019-03-30T14:31:29.170Z",
264+
"environment": {
265+
"sys": {
266+
"id": "master",
267+
"type": "Link",
268+
"linkType": "Environment"
269+
}
270+
},
271+
"revision": 4
272+
},
273+
"fields": {
274+
"title": {
275+
"en": "bg-650-noiseless"
276+
},
277+
"file": {
278+
"en": {
279+
"url": "//images.ctfassets.net/dbq0oal15rwl/3KKHzDRm3C6QekKoOGWGea/30798260afacc1f1d874c7291e2a9216/bg-650-noiseless.jpg",
280+
"details": {
281+
"size": 100312,
282+
"image": {
283+
"width": 650,
284+
"height": 1268
285+
}
286+
},
287+
"fileName": "bg-650-noiseless.jpg",
288+
"contentType": "image/jpeg"
289+
}
290+
}
291+
}
292+
}
293+
],
294+
"nextSyncUrl": "http://cdn.contentful.com/spaces/dbq0oal15rwl/environments/master/sync?sync_token=w5ZGw6JFwqZmVcKsE8Kow4grw45QdyY7w6Ipc8OfwpXCtsOmwr8nBMKrEsOmwr1_w4FYw5rCvhA4w4LDosONTXfDnA_Di8KkX8OcZsOLT8OewpZ2wrDDghzDucK9w7HCuXLDjAxzeVVZwojCt30fYcOnOVvDk8Klwqs"
295+
}`

0 commit comments

Comments
 (0)