# This is an **example** API to demonstrate features of OpenAPI specification.
# It doesn't cover all OpenAPI features. For more full example check out: https://github.com/APIs-guru/petstore_extended

swagger: "2.0"
# You should specify common part of your endpoints in the following format:
#   <schemes>://<host><basepath>
schemes:
  # - http # Remove if your API doesn't support HTTP
  - https # Remove if your API doesn't support HTTPS
host: app.castos.com # Replace with your hostname. You can also specify port e.g. example.com:777
basePath: /api/v2 # Replace with your basePath. Note: SHOULD begin with '/'.
info:
  # Describe your API here, you can use GFM (https://guides.github.com/features/mastering-markdown) here
  version: "2.0.0" # Your API version
  # It can be any string but it is better to use semantic versioning: http://semver.org/
  # Warning: OpenAPI require version to be string, but without quotation YAML can recognize it as number.
  title: Castos API # Replace with your API title
  # Keep it simple. Don't add "API" or verison at the end of the string.
  termsOfService: "https://castos.com/terms-of-service/" # [Optional] Replace with an URL to your ToS
  contact:
    email: hello@castos.com # [Optional] Replace with your contact email
    url: "https://castos.com" # [Optional] Replace with link to your contact form
  x-logo:
    url: "https://app.castos.com/assets/images/logo.png"
  description: |
    # Introduction
    The Castos API allows you to manage your Podcasts and Episode using a RESTful like service.
    # Base url
    https://app.castos.com/api/v2
produces:
  # List of mime types your API endpoints can return.
  # This is a global default. You can OVERWRITE it in each specific operation.
  # Remove the ones not used in your API
  - application/json
  # you can add any mime type your API produces to the list
consumes:
  # List of mime types your API endpoints consumes.
  # This is a global default. You can OVERWRITE it in each specific operation.
  # Remove the ones not supported by your API
  - application/json
  - multipart/form-data
  # you can add any mime type your API consumes to the list

# A list of tags used by the specification with additional metadata.
# The order of the tags can be used to reflect on their order by the parsing tools.
tags:
  - name: Podcasts
    description: Operations about Podcasts
  - name: Episodes
    description: Operations about Episodes
  - name: Private Subscribers
    description: Operations about Private Subscribers
# Security scheme definitions that can be used across the specification.
securityDefinitions:
  Bearer: # security definition name (you can name it as you want)
    type: apiKey
    name: Authorization
    in: header
    description: >-
      Enter the token with the 'Bearer:'' prefix.


      For example: "Bearer xdsa-abcdefg1234567890".


      For legacy reasons, the key can also be passed as a query parameter, e.g. "?token=xdsa-abcdef" but this is strongly recommended against using.
