Skip to content

Instantly share code, notes, and snippets.

@philiplambok
Created October 23, 2022 15:44
Show Gist options
  • Save philiplambok/43f91b67a3e4195bd127284ef9e44588 to your computer and use it in GitHub Desktop.
Save philiplambok/43f91b67a3e4195bd127284ef9e44588 to your computer and use it in GitHub Desktop.
Learn Open API 3.0
openapi: 3.0.0
info:
version: 1.0.0
title: P & T Kitchen
description: The payment gateway that you don't hate.
servers:
- url: https://api.kitchen.com/api/v1
- url: https://staging-api.kitchen.com/api/v1
paths:
/balances:
get:
description: Fetch the current balances
responses:
'200':
description: Successful response.
content:
application/json:
schema:
type: object
properties:
amount:
type: integer
description: The current balance
/bank_transfers:
post:
description: Send money to spesific bank.
responses:
'201':
description: Successful response.
security:
- ApiKeyAuth: []
components:
securitySchemes:
ApiKeyAuth:
type: apikey
in: header
name: 'Authorization'
@philiplambok
Copy link
Author

openapi: 3.0.0
info: 
  version: 1.0.0
  title: P & T Kitchen
  description: The payment gateway that you don't hate.

servers:
  - url: https://api.kitchen.com/api/v1
  - url: https://staging-api.kitchen.com/api/v1

security:
  - ApiKeyAuth: [] 

paths:
  /balances:
    get: 
      description: Fetch the current balances
      responses:
        '200':
          description: Successful response.
          content: 
            application/json:
              schema:
                $ref: '#/components/schemas/UserBalance'
  /bank_transfers:
    post:
      description: Send money to spesific bank.
      responses:
        '201':
          description: Successful response.

components:
  securitySchemes:
    ApiKeyAuth:
      type: apikey
      in: header
      name: Authorization
  schemas:
    UserBalance:
      type: object
      properties:
        amount:
          type: integer
          description: The current balance

@philiplambok
Copy link
Author

openapi: 3.0.0
info: 
  version: 1.0.0
  title: P & T Kitchen
  description: The payment gateway that you don't hate.

servers:
  - url: https://api.kitchen.com/api/v1
  - url: https://staging-api.kitchen.com/api/v1

paths:
  /balances:
    get: 
      description: Fetch the current balances
      responses:
        '200':
          description: 'Successful response'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserBalance'
  /bank_transfers:
    post:
      description: Send money to spesific bank.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: 
                - account_holder_name
                - acount_number
                - bank_code
                - amount
              properties:
                account_holder_name:
                  type: string
                  example: Bill John
                account_number:
                  type: string
                  example: 12312332
                bank_code:
                  type: string
                  example: bca
                amount:
                  type: integer
                  example: 10000
                
      responses:
        '201':
          description: Successful response.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      id:
                        type: number
                      attributes:
                        type: object
                        properties:
                          account_holder_name:
                            type: string
                            example: Bill John
                          account_number:
                            type: string
                            example: 12312332
                          amount:
                            type: number
                            example: 10000
                          bank_code:
                            type: string
                            example: bca
                        

security:
  - AuthorizationAuth: []

components:
  securitySchemes:
    AuthorizationAuth:
      type: apiKey
      in: header
      name: 'Authorization'
  schemas:
    UserBalance:
      type: object
      properties:
        amount:
          type: integer
          description: The user's current balance 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment