"description": "Performs a matches import using TheSports match/diary API for a given date or 24h window. The `+"`"+`date`+"`"+` query parameter (YYYY-MM-DD) is recommended; if omitted, the provider default will be used (usually current day).",
"description": "Single: provide matchWyId (imports both teams' match advanced stats). Auto: omit matchWyId (imports all matches with wy_id in matches table; resumable).",
"tags": [
"tags": [
"Import"
"Import"
],
],
"summary": "Import matches diary from TheSports",
"summary": "Import match advanced stats from Wyscout",
"parameters": [
"parameters": [
{
{
"type": "string",
"type": "integer",
"description": "Date in YYYY-MM-DD format for which to import the schedule/results",
"description": "Wyscout match ID (optional; omit for auto mode)",
"name": "date",
"name": "matchWyId",
"in": "query"
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
},
"/import/matches/fixtures": {
"post": {
"description": "Imports matches for a given Wyscout season via /v3/seasons/{seasonWyId}/fixtures?details=matches. If seasonWyId is omitted, imports for all seasons in the DB with a wy_id.",
"tags": [
"Import"
],
"summary": "Import matches from Wyscout fixtures",
"parameters": [
{
{
"type": "integer",
"type": "integer",
"description": "Wyscout season ID",
"description": "Optional limit on number of requests (auto: matches)",
"name": "seasonWyId",
"name": "limit",
"in": "query"
"in": "query"
},
},
{
{
"type": "integer",
"type": "integer",
"description": "Limit number of seasons processed when seasonWyId is omitted",
"description": "Auto mode only: reset checkpoint and restart from beginning",
"name": "reset",
"in": "query"
"in": "query"
}
}
],
],
...
@@ -835,24 +812,24 @@ const docTemplate = `{
...
@@ -835,24 +812,24 @@ const docTemplate = `{
}
}
}
}
},
},
"/import/matches/formations": {
"/import/matches/fixtures": {
"post": {
"post": {
"description": "Fetches /v4/matches/{matchWyId}/formations for a given matchWyId. If matchWyId is omitted, processes matches in the DB with a wy_id. Stores formations in match_formations.",
"description": "Imports matches for a given Wyscout season via /v3/seasons/{seasonWyId}/fixtures?details=matches. If seasonWyId is omitted, imports for all seasons in the DB with a wy_id.",
"tags": [
"tags": [
"Import"
"Import"
],
],
"summary": "Import match formations from Wyscout v4",
"summary": "Import matches from Wyscout fixtures",
"parameters": [
"parameters": [
{
{
"type": "integer",
"type": "integer",
"description": "Wyscout match wy_id",
"description": "Wyscout season ID",
"name": "matchWyId",
"name": "seasonWyId",
"in": "query"
"in": "query"
},
},
{
{
"type": "integer",
"type": "integer",
"description": "Limit number of matches processed when matchWyId is omitted",
"description": "Limit number of seasons processed when seasonWyId is omitted",
"name": "limit",
"name": "limitSeasons",
"in": "query"
"in": "query"
}
}
],
],
...
@@ -885,30 +862,24 @@ const docTemplate = `{
...
@@ -885,30 +862,24 @@ const docTemplate = `{
}
}
}
}
},
},
"/import/matches/lineup": {
"/import/matches/formations": {
"post": {
"post": {
"description": "Performs a lineup import using TheSports match/lineup/detail API. If 'matchTsId' is provided, imports lineup for a specific match. If omitted, processes matches from the last 30 days only (API limitation). Use 'limit' for testing and 'batchSize' to control memory usage.",
"description": "Fetches /v4/matches/{matchWyId}/formations for a given matchWyId. If matchWyId is omitted, processes matches in the DB with a wy_id. Stores formations in match_formations.",
"tags": [
"tags": [
"Import"
"Import"
],
],
"summary": "Import match lineups from TheSports",
"summary": "Import match formations from Wyscout v4",
"parameters": [
"parameters": [
{
{
"type": "string",
"description": "TheSports match id (tsId) for which to import the lineup (optional; if omitted, processes matches from last 30 days)",
"name": "matchTsId",
"in": "query"
},
{
"type": "integer",
"type": "integer",
"description": "Maximum number of matches to process in batch mode (default: no limit; useful for debugging)",
"description": "Wyscout match wy_id",
"name": "limit",
"name": "matchWyId",
"in": "query"
"in": "query"
},
},
{
{
"type": "integer",
"type": "integer",
"description": "Number of matches to load per batch (default: 1000; lower for memory constraints)",
"description": "Limit number of matches processed when matchWyId is omitted",
"name": "batchSize",
"name": "limit",
"in": "query"
"in": "query"
}
}
],
],
...
@@ -941,82 +912,6 @@ const docTemplate = `{
...
@@ -941,82 +912,6 @@ const docTemplate = `{
}
}
}
}
},
},
"/import/matches/list": {
"post": {
"description": "Performs a full import of all matches from TheSports match/list API using pagination. This is intended for one-time initial sync to get all historical matches. The API returns 1000 matches per page and stops when total is 0. Use startPage to resume from a specific page if the import was interrupted.",
"tags": [
"Import"
],
"summary": "Import all matches from TheSports (one-time full sync)",
"parameters": [
{
"type": "integer",
"description": "Starting page number (default: 1, use to resume interrupted import)",
"name": "startPage",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/import/matches/recent": {
"post": {
"description": "Performs a matches import using TheSports match/recent/list API. If `+"`"+`since`+"`"+` is provided (unix seconds), only matches updated since that time are fetched using the time-based endpoint. Otherwise, a full import is performed using page-based pagination (last 30 days).",
"tags": [
"Import"
],
"summary": "Import recent matches from TheSports",
"parameters": [
{
"type": "integer",
"description": "Page size per request (default 100, only used for full imports)",
"name": "pageSize",
"in": "query"
},
{
"type": "integer",
"description": "Unix timestamp (seconds) to import only matches updated since this time",
"name": "since",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/import/matches/wyscout": {
"/import/matches/wyscout": {
"post": {
"post": {
"description": "Imports matches for a given Wyscout season via /v3/seasons/{seasonWyId}/matches. Requires seasonWyId query param.",
"description": "Imports matches for a given Wyscout season via /v3/seasons/{seasonWyId}/matches. Requires seasonWyId query param.",
...
@@ -1531,6 +1426,80 @@ const docTemplate = `{
...
@@ -1531,6 +1426,80 @@ const docTemplate = `{
}
}
}
}
},
},
"/import/teams/advancedstats": {
"post": {
"description": "Single: provide teamWyId+competitionId+seasonId. Auto: omit all IDs (imports distinct team+competition+season combos derived from matches; resumable).",
"tags": [
"Import"
],
"summary": "Import team advanced stats from Wyscout",
"parameters": [
{
"type": "integer",
"description": "Wyscout team ID (optional; omit for auto mode)",
"name": "teamWyId",
"in": "query"
},
{
"type": "integer",
"description": "Wyscout competition ID (required for single; omit for auto mode)",
"name": "competitionId",
"in": "query"
},
{
"type": "integer",
"description": "Wyscout season ID (required for single; omit for auto mode)",
"name": "seasonId",
"in": "query"
},
{
"type": "integer",
"description": "Optional limit on number of requests (auto: combos)",
"description": "Auto mode only: reset checkpoint and restart from beginning",
"name": "reset",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/import/teams/career": {
"/import/teams/career": {
"post": {
"post": {
"description": "Fetches /v3/teams/{teamWyId}/career?details=competition,season for teams in the DB (teams.wy_id not null) plus teams referenced in team_children. Upserts records into team_careers.",
"description": "Fetches /v3/teams/{teamWyId}/career?details=competition,season for teams in the DB (teams.wy_id not null) plus teams referenced in team_children. Upserts records into team_careers.",
"description":"Performs a matches import using TheSports match/diary API for a given date or 24h window. The `date` query parameter (YYYY-MM-DD) is recommended; if omitted, the provider default will be used (usually current day).",
"description":"Single: provide matchWyId (imports both teams' match advanced stats). Auto: omit matchWyId (imports all matches with wy_id in matches table; resumable).",
"tags":[
"tags":[
"Import"
"Import"
],
],
"summary":"Import matches diary from TheSports",
"summary":"Import match advanced stats from Wyscout",
"parameters":[
"parameters":[
{
{
"type":"string",
"type":"integer",
"description":"Date in YYYY-MM-DD format for which to import the schedule/results",
"description":"Wyscout match ID (optional; omit for auto mode)",
"name":"date",
"name":"matchWyId",
"in":"query"
"in":"query"
}
],
"responses":{
"200":{
"description":"OK",
"schema":{
"type":"object",
"additionalProperties":true
}
},
"500":{
"description":"Internal Server Error",
"schema":{
"type":"object",
"additionalProperties":{
"type":"string"
}
}
}
}
}
},
},
"/import/matches/fixtures":{
"post":{
"description":"Imports matches for a given Wyscout season via /v3/seasons/{seasonWyId}/fixtures?details=matches. If seasonWyId is omitted, imports for all seasons in the DB with a wy_id.",
"tags":[
"Import"
],
"summary":"Import matches from Wyscout fixtures",
"parameters":[
{
{
"type":"integer",
"type":"integer",
"description":"Wyscout season ID",
"description":"Optional limit on number of requests (auto: matches)",
"name":"seasonWyId",
"name":"limit",
"in":"query"
"in":"query"
},
},
{
{
"type":"integer",
"type":"integer",
"description":"Limit number of seasons processed when seasonWyId is omitted",
"description":"Auto mode only: reset checkpoint and restart from beginning",
"name":"reset",
"in":"query"
"in":"query"
}
}
],
],
...
@@ -828,24 +805,24 @@
...
@@ -828,24 +805,24 @@
}
}
}
}
},
},
"/import/matches/formations":{
"/import/matches/fixtures":{
"post":{
"post":{
"description":"Fetches /v4/matches/{matchWyId}/formations for a given matchWyId. If matchWyId is omitted, processes matches in the DB with a wy_id. Stores formations in match_formations.",
"description":"Imports matches for a given Wyscout season via /v3/seasons/{seasonWyId}/fixtures?details=matches. If seasonWyId is omitted, imports for all seasons in the DB with a wy_id.",
"tags":[
"tags":[
"Import"
"Import"
],
],
"summary":"Import match formations from Wyscout v4",
"summary":"Import matches from Wyscout fixtures",
"parameters":[
"parameters":[
{
{
"type":"integer",
"type":"integer",
"description":"Wyscout match wy_id",
"description":"Wyscout season ID",
"name":"matchWyId",
"name":"seasonWyId",
"in":"query"
"in":"query"
},
},
{
{
"type":"integer",
"type":"integer",
"description":"Limit number of matches processed when matchWyId is omitted",
"description":"Limit number of seasons processed when seasonWyId is omitted",
"name":"limit",
"name":"limitSeasons",
"in":"query"
"in":"query"
}
}
],
],
...
@@ -878,30 +855,24 @@
...
@@ -878,30 +855,24 @@
}
}
}
}
},
},
"/import/matches/lineup":{
"/import/matches/formations":{
"post":{
"post":{
"description":"Performs a lineup import using TheSports match/lineup/detail API. If 'matchTsId' is provided, imports lineup for a specific match. If omitted, processes matches from the last 30 days only (API limitation). Use 'limit' for testing and 'batchSize' to control memory usage.",
"description":"Fetches /v4/matches/{matchWyId}/formations for a given matchWyId. If matchWyId is omitted, processes matches in the DB with a wy_id. Stores formations in match_formations.",
"tags":[
"tags":[
"Import"
"Import"
],
],
"summary":"Import match lineups from TheSports",
"summary":"Import match formations from Wyscout v4",
"parameters":[
"parameters":[
{
{
"type":"string",
"description":"TheSports match id (tsId) for which to import the lineup (optional; if omitted, processes matches from last 30 days)",
"name":"matchTsId",
"in":"query"
},
{
"type":"integer",
"type":"integer",
"description":"Maximum number of matches to process in batch mode (default: no limit; useful for debugging)",
"description":"Wyscout match wy_id",
"name":"limit",
"name":"matchWyId",
"in":"query"
"in":"query"
},
},
{
{
"type":"integer",
"type":"integer",
"description":"Number of matches to load per batch (default: 1000; lower for memory constraints)",
"description":"Limit number of matches processed when matchWyId is omitted",
"name":"batchSize",
"name":"limit",
"in":"query"
"in":"query"
}
}
],
],
...
@@ -934,82 +905,6 @@
...
@@ -934,82 +905,6 @@
}
}
}
}
},
},
"/import/matches/list":{
"post":{
"description":"Performs a full import of all matches from TheSports match/list API using pagination. This is intended for one-time initial sync to get all historical matches. The API returns 1000 matches per page and stops when total is 0. Use startPage to resume from a specific page if the import was interrupted.",
"tags":[
"Import"
],
"summary":"Import all matches from TheSports (one-time full sync)",
"parameters":[
{
"type":"integer",
"description":"Starting page number (default: 1, use to resume interrupted import)",
"name":"startPage",
"in":"query"
}
],
"responses":{
"200":{
"description":"OK",
"schema":{
"type":"object",
"additionalProperties":true
}
},
"500":{
"description":"Internal Server Error",
"schema":{
"type":"object",
"additionalProperties":{
"type":"string"
}
}
}
}
}
},
"/import/matches/recent":{
"post":{
"description":"Performs a matches import using TheSports match/recent/list API. If `since` is provided (unix seconds), only matches updated since that time are fetched using the time-based endpoint. Otherwise, a full import is performed using page-based pagination (last 30 days).",
"tags":[
"Import"
],
"summary":"Import recent matches from TheSports",
"parameters":[
{
"type":"integer",
"description":"Page size per request (default 100, only used for full imports)",
"name":"pageSize",
"in":"query"
},
{
"type":"integer",
"description":"Unix timestamp (seconds) to import only matches updated since this time",
"name":"since",
"in":"query"
}
],
"responses":{
"200":{
"description":"OK",
"schema":{
"type":"object",
"additionalProperties":true
}
},
"500":{
"description":"Internal Server Error",
"schema":{
"type":"object",
"additionalProperties":{
"type":"string"
}
}
}
}
}
},
"/import/matches/wyscout":{
"/import/matches/wyscout":{
"post":{
"post":{
"description":"Imports matches for a given Wyscout season via /v3/seasons/{seasonWyId}/matches. Requires seasonWyId query param.",
"description":"Imports matches for a given Wyscout season via /v3/seasons/{seasonWyId}/matches. Requires seasonWyId query param.",
...
@@ -1524,6 +1419,80 @@
...
@@ -1524,6 +1419,80 @@
}
}
}
}
},
},
"/import/teams/advancedstats":{
"post":{
"description":"Single: provide teamWyId+competitionId+seasonId. Auto: omit all IDs (imports distinct team+competition+season combos derived from matches; resumable).",
"tags":[
"Import"
],
"summary":"Import team advanced stats from Wyscout",
"parameters":[
{
"type":"integer",
"description":"Wyscout team ID (optional; omit for auto mode)",
"name":"teamWyId",
"in":"query"
},
{
"type":"integer",
"description":"Wyscout competition ID (required for single; omit for auto mode)",
"name":"competitionId",
"in":"query"
},
{
"type":"integer",
"description":"Wyscout season ID (required for single; omit for auto mode)",
"name":"seasonId",
"in":"query"
},
{
"type":"integer",
"description":"Optional limit on number of requests (auto: combos)",
"description":"Auto mode only: reset checkpoint and restart from beginning",
"name":"reset",
"in":"query"
}
],
"responses":{
"200":{
"description":"OK",
"schema":{
"type":"object",
"additionalProperties":true
}
},
"400":{
"description":"Bad Request",
"schema":{
"type":"object",
"additionalProperties":{
"type":"string"
}
}
},
"500":{
"description":"Internal Server Error",
"schema":{
"type":"object",
"additionalProperties":{
"type":"string"
}
}
}
}
}
},
"/import/teams/career":{
"/import/teams/career":{
"post":{
"post":{
"description":"Fetches /v3/teams/{teamWyId}/career?details=competition,season for teams in the DB (teams.wy_id not null) plus teams referenced in team_children. Upserts records into team_careers.",
"description":"Fetches /v3/teams/{teamWyId}/career?details=competition,season for teams in the DB (teams.wy_id not null) plus teams referenced in team_children. Upserts records into team_careers.",
// ImportMatchLineup imports match lineups from TheSports API (match/lineup/detail).
// @Summary Import match lineups from TheSports
// @Description Performs a lineup import using TheSports match/lineup/detail API. If 'matchTsId' is provided, imports lineup for a specific match. If omitted, processes matches from the last 30 days only (API limitation). Use 'limit' for testing and 'batchSize' to control memory usage.
// @Tags Import
// @Param matchTsId query string false "TheSports match id (tsId) for which to import the lineup (optional; if omitted, processes matches from last 30 days)"
// @Param limit query int false "Maximum number of matches to process in batch mode (default: no limit; useful for debugging)"
// @Param batchSize query int false "Number of matches to load per batch (default: 1000; lower for memory constraints)"
// ImportMatchesDiary imports matches for a given day from TheSports API (match/diary).
// @Summary Import matches diary from TheSports
// @Description Performs a matches import using TheSports match/diary API for a given date or 24h window. The `date` query parameter (YYYY-MM-DD) is recommended; if omitted, the provider default will be used (usually current day).
// @Tags Import
// @Param date query string false "Date in YYYY-MM-DD format for which to import the schedule/results"
// ImportMatchesList imports all matches from TheSports API (match/list) for one-time full sync.
// @Summary Import all matches from TheSports (one-time full sync)
// @Description Performs a full import of all matches from TheSports match/list API using pagination. This is intended for one-time initial sync to get all historical matches. The API returns 1000 matches per page and stops when total is 0. Use startPage to resume from a specific page if the import was interrupted.
// @Tags Import
// @Param startPage query int false "Starting page number (default: 1, use to resume interrupted import)"
fmt.Printf("ImportMatchesList: Reached end of pagination at page %d\n",page)
break
}
page++
}
fmt.Printf("ImportMatchesList: Completed full sync. Total matches imported: %d\n",totalMatches)
c.JSON(http.StatusOK,gin.H{
"message":"Full match import completed",
"totalMatches":totalMatches,
"pagesProcessed":page-1,
})
}
// ImportMatchesRecent imports recent matches from TheSports API (match/recent/list).
// @Summary Import recent matches from TheSports
// @Description Performs a matches import using TheSports match/recent/list API. If `since` is provided (unix seconds), only matches updated since that time are fetched using the time-based endpoint. Otherwise, a full import is performed using page-based pagination (last 30 days).
// @Tags Import
// @Param pageSize query int false "Page size per request (default 100, only used for full imports)"
// @Param since query int false "Unix timestamp (seconds) to import only matches updated since this time"
// ImportCompetitions imports competitions from TheSports API.
// ImportCompetitions imports competitions from TheSports API.
// @Summary Import competitions from TheSports
// @Summary Import competitions from TheSports
// @Description Performs a competition import using TheSports competition additional list API. If `since` is provided (unix seconds), only competitions updated since that time are fetched using the time-based endpoint. Otherwise, a full import is performed using page-based pagination.
// @Description Performs a competition import using TheSports competition additional list API. If `since` is provided (unix seconds), only competitions updated since that time are fetched using the time-based endpoint. Otherwise, a full import is performed using page-based pagination.