api key auth added

This commit is contained in:
Ravi Prasad
2025-05-08 00:32:49 -05:00
parent 09d81c251a
commit 8c577b441c
17 changed files with 345 additions and 61 deletions
+27
View File
@@ -0,0 +1,27 @@
//go:build docs
// +build docs
// Package docs Only contains Swagger annotations that are **global**.
// Run `swag init --parseDependency --parseInternal` after editing.
package docs
// ------------------------------------------------------------
// General API meta (kept here so CI can inject version/build).
// ------------------------------------------------------------
// @title NBA_Go API
// @version 1.0
// @description Stats service with APIkey auth
// @BasePath /
// @schemes http https
// ------------------------------------------------------------
// 🔐 SECURITY this block is what you asked for
// ------------------------------------------------------------
//
// @securityDefinitions.apikey ApiKeyAuth
// @in header
// @name X-API-Key
//
// (every protected endpoint still needs `@Security ApiKeyAuth`)
// ------------------------------------------------------------
+10
View File
@@ -17,6 +17,11 @@ const docTemplate = `{
"paths": {
"/api/playeradvancedstats": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Returns filtered and paginated player stats",
"consumes": [
"application/json"
@@ -87,6 +92,11 @@ const docTemplate = `{
},
"/api/playertotals": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Filter and paginate player totals",
"consumes": [
"application/json"
+10
View File
@@ -6,6 +6,11 @@
"paths": {
"/api/playeradvancedstats": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Returns filtered and paginated player stats",
"consumes": [
"application/json"
@@ -76,6 +81,11 @@
},
"/api/playertotals": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Filter and paginate player totals",
"consumes": [
"application/json"
+4
View File
@@ -45,6 +45,8 @@ paths:
schema:
additionalProperties: true
type: object
security:
- ApiKeyAuth: []
summary: Get player stats
tags:
- PlayerStats
@@ -98,6 +100,8 @@ paths:
additionalProperties:
type: string
type: object
security:
- ApiKeyAuth: []
summary: Get player total stats
tags:
- PlayerTotals