Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
euanwm committed Dec 26, 2023
1 parent d5c1dfd commit 22d1098
Show file tree
Hide file tree
Showing 5 changed files with 240 additions and 89 deletions.
87 changes: 65 additions & 22 deletions backend/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@ const docTemplate = `{
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"contact": {},
"contact": {
"name": "Euan Meston",
"email": "[email protected]"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/event": {
"post": {
"description": "Requires a case-sensitive event name to be passed to it.",
"description": "Requires a case-sensitive event name to be passed to it. This is still a work in progress.",
"consumes": [
"application/json"
],
Expand Down Expand Up @@ -51,13 +54,16 @@ const docTemplate = `{
}
}
}
},
"204": {
"description": "No Content"
}
}
}
},
"/history": {
"post": {
"description": "do ping",
"description": "Pull a lifter's history by name. The name must be an exact match and can be checked using the search endpoint.",
"consumes": [
"application/json"
],
Expand All @@ -67,13 +73,27 @@ const docTemplate = `{
"tags": [
"POST Requests"
],
"summary": "how to use the lifter history endpoint",
"summary": "Retrieve a lifter's history",
"parameters": [
{
"description": "name",
"name": "name",
"in": "body",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/structs.LifterHistory"
}
},
"204": {
"description": "No Content"
}
}
}
Expand All @@ -94,49 +114,49 @@ const docTemplate = `{
"parameters": [
{
"type": "integer",
"description": "start",
"description": "Position to begin from within the full query",
"name": "start",
"in": "query"
},
{
"type": "integer",
"description": "stop",
"description": "Position to stop at within the full query",
"name": "stop",
"in": "query"
},
{
"type": "string",
"description": "sortby",
"description": "Sort by either total or sinclair",
"name": "sortby",
"in": "query"
},
{
"type": "string",
"description": "federation",
"description": "Federation or country to filter by",
"name": "federation",
"in": "query"
},
{
"type": "string",
"description": "weightclass",
"description": "Weightclass to filter by",
"name": "weightclass",
"in": "query"
},
{
"type": "integer",
"description": "year",
"description": "Year to filter by",
"name": "year",
"in": "query"
},
{
"type": "string",
"description": "startdate",
"description": "Not currently used",
"name": "startdate",
"in": "query"
},
{
"type": "string",
"description": "enddate",
"description": "Not currently used",
"name": "enddate",
"in": "query"
}
Expand All @@ -153,7 +173,7 @@ const docTemplate = `{
},
"/lifter": {
"post": {
"description": "do ping",
"description": "This is used within the lifter page to display a lifter's record. It returns a JSON object that can be used with ChartJS without having to do any additional processing.",
"consumes": [
"application/json"
],
Expand All @@ -163,20 +183,34 @@ const docTemplate = `{
"tags": [
"POST Requests"
],
"summary": "how to use the lifter record endpoint",
"summary": "Retrieve a lifter's record for use with ChartJS",
"parameters": [
{
"description": "name",
"name": "name",
"in": "body",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/structs.ChartData"
}
},
"204": {
"description": "No Content"
}
}
}
},
"/search": {
"get": {
"description": "do ping",
"description": "Looks up a lifter by name and returns a list of possible matches. Requires a minimum of 3 characters.",
"consumes": [
"application/json"
],
Expand All @@ -186,7 +220,16 @@ const docTemplate = `{
"tags": [
"GET Requests"
],
"summary": "how to use the name search endpoint",
"summary": "Search through lifter names",
"parameters": [
{
"type": "string",
"description": "name",
"name": "name",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
Expand Down Expand Up @@ -367,12 +410,12 @@ const docTemplate = `{

// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "",
Host: "",
BasePath: "",
Schemes: []string{},
Title: "",
Description: "",
Version: "1.0",
Host: "api.openweightlifting.org",
BasePath: "/",
Schemes: []string{"https"},
Title: "OpenWeightlifting API",
Description: "This is the API for OpenWeightlifting.org",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
Expand Down
Loading

0 comments on commit 22d1098

Please sign in to comment.