mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-23 13:12:16 +00:00
refactor: Extract ES2 types from client.go to separate types.go file
- Move ES2Client struct definition from client.go to types.go - Move DownloadProfileRequest, DownloadProfileResponse, GetProfileStatusRequest, GetProfileStatusResponse types to types.go - Move DeleteProfileRequest, DeleteProfileResponse, EnableProfileRequest, EnableProfileResponse types to types.go - Move DisableProfileRequest, DisableProfileResponse types to types.go - Add net/http, time, and config package imports to types.go
This commit is contained in:
@@ -17,14 +17,6 @@ import (
|
||||
"github.com/nutcas3/telecom-platform/apps/carrier-connector/internal/config"
|
||||
)
|
||||
|
||||
type ES2Client struct {
|
||||
httpClient *http.Client
|
||||
config *config.ES2Config
|
||||
baseURL string
|
||||
maxRetries int
|
||||
retryDelay time.Duration
|
||||
}
|
||||
|
||||
func NewES2Client(cfg *config.ES2Config) *ES2Client {
|
||||
return &ES2Client{
|
||||
httpClient: &http.Client{
|
||||
@@ -316,56 +308,3 @@ func (c *ES2Client) setHeaders(req *http.Request) {
|
||||
func generateRequestID() string {
|
||||
return fmt.Sprintf("%d", time.Now().UnixNano())
|
||||
}
|
||||
|
||||
type DownloadProfileRequest struct {
|
||||
EID string `json:"eid"`
|
||||
ICCID string `json:"iccid"`
|
||||
ProfileType string `json:"profileType"`
|
||||
ConfirmationCode string `json:"confirmationCode,omitempty"`
|
||||
}
|
||||
|
||||
type DownloadProfileResponse struct {
|
||||
ExecutionStatus string `json:"executionStatus"`
|
||||
StatusMessage string `json:"statusMessage"`
|
||||
}
|
||||
|
||||
type GetProfileStatusRequest struct {
|
||||
EID string `json:"eid"`
|
||||
ICCID string `json:"iccid"`
|
||||
}
|
||||
|
||||
type GetProfileStatusResponse struct {
|
||||
ExecutionStatus string `json:"executionStatus"`
|
||||
StatusMessage string `json:"statusMessage"`
|
||||
ProfileState string `json:"profileState,omitempty"`
|
||||
}
|
||||
|
||||
type DeleteProfileRequest struct {
|
||||
EID string `json:"eid"`
|
||||
ICCID string `json:"iccid"`
|
||||
}
|
||||
|
||||
type DeleteProfileResponse struct {
|
||||
ExecutionStatus string `json:"executionStatus"`
|
||||
StatusMessage string `json:"statusMessage"`
|
||||
}
|
||||
|
||||
type EnableProfileRequest struct {
|
||||
EID string `json:"eid"`
|
||||
ICCID string `json:"iccid"`
|
||||
}
|
||||
|
||||
type EnableProfileResponse struct {
|
||||
ExecutionStatus string `json:"executionStatus"`
|
||||
StatusMessage string `json:"statusMessage"`
|
||||
}
|
||||
|
||||
type DisableProfileRequest struct {
|
||||
EID string `json:"eid"`
|
||||
ICCID string `json:"iccid"`
|
||||
}
|
||||
|
||||
type DisableProfileResponse struct {
|
||||
ExecutionStatus string `json:"executionStatus"`
|
||||
StatusMessage string `json:"statusMessage"`
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package es2
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/nutcas3/telecom-platform/apps/carrier-connector/internal/config"
|
||||
)
|
||||
|
||||
|
||||
type ES2Client struct {
|
||||
httpClient *http.Client
|
||||
config *config.ES2Config
|
||||
baseURL string
|
||||
maxRetries int
|
||||
retryDelay time.Duration
|
||||
}
|
||||
|
||||
type DownloadProfileRequest struct {
|
||||
EID string `json:"eid"`
|
||||
ICCID string `json:"iccid"`
|
||||
ProfileType string `json:"profileType"`
|
||||
ConfirmationCode string `json:"confirmationCode,omitempty"`
|
||||
}
|
||||
|
||||
type DownloadProfileResponse struct {
|
||||
ExecutionStatus string `json:"executionStatus"`
|
||||
StatusMessage string `json:"statusMessage"`
|
||||
}
|
||||
|
||||
type GetProfileStatusRequest struct {
|
||||
EID string `json:"eid"`
|
||||
ICCID string `json:"iccid"`
|
||||
}
|
||||
|
||||
type GetProfileStatusResponse struct {
|
||||
ExecutionStatus string `json:"executionStatus"`
|
||||
StatusMessage string `json:"statusMessage"`
|
||||
ProfileState string `json:"profileState,omitempty"`
|
||||
}
|
||||
|
||||
type DeleteProfileRequest struct {
|
||||
EID string `json:"eid"`
|
||||
ICCID string `json:"iccid"`
|
||||
}
|
||||
|
||||
type DeleteProfileResponse struct {
|
||||
ExecutionStatus string `json:"executionStatus"`
|
||||
StatusMessage string `json:"statusMessage"`
|
||||
}
|
||||
|
||||
type EnableProfileRequest struct {
|
||||
EID string `json:"eid"`
|
||||
ICCID string `json:"iccid"`
|
||||
}
|
||||
|
||||
type EnableProfileResponse struct {
|
||||
ExecutionStatus string `json:"executionStatus"`
|
||||
StatusMessage string `json:"statusMessage"`
|
||||
}
|
||||
|
||||
type DisableProfileRequest struct {
|
||||
EID string `json:"eid"`
|
||||
ICCID string `json:"iccid"`
|
||||
}
|
||||
|
||||
type DisableProfileResponse struct {
|
||||
ExecutionStatus string `json:"executionStatus"`
|
||||
StatusMessage string `json:"statusMessage"`
|
||||
}
|
||||
Reference in New Issue
Block a user