gatsby-source-cloudinary
Advanced tools
Comparing version
@@ -32,5 +32,13 @@ const cloudinary = require('cloudinary') | ||
} | ||
const {resourceType, prefix, tags, maxResults, type} = configOptions | ||
const queryParams ={ | ||
resource_type:resourceType ? resourceType: undefined, | ||
tags: tags ? tags: undefined, | ||
max_results: maxResults? maxResults: undefined, | ||
type: type ? type: undefined | ||
} | ||
console.log(queryParams) | ||
return ( | ||
cloudinary.v2.api.resources({resource_type:'video'},(error, result)=>{ | ||
cloudinary.v2.api.resources(queryParams,(error, result)=>{ | ||
result.resources.forEach((mediaItem)=>{ | ||
@@ -37,0 +45,0 @@ const nodeData = processMedia(mediaItem) |
{ | ||
"name": "gatsby-source-cloudinary", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "Gatsby source plugin to fetch files from Cloudinary into Gatsby.", | ||
@@ -5,0 +5,0 @@ "main": "gatsby-node.js", |
@@ -19,8 +19,23 @@ # Gatsby-Source-Cloudinary | ||
apiKey: 'xxxxxxxxxxxxxx', | ||
apiSecret: 'xxxxxxxxxxxxx' | ||
apiSecret: 'xxxxxxxxxxxxx', | ||
resourceType: 'image', | ||
type: null, | ||
maxResults: 20, | ||
tags:true | ||
} | ||
} | ||
``` | ||
`cloudName`, `apiKey` and `apiSecret` are compulsory fields whereas the rest are optional query parameters to be included. | ||
Here are details of each query parameter as culled from cloudinary.com. | ||
* resource_type - Optional (String, default: image). The type of file. Possible values: image, raw, video. Relevant as a parameter only when using the SDKs (the resource type is included in the endpoint URL for direct calls to the HTTP API). Note: Use the video resource type for all video resources as well as for audio files, such as .mp3. | ||
* type - Optional (String, default: all). The storage type: upload, private, authenticated, facebook, twitter, gplus, instagram_name, gravatar, youtube, hulu, vimeo, animoto, worldstarhiphop or dailymotion. Relevant as a parameter only when using the SDKs (the type is included in the endpoint URL for direct calls to the HTTP API). | ||
* prefix - Optional. (String). Find all resources with a public ID that starts with the given prefix. The resources are sorted by public ID in the response. | ||
* max_results - Optional. (Integer, default=10. maximum=500). Max number of resources to return. | ||
* tags - Optional (Boolean, default: false). If true, include the list of tag names assigned each resource. | ||
Obtain your cloudname, key and secret from your cloudinary console when you signup at http://cloudinary.com | ||
Feel free to create feature requests.... and PRs :) |
4005
68.56%42
23.53%40
60%