Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- openapi: '3.0.0'
- info:
- version: 0.1.0
- title: Lanye API demo
- description: |
- This is the API reference of the Lanye API demo.
- All fields which store time like `createAt`, `updateAt` are all unix timestamp.
- host: lanye.test.hsexpert.net
- basePath: /v0
- schemes:
- - http
- - https
- paths:
- /user:
- post:
- consumes:
- - application/json
- produces:
- - application/json
- tags:
- - User
- summary: Add a user
- description: |
- Add a user using the user input.
- You **must** fill in the following fields:
- * email
- * password
- All sensitive information will be removed in response.
- parameters:
- - name: body
- in: body
- description: User information
- required: true
- schema:
- $ref: "#/definitions/User"
- responses:
- 201:
- description: OK
- schema:
- $ref: "#/definitions/User"
- 400:
- description: Invalid user information, maybe duplicate email or wrong field name / datatype. More information will be in `Error.message`
- schema:
- $ref: "#/definitions/Error"
- /user/{user_id}:
- patch:
- consumes:
- - application/json
- produces:
- - application/json
- tags:
- - User
- summary: Update specified user data.
- description: |
- Update user data specified in `user_id`. This API will only replace given fields.
- ** `email` cannot be modified. ** It makes no effect if you give that.
- parameters:
- - name: user_id
- in: path
- description: Unique identifier of user
- required: true
- type: integer
- format: int32
- - name: body
- in: body
- description: User information
- required: false
- schema:
- $ref: "#/definitions/User"
- responses:
- 200:
- description: OK
- schema:
- $ref: "#/definitions/User"
- 400:
- description: Invalid input, maybe undefined fields or incorrect content.
- schema:
- $ref: "#/definitions/Error"
- 404:
- description: Cannot find user given in `user_id`
- schema:
- $ref: "#/definitions/Error"
- security:
- - user_login_token: []
- put:
- consumes:
- - application/json
- produces:
- - application/json
- tags:
- - User
- summary: Replace specified user data.
- description: |
- Update user data specified in `user_id`. This API will replace all fields with input.
- ** `email` cannot be modified. ** It makes no effect if you give that.
- parameters:
- - name: user_id
- in: path
- description: Unique identifier of user
- required: true
- type: integer
- format: int32
- - name: body
- in: body
- description: User information
- required: false
- schema:
- $ref: "#/definitions/User"
- responses:
- 200:
- description: OK
- schema:
- $ref: "#/definitions/User"
- 400:
- description: Invalid input, maybe undefined fields or incorrect content.
- schema:
- $ref: "#/definitions/Error"
- 404:
- description: Cannot find user given in `user_id`
- schema:
- $ref: "#/definitions/Error"
- security:
- - user_login_token: []
- delete:
- consumes:
- - application/json
- produces:
- - application/json
- tags:
- - User
- summary: Delete specified user.
- description: Delete user specified in `user_id`.
- parameters:
- - name: user_id
- in: path
- description: Unique identifier of user
- required: true
- type: integer
- format: int32
- responses:
- 200:
- description: OK
- schema:
- $ref: "#/definitions/User"
- 400:
- description: Invalid input, maybe undefined fields or incorrect content.
- schema:
- $ref: "#/definitions/Error"
- 404:
- description: Cannot find user given in `user_id`
- schema:
- $ref: "#/definitions/Error"
- security:
- - user_login_token: []
- /user/now:
- get:
- consumes:
- - application/json
- produces:
- - application/json
- tags:
- - User
- summary: Get user logged in now.
- description: |
- Get the user logged in now, if user is not logged in, an 401 error will be return.
- responses:
- 200:
- description: OK
- schema:
- $ref: "#/definitions/User"
- 401:
- description: Not logged in.
- schema:
- $ref: "#/definitions/Error"
- security:
- - user_login_token: []
- /auth/local:
- post:
- consumes:
- - application/json
- produces:
- - application/json
- tags:
- - Authentication
- summary: Authenticate to the system using email and password.
- description: |
- Authenticate to the system using `email` and `password` (`user_id` is no need.).
- You have to put `token` from response in header as `authorization` when querying APIs that needs authorization.
- parameters:
- - name: body
- in: body
- description: Email and password of user
- required: true
- schema:
- $ref: "#/definitions/User"
- responses:
- 200:
- description: OK
- schema:
- $ref: "#/definitions/TokenAuthentication"
- 403:
- description: Email or password is incorrect.
- schema:
- $ref: "#/definitions/Error"
- /device:
- post:
- consumes:
- - application/json
- produces:
- - application/json
- tags:
- - Device
- summary: Add a device
- description: |
- Add a device using the user input.
- You only have to pass `user_id` and `onesignal_id` when calling this API. Other information will retrive via Onesignal API.
- `user_id` is indicated to the user who own this device, but it's **NOT** required, because app needs to register the device when it started, at that time the user is not created.
- But it should be added later.
- P.S. Device here is similar to `Device` in Onesignal, so all the fields which name is same as Onesignal Device store same data as in Onesignal.
- parameters:
- - name: body
- in: body
- description: Device information
- required: true
- schema:
- $ref: "#/definitions/Device"
- responses:
- 201:
- description: OK
- schema:
- $ref: "#/definitions/Device"
- 400:
- description: Invalid device information, maybe duplicate identifier or wrong field name / datatype. More information will be in `Error.message`
- schema:
- $ref: "#/definitions/Error"
- 404:
- description: The `identifier` or `user_id` is not found in database.
- schema:
- $ref: "#/definitions/Error"
- /device/{device_id}:
- patch:
- consumes:
- - application/json
- produces:
- - application/json
- tags:
- - Device
- summary: Update specified device data.
- description: |
- Update device data specified in `device_id`. This API will only replace given fields.
- parameters:
- - name: device_id
- in: path
- description: Unique identifier of user
- required: true
- type: integer
- format: int32
- - name: body
- in: body
- description: User information
- required: false
- schema:
- $ref: "#/definitions/Device"
- responses:
- 200:
- description: OK
- schema:
- $ref: "#/definitions/Device"
- 400:
- description: Invalid input, maybe undefined fields or incorrect content.
- schema:
- $ref: "#/definitions/Error"
- 404:
- description: Cannot find device given in `device_id`
- schema:
- $ref: "#/definitions/Error"
- security:
- - user_login_token: []
- put:
- consumes:
- - application/json
- produces:
- - application/json
- tags:
- - Device
- summary: Replace specified device data.
- description: |
- Update device data specified in `device_id`. This API will replace all fields with input.
- parameters:
- - name: device_id
- in: path
- description: Unique identifier of user
- required: true
- type: integer
- format: int32
- - name: body
- in: body
- description: Device information
- required: false
- schema:
- $ref: "#/definitions/Device"
- responses:
- 200:
- description: OK
- schema:
- $ref: "#/definitions/Device"
- 400:
- description: Invalid input, maybe undefined fields or incorrect content.
- schema:
- $ref: "#/definitions/Error"
- 404:
- description: Cannot find user given in `device_id`
- schema:
- $ref: "#/definitions/Error"
- security:
- - user_login_token: []
- delete:
- consumes:
- - application/json
- produces:
- - application/json
- tags:
- - Device
- summary: Delete specified device.
- description: Delete device specified in `device_id`.
- parameters:
- - name: device_id
- in: path
- description: Unique identifier of device
- required: true
- type: integer
- format: int32
- responses:
- 200:
- description: OK
- schema:
- $ref: "#/definitions/Device"
- 400:
- description: Invalid input, maybe undefined fields or incorrect content.
- schema:
- $ref: "#/definitions/Error"
- 404:
- description: Cannot find device given in `device_id`
- schema:
- $ref: "#/definitions/Error"
- security:
- - user_login_token: []
- /push-notification:
- post:
- tags:
- - Push-Notification
- consumes:
- - application/json
- produces:
- - application/json
- summary: Create a push notification.
- description: |
- Create a push notification send via Onesignal API.
- For the fields in body, please refer to [Onesignal official API document](https://documentation.onesignal.com/reference#create-notification).
- You **must** fill in the following fields:
- * contents
- The `user_id` in `include_user_ids` is same as the `user_id` field in `User` object, and so is `device_id`.
- If none of `included_segments`, `excluded_segments`, `filters`, `include_player_ids`, `include_device_ids`, `include_user_ids` are given, every device will receive push notification.
- parameters:
- - name: body
- in: body
- schema:
- $ref: "#/definitions/Notification"
- responses:
- 200:
- description: OK
- schema:
- $ref: "#/definitions/Notification"
- 401:
- description: Not logged in.
- schema:
- $ref: "#/definitions/Error"
- security:
- - user_login_token: []
- /push-notification/history:
- get:
- tags:
- - Push-Notification
- consumes:
- - application/json
- produces:
- - application/json
- summary: Get push notification history list.
- description: |
- Get the list of push notification history.
- responses:
- 200:
- description: OK
- schema:
- type: array
- items:
- $ref: "#/definitions/Notification"
- security:
- - user_login_token: []
- definitions:
- User:
- type: object
- required:
- - email
- properties:
- user_id:
- type: integer
- format: int32
- email:
- type: string
- format: email
- password:
- type: string
- format: password
- createAt:
- type: integer
- format: int32
- updateAt:
- type: integer
- format: int32
- devices:
- type: array
- items:
- $ref: "#/definitions/Device"
- Error:
- type: object
- required:
- - name
- - message
- - code
- - className
- properties:
- name:
- type: string
- message:
- type: string
- code:
- type: integer
- format: int32
- className:
- type: string
- errors:
- type: object
- TokenAuthentication:
- type: object
- required:
- - token
- - data
- properties:
- token:
- type: string
- data:
- $ref: "#/definitions/User"
- Device:
- type: object
- required:
- - onesingal_id
- properties:
- device_id:
- type: integer
- format: int32
- user_id:
- type: integer
- format: int32
- device_type:
- type: integer
- format: int32
- onesingal_id:
- type: string
- identifier:
- type: string
- language:
- type: string
- timezone:
- type: integer
- game_version:
- type: string
- device_model:
- type: string
- device_os:
- type: string
- ad_id:
- type: string
- sdk:
- type: string
- createAt:
- type: integer
- format: int32
- updateAt:
- type: integer
- format: int32
- Notification:
- type: object
- required:
- - contents
- properties:
- notification_id:
- type: integer
- format: int32
- included_segments:
- type: array
- items:
- type: string
- excluded_segments:
- type: array
- items:
- type: string
- filters:
- type: object
- include_player_ids:
- type: array
- items:
- type: string
- include_device_ids:
- type: array
- items:
- type: integer
- include_user_ids:
- type: array
- items:
- type: integer
- contents:
- type: object
- headings:
- type: object
- createAt:
- type: integer
- format: int32
- updateAt:
- type: integer
- format: int32
- securityDefinitions:
- user_login_token:
- type: apiKey
- name: authorization
- in: header
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement