Files
2025-06-03 22:56:34 -05:00

635 lines
21 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Package docs Code generated by swaggo/swag. DO NOT EDIT
package docs
import "github.com/swaggo/swag"
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"contact": {},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/api/playeradvancedstats": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Returns filtered and paginated player advanced stats",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"PlayerStats"
],
"summary": "Get player advanced stats",
"parameters": [
{
"type": "integer",
"description": "Season (e.g., 2025)",
"name": "season",
"in": "query"
},
{
"type": "string",
"description": "Team abbreviation (e.g., MIL)",
"name": "team",
"in": "query"
},
{
"type": "string",
"description": "Player ID (e.g., greenaj01)",
"name": "playerId",
"in": "query"
},
{
"type": "integer",
"default": 1,
"description": "Page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 20,
"description": "Page size",
"name": "pageSize",
"in": "query"
},
{
"type": "string",
"default": "winShares",
"description": "Field to sort by",
"name": "sortBy",
"in": "query"
},
{
"type": "boolean",
"default": false,
"description": "Sort ascending",
"name": "ascending",
"in": "query"
},
{
"type": "boolean",
"description": "Whether playoffs?",
"name": "isPlayoff",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.AdvancedStatsResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/playeradvancedstats/scrape": {
"get": {
"tags": [
"PlayerStats"
],
"summary": "Scrape player advanced stats from BR website",
"parameters": [
{
"type": "integer",
"description": "Season (e.g. 2025)",
"name": "season",
"in": "query",
"required": true
},
{
"type": "boolean",
"description": "Whether playoffs?",
"name": "isPlayoff",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/playershotchart": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Returns shot-chart points, optionally filtered by playerId and/or season",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"PlayerShotChart"
],
"summary": "Get shot-chart data",
"parameters": [
{
"type": "string",
"description": "Player ID (e.g., hardeja01)",
"name": "playerId",
"in": "query"
},
{
"type": "integer",
"description": "Season (e.g., 2023)",
"name": "season",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.PlayerShotChart"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/playershotchart/scrape": {
"get": {
"description": "Scrapes seasons [startSeason…endSeason] for the given playerId",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"PlayerShotChart"
],
"summary": "Scrape a player's shot-chart from BR website",
"parameters": [
{
"type": "string",
"description": "Player ID (e.g. derozde01)",
"name": "playerId",
"in": "query",
"required": true
},
{
"type": "integer",
"description": "Start season (e.g. 2024)",
"name": "startSeason",
"in": "query",
"required": true
},
{
"type": "integer",
"description": "End season (e.g. 2021)",
"name": "endSeason",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/playertotals": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Filter and paginate player totals",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"PlayerTotals"
],
"summary": "Get player total stats",
"parameters": [
{
"type": "integer",
"description": "Season (e.g. 2000)",
"name": "season",
"in": "query"
},
{
"type": "string",
"description": "Team abbreviation (e.g. LAL)",
"name": "team",
"in": "query"
},
{
"type": "string",
"description": "Player ID (e.g. greenac01)",
"name": "playerId",
"in": "query"
},
{
"type": "integer",
"default": 1,
"description": "Page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 20,
"description": "Page size",
"name": "pageSize",
"in": "query"
},
{
"type": "string",
"description": "Field to sort by (e.g. points, assists)",
"name": "sortBy",
"in": "query"
},
{
"type": "boolean",
"description": "Sort ascending (default false)",
"name": "ascending",
"in": "query"
},
{
"type": "boolean",
"description": "Whether the stats are for playoffs",
"name": "isPlayoff",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/playertotals/scrape": {
"get": {
"tags": [
"PlayerTotals"
],
"summary": "Scrape player total stats from BR website",
"parameters": [
{
"type": "integer",
"description": "Season (e.g. 2025)",
"name": "season",
"in": "query",
"required": true
},
{
"type": "boolean",
"description": "Whether playoffs?",
"name": "isPlayoff",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
}
},
"definitions": {
"controllers.AdvancedStatsResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.PlayerAdvancedStat"
}
},
"pagination": {
"type": "object",
"properties": {
"page": {
"type": "integer"
},
"pageSize": {
"type": "integer"
},
"pages": {
"type": "integer"
},
"total": {
"type": "integer"
}
}
}
}
},
"models.PlayerAdvancedStat": {
"type": "object",
"properties": {
"age": {
"type": "integer"
},
"assistPercent": {
"type": "number"
},
"blockPercent": {
"type": "number"
},
"box": {
"type": "number"
},
"defensiveBox": {
"type": "number"
},
"defensiveRBPercent": {
"type": "number"
},
"defensiveWS": {
"type": "number"
},
"ftr": {
"type": "number"
},
"games": {
"type": "integer"
},
"id": {
"type": "integer"
},
"isPlayoff": {
"type": "boolean"
},
"minutesPlayed": {
"type": "integer"
},
"offensiveBox": {
"type": "number"
},
"offensiveRBPercent": {
"type": "number"
},
"offensiveWS": {
"type": "number"
},
"per": {
"type": "number"
},
"playerId": {
"type": "string"
},
"playerName": {
"type": "string"
},
"position": {
"type": "string"
},
"season": {
"type": "integer"
},
"stealPercent": {
"type": "number"
},
"team": {
"type": "string"
},
"threePAR": {
"type": "number"
},
"totalRBPercent": {
"type": "number"
},
"tsPercent": {
"type": "number"
},
"turnoverPercent": {
"type": "number"
},
"usagePercent": {
"type": "number"
},
"vorp": {
"type": "number"
},
"winShares": {
"type": "number"
},
"winSharesPer": {
"type": "number"
}
}
},
"models.PlayerShotChart": {
"type": "object",
"properties": {
"date": {
"type": "string"
},
"distanceFt": {
"type": "integer"
},
"id": {
"description": "Autoincrement primary key — works in SQLite and any other DB.",
"type": "integer"
},
"lead": {
"type": "boolean"
},
"left": {
"type": "integer"
},
"opponent": {
"type": "string"
},
"opponentTeamScore": {
"type": "integer"
},
"playerId": {
"description": "────────── \"identity\" columns (the dedup key) ──────────",
"type": "string"
},
"playerName": {
"description": "────────── the rest of the payload ──────────",
"type": "string"
},
"qtr": {
"type": "string"
},
"result": {
"type": "boolean"
},
"season": {
"type": "integer"
},
"shotType": {
"type": "string"
},
"team": {
"type": "string"
},
"teamScore": {
"type": "integer"
},
"timeRemaining": {
"type": "string"
},
"top": {
"type": "integer"
}
}
}
},
"securityDefinitions": {
"ApiKeyAuth": {
"type": "apiKey",
"name": "X-API-Key",
"in": "header"
}
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Host: "",
BasePath: "/",
Schemes: []string{"http", "https"},
Title: "NBA_Go API",
Description: "Stats service with API-key auth",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}