# GET /v2/auth/trainer-course

Formularauswahl und eigene Trainerangebote lesen

Liest Trainername, Kontoformate, Kategorien der zweiten Stammstruktur, Tags, aktive Orte/Räume sowie höchstens 200 vom Trainer erstellte Angebote. Der persönliche Bearer-Code ersetzt den gewöhnlichen Kontokontext. Die Antwort ist vertraulich und wird mit no-store/private und no-referrer ausgeliefert. Ein ungültiger Code erhöht den IP-Fehlversuchszähler; nach fünf Fehlversuchen innerhalb einer Stunde wird die IP eine Stunde gesperrt. Gültige Codes setzen frühere Fehlversuche nicht zurück.

- Operation-ID: get_v2_auth_trainer_course
- Dokumentation: /docs/api/v2/operations/get-v2-auth-trainer-course-03830f9768a1/
- OpenAPI-Version: 3.2.1
- Vollständige Spezifikation: /docs/api/v2/openapi.json
- Dokumentationsstatus: reviewed
- Ändert Zustand: ja
- Für Automation freigegeben: nein

## Server

Serverwerte stammen unverändert aus der Datei. Eine lokale Entwicklungsadresse ist keine bestätigte Produktionsadresse. `API_ORIGIN` muss auf die passende Instanz gesetzt werden.

```json
[
  {
    "url": "https://app2.edoobox.com",
    "description": "edoobox API"
  }
]
```

## Authentifizierung

Eine der folgenden Alternativen genügt (ODER). Innerhalb einer Alternative müssen alle Verfahren gemeinsam erfüllt sein (UND).

1. **trainerToken** (HTTP bearer) — Dedicated revocable trainer-course token; not a normal account JWT.

### Wirksame Security Requirements und vollständige Verfahren

```json
{
  "security": [
    {
      "trainerToken": []
    }
  ],
  "securitySchemes": {
    "trainerToken": {
      "type": "http",
      "scheme": "bearer",
      "description": "Dedicated revocable trainer-course token; not a normal account JWT."
    }
  }
}
```

## Parameter

| Name | Ort | Pflicht | Beschreibung |
| --- | --- | --- | --- |
| language | header | nein | Account language code, where the resource supports setLanguage(). |
| Authorization | header | ja | Persönlicher Trainer-Bearer-Code aus der administrativ verwalteten Freigabe; kein gewöhnlicher V2-Admin-Token. |

### Vollständige wirksame Parameterdefinitionen

```json
[
  {
    "name": "language",
    "in": "header",
    "required": false,
    "description": "Account language code, where the resource supports setLanguage().",
    "schema": {
      "type": "string",
      "examples": [
        "de"
      ]
    }
  },
  {
    "name": "Authorization",
    "in": "header",
    "required": true,
    "schema": {
      "type": "string",
      "pattern": "^Bearer [A-Za-z0-9_-]{43}$"
    },
    "description": "Persönlicher Trainer-Bearer-Code aus der administrativ verwalteten Freigabe; kein gewöhnlicher V2-Admin-Token."
  }
]
```

## Anfrage

Kein Request Body deklariert.

## Antworten

HTTP-Status und Antwortinhalt gemeinsam auswerten. Die folgenden Beschreibungen und Schemata sind die Angaben der Quelldatei.

