@@ -29,9 +29,11 @@ module.exports = {
2929 options: {
3030 apiKey: ' MICROCMS_API_KEY' ,
3131 serviceId: ' myblog' ,
32- apis: [{
33- endpoint: ' posts' ,
34- }],
32+ apis: [
33+ {
34+ endpoint: ' posts' ,
35+ },
36+ ],
3537 },
3638 },
3739 ],
@@ -92,14 +94,6 @@ module.exports = {
9294 **/
9395 apiKey: ' 11111111-2222-3333-4444-555555555555' ,
9496
95- /**
96- * Global draft key.
97- * If you set this key, you can get all draft contents.
98- *
99- * Type: string.
100- **/
101- globalDraftKey: ' 11111111-2222-3333-4444-555555555555' ,
102-
10397 /**
10498 * Service information. (Required)
10599 * xxxx.microcms.io
@@ -114,55 +108,57 @@ module.exports = {
114108 *
115109 * Type: array.
116110 **/
117- apis: [{
118- /**
119- * API endpoint name. (Required)
120- * https://xxxx.microcms.io/api/v1/posts
121- *
122- * Type: string.
123- **/
124- endpoint: ' posts' ,
125-
126- /**
127- * Graphql type. (Optional)
128- * This is used in GraphQL queries.
129- * If type = 'post', the GraphQL types are named 'microcmsPost' and 'allMicrocmsPost'.
130- *
131- * Type: string.
132- * Default: endpoint value.
133- **/
134- type: ' post' ,
135-
136- /**
137- * microCMS's content type('list' or 'object'). (Optional)
138- * if format is 'list', read all contents by fetching multiple times.
139- *
140- * Type: string.
141- * Default: 'list'.
142- **/
143- format: ' object' ,
144-
145- /**
146- * API request query options. (Optional)
147- *
148- * Type:
149- * draftKey: string.
150- * limit: number.
151- * offset: number.
152- * fields: string.
153- * filters: string.
154- * depth: number.
155- * Default: {}.
156- **/
157- query: {
158- draftKey: ' DRAFT_KEY' ,
159- limit: 100 ,
160- offset: 40 ,
161- fields: [' id' , ' title' , ' body' ].join (' ,' ),
162- filters: ' tag[exists]' ,
163- depth: 2
164- }
165- }],
111+ apis: [
112+ {
113+ /**
114+ * API endpoint name. (Required)
115+ * https://xxxx.microcms.io/api/v1/posts
116+ *
117+ * Type: string.
118+ **/
119+ endpoint: ' posts' ,
120+
121+ /**
122+ * Graphql type. (Optional)
123+ * This is used in GraphQL queries.
124+ * If type = 'post', the GraphQL types are named 'microcmsPost' and 'allMicrocmsPost'.
125+ *
126+ * Type: string.
127+ * Default: endpoint value.
128+ **/
129+ type: ' post' ,
130+
131+ /**
132+ * microCMS's content type('list' or 'object'). (Optional)
133+ * if format is 'list', read all contents by fetching multiple times.
134+ *
135+ * Type: string.
136+ * Default: 'list'.
137+ **/
138+ format: ' object' ,
139+
140+ /**
141+ * API request query options. (Optional)
142+ *
143+ * Type:
144+ * draftKey: string.
145+ * limit: number.
146+ * offset: number.
147+ * fields: string.
148+ * filters: string.
149+ * depth: number.
150+ * Default: {}.
151+ **/
152+ query: {
153+ draftKey: ' DRAFT_KEY' ,
154+ limit: 100 ,
155+ offset: 40 ,
156+ fields: [' id' , ' title' , ' body' ].join (' ,' ),
157+ filters: ' tag[exists]' ,
158+ depth: 2 ,
159+ },
160+ },
161+ ],
166162 },
167163 },
168164 ],
@@ -175,81 +171,86 @@ This plugin provides [filters query](https://microcms.io/blog/filters-parameter/
175171
176172``` js
177173// gatsby-config.js
178- const { and , contains , exists } = require (' gatsby-source-microcms/src/query-builder' );
174+ const {
175+ and ,
176+ contains ,
177+ exists ,
178+ } = require (' gatsby-source-microcms/src/query-builder' );
179179
180180module .exports = {
181181 plugins: [
182182 {
183183 resolve: ' gatsby-source-microcms' ,
184184 options: {
185- apis: [{
186- query: {
187- filters: and (contains (' title' , ' sale' ), exists (' tag' )),
188- // => `title[contains]sale[and]tag[exists]`
189- }
190- }]
185+ apis: [
186+ {
187+ query: {
188+ filters: and (contains (' title' , ' sale' ), exists (' tag' )),
189+ // => `title[contains]sale[and]tag[exists]`
190+ },
191+ },
192+ ],
191193 },
192194 },
193195 ],
194196};
195-
196197```
197198
198199Helper list:
199200
200201- ` equals ` (alias: ` eq ` )
201202
202203``` js
203- equals (' gender' , ' women' )
204+ equals (' gender' , ' women' );
204205// => gender[equals]women
205206```
206207
207208- ` notEquals ` (alias: ` neq ` )
208209
209210``` js
210- notEquals (' gender' , ' women' )
211+ notEquals (' gender' , ' women' );
211212// => gender[not_equals]women
212213```
213214
214215- ` lessThan ` (alias: ` lg ` )
215216
216217``` js
217- lessThan (' createdAt' , ' 2019-11' )
218+ lessThan (' createdAt' , ' 2019-11' );
218219// => createdAt[less_than]2019-11
219220```
220221
221222- ` greaterThan ` (alias: ` gt ` )
222223
223224``` js
224- greaterThan (' createdAt' , ' 2019-11' )
225+ greaterThan (' createdAt' , ' 2019-11' );
225226// => createdAt[greater_than]2019-11
226227```
227228
228229- ` contains `
229230
230231``` js
231- contains (' title' , ' sale' )
232+ contains (' title' , ' sale' );
232233// => title[contains]sale
233234```
234235
235236- ` exists `
236237
237238``` js
238- exists (' nextLink' )
239+ exists (' nextLink' );
239240// => nextLink[exists]
240241```
241242
242243- ` notExists `
243244
244245``` js
245- notExists (' nextLink' )
246+ notExists (' nextLink' );
246247// => nextLink[not_exists]
247248```
248249
249250- ` beginsWith `
250251
251252``` js
252- beginsWith (' publishedAt' , ' 2019-11' )
253+ beginsWith (' publishedAt' , ' 2019-11' );
253254// => publishedAt[begins_with]2019-11
254255```
255256
@@ -268,5 +269,6 @@ or('filter1', 'filter2', ..., 'filter10')
268269```
269270
270271## Contributing
271- 日本語歓迎🇯🇵
272- Pull Request, Issueお気軽にどうぞ。
272+
273+ 日本語歓迎 🇯🇵
274+ Pull Request, Issue お気軽にどうぞ。
0 commit comments