--- openapi: 3.0.1 info: title: API V1 version: v1 paths: "/api/v1/users/{user_id}/clock_in_summaries": get: summary: Get current user's sleeping record tags: - Sleeping Record parameters: - name: user_id in: path description: User ID which the clock in will be performed for required: true schema: type: integer - name: page in: query required: false schema: type: integer - name: limit in: query required: false schema: type: integer - name: start_date in: query required: false schema: type: string format: date description: optional, the default value will be from 1 week ago - name: end_date in: query required: false schema: type: string format: date description: optional, the default value will be the current date responses: '200': description: Success content: application/json: schema: "$ref": "#/components/schemas/summary_clock_in_list_record" "/api/v1/users/{user_id}/clock_in_summaries/followings": get: summary: Get the sleep records of user's following list tags: - Sleeping Record parameters: - name: user_id in: path description: User ID which the clock in will be performed for required: true schema: type: integer - name: page in: query required: false schema: type: integer - name: limit in: query required: false schema: type: integer - name: start_date in: query required: false description: optional, the default value will be from the beginning of previous week schema: type: string format: date - name: end_date in: query required: false description: optional, the default value will be the current date schema: type: string format: date responses: '200': description: Success content: application/json: schema: "$ref": "#/components/schemas/summary_clock_in_list_record" "/api/v1/users/{user_id}/clock_ins": post: summary: Create Clock In Record tags: - Clock In parameters: - name: user_id in: path description: User ID which the clock in will be performed for required: true schema: type: integer responses: '201': description: Success content: application/json: schema: "$ref": "#/components/schemas/clock_in_single_record" '422': description: Unprocessable Entity content: application/json: schema: "$ref": "#/components/schemas/error_record" requestBody: content: application/json: schema: type: object properties: event_type: type: string enum: - sleep_start - sleep_end required: - event_type get: summary: Get all Clock In Records tags: - Clock In parameters: - name: user_id in: path description: User ID which the clock in will be performed for required: true schema: type: integer - name: page in: query example: 1 schema: type: integer - name: limit in: query example: 32 schema: type: integer responses: '200': description: Success content: application/json: schema: "$ref": "#/components/schemas/clock_in_list_record" "/api/v1/follows": post: summary: Create Follow tags: - Following parameters: [] responses: '201': description: Created content: application/json: schema: "$ref": "#/components/schemas/following_single_record" '422': description: Unprocessable entity content: application/json: schema: "$ref": "#components/schemas/error_record" requestBody: content: application/json: schema: type: object properties: follower_id: type: integer example: 10 followee_id: type: integer example: 45 "/api/v1/follows/unfollow": delete: summary: Unfollow a user tags: - Following parameters: [] responses: '200': description: Success '404': description: Not Found requestBody: content: application/json: schema: type: object properties: follower_id: type: integer example: 10 followee_id: type: integer example: 45 "/api/v1/users": post: summary: Create User tags: - User parameters: [] responses: '201': description: created content: application/json: schema: "$ref": "#/components/schemas/user_single_record" '422': description: Unprocessable Entity content: application/json: schema: "$ref": "#components/schemas/error_record" requestBody: content: application/json: schema: type: object properties: name: type: string required: - name get: summary: Fetch List Of Users tags: - User parameters: - name: page in: query example: 1 schema: type: integer - name: limit in: query example: 32 schema: type: integer responses: '200': description: Ok content: application/json: schema: "$ref": "#components/schemas/user_list_record" "/api/v1/users/{id}": get: summary: Get User Detail tags: - User parameters: - name: id in: path required: true schema: type: integer responses: '200': description: Ok content: application/json: schema: "$ref": "#/components/schemas/user_single_record" '404': description: Not Found put: summary: Update user detail tags: - User parameters: - name: id in: path required: true schema: type: integer responses: '200': description: created content: application/json: schema: "$ref": "#/components/schemas/user_single_record" '404': description: Not Found '422': description: Unprocessable entity content: application/json: schema: "$ref": "#components/schemas/error_record" requestBody: content: application/json: schema: type: object properties: name: type: string required: - name servers: - url: http://{defaultHost} variables: defaultHost: default: 127.0.0.1:3000 components: schemas: user_record: type: object properties: id: type: integer name: type: string created_at: type: string format: date-time updated_at: type: string format: date-time user_single_record: type: object properties: data: type: object properties: id: type: string example: '10' type: type: string example: user attributes: "$ref": "#/components/schemas/user_record" user_list_record: type: object properties: data: type: array items: type: object properties: id: type: string example: '10' type: type: string example: user attributes: "$ref": "#/components/schemas/user_record" links: "$ref": "#/components/schemas/pagination_links" meta: type: object properties: pagination: "$ref": "#/components/schemas/pagination_details" following_record: type: object properties: id: type: integer example: 19 follower_id: type: integer example: 2 followeee_id: type: integer example: 8 created_at: type: string format: date-time updated_at: type: string format: date-time following_single_record: type: object properties: data: type: object properties: id: type: string example: '10' type: type: string example: user attributes: "$ref": "#/components/schemas/following_record" clock_in_record: type: object properties: id: type: integer example: 10 user_id: type: integer example: 1 event_time: type: string format: date-time event_type: type: string enum: - sleep_start - sleep_end schedule_date: type: string format: date created_at: type: string format: date-time updated_at: type: string format: date-time clock_in_single_record: type: object properties: data: type: object properties: id: type: string example: '10' type: type: string example: user attributes: "$ref": "#/components/schemas/clock_in_record" clock_in_list_record: type: object properties: data: type: array items: type: object properties: id: type: string example: '10' type: type: string example: clock_in attributes: "$ref": "#/components/schemas/clock_in_record" links: "$ref": "#/components/schemas/pagination_links" meta: type: object properties: pagination: "$ref": "#/components/schemas/pagination_details" summary_clock_in_record: type: object properties: id: type: integer example: 1 user_id: type: integer example: 100 schedule_date: type: string format: date sleep_start: type: string format: date-time nullable: true sleep_end: type: string format: date-time nullable: true status: type: string enum: - completed - incomplete created_at: type: string format: date-time updated_at: type: string format: date-time summary_clock_in_list_record: type: object properties: data: type: array items: type: object properties: id: type: string example: '10' type: type: string example: clock_in_summary attributes: "$ref": "#/components/schemas/summary_clock_in_record" links: "$ref": "#/components/schemas/pagination_links" meta: type: object properties: pagination: "$ref": "#/components/schemas/pagination_details" pagination_links: type: object properties: self: type: string example: "/api/v1/path-to-resources?page=3&limit=32" first: type: string example: "/api/v1/path-to-resources?page=1&limit=32" next: type: string example: "/api/v1/path-to-resources?page=4&limit=32" nullable: true prev: type: string example: "/api/v1/path-to-resources?page=2&limit=32" nullable: true last: type: string example: "/api/v1/path-to-resources?page=6&limit=32" pagination_details: type: object properties: page: type: integer example: 3 next: type: integer nullable: true example: 4 prev: type: integer nullable: true example: 2 count: type: integer example: 192 limit: type: integer example: 32 error_record: type: object properties: errors: type: array items: type: object properties: source: type: object properties: pointer: type: string detail: type: string