```json
{
  "200": {
    "description": "data enthält settings, trainer sowie Auswahl- und Angebotslisten. Alle IDs verwenden das jeweilige öffentliche v2-Format.",
    "content": {
      "application/json": {
        "example": {
          "success": true,
          "error": false,
          "data": {
            "settings": {
              "format_date": 0,
              "format_time": 0,
              "firstweekday": 1,
              "format_timezone": "Europe/Zurich",
              "language": "de"
            },
            "trainer": {
              "name": "Beispiel Trainer"
            },
            "categories": [
              {
                "id": "category_012345abcdef_123456",
                "name": "Kurse"
              }
            ],
            "tags": [],
            "places": [],
            "rooms": [],
            "courses": []
          }
        },
        "schema": {
          "type": "object",
          "properties": {
            "success": {
              "type": "boolean"
            },
            "error": {
              "type": [
                "boolean",
                "string"
              ]
            },
            "error_code": {
              "type": "string"
            },
            "data": {
              "type": "object",
              "properties": {
                "settings": {
                  "type": "object",
                  "properties": {
                    "format_date": {
                      "type": "integer"
                    },
                    "format_time": {
                      "type": "integer"
                    },
                    "firstweekday": {
                      "type": "integer"
                    },
                    "format_timezone": {
                      "type": "string"
                    },
                    "language": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                },
                "trainer": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                },
                "categories": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^category_[a-f0-9]{12}_-?[0-9]+$",
                        "description": "Öffentliche v2-ID; Beispiel ist synthetisch.",
                        "examples": [
                          "category_012345abcdef_123456"
                        ]
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": true
                  }
                },
                "tags": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^tag_[a-f0-9]{12}_-?[0-9]+$",
                        "description": "Öffentliche v2-ID; Beispiel ist synthetisch.",
                        "examples": [
                          "tag_012345abcdef_123456"
                        ]
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": true
                  }
                },
                "places": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^place_[a-f0-9]{12}_-?[0-9]+$",
                        "description": "Öffentliche v2-ID; Beispiel ist synthetisch.",
                        "examples": [
                          "place_012345abcdef_123456"
                        ]
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": true
                  }
                },
                "rooms": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^room_[a-f0-9]{12}_-?[0-9]+$",
                        "description": "Öffentliche v2-ID; Beispiel ist synthetisch.",
                        "examples": [
                          "room_012345abcdef_123456"
                        ]
                      },
                      "place": {
                        "type": "string",
                        "pattern": "^place_[a-f0-9]{12}_-?[0-9]+$",
                        "description": "Öffentliche v2-ID; Beispiel ist synthetisch.",
                        "examples": [
                          "place_012345abcdef_123456"
                        ]
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": true
                  }
                },
                "courses": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^offer_[a-f0-9]{12}_-?[0-9]+$",
                        "description": "Öffentliche v2-ID; Beispiel ist synthetisch.",
                        "examples": [
                          "offer_012345abcdef_123456"
                        ]
                      },
                      "name": {
                        "type": "string"
                      },
                      "number": {
                        "type": "string"
                      },
                      "date_start": {
                        "type": [
                          "string",
                          "boolean"
                        ],
                        "description": "ISO-8601 mit Offset, false ohne gültiges Datum."
                      },
                      "status": {
                        "type": "integer"
                      }
                    },
                    "additionalProperties": true
                  }
                }
              },
              "additionalProperties": true
            },
            "type": {
              "type": "string"
            }
          },
          "additionalProperties": true
        }
      }
    }
  },
  "400": {
    "description": "Invalid request.",
    "content": {
      "application/json": {
        "example": {
          "success": false,
          "error": "ED40006"
        }
      }
    }
  },
  "401": {
    "description": "Missing/expired token, missing account context, account paused or model-specific authorization failure.",
    "content": {
      "application/json": {
        "example": {
          "success": false,
          "error": "ED40103"
        }
      }
    }
  },
  "402": {
    "description": "Missing/invalid action data or subscription/operation restriction.",
    "content": {
      "application/json": {
        "example": {
          "success": false,
          "error": "ED80100"
        }
      }
    }
  },
  "403": {
    "description": "Permission denied. Browser CORS rejection may have an empty body.",
    "content": {
      "application/json": {
        "example": {
          "success": false,
          "error": "ED40340"
        }
      }
    }
  },
  "404": {
    "description": "Unknown resource/action or unsupported method.",
    "content": {
      "application/json": {
        "example": {
          "success": false,
          "error": "ED80019"
        }
      }
    }
  },
  "422": {
    "description": "Validation failed.",
    "content": {
      "application/json": {
        "example": {
          "success": false,
          "error": "ED80020"
        }
      }
    }
  },
  "429": {
    "description": "Request/login rate limit exceeded. Honor Retry-After when supplied; legacy rate-limit paths may omit it. Retry only proven reads within a bounded deadline; a mutation is never automatically replayed after an ambiguous response.",
    "content": {
      "application/json": {
        "example": {
          "success": false,
          "error": "ED42902"
        }
      }
    },
    "headers": {
      "Retry-After": {
        "description": "Optional server delay in whole seconds or an HTTP date. Absence is not permission for an immediate retry.",
        "schema": {
          "type": "string",
          "examples": [
            "30"
          ]
        }
      }
    }
  },
  "502": {
    "description": "Server-side operation failed.",
    "content": {
      "application/json": {
        "example": {
          "success": false,
          "error": "ED50201"
        }
      }
    }
  }
}
```

## Aufrufbeispiele

Anpassen vor dem Ausführen. Platzhalter und veröffentlichte Beispiele sind synthetisch. Die Beispiele senden hier keine Anfrage; sie ergänzen keine unbekannten Pflichtfelder.

### cURL

```sh
: "${API_ORIGIN:?API_ORIGIN setzen}"
: "${AUTH_TRAINERTOKEN:?AUTH_TRAINERTOKEN setzen}"
: "${HEADER_AUTHORIZATION:?HEADER_AUTHORIZATION setzen}"
curl --request 'GET' \
  --url "${API_ORIGIN%/}"'/v2/auth/trainer-course' \
  --header 'Authorization: Bearer '"${AUTH_TRAINERTOKEN}"
```

### JavaScript (Node.js)

```javascript
const required = (name) => {
  const value = process.env[name];
  if (!value) throw new Error(`Set ${name}`);
  return value;
};
let path = "/v2/auth/trainer-course";
const origin = required('API_ORIGIN');
const url = new URL((origin.endsWith('/') ? origin.slice(0, -1) : origin) + path);
const headers = {};
headers["Authorization"] = "Bearer " + required("AUTH_TRAINERTOKEN");
const response = await fetch(url, { method: "GET", headers, redirect: 'manual' });
const text = await response.text();
console.log(response.status, text);
// HTTP-Status und dokumentierte error/success-Felder gemeinsam prüfen.
```

### Python

```python
import os
import urllib.parse
import urllib.request
import urllib.error

path = "/v2/auth/trainer-course"
url = os.environ["API_ORIGIN"].rstrip("/") + path
headers = {}
headers["Authorization"] = "Bearer " + os.environ["AUTH_TRAINERTOKEN"]

# Redirects nicht automatisch verfolgen.
class NoRedirect(urllib.request.HTTPRedirectHandler):
    def redirect_request(self, req, fp, code, msg, headers, newurl):
        return None
request = urllib.request.Request(url, headers=headers, method="GET")
try:
    response = urllib.request.build_opener(NoRedirect).open(request, timeout=30)
except urllib.error.HTTPError as error:
    response = error
print(response.status, response.read().decode("utf-8", errors="replace"))
# HTTP-Status und dokumentierte error/success-Felder gemeinsam prüfen.
```

## Vollständige Operationsdefinition und edoobox-Hinweise

Alle Originalfelder einschliesslich `x-edoobox-*`, requestBody und responses bleiben erhalten. Teilweise dokumentierte Schemata sind kein vollständiger Validierungsvertrag.

```json
{
  "operationId": "get_v2_auth_trainer_course",
  "summary": "Formularauswahl und eigene Trainerangebote lesen",
  "description": "Liest Trainername, Kontoformate, Kategorien der zweiten Stammstruktur, Tags, aktive Orte/Räume sowie höchstens 200 vom Trainer erstellte Angebote. Der persönliche Bearer-Code ersetzt den gewöhnlichen Kontokontext. Die Antwort ist vertraulich und wird mit no-store/private und no-referrer ausgeliefert. Ein ungültiger Code erhöht den IP-Fehlversuchszähler; nach fünf Fehlversuchen innerhalb einer Stunde wird die IP eine Stunde gesperrt. Gültige Codes setzen frühere Fehlversuche nicht zurück.",
  "tags": [
    "trainer-course"
  ],
  "security": [
    {
      "trainerToken": []
    }
  ],
  "parameters": [
    {
      "name": "language",
      "in": "header",
      "required": false,
      "description": "Account language code, where the resource supports setLanguage().",
      "schema": {
        "type": "string",
        "examples": [
          "de"
        ]
      }
    },
    {
      "name": "Authorization",
      "in": "header",
      "required": true,
      "schema": {
        "type": "string",
        "pattern": "^Bearer [A-Za-z0-9_-]{43}$"
      },
      "description": "Persönlicher Trainer-Bearer-Code aus der administrativ verwalteten Freigabe; kein gewöhnlicher V2-Admin-Token."
    }
  ],
  "responses": {
    "200": {
      "description": "data enthält settings, trainer sowie Auswahl- und Angebotslisten. Alle IDs verwenden das jeweilige öffentliche v2-Format.",
      "content": {
        "application/json": {
          "example": {
            "success": true,
            "error": false,
            "data": {
              "settings": {
                "format_date": 0,
                "format_time": 0,
                "firstweekday": 1,
                "format_timezone": "Europe/Zurich",
                "language": "de"
              },
              "trainer": {
                "name": "Beispiel Trainer"
              },
              "categories": [
                {
                  "id": "category_012345abcdef_123456",
                  "name": "Kurse"
                }
              ],
              "tags": [],
              "places": [],
              "rooms": [],
              "courses": []
            }
          },
          "schema": {
            "type": "object",
            "properties": {
              "success": {
                "type": "boolean"
              },
              "error": {
                "type": [
                  "boolean",
                  "string"
                ]
              },
              "error_code": {
                "type": "string"
              },
              "data": {
                "type": "object",
                "properties": {
                  "settings": {
                    "type": "object",
                    "properties": {
                      "format_date": {
                        "type": "integer"
                      },
                      "format_time": {
                        "type": "integer"
                      },
                      "firstweekday": {
                        "type": "integer"
                      },
                      "format_timezone": {
                        "type": "string"
                      },
                      "language": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": true
                  },
                  "trainer": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": true
                  },
                  "categories": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^category_[a-f0-9]{12}_-?[0-9]+$",
                          "description": "Öffentliche v2-ID; Beispiel ist synthetisch.",
                          "examples": [
                            "category_012345abcdef_123456"
                          ]
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^tag_[a-f0-9]{12}_-?[0-9]+$",
                          "description": "Öffentliche v2-ID; Beispiel ist synthetisch.",
                          "examples": [
                            "tag_012345abcdef_123456"
                          ]
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "places": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^place_[a-f0-9]{12}_-?[0-9]+$",
                          "description": "Öffentliche v2-ID; Beispiel ist synthetisch.",
                          "examples": [
                            "place_012345abcdef_123456"
                          ]
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "rooms": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^room_[a-f0-9]{12}_-?[0-9]+$",
                          "description": "Öffentliche v2-ID; Beispiel ist synthetisch.",
                          "examples": [
                            "room_012345abcdef_123456"
                          ]
                        },
                        "place": {
                          "type": "string",
                          "pattern": "^place_[a-f0-9]{12}_-?[0-9]+$",
                          "description": "Öffentliche v2-ID; Beispiel ist synthetisch.",
                          "examples": [
                            "place_012345abcdef_123456"
                          ]
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "courses": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^offer_[a-f0-9]{12}_-?[0-9]+$",
                          "description": "Öffentliche v2-ID; Beispiel ist synthetisch.",
                          "examples": [
                            "offer_012345abcdef_123456"
                          ]
                        },
                        "name": {
                          "type": "string"
                        },
                        "number": {
                          "type": "string"
                        },
                        "date_start": {
                          "type": [
                            "string",
                            "boolean"
                          ],
                          "description": "ISO-8601 mit Offset, false ohne gültiges Datum."
                        },
                        "status": {
                          "type": "integer"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                },
                "additionalProperties": true
              },
              "type": {
                "type": "string"
              }
            },
            "additionalProperties": true
          }
        }
      }
    },
    "400": {
      "description": "Invalid request.",
      "content": {
        "application/json": {
          "example": {
            "success": false,
            "error": "ED40006"
          }
        }
      }
    },
    "401": {
      "description": "Missing/expired token, missing account context, account paused or model-specific authorization failure.",
      "content": {
        "application/json": {
          "example": {
            "success": false,
            "error": "ED40103"
          }
        }
      }
    },
    "402": {
      "description": "Missing/invalid action data or subscription/operation restriction.",
      "content": {
        "application/json": {
          "example": {
            "success": false,
            "error": "ED80100"
          }
        }
      }
    },
    "403": {
      "description": "Permission denied. Browser CORS rejection may have an empty body.",
      "content": {
        "application/json": {
          "example": {
            "success": false,
            "error": "ED40340"
          }
        }
      }
    },
    "404": {
      "description": "Unknown resource/action or unsupported method.",
      "content": {
        "application/json": {
          "example": {
            "success": false,
            "error": "ED80019"
          }
        }
      }
    },
    "422": {
      "description": "Validation failed.",
      "content": {
        "application/json": {
          "example": {
            "success": false,
            "error": "ED80020"
          }
        }
      }
    },
    "429": {
      "description": "Request/login rate limit exceeded. Honor Retry-After when supplied; legacy rate-limit paths may omit it. Retry only proven reads within a bounded deadline; a mutation is never automatically replayed after an ambiguous response.",
      "content": {
        "application/json": {
          "example": {
            "success": false,
            "error": "ED42902"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "description": "Optional server delay in whole seconds or an HTTP date. Absence is not permission for an immediate retry.",
          "schema": {
            "type": "string",
            "examples": [
              "30"
            ]
          }
        }
      }
    },
    "502": {
      "description": "Server-side operation failed.",
      "content": {
        "application/json": {
          "example": {
            "success": false,
            "error": "ED50201"
          }
        }
      }
    }
  },
  "x-edoobox-mutates-state": true,
  "x-edoobox-runtimeMutationGuard": false,
  "x-edoobox-get-effect": "maintenance",
  "x-edoobox-documentationReview": {
    "file": "docs/openapi/operation-contracts/10-other-resources.json",
    "notes": []
  },
  "x-edoobox-source": {
    "file": "application/models/v2/Trainercourse.php",
    "method": "handlePublicRequest",
    "line": 88
  },
  "x-edoobox-documentationStatus": "reviewed",
  "x-edoobox-readOnly": false,
  "x-edoobox-safeForAutomation": false,
  "x-edoobox-permission": {
    "resource": "trainer-course",
    "short": null,
    "checkedByDispatcher": false,
    "levels": [],
    "description": "No account-JWT resource permission levels are applied. Authentication requirements, if any, are defined by this route source-specific boundary and dedicated security scheme."
  }
}
```
