/ docs / swagger.json
swagger.json
  1  {
  2      "consumes": [
  3          "application/json"
  4      ],
  5      "produces": [
  6          "application/json"
  7      ],
  8      "schemes": [
  9          "http"
 10      ],
 11      "swagger": "2.0",
 12      "info": {
 13          "description": "The Journalist REST API v1",
 14          "title": "Journalist API",
 15          "contact": {
 16              "name": "Marius",
 17              "url": "https://xn--gckvb8fzb.com",
 18              "email": "marius@xn--gckvb8fzb.com"
 19          },
 20          "license": {
 21              "name": "GPL-3.0",
 22              "url": "https://github.com/mrusme/journalist/blob/master/LICENSE"
 23          },
 24          "version": "1.0"
 25      },
 26      "host": "localhost:8000",
 27      "basePath": "/api/v1",
 28      "paths": {
 29          "/feeds": {
 30              "get": {
 31                  "security": [
 32                      {
 33                          "BasicAuth": []
 34                      }
 35                  ],
 36                  "description": "Get all feeds",
 37                  "consumes": [
 38                      "application/json"
 39                  ],
 40                  "produces": [
 41                      "application/json"
 42                  ],
 43                  "tags": [
 44                      "feeds"
 45                  ],
 46                  "summary": "List feeds",
 47                  "responses": {
 48                      "200": {
 49                          "description": "OK",
 50                          "schema": {
 51                              "$ref": "#/definitions/feeds.FeedListResponse"
 52                          }
 53                      },
 54                      "400": {
 55                          "description": "Bad Request",
 56                          "schema": {
 57                              "$ref": "#/definitions/feeds.FeedListResponse"
 58                          }
 59                      },
 60                      "404": {
 61                          "description": "Not Found",
 62                          "schema": {
 63                              "$ref": "#/definitions/feeds.FeedListResponse"
 64                          }
 65                      },
 66                      "500": {
 67                          "description": "Internal Server Error",
 68                          "schema": {
 69                              "$ref": "#/definitions/feeds.FeedListResponse"
 70                          }
 71                      }
 72                  }
 73              },
 74              "post": {
 75                  "security": [
 76                      {
 77                          "BasicAuth": []
 78                      }
 79                  ],
 80                  "description": "Add a new feed",
 81                  "consumes": [
 82                      "application/json"
 83                  ],
 84                  "produces": [
 85                      "application/json"
 86                  ],
 87                  "tags": [
 88                      "feeds"
 89                  ],
 90                  "summary": "Create a feed",
 91                  "parameters": [
 92                      {
 93                          "description": "Add feed",
 94                          "name": "feed",
 95                          "in": "body",
 96                          "required": true,
 97                          "schema": {
 98                              "$ref": "#/definitions/feeds.FeedCreateModel"
 99                          }
100                      }
101                  ],
102                  "responses": {
103                      "200": {
104                          "description": "OK",
105                          "schema": {
106                              "$ref": "#/definitions/feeds.FeedCreateResponse"
107                          }
108                      },
109                      "400": {
110                          "description": "Bad Request",
111                          "schema": {
112                              "$ref": "#/definitions/feeds.FeedCreateResponse"
113                          }
114                      },
115                      "404": {
116                          "description": "Not Found",
117                          "schema": {
118                              "$ref": "#/definitions/feeds.FeedCreateResponse"
119                          }
120                      },
121                      "500": {
122                          "description": "Internal Server Error",
123                          "schema": {
124                              "$ref": "#/definitions/feeds.FeedCreateResponse"
125                          }
126                      }
127                  }
128              }
129          },
130          "/feeds/{id}": {
131              "get": {
132                  "security": [
133                      {
134                          "BasicAuth": []
135                      }
136                  ],
137                  "description": "Get feed by ID",
138                  "consumes": [
139                      "application/json"
140                  ],
141                  "produces": [
142                      "application/json"
143                  ],
144                  "tags": [
145                      "feeds"
146                  ],
147                  "summary": "Show a feed",
148                  "parameters": [
149                      {
150                          "type": "string",
151                          "description": "Feed ID",
152                          "name": "id",
153                          "in": "path",
154                          "required": true
155                      }
156                  ],
157                  "responses": {
158                      "200": {
159                          "description": "OK",
160                          "schema": {
161                              "$ref": "#/definitions/feeds.FeedShowResponse"
162                          }
163                      },
164                      "400": {
165                          "description": "Bad Request",
166                          "schema": {
167                              "$ref": "#/definitions/feeds.FeedShowResponse"
168                          }
169                      },
170                      "404": {
171                          "description": "Not Found",
172                          "schema": {
173                              "$ref": "#/definitions/feeds.FeedShowResponse"
174                          }
175                      },
176                      "500": {
177                          "description": "Internal Server Error",
178                          "schema": {
179                              "$ref": "#/definitions/feeds.FeedShowResponse"
180                          }
181                      }
182                  }
183              }
184          },
185          "/tokens": {
186              "post": {
187                  "security": [
188                      {
189                          "BasicAuth": []
190                      }
191                  ],
192                  "description": "Add a new token",
193                  "consumes": [
194                      "application/json"
195                  ],
196                  "produces": [
197                      "application/json"
198                  ],
199                  "tags": [
200                      "tokens"
201                  ],
202                  "summary": "Create a token",
203                  "parameters": [
204                      {
205                          "description": "Add token",
206                          "name": "token",
207                          "in": "body",
208                          "required": true,
209                          "schema": {
210                              "$ref": "#/definitions/tokens.TokenCreateModel"
211                          }
212                      }
213                  ],
214                  "responses": {
215                      "200": {
216                          "description": "OK",
217                          "schema": {
218                              "$ref": "#/definitions/tokens.TokenCreateResponse"
219                          }
220                      },
221                      "400": {
222                          "description": "Bad Request",
223                          "schema": {
224                              "$ref": "#/definitions/tokens.TokenCreateResponse"
225                          }
226                      },
227                      "404": {
228                          "description": "Not Found",
229                          "schema": {
230                              "$ref": "#/definitions/tokens.TokenCreateResponse"
231                          }
232                      },
233                      "500": {
234                          "description": "Internal Server Error",
235                          "schema": {
236                              "$ref": "#/definitions/tokens.TokenCreateResponse"
237                          }
238                      }
239                  }
240              }
241          },
242          "/users": {
243              "get": {
244                  "security": [
245                      {
246                          "BasicAuth": []
247                      }
248                  ],
249                  "description": "Get all users",
250                  "consumes": [
251                      "application/json"
252                  ],
253                  "produces": [
254                      "application/json"
255                  ],
256                  "tags": [
257                      "users"
258                  ],
259                  "summary": "List users",
260                  "responses": {
261                      "200": {
262                          "description": "OK",
263                          "schema": {
264                              "$ref": "#/definitions/users.UserListResponse"
265                          }
266                      },
267                      "400": {
268                          "description": "Bad Request",
269                          "schema": {
270                              "$ref": "#/definitions/users.UserListResponse"
271                          }
272                      },
273                      "404": {
274                          "description": "Not Found",
275                          "schema": {
276                              "$ref": "#/definitions/users.UserListResponse"
277                          }
278                      },
279                      "500": {
280                          "description": "Internal Server Error",
281                          "schema": {
282                              "$ref": "#/definitions/users.UserListResponse"
283                          }
284                      }
285                  }
286              },
287              "post": {
288                  "security": [
289                      {
290                          "BasicAuth": []
291                      }
292                  ],
293                  "description": "Add a new user",
294                  "consumes": [
295                      "application/json"
296                  ],
297                  "produces": [
298                      "application/json"
299                  ],
300                  "tags": [
301                      "users"
302                  ],
303                  "summary": "Create a user",
304                  "parameters": [
305                      {
306                          "description": "Add user",
307                          "name": "user",
308                          "in": "body",
309                          "required": true,
310                          "schema": {
311                              "$ref": "#/definitions/users.UserCreateModel"
312                          }
313                      }
314                  ],
315                  "responses": {
316                      "200": {
317                          "description": "OK",
318                          "schema": {
319                              "$ref": "#/definitions/users.UserCreateResponse"
320                          }
321                      },
322                      "400": {
323                          "description": "Bad Request",
324                          "schema": {
325                              "$ref": "#/definitions/users.UserCreateResponse"
326                          }
327                      },
328                      "404": {
329                          "description": "Not Found",
330                          "schema": {
331                              "$ref": "#/definitions/users.UserCreateResponse"
332                          }
333                      },
334                      "500": {
335                          "description": "Internal Server Error",
336                          "schema": {
337                              "$ref": "#/definitions/users.UserCreateResponse"
338                          }
339                      }
340                  }
341              }
342          },
343          "/users/{id}": {
344              "get": {
345                  "security": [
346                      {
347                          "BasicAuth": []
348                      }
349                  ],
350                  "description": "Get user by ID",
351                  "consumes": [
352                      "application/json"
353                  ],
354                  "produces": [
355                      "application/json"
356                  ],
357                  "tags": [
358                      "users"
359                  ],
360                  "summary": "Show a user",
361                  "parameters": [
362                      {
363                          "type": "string",
364                          "description": "User ID",
365                          "name": "id",
366                          "in": "path",
367                          "required": true
368                      }
369                  ],
370                  "responses": {
371                      "200": {
372                          "description": "OK",
373                          "schema": {
374                              "$ref": "#/definitions/users.UserShowResponse"
375                          }
376                      },
377                      "400": {
378                          "description": "Bad Request",
379                          "schema": {
380                              "$ref": "#/definitions/users.UserShowResponse"
381                          }
382                      },
383                      "404": {
384                          "description": "Not Found",
385                          "schema": {
386                              "$ref": "#/definitions/users.UserShowResponse"
387                          }
388                      },
389                      "500": {
390                          "description": "Internal Server Error",
391                          "schema": {
392                              "$ref": "#/definitions/users.UserShowResponse"
393                          }
394                      }
395                  }
396              },
397              "put": {
398                  "security": [
399                      {
400                          "BasicAuth": []
401                      }
402                  ],
403                  "description": "Change an existing user",
404                  "consumes": [
405                      "application/json"
406                  ],
407                  "produces": [
408                      "application/json"
409                  ],
410                  "tags": [
411                      "users"
412                  ],
413                  "summary": "Update a user",
414                  "parameters": [
415                      {
416                          "type": "string",
417                          "description": "User ID",
418                          "name": "id",
419                          "in": "path",
420                          "required": true
421                      },
422                      {
423                          "description": "Change user",
424                          "name": "user",
425                          "in": "body",
426                          "required": true,
427                          "schema": {
428                              "$ref": "#/definitions/users.UserUpdateModel"
429                          }
430                      }
431                  ],
432                  "responses": {
433                      "200": {
434                          "description": "OK",
435                          "schema": {
436                              "$ref": "#/definitions/users.UserUpdateResponse"
437                          }
438                      },
439                      "400": {
440                          "description": "Bad Request",
441                          "schema": {
442                              "$ref": "#/definitions/users.UserUpdateResponse"
443                          }
444                      },
445                      "404": {
446                          "description": "Not Found",
447                          "schema": {
448                              "$ref": "#/definitions/users.UserUpdateResponse"
449                          }
450                      },
451                      "500": {
452                          "description": "Internal Server Error",
453                          "schema": {
454                              "$ref": "#/definitions/users.UserUpdateResponse"
455                          }
456                      }
457                  }
458              }
459          }
460      },
461      "definitions": {
462          "feeds.FeedCreateModel": {
463              "type": "object",
464              "required": [
465                  "url"
466              ],
467              "properties": {
468                  "group": {
469                      "type": "string",
470                      "maxLength": 32
471                  },
472                  "name": {
473                      "type": "string",
474                      "maxLength": 32
475                  },
476                  "password": {
477                      "type": "string"
478                  },
479                  "url": {
480                      "type": "string"
481                  },
482                  "username": {
483                      "type": "string"
484                  }
485              }
486          },
487          "feeds.FeedCreateResponse": {
488              "type": "object",
489              "properties": {
490                  "feed": {
491                      "$ref": "#/definitions/feeds.FeedShowModel"
492                  },
493                  "message": {
494                      "type": "string"
495                  },
496                  "success": {
497                      "type": "boolean"
498                  }
499              }
500          },
501          "feeds.FeedListResponse": {
502              "type": "object",
503              "properties": {
504                  "feeds": {
505                      "type": "array",
506                      "items": {
507                          "$ref": "#/definitions/feeds.FeedShowModel"
508                      }
509                  },
510                  "message": {
511                      "type": "string"
512                  },
513                  "success": {
514                      "type": "boolean"
515                  }
516              }
517          },
518          "feeds.FeedShowModel": {
519              "type": "object",
520              "properties": {
521                  "group": {
522                      "type": "string",
523                      "maxLength": 32
524                  },
525                  "id": {
526                      "type": "string"
527                  },
528                  "name": {
529                      "type": "string",
530                      "maxLength": 32
531                  },
532                  "url": {
533                      "type": "string"
534                  }
535              }
536          },
537          "feeds.FeedShowResponse": {
538              "type": "object",
539              "properties": {
540                  "feed": {
541                      "$ref": "#/definitions/feeds.FeedShowModel"
542                  },
543                  "message": {
544                      "type": "string"
545                  },
546                  "success": {
547                      "type": "boolean"
548                  }
549              }
550          },
551          "tokens.TokenCreateModel": {
552              "type": "object",
553              "required": [
554                  "name"
555              ],
556              "properties": {
557                  "name": {
558                      "type": "string",
559                      "maxLength": 32
560                  }
561              }
562          },
563          "tokens.TokenCreateResponse": {
564              "type": "object",
565              "properties": {
566                  "message": {
567                      "type": "string"
568                  },
569                  "success": {
570                      "type": "boolean"
571                  },
572                  "token": {
573                      "$ref": "#/definitions/tokens.TokenShowModel"
574                  }
575              }
576          },
577          "tokens.TokenShowModel": {
578              "type": "object",
579              "properties": {
580                  "id": {
581                      "type": "string"
582                  },
583                  "token": {
584                      "type": "string"
585                  },
586                  "tokenname": {
587                      "type": "string"
588                  },
589                  "type": {
590                      "type": "string"
591                  }
592              }
593          },
594          "users.UserCreateModel": {
595              "type": "object",
596              "required": [
597                  "password",
598                  "role",
599                  "username"
600              ],
601              "properties": {
602                  "password": {
603                      "type": "string"
604                  },
605                  "role": {
606                      "type": "string"
607                  },
608                  "username": {
609                      "type": "string",
610                      "maxLength": 32
611                  }
612              }
613          },
614          "users.UserCreateResponse": {
615              "type": "object",
616              "properties": {
617                  "message": {
618                      "type": "string"
619                  },
620                  "success": {
621                      "type": "boolean"
622                  },
623                  "user": {
624                      "$ref": "#/definitions/users.UserShowModel"
625                  }
626              }
627          },
628          "users.UserListResponse": {
629              "type": "object",
630              "properties": {
631                  "message": {
632                      "type": "string"
633                  },
634                  "success": {
635                      "type": "boolean"
636                  },
637                  "users": {
638                      "type": "array",
639                      "items": {
640                          "$ref": "#/definitions/users.UserShowModel"
641                      }
642                  }
643              }
644          },
645          "users.UserShowModel": {
646              "type": "object",
647              "properties": {
648                  "id": {
649                      "type": "string"
650                  },
651                  "role": {
652                      "type": "string"
653                  },
654                  "username": {
655                      "type": "string"
656                  }
657              }
658          },
659          "users.UserShowResponse": {
660              "type": "object",
661              "properties": {
662                  "message": {
663                      "type": "string"
664                  },
665                  "success": {
666                      "type": "boolean"
667                  },
668                  "user": {
669                      "$ref": "#/definitions/users.UserShowModel"
670                  }
671              }
672          },
673          "users.UserUpdateModel": {
674              "type": "object",
675              "properties": {
676                  "password": {
677                      "type": "string",
678                      "minLength": 5
679                  },
680                  "role": {
681                      "type": "string"
682                  }
683              }
684          },
685          "users.UserUpdateResponse": {
686              "type": "object",
687              "properties": {
688                  "message": {
689                      "type": "string"
690                  },
691                  "success": {
692                      "type": "boolean"
693                  },
694                  "user": {
695                      "$ref": "#/definitions/users.UserShowModel"
696                  }
697              }
698          }
699      },
700      "securityDefinitions": {
701          "BasicAuth": {
702              "type": "basic"
703          }
704      }
705  }