DEV: Document notifications and tags api endpoints

DEV: Document notifications and tags api endpoints

Added some more specs that will be used to auto generate the api docs.

diff --git a/spec/requests/api/notifications_spec.rb b/spec/requests/api/notifications_spec.rb
new file mode 100644
index 0000000..ae1fa8f
--- /dev/null
+++ b/spec/requests/api/notifications_spec.rb
@@ -0,0 +1,84 @@
+# frozen_string_literal: true
+require 'swagger_helper'
+
+describe 'notifications' do
+
+  let(:admin) { Fabricate(:admin) }
+  let!(:notification) { Fabricate(:notification, user: admin) }
+
+  before do
+    Jobs.run_immediately!
+    sign_in(admin)
+  end
+
+  path '/notifications.json' do
+
+    get 'Get the notifications that belong to the current user' do
+      tags 'Notifications'
+
+      produces 'application/json'
+      response '200', 'notifications' do
+        schema type: :object, properties: {
+          notifications: {
+            type: :array,
+            items: {
+              type: :object,
+              properties: {
+                id: { type: :integer },
+                user_id: { type: :integer },
+                notification_type: { type: :integer },
+                read: { type: :boolean },
+                created_at: { type: :string },
+                post_number: { type: :string, nullable: true },
+                topic_id: { type: :integer, nullable: true },
+                slug: { type: :string, nullable: true },
+                data: {
+                  type: :object,
+                  properties: {
+                    badge_id: { type: :integer },
+                    badge_name: { type: :string },
+                    badge_slug: { type: :string },
+                    badge_title: { type: :boolean },
+                    username: { type: :string },
+                  }
+                },
+              }
+            },
+          },
+          total_rows_notifications: { type: :integer },
+          seen_notification_id: { type: :integer },
+          load_more_notifications: { type: :string },
+        }
+
+        run_test!
+      end
+    end
+
+  end
+
+  path '/notifications/mark-read.json' do
+
+    put 'Mark notifications as read' do
+      tags 'Notifications'
+      consumes 'application/json'
+      parameter name: :notification, in: :body, schema: {
+        type: :object,
+        properties: {
+          id: {
+            type: :integer,
+            description: '(optional) Leave off to mark all notifications as read'
+          }
+        },
+      }
+
+      produces 'application/json'
+      response '200', 'notifications marked read' do
+        schema type: :object, properties: {
+          success: { type: :string },
+        }
+
+        run_test!
+      end
+    end
+  end
+end
diff --git a/spec/requests/api/tags_spec.rb b/spec/requests/api/tags_spec.rb
new file mode 100644
index 0000000..7ef2a23
--- /dev/null
+++ b/spec/requests/api/tags_spec.rb
@@ -0,0 +1,350 @@
+# frozen_string_literal: true
+require 'swagger_helper'
+
+describe 'tags' do
+
+  let(:admin) { Fabricate(:admin) }
+  let!(:tag) { Fabricate(:tag, name: 'foo') }
+  let!(:tag_group) { Fabricate(:tag_group, tags: [tag]) }
+
+  before do
+    SiteSetting.tagging_enabled = true
+    Jobs.run_immediately!
+    sign_in(admin)
+  end
+
+  path '/tag_groups.json' do
+
+    get 'Get a list of tag groups' do
+      tags 'Tags'
+
+      produces 'application/json'
+      response '200', 'tags' do
+        schema type: :object, properties: {
+          tag_groups: {
+            type: :array,
+            items: {
+              type: :object,
+              properties: {
+                id: { type: :integer },
+                name: { type: :string },
+                tag_names: {
+                  type: :array,
+                  items: {
+                  },
+                },
+                parent_tag_name: {
+                  type: :array,
+                  items: {
+                  },
+                },
+                one_per_topic: { type: :boolean },
+                permissions: {
+                  type: :object,
+                  properties: {
+                    staff: { type: :integer },
+                  }
+                },
+              }
+            },
+          },
+        }
+
+        run_test!
+      end
+    end
+  end
+
+  path '/tag_groups.json' do
+
+    post 'Creates a tag group' do
+      tags 'Tags'
+      consumes 'application/json'
+      parameter name: :post_body, in: :body, schema: {
+        type: :object,
+        properties: {
+          name: { type: :string }
+        },
+        required: [ 'name' ]
+      }
+
+      produces 'application/json'
+      response '200', 'tag group created' do
+        schema type: :object, properties: {
+          tag_group: {
+            type: :object,
+            properties: {
+              id: { type: :integer },
+              name: { type: :string },
+              tag_names: {
+                type: :array,
+                items: {
+                },
+              },
+              parent_tag_name: {
+                type: :array,
+                items: {
+                },
+              },
+              one_per_topic: { type: :boolean },
+              permissions: {
+                type: :object,
+                properties: {
+                  everyone: { type: :integer },
+                }
+              },
+            }
+          },
+        }
+
+        let(:post_body) { { name: 'todo' } }
+
+        run_test!
+      end
+    end
+
+  end
+
+  path '/tag_groups/{id}.json' do
+
+    get 'Get a single tag group' do
+      tags 'Tags'
+      consumes 'application/json'
+      parameter name: :id, in: :path, schema: { type: :string }
+
+      produces 'application/json'
+      response '200', 'notifications' do
+        schema type: :object, properties: {
+          tag_group: {
+            type: :object,
+            properties: {
+              id: { type: :integer },
+              name: { type: :string },
+              tag_names: {
+                type: :array,
+                items: {
+                },
+              },
+              parent_tag_name: {
+                type: :array,
+                items: {
+                },
+              },
+              one_per_topic: { type: :boolean },
+              permissions: {
+                type: :object,
+                properties: {
+                  everyone: { type: :integer },
+                }
+              },
+            }
+          },
+        }
+
+        let(:id) { tag_group.id }
+        run_test!
+      end
+    end
+  end
+
+  path '/tag_groups/{id}.json' do
+
+    put 'Update tag group' do
+      tags 'Tags'
+      consumes 'application/json'
+      parameter name: :id, in: :path, schema: { type: :string }
+      parameter name: :put_body, in: :body, schema: {
+        type: :object,
+        properties: {
+          name: { type: :string }
+        }
+      }
+
+      produces 'application/json'
+      response '200', 'Tag group updated' do
+        schema type: :object, properties: {
+          success: { type: :string },
+          tag_group: {
+            type: :object,
+            properties: {
+              id: { type: :integer },
+              name: { type: :string },
+              tag_names: {
+                type: :array,
+                items: {
+                },
+              },
+              parent_tag_name: {
+                type: :array,
+                items: {
+                },
+              },
+              one_per_topic: { type: :boolean },
+              permissions: {
+                type: :object,
+                properties: {
+                  everyone: { type: :integer },
+                }
+              },
+            }
+          },
+        }
+
+        let(:id) { tag_group.id }
+        let(:put_body) { { name: 'todo2' } }
+        run_test!
+      end
+    end
+  end
+
+  path '/tags.json' do
+
+    get 'Get a list of tags' do
+      tags 'Tags'
+
+      produces 'application/json'
+      response '200', 'notifications' do

[... diff too long, it was truncated ...]

GitHub sha: 33982c0c