# Holds the relative paths to the individual endpoints. The path is appended to the
# basePath in order to construct the full URL.
paths:
  "/private-subscribers":
    get:
      security:
        - Bearer: []
      tags:
        - Private Subscribers
      summary: Get Subscribers
      description: List all private subscribers for a podcast
      operationId: getPrivateSubscribers
      produces:
        - application/json
      parameters:
        - name: podcast_id
          in: query
          description: The ID of the podcast to request subscribers for.
          required: true
          type: integer
        - name: per_page
          in: query
          description: An integer between 1 and 250. Results will be paginated by the number of items specified.
          required: false
          type: integer
        - name: page
          in: query
          description: When used with `per_page`, the page of subscribers to return.
          required: false
          type: integer
      responses: # list of responses
        "200":
          description: Success
          schema: # response schema can be specified for each response
            $ref: "#/definitions/PrivateSubscribers"
          examples:
            # response samples for each type operation produces
            application/json:
              success: true
              message: Successfully retrieved private subscribers!
              subscribers:
                [
                  {
                    "id": 36,
                    "podcast_id": 108,
                    "name": "Danilo Castos",
                    "email": "danilo@castos.com",
                    "uuid": "15f16a5386f805",
                    "feed_url": "http://plustesting.seriouslysimplehosting.org/feed?uuidp=15f16a5386f805",
                    "status": "active",
                    "created_at": "2020-07-21 08:20:08",
                    "updated_at": "2020-07-21 10:24:37",
                  },
                  {
                    "id": 37,
                    "podcast_id": 108,
                    "name": "Danilo Radovic",
                    "email": "mailman.danjo@gmail.com",
                    "uuid": "15f16a5387238c",
                    "feed_url": "http://plustesting.seriouslysimplehosting.org/feed?uuidp=15f16a5387238c",
                    "status": "active",
                    "created_at": "2020-07-21 08:20:08",
                    "updated_at": "2020-07-21 10:24:37",
                  },
                ]
              status: 200
        "401":
          description: Unauthorized
          schema: # response schema can be specified for each response
            $ref: "#/definitions/Auth"
          examples:
            # response samples for each type operation produces
            application/json:
              success: false
              message: Authentication failed! Invalid or missing Access Token!
              status: 401
    post:
      security:
        - Bearer: []
      tags:
        - Private Subscribers
      summary: Create Subscriber
      description: This can only be done by the logged in user.
      operationId: createPrivateSubscriber
      produces:
        - application/json
      parameters:
        - in: header
          name: Accept
          schema:
            type: string
            default: application/json
          required: true
        - in: body
          name: body
          description: Create new Private Subscriber object
          # for body parameter you should specify request schema instead of type
          schema:
            $ref: "#/definitions/privateSubscriberBody"
      requestBody:
        content:
          "multipart/form-data":
            schema:
              $ref: "#/definitions/privateSubscriberBody"
      responses:
        "200":
          description: Success
          schema:
            $ref: "#/definitions/createPrivateSubscriber"
        "401":
          description: Authentication failed
          schema:
            $ref: "#/definitions/AuthFailedResponse"
        "404":
          description: Podcast missing
          schema:
            $ref: "#/definitions/podcastIdMissing"
  "/private-subscribers/email/{email_address}":
    parameters:
      - name: email_address
        in: path # place where parameter is passed: path, header, query or body, formData
        description: The subscriber email address
        required: true
        # type of the parameter: string, number, integer, boolean, array
        type: string
    get:
      security:
        - Bearer: []
      tags:
        - Private Subscribers
      summary: Get Subscriber by Email
      description: Get Subscriber and Subscription information by Email address
      operationId: getPrivateSubscribersByEmail
      produces:
        - application/json
      responses: # list of responses
        "200":
          description: Success
          schema: # response schema can be specified for each response
            $ref: "#/definitions/PrivateSubscriberByEmail"
          examples:
            application/json:
              success: true
              message: Successfully retrieved private subscriber!
              subscriber:
                {
                  "subscriber_id": 42,
                  "name": "Danilo Castos",
                  "email": "danilo@castos.com",
                }
              subscriptions:
                [
                  {
                    "subscription_id": 1,
                    "podcast_id": 4,
                    "podcast_title": "Example Podcast 1",
                    "feed_url": "https://example-podcast-1.castos.com/feed?uuidp=16359280515f8d",
                    "notifications_enabled": true,
                    "status": "active",
                  },
                  {
                    "subscription_id": 2,
                    "podcast_id": 5,
                    "podcast_title": "Example Podcast 2",
                    "feed_url": "https://example-podcast-2.castos.com/feed?uuidp=16359280615f8f",
                    "notifications_enabled": false,
                    "status": "canceled",
                  },
                ]
        "401":
          description: Unauthorized
          schema: # response schema can be specified for each response
            $ref: "#/definitions/Auth"
          examples:
            # response samples for each type operation produces
            application/json:
              success: false
              message: Authentication failed! Invalid or missing Access Token!
              status: 401
  "/private-subscribers/reactivate/{subscriber_id}":
    parameters:
      - name: subscriber_id
        in: path # place where parameter is passed: path, header, query or body, formData
        description: The subscriber ID
        required: true
        # type of the parameter: string, number, integer, boolean, array
        type: integer
    post:
      security:
        - Bearer: []
      tags:
        - Private Subscribers
      summary: Reactivate Subscriber by ID
      description: Reactivate a podcast for a private subscriber, given their subscriber_id and a podcast_id.
      operationId: reactivatePrivateSubscriberById
      produces:
        - application/json
      requestBody:
        description: The Podcast to reactivate the subscription for.
        required: true
        content:
          application/json:
            schema:
              $ref: "#/definitions/reactivatePrivateSubscriberRequest"
      responses: # list of responses
        "200":
          description: Success
          examples:
            application/json:
              success: true
              message: Private subscriber reactivated!
              status: 200
        "401":
          description: Unauthorized
          schema: # response schema can be specified for each response
            $ref: "#/definitions/Auth"
          examples:
            application/json:
              success: false
              message: Authentication failed! Invalid or missing Access Token!
              status: 401
        "404":
          description: Not Found
          examples:
            # response samples for each type operation produces
            application/json:
              success: false
              message: Subscriber|Podcast not found.
              status: 404
        "422":
          description: Invalid
          examples:
            application/json:
              success: false
              message: This subscriber is already active.
              status: 422
  "/private-subscribers/reactivate/email/{email_address}":
    parameters:
      - name: email_address
        in: path # place where parameter is passed: path, header, query or body, formData
        description: The subscriber email address
        required: true
        # type of the parameter: string, number, integer, boolean, array
        type: string
    post:
      security:
        - Bearer: []
      tags:
        - Private Subscribers
      summary: Reactivate Subscriber by Email
      description: Reactivate a podcast for a private subscriber, given their email address and a podcast_id.
      operationId: reactivatePrivateSubscriberByEmail
      produces:
        - application/json
      requestBody:
        description: The Podcast to reactivate the subscription for.
        required: true
        content:
          application/json:
            schema:
              $ref: "#/definitions/reactivatePrivateSubscriberRequest"
      responses: # list of responses
        "200":
          description: Success
          examples:
            application/json:
              success: true
              message: Private subscriber reactivated!
              status: 200
        "401":
          description: Unauthorized
          schema: # response schema can be specified for each response
            $ref: "#/definitions/Auth"
          examples:
            # response samples for each type operation produces
            application/json:
              success: false
              message: Authentication failed! Invalid or missing Access Token!
              status: 401
        "404":
          description: Not found.
          examples:
            # response samples for each type operation produces
            application/json:
              success: false
              message: Subscriber|Podcast not found.
              status: 404
        "422":
          description: Invalid
          examples:
            application/json:
              success: false
              message: This subscriber is already active.
              status: 422
  "/private-subscribers/{subscriber_id}":
    get:
      security:
        - Bearer: []
      tags:
        - Private Subscribers
      summary: Get Subscriber By ID
      operationId: getPrivateSubscribersById
      description: |+
        Get subscription details for a subscriber by subscriber_id.
      produces:
        - application/json
      responses: # list of responses
        "200":
          description: Success
          schema:
            $ref: "#/definitions/GetPrivateSubscriberById"
          examples:
            application/json:
              success: true
              message: Successfully retrieved private subscriber!
              subscriber:
                {
                  "subscriber_id": 42,
                  "name": "Danilo Castos",
                  "email": "danilo@castos.com",
                }
              subscriptions:
                [
                  {
                    "subscription_id": 1,
                    "podcast_id": 4,
                    "podcast_title": "Example Podcast 1",
                    "feed_url": "https://example-podcast-1.castos.com/feed?uuidp=16359280515f8d",
                    "notifications_enabled": true,
                    "status": "active",
                  },
                  {
                    "subscription_id": 2,
                    "podcast_id": 5,
                    "podcast_title": "Example Podcast 2",
                    "feed_url": "https://example-podcast-2.castos.com/feed?uuidp=16359280615f8f",
                    "notifications_enabled": false,
                    "status": "canceled",
                  },
                ]
        "401":
          description: Authentication failed
          schema:
            $ref: "#/definitions/AuthFailedResponse"
        "404":
          description: Not Found
  "/private-subscribers/{subscription_id}":
    post:
      security:
        - Bearer: []
      tags:
        - Private Subscribers
      summary: Revoke Private Subscriber
      description: Set status for Private Subscriber's Subscription to Cancelled by subscription_id.
      operationId: revokePrivateSubscriber
      produces:
        - application/json
      responses: # list of responses
        "200":
          description: Success
          schema:
            $ref: "#/definitions/revokePrivateSubscriber"
          examples:
            application/json:
              success: true
              message: Private subscriber canceled!
              status: 200
        "401":
          description: Authentication failed
          schema:
            $ref: "#/definitions/AuthFailedResponse"
        "404":
          description: Podcast missing
          schema:
            $ref: "#/definitions/podcastIdMissing"
    delete:
      security:
        - Bearer: []
      tags:
        - Private Subscribers
      summary: Delete Private Subscriber
      description: Delete a Subscriber's Subscription record by subscription_id.
      operationId: deletePrivateSubscriber
      produces:
        - application/json
      responses:
        "200":
          description: Success
          schema:
            $ref: "#/definitions/deletePrivateSubscriber"
          examples:
            application/json:
              success: true
              message: Private subscriber test@castos.com has been successfully deleted!
              status: 200
        "401":
          description: Authentication failed
          schema:
            $ref: "#/definitions/AuthFailedResponse"
        "404":
          description: Podcast missing
          schema:
            $ref: "#/definitions/podcastIdMissing"
        "422":
          description: Podcast does not belong to authenticated user
          schema:
            $ref: "#/definitions/unmatchedPodcastWithUser"
          examples:
            success: false
            message: Podcast with the id 123 does not belong to an authenticated user Castos User
            status: 422
  "/update-private-subscribers":
    post:
      security:
        - Bearer: []
      tags:
        - Private Subscribers
      summary: Update Private Subscribers
      description: Bulk create/revoke of private subscribers
      operationId: updatePrivateSubscribers
      produces:
        - application/json
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                subscribers: # <!--- form field name
                  type: array
                  items:
                    type: object
                    properties:
                      email:
                        type: string
                      name:
                        type: string
                podcasts: # <!--- form field name
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: integer
              example:
                subscribers:
                  [
                    { email: craig@castos.com, name: Craig Hewitt },
                    { email: danilo@castos.com, name: Danilo Radovic },
                  ]
                podcasts: [{ id: 2, title: Rogue Startups }]
      responses:
        "200":
          description: Success
          schema: # response schema can be specified for each response
            $ref: "#/definitions/updatePrivateSubscribers"
          examples:
            # response samples for each type operation produces
            application/json:
              success: true
              message: Private Subscribers successfully updated!

  "/create-private-subscribers":
    post:
      security:
        - Bearer: []
      tags:
        - Private Subscribers
      summary: Create Private Subscribers
      description: Create multiple Private Subscribers
      operationId: createPrivateSubscribers
      produces:
        - application/json
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                subscribers: # <!--- form field name
                  type: array
                  items:
                    type: object
                    properties:
                      email:
                        type: string
                      name:
                        type: string
                podcasts: # <!--- form field name
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: integer
              example:
                subscribers:
                  [
                    { email: craig@castos.com, name: Craig Hewitt },
                    { email: danilo@castos.com, name: Danilo Radovic },
                  ]
                podcasts: [{ id: 2, title: Rogue Startups }]
      responses:
        "200":
          description: Success
          schema: # response schema can be specified for each response
            $ref: "#/definitions/createPrivateSubscribers"
          examples:
            # response samples for each type operation produces
            application/json:
              success: true
              message: Successfully processed create private subscribers activity!
              existing-subscribers:
                description: Private subscribers that already exist on platform
                type: array
                example:
                  [
                    {
                      "email": "mirastupica@test.com",
                      "feedUrl": "http://prvi-podcast.seriouslysimplehosting.test/feed?uuidp=15f3aabc0bf8b5",
                      "podcastId": "10166",
                    },
                    {
                      "email": "aleksandar@rakic.com",
                      "feedUrl": "http://prvi-podcast.seriouslysimplehosting.test/feed?uuidp=15f3aabc1dab75",
                      "podcastId": "10166",
                    },
                    {
                      "email": "mirastupica@test.com",
                      "feedUrl": "http://drugi-podcast.seriouslysimplehosting.test/feed?uuidp=15f3aabc2adb59",
                      "podcastId": "10167",
                    },
                    {
                      "email": "aleksandar@rakic.com",
                      "feedUrl": "http://drugi-podcast.seriouslysimplehosting.test/feed?uuidp=15f3aabcdd7300",
                      "podcastId": "10167",
                    },
                  ]
              podcasts-not-belonging-to-user:
                description: List of podcasts that are sent within request but do not belong to authenticated user
                type: array
                example: [{ "podcastId": "123123" }, { "podcastId": "1111111" }]
  "/revoke-private-subscribers":
    post:
      security:
        - Bearer: []
      tags:
        - Private Subscribers
      summary: Revoke Private Subscribers
      description: Revoke multiple Private Subscribers
      operationId: revokePrivateSubscribers
      produces:
        - application/json
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                subscribers: # <!--- form field name
                  type: array
                  items:
                    type: object
                    properties:
                      email:
                        type: string
                        description: "The subscriber email address."
                      podcast_id:
                        type: integer
                        description: "The ID of the podcast to revoke access."
              example:
                subscribers:
                  [
                    { email: craig@castos.com, podcast_id: 12 },
                    { email: danilo@castos.com, podcast_id: 12 },
                  ]
      responses:
        "200":
          description: Success
          schema: # response schema can be specified for each response
            $ref: "#/definitions/revokePrivateSubscribers"
          examples:
            # response samples for each type operation produces
            application/json:
              success: true
              message: Successfully processed create private subscriberes activity!
              non-existing-podcasts:
                description: Podcast that do not exist on castos platform
                type: array
                example: [{ "podcastId": "101688" }]
              podcasts-not-belonging-to-user:
                description: Podcast that do not belong to authenticated user
                type: array
                example: [{ "podcastId": "101688" }, { "podcastId": "101646" }]
              non-existing-private-subscribers:
                description: Private subscribers that cannot be found on Castos platform
                type: array
                example:
                  [{ "email": "castostest@test.com", "podcastId": "10166" }]
              subscribers-being-already-revoked:
                description: Private subscribers that are already been revoked - in canceled status
                type: array
                example:
                  [
                    { "email": "danilo@castos.com", "podcastId": "10166" },
                    {
                      "email": "daniloradovic86@castos.com",
                      "podcastId": "10166",
                    },
                  ]
              revoked-subscribers:
                [
                  { "email": "revoketest@castos.com", "podcastId": "10166" },
                  { "email": "mirko@kabarilo.com", "podcastId": "10166" },
                ]
  "/podcasts":
    parameters:
      - name: show_details
        in: query # place where parameter is passed: path, header, query or body, formData
        description: Whether to show additional details for the podcast. Note this changes the structure of the response data. See the "2XX" response example for details.
        required: false
        type: boolean
    get:
      security:
        - Bearer: []
      tags:
        - Podcasts
      summary: Get Podcasts
      description: List all the podcasts for authenticated user
      operationId: getPodcasts
      # overwriting default global produces
      produces:
        - application/json
      responses: # list of responses
        "200":
          description: Success (show_details is false)
          schema: # response schema can be specified for each response
            $ref: "#/definitions/Podcasts"
          examples:
            # response samples for each type operation produces
            application/json:
              success: true
              message: Successfully retrieved podcasts!
              data:
                podcast_list:
                  620: API Podcast 01
                  621: API Podcast 02
              status: 200
        "2XX":
          description: Success (show_details is true)
          schema: # response schema can be specified for each response
            $ref: "#/definitions/Podcasts"
          examples:
            # response samples for each type operation produces
            application/json:
              success: true
              message: Successfully retrieved podcasts!
              data:
                podcast_list:
                  [
                    {
                      "podcast_title": "Podcast One",
                      "type": "public",
                      "is_feed_protected": false,
                      "id": 21,
                    },
                    {
                      "podcast_title": "Podcast Two",
                      "type": "private",
                      "is_feed_protected": true,
                      "id": 22,
                    },
                  ]
              status: 200
        "401":
          description: Unauthorized
          schema: # response schema can be specified for each response
            $ref: "#/definitions/Auth"
          examples:
            # response samples for each type operation produces
            application/json:
              success: false
              message: Authentication failed! Invalid or missing Access Token!
              status: 401
    post:
      security:
        - Bearer: []
      tags:
        - Podcasts
      summary: Create Podcast
      description: This can only be done by the logged in user.
      operationId: createPodcast
      produces:
        - application/json
      parameters:
        - in: header
          name: Accept
          schema:
            type: string
            default: application/json
          required: true
        - in: body
          name: body
          description: Create new Podcast object
          # for body parameter you should specify request schema instead of type
          schema:
            $ref: "#/definitions/podcastBody"
        - in: body
          name: image
          type: file
          description: Podcast cover image upload
      requestBody:
        content:
          "multipart/form-data":
            schema:
              $ref: "#/definitions/podcastBody"
      responses:
        "200":
          description: Success
          schema:
            $ref: "#/definitions/createdPodcast"
        "401":
          description: Authentication failed
          schema:
            $ref: "#/definitions/AuthFailedResponse"
        "404":
          description: Podcast missing
          schema:
            $ref: "#/definitions/podcastIdMissing"
  "/podcasts/{podcast_id}":
    get:
      security:
        - Bearer: []
      tags:
        - Podcasts
      summary: Get Podcast
      description: Get specific podcast by id
      operationId: getPodcast
      produces:
        - application/json
      parameters:
        - name: podcast_id
          in: path
          description: Id of the Podcast
          type: integer
          required: true
          # for body parameter you should specify request schema instead of type
      responses:
        "200":
          description: Success
          schema:
            $ref: "#/definitions/getPodcast"
        "401":
          description: Authentication failed
          schema:
            $ref: "#/definitions/AuthFailedResponse"
        "404":
          description: Podcast missing
          schema:
            $ref: "#/definitions/podcastIdMissing"
    post:
      security:
        - Bearer: []
      tags:
        - Podcasts
      summary: Update Podcast
      description: Update Podcast
      operationId: updatePodcast
      produces:
        - application/json
      parameters:
        - name: podcast_id
          in: path
          description: Id of Podcast
          type: integer
          required: true
        - in: body
          name: body
          description: Update an existing Podcast object
          # for body parameter you should specify request schema instead of type
          schema:
            $ref: "#/definitions/updatePodcastBody"
      requestBody:
        content:
          "multipart/form-data":
            schema:
              $ref: "#/definitions/updatePodcastBody"
      responses:
        "200":
          description: Success
          schema:
            $ref: "#/definitions/updatedPodcast"
        "401":
          description: Authentication failed
          schema:
            $ref: "#/definitions/AuthFailedResponse"
        "404":
          description: Podcast missing
          schema:
            $ref: "#/definitions/podcastIdMissing"
    delete:
      security:
        - Bearer: []
      tags:
        - Podcasts
      summary: Delete Podcast
      description: Delete Podcast
      operationId: deletePodcast
      produces:
        - application/json
      parameters:
        - name: podcast_id
          in: path
          type: integer
          required: true
          description: Id of Podcast
      responses:
        "200":
          description: Success
          schema:
            $ref: "#/definitions/deletedPodcast"
        "401":
          description: Authentication failed
          schema:
            $ref: "#/definitions/AuthFailedResponse"
        "404":
          description: Podcast missing
          schema:
            $ref: "#/definitions/podcastIdMissing"
  "/podcasts/{podcast_id}/episodes":
    get:
      security:
        - Bearer: []
      tags:
        - Episodes
      summary: Get Episodes
      description: List all the episodes for specified podcast
      operationId: getEpisodes
      produces:
        - application/json
      responses: # list of responses
        "200":
          description: Success
          schema: # response schema can be specified for each response
            $ref: "#/definitions/Episodes"
        "401":
          description: Unauthorized
          schema: # response schema can be specified for each response
            $ref: "#/definitions/AuthFailedResponse"
        "404":
          description: Podcast id missing
          schema:
            $ref: "#/definitions/podcastIdMissing"
    post:
      security:
        - Bearer: []
      tags:
        - Episodes
      summary: Create Episode
      description: This can only be done by the logged in user.
      operationId: createEpisode
      produces:
        - application/json
      parameters:
        - name: podcast_id
          in: path
          description: Id of podcast
          type: integer
          required: true
        - in: body
          name: body
          description: Create new Episode object
          # for body parameter you should specify request schema instead of type
          schema:
            $ref: "#/definitions/episodeBody"
      requestBody:
        content:
          "multipart/form-data":
            schema:
              $ref: "#/definitions/episodeBody"
      responses:
        "200":
          description: Success
          schema:
            $ref: "#/definitions/createdEpisode"
        "401":
          description: Authentication failed
          schema:
            $ref: "#/definitions/AuthFailedResponse"
        "404":
          description: Podcast id missing
          schema:
            $ref: "#/definitions/podcastIdMissing"
  "/podcasts/{podcast_id}/episodes/{episode_id}":
    get:
      security:
        - Bearer: []
      tags:
        - Episodes
      summary: Get Episode
      description: Get specific episode by id
      operationId: getEpisode
      produces:
        - application/json
      parameters:
        - name: episode_id
          in: path
          description: Id of the an episode
          required: true
          type: integer
          # for body parameter you should specify request schema instead of type
      responses:
        "200":
          description: Success
          schema:
            $ref: "#/definitions/getEpisode"
        "401":
          description: Authentication failed
          schema:
            $ref: "#/definitions/AuthFailedResponse"
        "404":
          description: Episode missing
          schema:
            $ref: "#/definitions/episodeIdMissing"
    post:
      security:
        - Bearer: []
      tags:
        - Episodes
      summary: Update Episode
      description: Update Episode
      operationId: updateEpisode
      produces:
        - application/json
      parameters:
        - name: episode_id
          in: path
          description: Id of episode
          type: integer
          required: true
        - in: body
          name: body
          description: Create new Podcast object
          # for body parameter you should specify request schema instead of type
          schema:
            $ref: "#/definitions/updatedEpisodeBody"
      requestBody:
        content:
          "multipart/form-data":
            schema:
              $ref: "#/definitions/updatedEpisodeBody"
      responses:
        "200":
          description: Success
          schema:
            $ref: "#/definitions/updatedEpisode"
        "401":
          description: Authentication failed
          schema:
            $ref: "#/definitions/AuthFailedResponse"
        "404":
          description: Episode missing
          schema:
            $ref: "#/definitions/episodeIdMissing"
    delete:
      security:
        - Bearer: []
      tags:
        - Episodes
      summary: Delete Episode
      description: Delete Episode
      operationId: deleteEpisode
      produces:
        - application/json
      parameters:
        - name: episode_id
          in: path
          description: Id of an episode
          type: integer
          required: true
      responses:
        "200":
          description: Success
          schema:
            $ref: "#/definitions/deletedEpisode"
        "401":
          description: Authentication failed
          schema:
            $ref: "#/definitions/AuthFailedResponse"
        "404":
          description: Podcast missing
          schema:
            $ref: "#/definitions/episodeIdMissing"
  "/get-categories":
    get:
      security:
        - Bearer: []
      tags:
        - Categories
      summary: Get Podcast Categories
      description: List all the podcast categories that are needed for category field when creating new and updating existing podcast
      operationId: getCategories

      # overwriting default global produces
      produces:
        - application/json
      responses: # list of responses
        "200":
          description: Success
          schema: # response schema can be specified for each response
            $ref: "#/definitions/categoryBody"
        "401":
          description: Authentication failed
          schema: # response schema can be specified for each response
            $ref: "#/definitions/AuthFailedResponse"
