mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-11-20 11:08:46 +00:00
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
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package telecom
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// RatingPlanAPI handles rating plan-related API calls
|
||||
type RatingPlanAPI struct {
|
||||
client *HTTPClient
|
||||
}
|
||||
|
||||
// NewRatingPlanAPI creates a new RatingPlanAPI
|
||||
func NewRatingPlanAPI(client *HTTPClient) *RatingPlanAPI {
|
||||
return &RatingPlanAPI{client: client}
|
||||
}
|
||||
|
||||
// List retrieves all available rating plans
|
||||
func (r *RatingPlanAPI) List(ctx context.Context) ([]RatingPlan, error) {
|
||||
var plans []RatingPlan
|
||||
err := r.client.Get(ctx, "/v1/rating-plans", &plans)
|
||||
return plans, err
|
||||
}
|
||||
|
||||
// Get retrieves a rating plan by ID
|
||||
func (r *RatingPlanAPI) Get(ctx context.Context, planID string) (*RatingPlan, error) {
|
||||
var plan RatingPlan
|
||||
err := r.client.Get(ctx, fmt.Sprintf("/v1/rating-plans/%s", planID), &plan)
|
||||
return &plan, err
|
||||
}
|
||||
Reference in New Issue
Block a user