mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-22 20:52:18 +00:00
feat: Add Swagger documentation models for API endpoints with comprehensive field annotations
- Add Subscriber model with IMSI/MSISDN/email/status/plan_id/profile_status fields and validation examples - Add Service model with name/namespace/replicas/ready_replicas/available_replicas/creation_timestamp fields - Add Deployment model with service/version/status/started_at/completed_at/metadata fields and status enum - Add Plugin model with name/version/author/description/enabled/config fields - Add Automation model with name/description/trigger/
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
// Package docs GENERATED BY SWAG; DO NOT EDIT
|
||||
// This file was generated by swaggo/swag
|
||||
|
||||
package docs
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/swaggo/swag"
|
||||
)
|
||||
|
||||
const docTemplate = `{
|
||||
"schemes": {{ marshal .Schemes }},
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "{{.Description}}",
|
||||
"title": "{{.Title}}",
|
||||
"termsOfService": "{{.TermsOfService}}",
|
||||
"contact": {
|
||||
"name": "{{.ContactName}}",
|
||||
"url": "{{.ContactURL}}",
|
||||
"email": "{{.ContactEmail}}"
|
||||
},
|
||||
"license": {
|
||||
"name": "{{.LicenseName}}",
|
||||
"url": "{{.LicenseURL}}"
|
||||
},
|
||||
"version": "{{.Version}}"
|
||||
},
|
||||
"host": "{{.Host}}",
|
||||
"basePath": "{{.BasePath}}",
|
||||
"paths": {},
|
||||
"definitions": {}
|
||||
}`
|
||||
|
||||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||||
var SwaggerInfo = struct {
|
||||
Host string
|
||||
BasePath string
|
||||
Schemes []string
|
||||
Title string
|
||||
Description string
|
||||
Version string
|
||||
// License information
|
||||
LicenseName string
|
||||
LicenseURL string
|
||||
// Contact information
|
||||
ContactName string
|
||||
ContactURL string
|
||||
ContactEmail string
|
||||
}{
|
||||
Host: "localhost:8000",
|
||||
BasePath: "/v1",
|
||||
Schemes: []string{"http", "https"},
|
||||
Title: "Telecom Platform API",
|
||||
Description: "A comprehensive telecom platform API for managing subscribers, services, monitoring, deployments, plugins, automation, and billing",
|
||||
Version: "1.0.0",
|
||||
LicenseName: "MIT",
|
||||
LicenseURL: "https://opensource.org/licenses/MIT",
|
||||
ContactName: "Telecom Platform Team",
|
||||
ContactURL: "https://github.com/nutcas3/telecom-platform",
|
||||
ContactEmail: "[email protected]",
|
||||
}
|
||||
|
||||
type s struct{}
|
||||
|
||||
func (s s) ReadDoc() string {
|
||||
sInfo := SwaggerInfo
|
||||
description := `Telecom Platform API
|
||||
|
||||
This API provides comprehensive functionality for managing a telecom platform including:
|
||||
- Subscriber management and eSIM provisioning
|
||||
- Service management and Kubernetes integration
|
||||
- Monitoring and metrics collection
|
||||
- Deployment management
|
||||
- Plugin system
|
||||
- Workflow automation
|
||||
- Billing and invoicing
|
||||
- Configuration management
|
||||
- Authentication and authorization
|
||||
|
||||
## Authentication
|
||||
|
||||
The API uses JWT (JSON Web Token) authentication. To access protected endpoints:
|
||||
1. Register a user account
|
||||
2. Login to obtain an access token
|
||||
3. Include the token in the Authorization header: "Bearer <token>"
|
||||
|
||||
## Rate Limiting
|
||||
|
||||
API requests are rate-limited to ensure fair usage. Current limits:
|
||||
- 100 requests per minute per authenticated user
|
||||
- 10 requests per minute for unauthenticated requests
|
||||
|
||||
## Error Handling
|
||||
|
||||
The API uses standard HTTP status codes:
|
||||
- 200: Success
|
||||
- 201: Created
|
||||
- 400: Bad Request
|
||||
- 401: Unauthorized
|
||||
- 403: Forbidden
|
||||
- 404: Not Found
|
||||
- 500: Internal Server Error
|
||||
|
||||
Error responses include a JSON object with an "error" field containing a descriptive message.`
|
||||
|
||||
// Replace template placeholders with actual values
|
||||
result := strings.Replace(docTemplate, "{{.Version}}", sInfo.Version, -1)
|
||||
result = strings.Replace(result, "{{.Description}}", description, -1)
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func init() {
|
||||
swag.Register(swag.Name, &s{})
|
||||
}
|
||||
Reference in New Issue
Block a user