You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
401 lines
9.1 KiB
401 lines
9.1 KiB
basePath: /
|
|
definitions:
|
|
common.ErrResponse:
|
|
properties:
|
|
code:
|
|
description: application-specific error code
|
|
type: integer
|
|
error:
|
|
description: application-level error message, for debugging
|
|
type: string
|
|
status:
|
|
description: user-level status message
|
|
type: string
|
|
type: object
|
|
common.TextResponse:
|
|
properties:
|
|
status:
|
|
description: user-level status message
|
|
type: string
|
|
text:
|
|
description: application-specific error code
|
|
type: string
|
|
type: object
|
|
ktmtrainbot.BookingCreateRequest:
|
|
properties:
|
|
contact:
|
|
example: "+6512345678"
|
|
type: string
|
|
gender:
|
|
example: M
|
|
type: string
|
|
name:
|
|
type: string
|
|
passport:
|
|
type: string
|
|
passportExpiry:
|
|
format: date-time
|
|
type: string
|
|
timeCode:
|
|
example: "1300"
|
|
type: string
|
|
travelDate:
|
|
format: date-time
|
|
type: string
|
|
required:
|
|
- contact
|
|
- gender
|
|
- name
|
|
- passport
|
|
- passportExpiry
|
|
- timeCode
|
|
- travelDate
|
|
type: object
|
|
ktmtrainbot.BookingResponse:
|
|
properties:
|
|
contact:
|
|
type: string
|
|
gender:
|
|
type: string
|
|
id:
|
|
type: string
|
|
name:
|
|
type: string
|
|
passport:
|
|
type: string
|
|
passportExpiry:
|
|
type: string
|
|
status:
|
|
type: string
|
|
timeCode:
|
|
type: string
|
|
travelDate:
|
|
type: string
|
|
type: object
|
|
ktmtrainbot.ServerTimeResponse:
|
|
properties:
|
|
serverLocalTime:
|
|
type: string
|
|
type: object
|
|
user.ProfileRequest:
|
|
properties:
|
|
ktmTrainCreditCard:
|
|
example: "1234123412341234"
|
|
type: string
|
|
ktmTrainCreditCardCVV:
|
|
example: "123"
|
|
type: string
|
|
ktmTrainCreditCardExpiry:
|
|
example: 01/2022
|
|
type: string
|
|
ktmTrainCreditCardType:
|
|
example: Visa|Mastercard
|
|
type: string
|
|
ktmTrainPassword:
|
|
example: password
|
|
type: string
|
|
ktmTrainUsername:
|
|
example: user@gmail.com
|
|
type: string
|
|
type: object
|
|
user.ProfileResponse:
|
|
properties:
|
|
ktmTrainCreditCard:
|
|
type: string
|
|
ktmTrainCreditCardCVV:
|
|
type: string
|
|
ktmTrainCreditCardExpiry:
|
|
type: string
|
|
ktmTrainCreditCardType:
|
|
type: string
|
|
ktmTrainPassword:
|
|
type: string
|
|
ktmTrainUsername:
|
|
type: string
|
|
type: object
|
|
user.UserLoginRequest:
|
|
properties:
|
|
password:
|
|
type: string
|
|
username:
|
|
maxLength: 100
|
|
minLength: 2
|
|
type: string
|
|
required:
|
|
- password
|
|
- username
|
|
type: object
|
|
user.UserRegisterRequest:
|
|
properties:
|
|
password:
|
|
maxLength: 100
|
|
minLength: 6
|
|
type: string
|
|
username:
|
|
maxLength: 100
|
|
minLength: 2
|
|
type: string
|
|
required:
|
|
- password
|
|
- username
|
|
type: object
|
|
user.UserResponse:
|
|
properties:
|
|
id:
|
|
type: string
|
|
profile:
|
|
$ref: '#/definitions/user.ProfileResponse'
|
|
username:
|
|
type: string
|
|
type: object
|
|
info:
|
|
contact:
|
|
name: Samuel Pua
|
|
url: https://git.samuelpua.com/telboon
|
|
description: API for frontend - built on Go-chi
|
|
title: KTM Train Booking Bot
|
|
version: "1.0"
|
|
paths:
|
|
/:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: Description
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
type: string
|
|
"404":
|
|
description: Not Found
|
|
schema:
|
|
type: string
|
|
summary: This is test
|
|
tags:
|
|
- Base
|
|
/api/v1/ktmtrainbot/booking:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: Description
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
items:
|
|
$ref: '#/definitions/ktmtrainbot.BookingResponse'
|
|
type: array
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/common.ErrResponse'
|
|
summary: Get All Booking
|
|
tags:
|
|
- ktmtrainbot Booking
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Description
|
|
parameters:
|
|
- description: Booking Create Request
|
|
in: body
|
|
name: user
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/ktmtrainbot.BookingCreateRequest'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/ktmtrainbot.BookingResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/common.ErrResponse'
|
|
summary: Create New Booking
|
|
tags:
|
|
- ktmtrainbot Booking
|
|
/api/v1/ktmtrainbot/booking/{bookingID}:
|
|
delete:
|
|
consumes:
|
|
- application/json
|
|
description: Description
|
|
parameters:
|
|
- description: Booking ID
|
|
in: path
|
|
name: bookingID
|
|
required: true
|
|
type: string
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/ktmtrainbot.BookingResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/common.ErrResponse'
|
|
summary: Delete booking
|
|
tags:
|
|
- ktmtrainbot Booking
|
|
/api/v1/ktmtrainbot/current-time:
|
|
get:
|
|
description: Description
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/ktmtrainbot.ServerTimeResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/common.ErrResponse'
|
|
summary: Get current server time
|
|
tags:
|
|
- Info
|
|
/api/v1/user/login:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Description
|
|
parameters:
|
|
- description: User Login info
|
|
in: body
|
|
name: user
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/user.UserLoginRequest'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/user.UserResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/common.ErrResponse'
|
|
summary: For user login
|
|
tags:
|
|
- User
|
|
/api/v1/user/logout:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Description
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/common.TextResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/common.ErrResponse'
|
|
summary: For user logout
|
|
tags:
|
|
- User
|
|
/api/v1/user/me:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: Description
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/user.UserResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/common.ErrResponse'
|
|
summary: Returns current logged in user
|
|
tags:
|
|
- User
|
|
/api/v1/user/profile:
|
|
put:
|
|
consumes:
|
|
- application/json
|
|
description: Description
|
|
parameters:
|
|
- description: User registration info
|
|
in: body
|
|
name: user
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/user.ProfileRequest'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/user.UserResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/common.ErrResponse'
|
|
summary: For setting current user profile
|
|
tags:
|
|
- User
|
|
/api/v1/user/register:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Description
|
|
parameters:
|
|
- description: User registration info
|
|
in: body
|
|
name: user
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/user.UserRegisterRequest'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/user.UserResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/common.ErrResponse'
|
|
summary: For user registration
|
|
tags:
|
|
- User
|
|
/health:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: Description
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
type: string
|
|
"404":
|
|
description: Not Found
|
|
schema:
|
|
type: string
|
|
summary: Responds to health check
|
|
tags:
|
|
- Base
|
|
swagger: "2.0"
|