tb/main #1
|
@ -7,7 +7,8 @@ func main() {
|
|||
router.GET("/test", runTest)
|
||||
|
||||
// Search for item info
|
||||
router.GET("/test", runTest)
|
||||
router.GET("/claims/{barcode}", runTest)
|
||||
router.DELETE("/claims/{barcode}", runTest)
|
||||
// Update item info
|
||||
router.GET("/test", runTest)
|
||||
// Add new item info
|
||||
|
|
|
@ -6,3 +6,9 @@ func testService(c *gin.Context) {
|
|||
"message": "Hello World!"
|
||||
})
|
||||
}
|
||||
|
||||
func claimsByBarcode(c *gin.Context) {
|
||||
system := c.DefaultQuery("system", "upc")
|
||||
barcode := c.Query("barcode")
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
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
|
Loading…
Reference in a new issue