mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-18 19:12:54 +00:00
- Add GET /api/v1/subscribers endpoint with pagination and filtering parameters
- Add POST /api/v1/subscribers endpoint for subscriber creation
- Add GET /api/v1/subscribers/{id} and GET /api/v1/subscribers/imsi/{imsi} endpoints
- Add PUT /api/v1/subscribers/{id} endpoint for subscriber updates
- Add POST /api/v1/subscribers/{id}/suspend and /api/v1/subscribers/{id}/terminate endpoints
- Add Swagger definitions
777 lines
24 KiB
Go
777 lines
24 KiB
Go
// 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/v1/subscribers": {
|
|
"get": {
|
|
"description": "List subscribers with pagination and filtering",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"subscribers"
|
|
],
|
|
"summary": "List subscribers",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"default": 1,
|
|
"description": "Page number",
|
|
"name": "page",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 20,
|
|
"description": "Page size",
|
|
"name": "page_size",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Subscriber status",
|
|
"name": "status",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Organization ID",
|
|
"name": "organization_id",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Search term",
|
|
"name": "search",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/services.ListSubscribersResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/handlers.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"description": "Create a new subscriber with allocated IMSI",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"subscribers"
|
|
],
|
|
"summary": "Create a new subscriber",
|
|
"parameters": [
|
|
{
|
|
"description": "Subscriber data",
|
|
"name": "subscriber",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/services.CreateSubscriberRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"201": {
|
|
"description": "Created",
|
|
"schema": {
|
|
"$ref": "#/definitions/models.Subscriber"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/handlers.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/handlers.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/subscribers/imsi/{imsi}": {
|
|
"get": {
|
|
"description": "Retrieve subscriber information by IMSI",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"subscribers"
|
|
],
|
|
"summary": "Get subscriber by IMSI",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "IMSI",
|
|
"name": "imsi",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/models.Subscriber"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/handlers.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/handlers.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/subscribers/{id}": {
|
|
"get": {
|
|
"description": "Retrieve subscriber information by ID",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"subscribers"
|
|
],
|
|
"summary": "Get subscriber by ID",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Subscriber ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/models.Subscriber"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/handlers.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/handlers.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"put": {
|
|
"description": "Update subscriber information",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"subscribers"
|
|
],
|
|
"summary": "Update subscriber",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Subscriber ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"description": "Updated subscriber data",
|
|
"name": "subscriber",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/services.UpdateSubscriberRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/models.Subscriber"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"$ref": "#/definitions/handlers.ErrorResponse"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/handlers.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/handlers.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/subscribers/{id}/suspend": {
|
|
"post": {
|
|
"description": "Suspend a subscriber and terminate their sessions",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"subscribers"
|
|
],
|
|
"summary": "Suspend subscriber",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Subscriber ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": "No Content"
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/handlers.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/handlers.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/subscribers/{id}/terminate": {
|
|
"post": {
|
|
"description": "Terminate a subscriber and deactivate their eSIM profile",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"subscribers"
|
|
],
|
|
"summary": "Terminate subscriber",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Subscriber ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": "No Content"
|
|
},
|
|
"404": {
|
|
"description": "Not Found",
|
|
"schema": {
|
|
"$ref": "#/definitions/handlers.ErrorResponse"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/handlers.ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"handlers.ErrorResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"code": {
|
|
"type": "string"
|
|
},
|
|
"details": {
|
|
"type": "string"
|
|
},
|
|
"error": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"models.AMBR": {
|
|
"type": "object",
|
|
"properties": {
|
|
"downlink": {
|
|
"type": "integer"
|
|
},
|
|
"uplink": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
},
|
|
"models.PLMN": {
|
|
"type": "object",
|
|
"properties": {
|
|
"mcc": {
|
|
"type": "string"
|
|
},
|
|
"mnc": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"models.ProfileStatus": {
|
|
"type": "string",
|
|
"enum": [
|
|
"inactive",
|
|
"active",
|
|
"downloading",
|
|
"error"
|
|
],
|
|
"x-enum-varnames": [
|
|
"ProfileStatusInactive",
|
|
"ProfileStatusActive",
|
|
"ProfileStatusDownloading",
|
|
"ProfileStatusError"
|
|
]
|
|
},
|
|
"models.QoSProfile": {
|
|
"type": "object",
|
|
"properties": {
|
|
"arpa": {
|
|
"type": "integer"
|
|
},
|
|
"gbr": {
|
|
"$ref": "#/definitions/models.AMBR"
|
|
},
|
|
"mbr": {
|
|
"$ref": "#/definitions/models.AMBR"
|
|
},
|
|
"priority": {
|
|
"type": "integer"
|
|
},
|
|
"qci": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
},
|
|
"models.SNSSAI": {
|
|
"type": "object",
|
|
"properties": {
|
|
"sd": {
|
|
"type": "integer"
|
|
},
|
|
"sst": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
},
|
|
"models.ServicePlan": {
|
|
"type": "object",
|
|
"properties": {
|
|
"ambr": {
|
|
"$ref": "#/definitions/models.AMBR"
|
|
},
|
|
"arpa": {
|
|
"type": "integer"
|
|
},
|
|
"created_at": {
|
|
"type": "string"
|
|
},
|
|
"data_limit": {
|
|
"type": "integer"
|
|
},
|
|
"data_rate": {
|
|
"type": "number"
|
|
},
|
|
"description": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "integer"
|
|
},
|
|
"monthly_fee": {
|
|
"type": "number"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"sms_limit": {
|
|
"type": "integer"
|
|
},
|
|
"sms_rate": {
|
|
"type": "number"
|
|
},
|
|
"updated_at": {
|
|
"type": "string"
|
|
},
|
|
"voice_limit": {
|
|
"type": "integer"
|
|
},
|
|
"voice_rate": {
|
|
"type": "number"
|
|
}
|
|
}
|
|
},
|
|
"models.Session": {
|
|
"type": "object",
|
|
"properties": {
|
|
"created_at": {
|
|
"type": "string"
|
|
},
|
|
"data_used": {
|
|
"type": "integer"
|
|
},
|
|
"dnn": {
|
|
"type": "string"
|
|
},
|
|
"end_time": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "integer"
|
|
},
|
|
"pdu_address": {
|
|
"type": "string"
|
|
},
|
|
"qos": {
|
|
"$ref": "#/definitions/models.QoSProfile"
|
|
},
|
|
"session_id": {
|
|
"type": "string"
|
|
},
|
|
"sms_used": {
|
|
"type": "integer"
|
|
},
|
|
"snssai": {
|
|
"$ref": "#/definitions/models.SNSSAI"
|
|
},
|
|
"start_time": {
|
|
"type": "string"
|
|
},
|
|
"status": {
|
|
"$ref": "#/definitions/models.SessionStatus"
|
|
},
|
|
"subscriber_id": {
|
|
"type": "integer"
|
|
},
|
|
"updated_at": {
|
|
"type": "string"
|
|
},
|
|
"voice_used": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
},
|
|
"models.SessionStatus": {
|
|
"type": "string",
|
|
"enum": [
|
|
"active",
|
|
"inactive",
|
|
"terminating"
|
|
],
|
|
"x-enum-varnames": [
|
|
"SessionStatusActive",
|
|
"SessionStatusInactive",
|
|
"SessionStatusTerminating"
|
|
]
|
|
},
|
|
"models.Subscriber": {
|
|
"type": "object",
|
|
"properties": {
|
|
"auth_key": {
|
|
"type": "string"
|
|
},
|
|
"balance": {
|
|
"type": "number"
|
|
},
|
|
"created_at": {
|
|
"type": "string"
|
|
},
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"euicc_id": {
|
|
"type": "string"
|
|
},
|
|
"first_name": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "integer"
|
|
},
|
|
"imei": {
|
|
"description": "Device identifier",
|
|
"type": "string"
|
|
},
|
|
"imsi": {
|
|
"type": "string"
|
|
},
|
|
"last_name": {
|
|
"type": "string"
|
|
},
|
|
"msisdn": {
|
|
"description": "Mobile phone number",
|
|
"type": "string"
|
|
},
|
|
"opc": {
|
|
"type": "string"
|
|
},
|
|
"organization_id": {
|
|
"type": "string"
|
|
},
|
|
"plan": {
|
|
"$ref": "#/definitions/models.ServicePlan"
|
|
},
|
|
"plan_id": {
|
|
"type": "integer"
|
|
},
|
|
"profile_id": {
|
|
"type": "string"
|
|
},
|
|
"profile_status": {
|
|
"$ref": "#/definitions/models.ProfileStatus"
|
|
},
|
|
"serving_plmn": {
|
|
"$ref": "#/definitions/models.PLMN"
|
|
},
|
|
"sessions": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/models.Session"
|
|
}
|
|
},
|
|
"status": {
|
|
"$ref": "#/definitions/models.SubscriberStatus"
|
|
},
|
|
"updated_at": {
|
|
"type": "string"
|
|
},
|
|
"usage_records": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/models.UsageRecord"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"models.SubscriberStatus": {
|
|
"type": "string",
|
|
"enum": [
|
|
"active",
|
|
"inactive",
|
|
"suspended",
|
|
"terminated",
|
|
"provisioning"
|
|
],
|
|
"x-enum-varnames": [
|
|
"SubscriberStatusActive",
|
|
"SubscriberStatusInactive",
|
|
"SubscriberStatusSuspended",
|
|
"SubscriberStatusTerminated",
|
|
"SubscriberStatusProvisioning"
|
|
]
|
|
},
|
|
"models.UsageRecord": {
|
|
"type": "object",
|
|
"properties": {
|
|
"billing_cycle": {
|
|
"type": "string"
|
|
},
|
|
"cost": {
|
|
"type": "number"
|
|
},
|
|
"created_at": {
|
|
"type": "string"
|
|
},
|
|
"end_time": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "integer"
|
|
},
|
|
"invoice_id": {
|
|
"type": "integer"
|
|
},
|
|
"rate": {
|
|
"type": "number"
|
|
},
|
|
"session_id": {
|
|
"type": "integer"
|
|
},
|
|
"start_time": {
|
|
"type": "string"
|
|
},
|
|
"subscriber_id": {
|
|
"type": "integer"
|
|
},
|
|
"updated_at": {
|
|
"type": "string"
|
|
},
|
|
"usage_type": {
|
|
"$ref": "#/definitions/models.UsageType"
|
|
},
|
|
"volume": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
},
|
|
"models.UsageType": {
|
|
"type": "string",
|
|
"enum": [
|
|
"data",
|
|
"voice",
|
|
"sms"
|
|
],
|
|
"x-enum-varnames": [
|
|
"UsageTypeData",
|
|
"UsageTypeVoice",
|
|
"UsageTypeSMS"
|
|
]
|
|
},
|
|
"services.CreateSubscriberRequest": {
|
|
"type": "object",
|
|
"required": [
|
|
"email",
|
|
"first_name",
|
|
"last_name",
|
|
"msisdn",
|
|
"plan_id"
|
|
],
|
|
"properties": {
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"euicc_id": {
|
|
"type": "string"
|
|
},
|
|
"first_name": {
|
|
"type": "string"
|
|
},
|
|
"last_name": {
|
|
"type": "string"
|
|
},
|
|
"msisdn": {
|
|
"type": "string"
|
|
},
|
|
"organization_id": {
|
|
"type": "string"
|
|
},
|
|
"plan_id": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
},
|
|
"services.ListSubscribersResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"page": {
|
|
"type": "integer"
|
|
},
|
|
"page_size": {
|
|
"type": "integer"
|
|
},
|
|
"subscribers": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/models.Subscriber"
|
|
}
|
|
},
|
|
"total": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
},
|
|
"services.UpdateSubscriberRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"first_name": {
|
|
"type": "string"
|
|
},
|
|
"last_name": {
|
|
"type": "string"
|
|
},
|
|
"plan_id": {
|
|
"type": "integer"
|
|
},
|
|
"status": {
|
|
"$ref": "#/definitions/models.SubscriberStatus"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}`
|
|
|
|
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
|
var SwaggerInfo = &swag.Spec{
|
|
Version: "",
|
|
Host: "",
|
|
BasePath: "",
|
|
Schemes: []string{},
|
|
Title: "",
|
|
Description: "",
|
|
InfoInstanceName: "swagger",
|
|
SwaggerTemplate: docTemplate,
|
|
LeftDelim: "{{",
|
|
RightDelim: "}}",
|
|
}
|
|
|
|
func init() {
|
|
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
|
}
|