Files
telecom-platform/sdk/go/graphql_api.go
T
nutcas3 d846c304a4 docs: Add Go SDK README with comprehensive API documentation and implement modular architecture with authentication provider
- Add README.md with installation instructions, architecture overview, and API examples for all SDK modules
- Add AuthProvider class with API key and JWT token support (GenerateJWTToken, ValidateJWTToken, GetHeaders, ClearTokenCache methods)
- Add HTTPClient base class with retry logic, error handling, and timeout management
- Add GraphQLAPI, PaymentsAPI, RatingPlansAPI
2026-04-25 04:56:33 +03:00

30 lines
654 B
Go

package telecom
import (
"context"
)
// GraphQLAPI handles GraphQL API calls
type GraphQLAPI struct {
client *HTTPClient
}
// NewGraphQLAPI creates a new GraphQLAPI
func NewGraphQLAPI(client *HTTPClient) *GraphQLAPI {
return &GraphQLAPI{client: client}
}
// Execute executes a GraphQL query
func (g *GraphQLAPI) Execute(ctx context.Context, query string, variables map[string]interface{}) (map[string]interface{}, error) {
data := map[string]interface{}{
"query": query,
}
if variables != nil {
data["variables"] = variables
}
var result map[string]interface{}
err := g.client.Post(ctx, "/graphql", data, &result)
return result, err
}