Commit from GitHub Actions (Publish APIs & Clients)

This commit is contained in:
asim
2021-09-22 11:52:45 +00:00
parent e841bc0ac6
commit cecb7ee50e
8 changed files with 174 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ import (
"github.com/micro/services/clients/go/location"
"github.com/micro/services/clients/go/otp"
"github.com/micro/services/clients/go/postcode"
"github.com/micro/services/clients/go/prayer"
"github.com/micro/services/clients/go/qr"
"github.com/micro/services/clients/go/quran"
"github.com/micro/services/clients/go/routing"
@@ -60,6 +61,7 @@ func NewClient(token string) *Client {
LocationService: location.NewLocationService(token),
OtpService: otp.NewOtpService(token),
PostcodeService: postcode.NewPostcodeService(token),
PrayerService: prayer.NewPrayerService(token),
QrService: qr.NewQrService(token),
QuranService: quran.NewQuranService(token),
RoutingService: routing.NewRoutingService(token),
@@ -100,6 +102,7 @@ type Client struct {
LocationService *location.LocationService
OtpService *otp.OtpService
PostcodeService *postcode.PostcodeService
PrayerService *prayer.PrayerService
QrService *qr.QrService
QuranService *quran.QuranService
RoutingService *routing.RoutingService

69
clients/go/prayer/prayer.go Executable file
View File

@@ -0,0 +1,69 @@
package prayer
import (
"github.com/m3o/m3o-go/client"
)
func NewPrayerService(token string) *PrayerService {
return &PrayerService{
client: client.NewClient(&client.Options{
Token: token,
}),
}
}
type PrayerService struct {
client *client.Client
}
//
func (t *PrayerService) Times(request *TimesRequest) (*TimesResponse, error) {
rsp := &TimesResponse{}
return rsp, t.client.Call("prayer", "Times", request, rsp)
}
type PrayerTime struct {
// asr time
Asr string `json:"asr"`
// date for prayer times in YYYY-MM-DD format
Date string `json:"date"`
// fajr time
Fajr string `json:"fajr"`
// isha time
Isha string `json:"isha"`
// maghrib time
Maghrib string `json:"maghrib"`
// time of sunrise
Sunrise string `json:"sunrise"`
// zuhr time
Zuhr string `json:"zuhr"`
}
type TimesRequest struct {
// optional date in YYYY-MM-DD format, otherwise uses today
Date string `json:"date"`
// number of days to request times for
Days int32 `json:"days"`
// optional latitude used in place of location
Latitude float64 `json:"latitude"`
// location to retrieve prayer times for.
// this can be a specific address, city, etc
Location string `json:"location"`
// optional longitude used in place of location
Longitude float64 `json:"longitude"`
}
type TimesResponse struct {
// date of request
Date string `json:"date"`
// number of days
Days int32 `json:"days"`
// latitude of location
Latitude float64 `json:"latitude"`
// location for the request
Location string `json:"location"`
// longitude of location
Longitude float64 `json:"longitude"`
// prayer times for the given location
Times []PrayerTime `json:"times"`
}