Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds additional query syntax for the CDA #49

Merged
merged 20 commits into from
Jul 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Master

* [#49](https://github.com/contentful-labs/contentful.ex/pull/49) Adds extended query syntax for building more complex queries, as suggested by @ryansch in [#38](https://github.com/contentful-labs/contentful.ex/issues/38)
* adds testgin against Elixir 1.10.4

## 0.3.2

* [#47](https://github.com/contentful-labs/contentful.ex/pull/47) Handle bitstring case when resolving assets (thanks @aspala)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[
{
"request": {
"body": "",
"headers": {
"authorization": "***",
"User-Agent": "Contentful Elixir SDK",
"accept": "application/json"
},
"method": "get",
"options": [],
"request_body": "",
"url": "https://cdn.contentful.com/spaces/bmehzfuz4raf/environments/master/assets?fields.title%5Bne%5D=bafoo"
},
"response": {
"binary": false,
"body": "{\n \"sys\": {\n \"type\": \"Array\"\n },\n \"total\": 1,\n \"skip\": 0,\n \"limit\": 100,\n \"items\": [\n {\n \"sys\": {\n \"space\": {\n \"sys\": {\n \"type\": \"Link\",\n \"linkType\": \"Space\",\n \"id\": \"bmehzfuz4raf\"\n }\n },\n \"id\": \"5ECf6ltDUOnX441PtBR8Wk\",\n \"type\": \"Asset\",\n \"createdAt\": \"2020-03-16T10:06:11.604Z\",\n \"updatedAt\": \"2020-06-10T12:59:00.879Z\",\n \"environment\": {\n \"sys\": {\n \"id\": \"master\",\n \"type\": \"Link\",\n \"linkType\": \"Environment\"\n }\n },\n \"revision\": 3,\n \"locale\": \"en-US\"\n },\n \"fields\": {\n \"file\": {\n \"url\": \"//images.ctfassets.net/bmehzfuz4raf/5ECf6ltDUOnX441PtBR8Wk/fa3dc5cde2b4d4c5736566c956f20163/Screenshot_from_2020-03-11_22-56-44.png\",\n \"details\": {\n \"size\": 247990,\n \"image\": {\n \"width\": 1920,\n \"height\": 1053\n }\n },\n \"fileName\": \"Screenshot from 2020-03-11 22-56-44.png\",\n \"contentType\": \"image/png\"\n }\n }\n }\n ]\n}\n",
"headers": {
"Connection": "keep-alive",
"Content-Length": "1131",
"Access-Control-Allow-Headers": "Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentful-Content-Type,X-Contentful-Organization,X-Contentful-Skip-Transformation,X-Contentful-User-Agent,X-Contentful-Enable-Alpha-Feature",
"Access-Control-Allow-Methods": "GET,HEAD,OPTIONS",
"Access-Control-Allow-Origin": "*",
"Access-Control-Expose-Headers": "Etag",
"Access-Control-Max-Age": "86400",
"CF-Environment-Id": "master",
"CF-Environment-Uuid": "69b0fe47-9d71-4e0c-a7e0-4e12cb573930",
"CF-Organization-Id": "0bEbsBel9WL3OIaiqx0MnO",
"CF-Space-Id": "bmehzfuz4raf",
"Content-Type": "application/vnd.contentful.delivery.v1+json",
"Contentful-Api": "cda_cached",
"ETag": "W/\"6071154412135978374\"",
"Server": "Contentful",
"X-Content-Type-Options": "nosniff",
"X-Contentful-Region": "us-east-1",
"Accept-Ranges": "bytes",
"Date": "Sun, 05 Jul 2020 14:18:56 GMT",
"Via": "1.1 varnish",
"Age": "0",
"X-Served-By": "cache-hhn4034-HHN",
"X-Cache": "MISS",
"X-Cache-Hits": "0",
"Vary": "Accept-Encoding",
"x-contentful-request-id": "591a465a-dc43-4014-a5bb-dca6d905fcdb"
},
"status_code": 200,
"type": "ok"
}
}
]
50 changes: 50 additions & 0 deletions fixture/vcr_cassettes/multiple_assets,_filtered_by_name.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[
{
"request": {
"body": "",
"headers": {
"authorization": "***",
"User-Agent": "Contentful Elixir SDK",
"accept": "application/json"
},
"method": "get",
"options": [],
"request_body": "",
"url": "https://cdn.contentful.com/spaces/bmehzfuz4raf/environments/master/assets?fields.title=bafoo"
},
"response": {
"binary": false,
"body": "{\n \"sys\": {\n \"type\": \"Array\"\n },\n \"total\": 1,\n \"skip\": 0,\n \"limit\": 100,\n \"items\": [\n {\n \"sys\": {\n \"space\": {\n \"sys\": {\n \"type\": \"Link\",\n \"linkType\": \"Space\",\n \"id\": \"bmehzfuz4raf\"\n }\n },\n \"id\": \"577fpmbIfYD71VCjCpYA84\",\n \"type\": \"Asset\",\n \"createdAt\": \"2020-03-16T10:30:45.706Z\",\n \"updatedAt\": \"2020-03-16T10:30:45.706Z\",\n \"environment\": {\n \"sys\": {\n \"id\": \"master\",\n \"type\": \"Link\",\n \"linkType\": \"Environment\"\n }\n },\n \"revision\": 1,\n \"locale\": \"en-US\"\n },\n \"fields\": {\n \"title\": \"bafoo\",\n \"description\": \"a pdf\",\n \"file\": {\n \"url\": \"//assets.ctfassets.net/bmehzfuz4raf/577fpmbIfYD71VCjCpYA84/6456d4157900af3b35537f5f15dd97c2/Travis_Picking_-_The_LEGENDARY_picking_pattern.pdf\",\n \"details\": {\n \"size\": 90783\n },\n \"fileName\": \"Travis Picking - The LEGENDARY picking pattern.pdf\",\n \"contentType\": \"application/pdf\"\n }\n }\n }\n ]\n}\n",
"headers": {
"Connection": "keep-alive",
"Content-Length": "1120",
"Access-Control-Allow-Headers": "Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentful-Content-Type,X-Contentful-Organization,X-Contentful-Skip-Transformation,X-Contentful-User-Agent,X-Contentful-Enable-Alpha-Feature",
"Access-Control-Allow-Methods": "GET,HEAD,OPTIONS",
"Access-Control-Allow-Origin": "*",
"Access-Control-Expose-Headers": "Etag",
"Access-Control-Max-Age": "86400",
"CF-Environment-Id": "master",
"CF-Environment-Uuid": "69b0fe47-9d71-4e0c-a7e0-4e12cb573930",
"CF-Organization-Id": "0bEbsBel9WL3OIaiqx0MnO",
"CF-Space-Id": "bmehzfuz4raf",
"Content-Type": "application/vnd.contentful.delivery.v1+json",
"Contentful-Api": "cda_cached",
"ETag": "W/\"14856425138171294666\"",
"Server": "Contentful",
"X-Content-Type-Options": "nosniff",
"X-Contentful-Region": "us-east-1",
"Accept-Ranges": "bytes",
"Date": "Sun, 05 Jul 2020 14:17:51 GMT",
"Via": "1.1 varnish",
"Age": "0",
"X-Served-By": "cache-fra19140-FRA",
"X-Cache": "MISS",
"X-Cache-Hits": "0",
"Vary": "Accept-Encoding",
"x-contentful-request-id": "f2ae57c3-a489-4c9a-a31a-6dbaa55c3d06"
},
"status_code": 200,
"type": "ok"
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[
{
"request": {
"body": "",
"headers": {
"authorization": "***",
"User-Agent": "Contentful Elixir SDK",
"accept": "application/json"
},
"method": "get",
"options": [],
"request_body": "",
"url": "https://cdn.contentful.com/spaces/bmehzfuz4raf/environments/master/entries?content_type=category"
},
"response": {
"binary": false,
"body": "{\n \"sys\": {\n \"type\": \"Array\"\n },\n \"total\": 2,\n \"skip\": 0,\n \"limit\": 100,\n \"items\": [\n {\n \"sys\": {\n \"space\": {\n \"sys\": {\n \"type\": \"Link\",\n \"linkType\": \"Space\",\n \"id\": \"bmehzfuz4raf\"\n }\n },\n \"id\": \"7qCGg4LadgJUcx5cr35Ou9\",\n \"type\": \"Entry\",\n \"createdAt\": \"2020-07-05T09:44:36.704Z\",\n \"updatedAt\": \"2020-07-05T09:44:36.704Z\",\n \"environment\": {\n \"sys\": {\n \"id\": \"master\",\n \"type\": \"Link\",\n \"linkType\": \"Environment\"\n }\n },\n \"revision\": 1,\n \"contentType\": {\n \"sys\": {\n \"type\": \"Link\",\n \"linkType\": \"ContentType\",\n \"id\": \"category\"\n }\n },\n \"locale\": \"en-US\"\n },\n \"fields\": {}\n },\n {\n \"sys\": {\n \"space\": {\n \"sys\": {\n \"type\": \"Link\",\n \"linkType\": \"Space\",\n \"id\": \"bmehzfuz4raf\"\n }\n },\n \"id\": \"4RPjazUzQMqemyNlcD3b9i\",\n \"type\": \"Entry\",\n \"createdAt\": \"2020-03-17T15:22:17.537Z\",\n \"updatedAt\": \"2020-04-30T08:18:45.388Z\",\n \"environment\": {\n \"sys\": {\n \"id\": \"master\",\n \"type\": \"Link\",\n \"linkType\": \"Environment\"\n }\n },\n \"revision\": 2,\n \"contentType\": {\n \"sys\": {\n \"type\": \"Link\",\n \"linkType\": \"ContentType\",\n \"id\": \"category\"\n }\n },\n \"locale\": \"en-US\"\n },\n \"fields\": {\n \"name\": \"A standard category\",\n \"image\": {\n \"sys\": {\n \"type\": \"Link\",\n \"linkType\": \"Asset\",\n \"id\": \"5ECf6ltDUOnX441PtBR8Wk\"\n }\n }\n }\n }\n ],\n \"includes\": {\n \"Asset\": [\n {\n \"sys\": {\n \"space\": {\n \"sys\": {\n \"type\": \"Link\",\n \"linkType\": \"Space\",\n \"id\": \"bmehzfuz4raf\"\n }\n },\n \"id\": \"5ECf6ltDUOnX441PtBR8Wk\",\n \"type\": \"Asset\",\n \"createdAt\": \"2020-03-16T10:06:11.604Z\",\n \"updatedAt\": \"2020-06-10T12:59:00.879Z\",\n \"environment\": {\n \"sys\": {\n \"id\": \"master\",\n \"type\": \"Link\",\n \"linkType\": \"Environment\"\n }\n },\n \"revision\": 3,\n \"locale\": \"en-US\"\n },\n \"fields\": {\n \"file\": {\n \"url\": \"//images.ctfassets.net/bmehzfuz4raf/5ECf6ltDUOnX441PtBR8Wk/fa3dc5cde2b4d4c5736566c956f20163/Screenshot_from_2020-03-11_22-56-44.png\",\n \"details\": {\n \"size\": 247990,\n \"image\": {\n \"width\": 1920,\n \"height\": 1053\n }\n },\n \"fileName\": \"Screenshot from 2020-03-11 22-56-44.png\",\n \"contentType\": \"image/png\"\n }\n }\n }\n ]\n }\n}\n",
"headers": {
"Connection": "keep-alive",
"Content-Length": "2952",
"Access-Control-Allow-Headers": "Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentful-Content-Type,X-Contentful-Organization,X-Contentful-Skip-Transformation,X-Contentful-User-Agent,X-Contentful-Enable-Alpha-Feature",
"Access-Control-Allow-Methods": "GET,HEAD,OPTIONS",
"Access-Control-Allow-Origin": "*",
"Access-Control-Expose-Headers": "Etag",
"Access-Control-Max-Age": "86400",
"CF-Environment-Id": "master",
"CF-Environment-Uuid": "69b0fe47-9d71-4e0c-a7e0-4e12cb573930",
"CF-Organization-Id": "0bEbsBel9WL3OIaiqx0MnO",
"CF-Space-Id": "bmehzfuz4raf",
"Content-Type": "application/vnd.contentful.delivery.v1+json",
"Contentful-Api": "cda_cached",
"ETag": "W/\"17446375927234312903\"",
"Server": "Contentful",
"X-Content-Type-Options": "nosniff",
"X-Contentful-Region": "us-east-1",
"Accept-Ranges": "bytes",
"Date": "Sun, 05 Jul 2020 10:15:36 GMT",
"Via": "1.1 varnish",
"Age": "1137",
"X-Served-By": "cache-hhn4067-HHN",
"X-Cache": "HIT",
"X-Cache-Hits": "2",
"Vary": "Accept-Encoding",
"x-contentful-request-id": "f23efb99-72c1-4342-8dcb-991550eee851"
},
"status_code": 200,
"type": "ok"
}
}
]
50 changes: 50 additions & 0 deletions fixture/vcr_cassettes/single_entry_with_select_filters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[
{
"request": {
"body": "",
"headers": {
"authorization": "***",
"User-Agent": "Contentful Elixir SDK",
"accept": "application/json"
},
"method": "get",
"options": [],
"request_body": "",
"url": "https://cdn.contentful.com/spaces/bmehzfuz4raf/environments/master/entries?content_type=category&sys.id=7qCGg4LadgJUcx5cr35Ou9"
},
"response": {
"binary": false,
"body": "{\n \"sys\": {\n \"type\": \"Array\"\n },\n \"total\": 1,\n \"skip\": 0,\n \"limit\": 100,\n \"items\": [\n {\n \"sys\": {\n \"space\": {\n \"sys\": {\n \"type\": \"Link\",\n \"linkType\": \"Space\",\n \"id\": \"bmehzfuz4raf\"\n }\n },\n \"id\": \"7qCGg4LadgJUcx5cr35Ou9\",\n \"type\": \"Entry\",\n \"createdAt\": \"2020-07-05T09:44:36.704Z\",\n \"updatedAt\": \"2020-07-05T09:44:36.704Z\",\n \"environment\": {\n \"sys\": {\n \"id\": \"master\",\n \"type\": \"Link\",\n \"linkType\": \"Environment\"\n }\n },\n \"revision\": 1,\n \"contentType\": {\n \"sys\": {\n \"type\": \"Link\",\n \"linkType\": \"ContentType\",\n \"id\": \"category\"\n }\n },\n \"locale\": \"en-US\"\n },\n \"fields\": {}\n }\n ]\n}\n",
"headers": {
"Connection": "keep-alive",
"Content-Length": "846",
"Access-Control-Allow-Headers": "Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentful-Content-Type,X-Contentful-Organization,X-Contentful-Skip-Transformation,X-Contentful-User-Agent,X-Contentful-Enable-Alpha-Feature",
"Access-Control-Allow-Methods": "GET,HEAD,OPTIONS",
"Access-Control-Allow-Origin": "*",
"Access-Control-Expose-Headers": "Etag",
"Access-Control-Max-Age": "86400",
"CF-Environment-Id": "master",
"CF-Environment-Uuid": "69b0fe47-9d71-4e0c-a7e0-4e12cb573930",
"CF-Organization-Id": "0bEbsBel9WL3OIaiqx0MnO",
"CF-Space-Id": "bmehzfuz4raf",
"Content-Type": "application/vnd.contentful.delivery.v1+json",
"Contentful-Api": "cda_cached",
"ETag": "\"5660330800706425331\"",
"Server": "Contentful",
"X-Content-Type-Options": "nosniff",
"X-Contentful-Region": "us-east-1",
"Accept-Ranges": "bytes",
"Date": "Sun, 05 Jul 2020 10:49:58 GMT",
"Via": "1.1 varnish",
"Age": "0",
"X-Served-By": "cache-fra19145-FRA",
"X-Cache": "MISS",
"X-Cache-Hits": "0",
"Vary": "Accept-Encoding",
"x-contentful-request-id": "3d69ef80-daf0-4be8-bbf5-9bf0b0f7929e"
},
"status_code": 200,
"type": "ok"
}
}
]
Loading