# An object to hold data types that can be consumed and produced by operations.
# These data types can be primitives, arrays or models.
definitions:
  PrivateSubscribers:
    type: object
    properties:
      success:
        description: Success message
        type: boolean
        example: true
      message:
        description: Response message
        type: string
        example: "Successfully retrieved private subscribers!"
      subscribers:
        description: The list of subscribers
        type: array
        items:
          type: object
      current_page:
        description: The current page (if paginated)
        type: integer
      first_page_url:
        description: URL to the first page of results (if paginated)
        type: string
      last_page_url:
        description: URL to the last page of results (if paginated)
        type: string
      prev_page_url:
        description: URL to the previous page of results (if paginated)
        type: string|null
      next_page_url:
        description: URL to the next page of results (if paginated)
        type: string|null
      per_page:
        description: Number of items per page (if paginated)
        type: integer
      total:
        description: Total number of results (if paginated)
        type: integer
  PrivateSubscriberByEmail:
    type: object
    properties:
      success:
        description: Success message
        type: boolean
        example: false
      subscriber:
        description: Subscriber information
        type: object
      subscriptions:
        description: Subscriber information
        type: array
        items:
          type: object
  GetPrivateSubscriberById:
    type: object
    properties:
      success:
        description: Success message
        type: boolean
        example: false
      subscriber:
        description: Subscriber information
        type: object
        example:
          {
            id: 1,
            podcast_id: 4,
            name: Jane Smith,
            email: "janesmith@email.test",
            uuid: 16359280615f8f,
            feed_url: "https://example-podcast.castos.com/feed?uuidp=16359280615f8f",
            status: "active",
            notifications_enabled: true,
            created_at: "2022-10-26T12:28:54.000000Z",
            updated_at: "2022-10-26T12:28:54.000000Z",
          }
  reactivatePrivateSubscriberRequest:
    type: object
    properties:
      podcast_id:
        description: The Podcast ID
        type: integer
        example: 42
  createPrivateSubscriber:
    type: object
    properties:
      success:
        description: Success message
        type: boolean
        example: false
      message:
        description: Response message
        type: string
        example: "Podcast subscriber successfully created!"
      status:
        description: Status of the response (true or false)
        type: integer
        example: 200
  revokePrivateSubscriber:
    type: object
    properties:
      success:
        description: Success message
        type: boolean
        example: true
      message:
        description: Response message
        type: string
        example: Private subscriber canceled!
      status:
        description: Status of the response
        type: integer
        example: 200
  deletePrivateSubscriber:
    type: object
    properties:
      success:
        description: Success message
        type: boolean
        example: true
      message:
        description: Response message
        type: string
        example: Private subscriber test@castos.com has been successfully deleted!
      status:
        description: Status of the response
        type: integer
        example: 200
  unmatchedPodcastWithUser:
    type: object
    properties:
      success:
        description: Success message
        type: boolean
        example: false
      message:
        description: Response message
        type: string
        example: Podcast with the id 123 does not belong to an authenticated user Castos User
      status:
        description: Status of the response
        type: integer
        example: 422
  updatePrivateSubscribers:
    type: object
    properties:
      success:
        description: Success message
        type: boolean
        example: true
      message:
        description: Response message
        type: string
        example: Private Subscribers successfully updated!
      status:
        description: Status of the response
        type: integer
        example: 200
  createPrivateSubscribers:
    type: object
    properties:
      success:
        description: Success message
        type: boolean
        example: true
      message:
        description: Response message
        type: string
        example: Successfully processed create private subscriberes activity!
      status:
        description: Status of the response
        type: integer
        example: 200
  revokePrivateSubscribers:
    type: object
    properties:
      success:
        description: Success message
        type: boolean
        example: true
      message:
        description: Response message
        type: string
        example: Successfully processed revoke of private subscriberes activity!
      status:
        description: Status of the response
        type: integer
        example: 200
  Auth:
    type: object
    properties:
      success:
        description: Success message
        type: string
        example: "false"
      message:
        description: Response message
        type: string
        example: "Successfully retrieved podcasts!"
      status:
        description: Status of the response (true or false)
        type: boolean
        example: true
  AuthFailedResponse:
    type: object
    properties:
      success:
        description: Failed message
        type: boolean
        example: false
      message:
        description: Response message
        type: string
        example: Authentication failed! Invalid or missing Access Token!
      status:
        description: Response status
        type: integer
        example: 401
  Token:
    description: token
    type: string
    example: http://seriouslysimplehosting.test/api/v2/podcasts?token=2y10Bcg8klsYs0goXDuRV5D5uuz51rYUnReUi8pQBHsSfeVVHFPj2
  Email:
    description: User email address
    type: string
    format: email
    example: john.smith@example.com
  User:
    type: object
    properties:
      username:
        description: User supplied username
        type: string
        minLength: 4
        example: John78
      firstName:
        description: User first name
        type: string
        minLength: 1
        example: John
      lastName:
        description: User last name
        type: string
        minLength: 1
        example: Smith
      email:
        $ref: "#/definitions/Email"
  podcastResponse:
    type: object
    properties:
      title:
        description: Podcast title
        type: string
        example: First Podcast
      description:
        description: Podcast description
        type: string
        example: First Podcast description
      rss_url:
        description: Podcast rss url
        type: string
        example: api-castos.seriouslysimplehosting.com/api-podcast-02
      subdomain:
        description: User's subdomain
        type: string
        example: api-castos
      author:
        description: Podcast author
        type: string
        example: John Doe
      copyright:
        description: copyright
        type: string
        example: copyright
      language:
        description: Podcast language
        type: string
        example: en
      image:
        description: Podcast image
        type: string
        example: http://app.seriouslysimplehosting.com/assets/images/cover-placeholder.png
      is_feed_protected:
        description: Whether the podcast is protected (private)
        type: boolean
        example: 1
      categories:
        description: Podcast categories
        type: string
        example: ["Arts", "Arts", "Arts"]
      website:
        description: Podcast website
        type: string
        example: website
      itunes:
        description: itunes
        type: string
        example: itunes
      google_podcasts:
        description: google podcasts
        type: string
        example: google podcasts
      stitcher:
        description: stitcher
        type: "null"
        example: null
      spotify:
        description: spotify id
        type: string
        example: spotifyid
      explicit:
        description: is podcast content explicit
        type: boolean
        example: true
      created_at:
        type: object
        properties:
          date:
            description: Podcast create date
            type: date
            example: "2018-12-04 08:49:37.000000"
          timezone_type:
            description: Timezone type
            type: integer
            example: 3
          timezone:
            description: Timezone
            type: string
            example: UTC
      updated_at:
        type: object
        properties:
          date:
            description: Podcast update date
            type: date
            example: "2018-12-04 08:49:37.000000"
          timezone_type:
            description: Timezone type
            type: integer
            example: 3
          timezone:
            description: Timezone
            type: string
            example: UTC
  podcastBody:
    type: object
    required:
      - podcast_title
      - podcast_description
      - website
      - author_name
      - podcast_owner
      - owner_email
      - language
      - copyright
      - feed_episodes_number
    properties:
      podcast_title:
        description: Podcast title
        type: string
        example: First Podcast
      podcast_description:
        description: Podcast description
        type: string
        example: Some podcast description
      show_type:
        description: Whether the Podcast is "episodic" or "serial"
        type: string
        enum: [episodic, serial]
        example: episodic
      cover_image:
        description: Podcast cover image
        type: string
        example: Podcast cover image
      keywords:
        description: keywords
        type: string
        example: castos podcast
      website:
        description: user's website
        type: string
        example: https://test.website.com
      author_name:
        description: author's name
        type: string
        example: John Doe
      podcast_owner:
        description: podcast owner
        type: string
        example: Mickey Roork
      owner_email:
        description: owner's email
        type: string
        example: john@doe.com
      copyright:
        description: copyright
        type: string
        example: © Castos, 2018. All rights reserved.
      explicit:
        description: specify if podcast content is explicit or not
        type: string
        example: yes
      language:
        description: podcast language
        type: string
        example: en
      itunes_category1:
        description: podcast category 1
        type: string
        example: Bussiness
      itunes_category2:
        description: podcast category 2
        type: string
        example: Arts
      itunes_category3:
        description: podcast category 3
        type: string
        example: Health
      itunes:
        description: itunes podcast url
        type: string
        example: https://itunes.apple.com/podcast/some-site/some-id
      google_podcasts:
        description: google podcasts url
        type: string
        example: https://play.google.com
      feed_episodes_number:
        description: specify number of episodes that will appear inside the podcast rss feed (default value is 100)
        type: integer
        example: 100
      new_feed_url:
        description: redirect your existing feed to new address by entering valid URL of the new feed you will be using
        type: string
        example: www.some-redirect-link.com
      country_of_origin_1:
        description: Defines the intended market/territory where the podcast is relevant to the consumer.
        type: string
        example: ANGOLA
      country_of_origin_2:
        description: Defines the intended market/territory where the podcast is relevant to the consumer.
        type: string
        example: UNITED KINGDOM
      country_of_origin_3:
        description: Defines the intended market/territory where the podcast is relevant to the consumer.
        type: string
        example: SPAIN
  updatePodcastBody:
    type: object
    properties:
      podcast_title:
        description: Podcast title
        type: string
        example: First Podcast
      podcast_description:
        description: Podcast description
        type: string
        example: Some podcast description
      show_type:
        description: Whether the Podcast is "episodic" or "serial"
        type: string
        enum: [episodic, serial]
        example: episodic
      cover_image:
        description: Podcast cover image
        type: string
        example: Podcast cover image
      keywords:
        description: keywords
        type: string
        example: castos podcast
      website:
        description: user's website
        type: string
        example: https://test.website.com
      author_name:
        description: author's name
        type: string
        example: John Doe
      podcast_owner:
        description: podcast owner
        type: string
        example: Mickey Roork
      owner_email:
        description: owner's email
        type: string
        example: john@doe.com
      copyright:
        description: copyright
        type: string
        example: © Castos, 2018. All rights reserved.
      explicit:
        description: specify if podcast content is explicit or not
        type: string
        example: yes
      language:
        description: podcast language
        type: string
        example: en
      itunes_category1:
        description: podcast category 1
        type: string
        example: Bussiness
      itunes_category2:
        description: podcast category 2
        type: string
        example: Arts
      itunes_category3:
        description: podcast category 3
        type: string
        example: Health
      itunes:
        description: itunes podcast url
        type: string
        example: https://itunes.apple.com/podcast/some-site/some-id
      google_podcasts:
        description: google podcasts url
        type: string
        example: https://play.google.com
      feed_episodes_number:
        description: specify number of episodes that will apear inside the podcast rss feed (default value is 25)
        type: integer
        example: 25
      new_feed_url:
        description: redirect your existing feed to new address by entering valid URL of the new feed you will be using
        type: string
        example: www.some-redirect-link.com
      country_of_origin_1:
        description: Defines the intended market/territory where the podcast is relevant to the consumer.
        type: string
        example: ANGOLA
      country_of_origin_2:
        description: Defines the intended market/territory where the podcast is relevant to the consumer.
        type: string
        example: UNITED KINGDOM
      country_of_origin_3:
        description: Defines the intended market/territory where the podcast is relevant to the consumer.
        type: string
        example: SPAIN
  getPodcast:
    type: object
    properties:
      success:
        description: Success message
        type: string
        example: true
      message:
        description: Response message
        example: "Successfully retrieved podcast"
      data:
        $ref: "#/definitions/podcastResponse"
      status:
        description: Status message
        type: integer
        example: 200
  Podcasts:
    type: object
    properties:
      success:
        description: Success message
        type: string
        example: "true"
      message:
        description: Response message
        type: string
        example: "Successfully retrieved podcasts!"
      data:
        $ref: "#/definitions/podcastsList"
      status:
        description: Status of the response
        type: integer
        example: 200
  podcastsList:
    type: object
    properties:
      podcast_list:
        type: array
        description: Podcasts list for authenticated user
        example:
          1: Podcast title 1
          2: Podcast title 2
  podcastIdMissing:
    type: object
    properties:
      success:
        description: Success message
        type: boolean
        example: false
      message:
        description: Response message
        type: string
        example: "No podcast with the id of 17 for the user John Doe"
      status:
        description: Status of the response
        type: integer
        example: 404
  updatedPodcast:
    type: object
    properties:
      success:
        description: Success message
        type: string
        example: true
      message:
        description: Response message
        type: string
        example: Podcast has been updated!
      status:
        description: Status of the response (true or false)
        type: boolean
        example: true
  createdPodcast:
    type: object
    properties:
      success:
        description: Success message
        type: string
        example: true
      message:
        description: Response message
        type: string
        example: Podcast created!
      data:
        type: object
        properties:
          podcast:
            type: object
            properties:
              id:
                type: integer
                example: 42
      status:
        description: Status of the response (true or false)
        type: boolean
        example: true
  deletedPodcast:
    type: object
    properties:
      success:
        description: Success message
        type: string
        example: true
      message:
        description: Response message
        type: string
        example: Podcast sucessfully deleted!
      status:
        description: Status of the response (true or false)
        type: boolean
        example: true
  episodeBody:
    type: object
    required: [post_title, post_content, episode_file]
    properties:
      post_title:
        description: Episode title
        type: string
        example: First Episode
      post_content:
        description: Episode content
        type: string
        example: Episode description
      episode_file:
        description: Episode file
        type: file
        example: File Object
      updated_episode_file:
        description: Updated Episode file
        type: string
        example: http://www.example.com/image.jpg
      keywords:
        description: Episode keywords
        type: string
        example: test keyword
      series_number:
        description: Episode series number
        type: string
        example: 1
      episode_number:
        description: Episode number
        type: string
        example: 1
      episode_type:
        description: Episode type
        type: string
        example: Full For Normal Episodes
      episode_image:
        description: Episode image
        type: image
        example:
      post_date:
        description: Episode post date
        type: dateTime
        example: "2018-11-14 09:11:00"
  updatedEpisodeBody:
    type: object
    properties:
      post_title:
        description: Episode title
        type: string
        example: First Episode
      post_content:
        description: Episode content
        type: string
        example: Episode description
      episode_file:
        description: Episode file
        type: file
        example: File Object
      updated_episode_file:
        description: Updated Episode file
        type: url
        example: http://www.example.com/image.jpg
      keywords:
        description: Episode keywords
        type: string
        example: test keyword
      series_number:
        description: Episode series number
        type: string
        example: 1
      episode_number:
        description: Episode number
        type: string
        example: 1
      episode_type:
        description: Episode type
        type: string
        example: Full For Normal Episodes
      episode_image:
        description: Episode image
        type: image
        example:
      post_date:
        description: Episode post date
        type: dateTime
        example: "2018-11-14 09:11:00"
  createdEpisode:
    type: object
    properties:
      success:
        description: Success message
        type: string
        example: true
      message:
        description: Response message
        type: string
        example: Episode created!
      status:
        description: Status of the response (true or false)
        type: boolean
        example: true
      errors:
        description: "An array containing non-fatal errors, such as the episode image failing to upload"
        type: array
        items:
          type: string
        example:
          image: "We could not access the episode image, please check that the URL is publicly accessible"
  episodeIdMissing:
    type: object
    properties:
      success:
        description: Success message
        type: boolean
        example: false
      message:
        description: Response message
        type: string
        example: "No episode with the id of 17 for the user John Doe"
      status:
        description: Status of the response
        type: integer
        example: 404
  Episodes:
    type: object
    properties:
      success:
        description: Success message
        type: string
        example: "true"
      message:
        description: Response message
        type: string
        example: "Podcast episodes successfully retrieved!"
      data:
        description: Response data
        $ref: "#/definitions/episodesList"
      status:
        description: Status of the response
        type: integer
        example: 200
  updatedEpisode:
    type: object
    properties:
      success:
        description: Success message
        type: string
        example: true
      message:
        description: Response message
        type: string
        example: Episode has been updated!
      status:
        description: Status of the response (true or false)
        type: boolean
        example: true
      errors:
        description: "An array containing non-fatal errors, such as the episode image failing to upload"
        type: array
        items:
          type: string
        example:
          image: "We could not access the episode image, please check that the URL is publicly accessible"
  getEpisode:
    type: object
    properties:
      success:
        description: Success message
        type: string
        example: true
      message:
        description: Response message
        example: "Successfully retrieved episode!"
      data:
        description: Episode data
        type: object
        example:
          "id": 43132
          "post_id": ""
          "post_title": "API Podcast 01 Episode Large File 04"
          "post_content": "API Podcast 01 Episode Large File 04"
          "post_date": "2018-11-14 09:11:00"
          "user_id": 1697
          "created_at": "2018-12-04 09:54:09"
          "updated_at": "2018-12-04 09:54:09"
          "keywords": "test"
          "series_number": "1"
          "episode_number": "1"
          "episode_image": ""
          "episode_type": "API Podcast 01 Episode Large File 04"
          "explicit": null
          "post_slug": "api-podcast-01-episode-large-file-04"
          "youtube_id": null
          "republish_triger": 0
          "podcast_id": "158"
          "website_sync": 0
      status:
        description: Status message
        type: integer
        example: 200
  episodesList:
    type: object
    description: List of Episodes for authenticated user
    properties:
      id:
        description: Episode id
        type: integer
        example: 1
      post_title:
        description: Episode title
        type: string
        example: Episode 01
      created_at:
        description: Date of episode's creation
        type: dateTime
        example: "2018-11-29 14:09:59"
      post_date:
        description: Date of episode's publishing
        type: dateTime
        example: "2018-11-29 14:09:59"
      youtube_id:
        description: YouTube id of the episode
        type: string
        example: h2Nz68Qxing
  deletedEpisode:
    type: object
    properties:
      success:
        description: Success message
        type: string
        example: true
      message:
        description: Response message
        type: string
        example: Episode sucessfully deleted!
      status:
        description: Status of the response (true or false)
        type: boolean
        example: true
  privateSubscriberBody:
    type: object
    properties:
      email:
        type: string
        description: Private subscriber's email
        example: hello@castos.com
      name:
        type: string
        description: Private subscriber's name
        example: Castos
      podcast_id:
        type: integer
        description: Podcast ID
        example: 120
    required:
      - email
      - podcast_id
  categoryBody:
    type: object
    properties:
      categories:
        description: Podcast category list
        type: array
        example:
          [
            "Arts",
            "Arts: Books",
            "Arts: Design",
            "Arts: Fashion & Beauty",
            "Arts: Food",
            "Arts: Performing Arts",
            "Arts: Visual Arts",
            "Business",
            "Business: Careers",
            "Business: Entrepreneurship",
            "Business: Investing",
            "Business: Management",
            "Business: Marketing",
            "Business: Non-Profit",
            "Comedy",
            "Comedy: Comedy Interviews",
            "Comedy: Improv",
            "Comedy: Stand-Up",
            "Education",
            "Education: Courses",
            "Education: How To",
            "Education: Language Learning",
            "Education: Self-Improvement",
            "Fiction",
            "Fiction: Comedy Fiction",
            "Fiction: Drama",
            "Fiction: Science Fiction",
            "Government",
            "Health & Fitness",
            "Health & Fitness: Alternative Health",
            "Health & Fitness: Fitness",
            "Health & Fitness: Medicine",
            "Health & Fitness: Mental Health",
            "Health & Fitness: Nutrition",
            "Health & Fitness: Sexuality",
            "History",
            "Kids & Family",
            "Kids & Family: Education for Kids",
            "Kids & Family: Parenting",
            "Kids & Family: Pets & Animals",
            "Kids & Family: Stories for Kids",
            "Leisure",
            "Leisure: Animation & Manga",
            "Leisure: Automotive",
            "Leisure: Aviation",
            "Leisure: Crafts",
            "Leisure: Games",
            "Leisure: Hobbies",
            "Leisure: Home & Garden",
            "Leisure: Video Games",
            "Music",
            "Music: Music Commentary",
            "Music: Music History",
            "Music: Music Interviews",
            "News",
            "News: Business News",
            "News: Daily News",
            "News: Entertainment News",
            "News: News Commentary",
            "News: Politics",
            "News: Sports News",
            "News: Tech News",
            "Religion & Spirituality",
            "Religion & Spirituality: Buddhism",
            "Religion & Spirituality: Christianity",
            "Religion & Spirituality: Hinduism",
            "Religion & Spirituality: Islam",
            "Religion & Spirituality: Judaism",
            "Religion & Spirituality: Religion",
            "Religion & Spirituality: Spirituality",
            "Science",
            "Science: Astronomy",
            "Science: Chemistry",
            "Science: Earth Sciences",
            "Science: Life Sciences",
            "Science: Mathematics",
            "Science: Natural Sciences",
            "Science: Nature",
            "Science: Physics",
            "Science: Social Sciences",
            "Society & Culture",
            "Society & Culture: Documentary",
            "Society & Culture: Personal Journals",
            "Society & Culture: Philosophy",
            "Society & Culture: Places & Travel",
            "Society & Culture: Relationships",
            "Sports",
            "Sports: Baseball",
            "Sports: Basketball",
            "Sports: Cricket",
            "Sports: Fantasy Sports",
            "Sports: Football",
            "Sports: Golf",
            "Sports: Hockey",
            "Sports: Rugby",
            "Sports: Running",
            "Sports: Soccer",
            "Sports: Swimming",
            "Sports: Tennis",
            "Sports: Volleyball",
            "Sports: Wilderness",
            "Sports: Wrestling",
            "TV & Film",
            "TV & Film: After Shows",
            "TV & Film: Film History",
            "TV & Film: Film Interviews",
            "TV & Film: Film Reviews",
            "TV & Film: TV Reviews",
            "Technology",
            "True Crime",
          ]
