mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-19 19:34:25 +00:00
- Add README.md with installation instructions, architecture overview, and API examples for all SDK modules - Refactor TelecomSDK main module to use modular API clients (SubscribersAPI, UsageAPI, PaymentAPI, RatingPlanAPI, SystemAPI, GraphQLAPI) - Add AuthProvider class with API key and JWT token support (generate_jwt_token, validate_jwt_token methods) - Add HTTPClient base
42 lines
1.1 KiB
Elixir
42 lines
1.1 KiB
Elixir
defmodule TelecomSDK.SubscriberAPI do
|
|
@moduledoc """
|
|
API for subscriber management
|
|
"""
|
|
|
|
defstruct [:client]
|
|
|
|
def new(client) do
|
|
%__MODULE__{client: client}
|
|
end
|
|
|
|
def get(api, id) do
|
|
TelecomSDK.HTTPClient.get(api.client, "/v1/subscribers/#{id}")
|
|
end
|
|
|
|
def list(api, page \\ 1, page_size \\ 50, status \\ nil) do
|
|
params = %{page: page, page_size: page_size}
|
|
params = if status, do: Map.put(params, :status, status), else: params
|
|
TelecomSDK.HTTPClient.get(api.client, "/v1/subscribers", params)
|
|
end
|
|
|
|
def create(api, request) do
|
|
TelecomSDK.HTTPClient.post(api.client, "/v1/subscribers", request)
|
|
end
|
|
|
|
def update(api, id, request) do
|
|
TelecomSDK.HTTPClient.put(api.client, "/v1/subscribers/#{id}", request)
|
|
end
|
|
|
|
def delete(api, id) do
|
|
TelecomSDK.HTTPClient.delete(api.client, "/v1/subscribers/#{id}")
|
|
end
|
|
|
|
def suspend(api, id) do
|
|
TelecomSDK.HTTPClient.post(api.client, "/v1/subscribers/#{id}/suspend")
|
|
end
|
|
|
|
def activate(api, id) do
|
|
TelecomSDK.HTTPClient.post(api.client, "/v1/subscribers/#{id}/activate")
|
|
end
|
|
end
|