lint: remove unused code across api, comms, h3utils, html, middleware, minio, platform, rmo
Deleted files: api/compliance.go, api/debug.go, rmo/compliance.go, rmo/email.go, rmo/mock.go, platform/publicreport/address.go Removed unused functions/types from: api/api.go, api/configuration.go, api/district.go, api/publicreport.go, api/sudo.go, api/types.go, comms/text/twilio.go, comms/text/voipms.go, h3utils/h3.go, html/embed.go, html/form.go, middleware/terminal.go, minio/client.go, platform/csv/csv.go, platform/csv/flyover.go, platform/file/base.go, platform/file/upload.go, platform/geocode/address.go, platform/types/service_request.go
This commit is contained in:
parent
d74c24339e
commit
53a3f9816a
25 changed files with 6 additions and 975 deletions
|
|
@ -2,7 +2,6 @@ package text
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/Gleipnir-Technology/nidus-sync/config"
|
||||
|
|
@ -32,21 +31,3 @@ func sendTextTwilio(ctx context.Context, source string, destination string, mess
|
|||
return *resp.Sid, nil
|
||||
}
|
||||
|
||||
func sendSMSTwilio(destination, source, message string) error {
|
||||
client := twilio.NewRestClientWithParams(twilio.ClientParams{
|
||||
Username: config.TwilioAccountSID,
|
||||
Password: config.TwilioAuthToken,
|
||||
})
|
||||
params := &twilioApi.CreateMessageParams{}
|
||||
params.SetTo("+15558675309")
|
||||
params.SetFrom("+15017250604")
|
||||
params.SetBody("Hello from Go!")
|
||||
|
||||
resp, err := client.Api.CreateMessage(params)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error sending SMS message: %w", err)
|
||||
}
|
||||
response, _ := json.Marshal(*resp)
|
||||
log.Debug().Str("response", string(response)).Msg("Send SMS")
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,26 +56,6 @@ func sendTextVoipms(ctx context.Context, to string, content string, media ...str
|
|||
return strconv.Itoa(response.MMS), nil
|
||||
}
|
||||
|
||||
func sendSMSVoipms(to string, content string) (string, error) {
|
||||
if len(content) > 160 {
|
||||
return "", errors.New("Message content is more than 160 characters")
|
||||
}
|
||||
params := url.Values{}
|
||||
params.Add("api_password", config.VoipMSPassword)
|
||||
params.Add("api_username", config.VoipMSUsername)
|
||||
params.Add("method", "sendSMS")
|
||||
params.Add("did", config.VoipMSNumber)
|
||||
params.Add("dst", to)
|
||||
params.Add("message", content)
|
||||
|
||||
response, err := makeVoipMSRequest(params)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Failed to send SMS: %w", err)
|
||||
}
|
||||
log.Info().Str("status", response.Status).Int("sms", response.SMS).Msg("Sent MMS message")
|
||||
return strconv.Itoa(response.SMS), nil
|
||||
}
|
||||
|
||||
func makeVoipMSRequest(params url.Values) (VoipMSResponse, error) {
|
||||
result := VoipMSResponse{}
|
||||
// Construct the URL with query parameters
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue