115 lines
		
	
	
	
		
			3.8 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			115 lines
		
	
	
	
		
			3.8 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
| openapi: 3.0.0
 | |
| info:
 | |
|     title: Automated Claims API
 | |
|     version: 1.0.0
 | |
| paths:
 | |
|     /claims/{barcode}:
 | |
|         get:
 | |
|             summary: Get claims for a barcode and system
 | |
|             parameters:
 | |
|                 - name: barcode
 | |
|                   in: path
 | |
|                   description: Barcode value
 | |
|                   required: true
 | |
|                   schema:
 | |
|                       type: string
 | |
|                 - name: system
 | |
|                   in: query
 | |
|                   description: Name of barcode standard
 | |
|                   required: false
 | |
|                   schema:
 | |
|                       type: string
 | |
|                       default: UPC
 | |
|             responses:
 | |
|                 "200":
 | |
|                     description: Claims found
 | |
|                     content:
 | |
|                         application/json:
 | |
|                             type: array
 | |
|                             items:
 | |
|                                 $ref: "#/components/schemas/Claim"
 | |
|                 "204":
 | |
|                     description: No claims found for product
 | |
|                 "404":
 | |
|                     description: Product not found
 | |
|         delete:
 | |
|             summary: Delete claims by user ID
 | |
|             parameters:
 | |
|                 - name: id
 | |
|                   in: path
 | |
|                   description: ID of the claim to delete
 | |
|                   required: true
 | |
|                   schema:
 | |
|                       type: long
 | |
|             responses:
 | |
|                 "200":  
 | |
|                     description: Successful deletion
 | |
|                     content: 
 | |
|                         application/json:
 | |
|                             schema:
 | |
|                                 $ref: "#/components/schemas/Claim"
 | |
|                 "404":
 | |
|                     description: Claim not found
 | |
|         post:
 | |
|             summary: Make a new user claim
 | |
|             parameters:
 | |
|                 - name: barcode
 | |
|                   in: path
 | |
|                   description: ID of the automated claim
 | |
|                   required: true
 | |
|                   schema:
 | |
|                       type: integer
 | |
|                 - name: claim
 | |
|                   in: body
 | |
|                   description: Claim information
 | |
|                   required: true
 | |
|                   schema:
 | |
|                       $ref: "#/components/schemas/AutomatedClaim"
 | |
|             responses:
 | |
|                 "200":
 | |
|                     description: Successfully added
 | |
|                     content:
 | |
|                         schema:
 | |
|                             $ref: "#/components/schemas/AutomatedClaim"
 | |
|                 "400":
 | |
|                     description: Missing information
 | |
| components:
 | |
|     schemas:
 | |
|         Claim:
 | |
|             type: object
 | |
|             properties:
 | |
|                 id:
 | |
|                     type: long
 | |
|                 product_id:
 | |
|                     type: long
 | |
|                 evidence_type: # only in user claims
 | |
|                     type: string
 | |
|                     enum: [image, link, text]
 | |
|                 worker: # only in auto claims
 | |
|                     type: string
 | |
|                     enum: [barnivore] # TODO add other workers
 | |
|                 evidence:
 | |
|                     type: object
 | |
|                 category: # single category claims
 | |
|                     type: string
 | |
|                     enum:
 | |
|                     - ContainsMeat
 | |
|                     - ContainsFish
 | |
|                     - ContainsEggs
 | |
|                     - ContainsMilk
 | |
|                     - ContainsHoney
 | |
|                     - ContainsWax
 | |
|                     - ContainsFur
 | |
|                     - ContainsLeather
 | |
|                     - ContainsAnimalFibers
 | |
|                     - ContainsWool
 | |
|                     - ContainsFeathers
 | |
|                     - AnimalTesting
 | |
|                     - MonkeySlavery
 | |
|                 polarity: # true means it does do the thing
 | |
|                     type: boolean
 | |
|                 created_at:
 | |
|                     type: string
 | |
|                     format: date-time
 | |
|                 created_by:
 | |
|                     type: string
 | 
