Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2021-11-22 12:25:01 +00:00
parent c2fb06ae73
commit ed691ec515
38 changed files with 806 additions and 806 deletions

View File

@@ -35,13 +35,13 @@ type LookupPostcodeResponse struct {
type Record struct { type Record struct {
// building name // building name
BuildingName string `json:"buildingName"` BuildingName string `json:"building_name"`
// the county // the county
County string `json:"county"` County string `json:"county"`
// line one of address // line one of address
LineOne string `json:"lineOne"` LineOne string `json:"line_one"`
// line two of address // line two of address
LineTwo string `json:"lineTwo"` LineTwo string `json:"line_two"`
// dependent locality // dependent locality
Locality string `json:"locality"` Locality string `json:"locality"`
// organisation if present // organisation if present

View File

@@ -114,13 +114,13 @@ type QuoteRequest struct {
type QuoteResponse struct { type QuoteResponse struct {
// the asking price // the asking price
AskPrice float64 `json:"askPrice"` AskPrice float64 `json:"ask_price"`
// the ask size // the ask size
AskSize float64 `json:"askSize"` AskSize float64 `json:"ask_size"`
// the bidding price // the bidding price
BidPrice float64 `json:"bidPrice"` BidPrice float64 `json:"bid_price"`
// the bid size // the bid size
BidSize float64 `json:"bidSize"` BidSize float64 `json:"bid_size"`
// the crypto symbol // the crypto symbol
Symbol string `json:"symbol"` Symbol string `json:"symbol"`
// the UTC timestamp of the quote // the UTC timestamp of the quote

View File

@@ -28,13 +28,13 @@ type SendRequest struct {
// the display name of the sender // the display name of the sender
From string `json:"from"` From string `json:"from"`
// the html body // the html body
HtmlBody string `json:"htmlBody"` HtmlBody string `json:"html_body"`
// an optional reply to email address // an optional reply to email address
ReplyTo string `json:"replyTo"` ReplyTo string `json:"reply_to"`
// the email subject // the email subject
Subject string `json:"subject"` Subject string `json:"subject"`
// the text body // the text body
TextBody string `json:"textBody"` TextBody string `json:"text_body"`
// the email address of the recipient // the email address of the recipient
To string `json:"to"` To string `json:"to"`
} }

View File

@@ -34,50 +34,50 @@ func (t *EvchargersService) Search(request *SearchRequest) (*SearchResponse, err
type Address struct { type Address struct {
// Any comments about how to access the charger // Any comments about how to access the charger
AccessComments string `json:"accessComments"` AccessComments string `json:"access_comments"`
AddressLine1 string `json:"addressLine1"` AddressLine1 string `json:"address_line_1"`
AddressLine2 string `json:"addressLine2"` AddressLine2 string `json:"address_line_2"`
Country *Country `json:"country"` Country *Country `json:"country"`
CountryId string `json:"countryId"` CountryId string `json:"country_id"`
LatLng string `json:"latLng"` LatLng string `json:"lat_lng"`
Location *Coordinates `json:"location"` Location *Coordinates `json:"location"`
Postcode string `json:"postcode"` Postcode string `json:"postcode"`
StateOrProvince string `json:"stateOrProvince"` StateOrProvince string `json:"state_or_province"`
Title string `json:"title"` Title string `json:"title"`
Town string `json:"town"` Town string `json:"town"`
} }
type BoundingBox struct { type BoundingBox struct {
BottomLeft *Coordinates `json:"bottomLeft"` BottomLeft *Coordinates `json:"bottom_left"`
TopRight *Coordinates `json:"topRight"` TopRight *Coordinates `json:"top_right"`
} }
type ChargerType struct { type ChargerType struct {
Comments string `json:"comments"` Comments string `json:"comments"`
Id string `json:"id"` Id string `json:"id"`
// Is this 40KW+ // Is this 40KW+
IsFastChargeCapable bool `json:"isFastChargeCapable"` IsFastChargeCapable bool `json:"is_fast_charge_capable"`
Title string `json:"title"` Title string `json:"title"`
} }
type CheckinStatusType struct { type CheckinStatusType struct {
Id string `json:"id"` Id string `json:"id"`
IsAutomated bool `json:"isAutomated"` IsAutomated bool `json:"is_automated"`
IsPositive bool `json:"isPositive"` IsPositive bool `json:"is_positive"`
Title string `json:"title"` Title string `json:"title"`
} }
type Connection struct { type Connection struct {
// The amps offered // The amps offered
Amps float64 `json:"amps"` Amps float64 `json:"amps"`
ConnectionType *ConnectionType `json:"connectionType"` ConnectionType *ConnectionType `json:"connection_type"`
// The ID of the connection type // The ID of the connection type
ConnectionTypeId string `json:"connectionTypeId"` ConnectionTypeId string `json:"connection_type_id"`
// The current // The current
Current string `json:"current"` Current string `json:"current"`
Level *ChargerType `json:"level"` Level *ChargerType `json:"level"`
// The level of charging power available // The level of charging power available
LevelId string `json:"levelId"` LevelId string `json:"level_id"`
// The power in KW // The power in KW
Power float64 `json:"power"` Power float64 `json:"power"`
Reference string `json:"reference"` Reference string `json:"reference"`
@@ -86,10 +86,10 @@ type Connection struct {
} }
type ConnectionType struct { type ConnectionType struct {
FormalName string `json:"formalName"` FormalName string `json:"formal_name"`
Id string `json:"id"` Id string `json:"id"`
IsDiscontinued bool `json:"isDiscontinued"` IsDiscontinued bool `json:"is_discontinued"`
IsObsolete bool `json:"isObsolete"` IsObsolete bool `json:"is_obsolete"`
Title string `json:"title"` Title string `json:"title"`
} }
@@ -99,9 +99,9 @@ type Coordinates struct {
} }
type Country struct { type Country struct {
ContinentCode string `json:"continentCode"` ContinentCode string `json:"continent_code"`
Id string `json:"id"` Id string `json:"id"`
IsoCode string `json:"isoCode"` IsoCode string `json:"iso_code"`
Title string `json:"title"` Title string `json:"title"`
} }
@@ -113,7 +113,7 @@ type CurrentType struct {
type DataProvider struct { type DataProvider struct {
Comments string `json:"comments"` Comments string `json:"comments"`
DataProviderStatusType *DataProviderStatusType `json:"dataProviderStatusType"` DataProviderStatusType *DataProviderStatusType `json:"data_provider_status_type"`
Id string `json:"id"` Id string `json:"id"`
// How is this data licensed // How is this data licensed
License string `json:"license"` License string `json:"license"`
@@ -123,19 +123,19 @@ type DataProvider struct {
type DataProviderStatusType struct { type DataProviderStatusType struct {
Id string `json:"id"` Id string `json:"id"`
IsProviderEnabled bool `json:"isProviderEnabled"` IsProviderEnabled bool `json:"is_provider_enabled"`
Title string `json:"title"` Title string `json:"title"`
} }
type Operator struct { type Operator struct {
Comments string `json:"comments"` Comments string `json:"comments"`
ContactEmail string `json:"contactEmail"` ContactEmail string `json:"contact_email"`
FaultReportEmail string `json:"faultReportEmail"` FaultReportEmail string `json:"fault_report_email"`
Id string `json:"id"` Id string `json:"id"`
// Is this operator a private individual vs a company // Is this operator a private individual vs a company
IsPrivateIndividual bool `json:"isPrivateIndividual"` IsPrivateIndividual bool `json:"is_private_individual"`
PhonePrimary string `json:"phonePrimary"` PhonePrimary string `json:"phone_primary"`
PhoneSecondary string `json:"phoneSecondary"` PhoneSecondary string `json:"phone_secondary"`
Title string `json:"title"` Title string `json:"title"`
Website string `json:"website"` Website string `json:"website"`
} }
@@ -148,19 +148,19 @@ type Poi struct {
// The cost of charging // The cost of charging
Cost string `json:"cost"` Cost string `json:"cost"`
// The ID of the data provider // The ID of the data provider
DataProviderId string `json:"dataProviderId"` DataProviderId string `json:"data_provider_id"`
// The ID of the charger // The ID of the charger
Id string `json:"id"` Id string `json:"id"`
// The number of charging points // The number of charging points
NumPoints int64 `json:"numPoints,string"` NumPoints int64 `json:"num_points,string"`
// The operator // The operator
Operator *Operator `json:"operator"` Operator *Operator `json:"operator"`
// The ID of the operator of the charger // The ID of the operator of the charger
OperatorId string `json:"operatorId"` OperatorId string `json:"operator_id"`
// The type of usage // The type of usage
UsageType *UsageType `json:"usageType"` UsageType *UsageType `json:"usage_type"`
// The type of usage for this charger point (is it public, membership required, etc) // The type of usage for this charger point (is it public, membership required, etc)
UsageTypeId string `json:"usageTypeId"` UsageTypeId string `json:"usage_type_id"`
} }
type ReferenceDataRequest struct { type ReferenceDataRequest struct {
@@ -168,36 +168,36 @@ type ReferenceDataRequest struct {
type ReferenceDataResponse struct { type ReferenceDataResponse struct {
// The types of charger // The types of charger
ChargerTypes *ChargerType `json:"chargerTypes"` ChargerTypes *ChargerType `json:"charger_types"`
// The types of checkin status // The types of checkin status
CheckinStatusTypes *CheckinStatusType `json:"checkinStatusTypes"` CheckinStatusTypes *CheckinStatusType `json:"checkin_status_types"`
// The types of connection // The types of connection
ConnectionTypes *ConnectionType `json:"connectionTypes"` ConnectionTypes *ConnectionType `json:"connection_types"`
// The countries // The countries
Countries []Country `json:"countries"` Countries []Country `json:"countries"`
// The types of current // The types of current
CurrentTypes *CurrentType `json:"currentTypes"` CurrentTypes *CurrentType `json:"current_types"`
// The providers of the charger data // The providers of the charger data
DataProviders *DataProvider `json:"dataProviders"` DataProviders *DataProvider `json:"data_providers"`
// The companies operating the chargers // The companies operating the chargers
Operators []Operator `json:"operators"` Operators []Operator `json:"operators"`
// The status of the charger // The status of the charger
StatusTypes *StatusType `json:"statusTypes"` StatusTypes *StatusType `json:"status_types"`
// The status of a submission // The status of a submission
SubmissionStatusTypes *SubmissionStatusType `json:"submissionStatusTypes"` SubmissionStatusTypes *SubmissionStatusType `json:"submission_status_types"`
// The different types of usage // The different types of usage
UsageTypes *UsageType `json:"usageTypes"` UsageTypes *UsageType `json:"usage_types"`
// The types of user comment // The types of user comment
UserCommentTypes *UserCommentType `json:"userCommentTypes"` UserCommentTypes *UserCommentType `json:"user_comment_types"`
} }
type SearchRequest struct { type SearchRequest struct {
// Bounding box to search within (top left and bottom right coordinates) // Bounding box to search within (top left and bottom right coordinates)
Box *BoundingBox `json:"box"` Box *BoundingBox `json:"box"`
// IDs of the connection type // IDs of the connection type
ConnectionTypes string `json:"connectionTypes"` ConnectionTypes string `json:"connection_types"`
// Country ID // Country ID
CountryId string `json:"countryId"` CountryId string `json:"country_id"`
// Search distance from point in metres, defaults to 5000m // Search distance from point in metres, defaults to 5000m
Distance int64 `json:"distance,string"` Distance int64 `json:"distance,string"`
// Supported charging levels // Supported charging levels
@@ -205,13 +205,13 @@ type SearchRequest struct {
// Coordinates from which to begin search // Coordinates from which to begin search
Location *Coordinates `json:"location"` Location *Coordinates `json:"location"`
// Maximum number of results to return, defaults to 100 // Maximum number of results to return, defaults to 100
MaxResults int64 `json:"maxResults,string"` MaxResults int64 `json:"max_results,string"`
// Minimum power in KW. Note: data not available for many chargers // Minimum power in KW. Note: data not available for many chargers
MinPower int64 `json:"minPower,string"` MinPower int64 `json:"min_power,string"`
// IDs of the the EV charger operator // IDs of the the EV charger operator
Operators []string `json:"operators"` Operators []string `json:"operators"`
// Usage of the charge point (is it public, membership required, etc) // Usage of the charge point (is it public, membership required, etc)
UsageTypes string `json:"usageTypes"` UsageTypes string `json:"usage_types"`
} }
type SearchResponse struct { type SearchResponse struct {
@@ -220,21 +220,21 @@ type SearchResponse struct {
type StatusType struct { type StatusType struct {
Id string `json:"id"` Id string `json:"id"`
IsOperational bool `json:"isOperational"` IsOperational bool `json:"is_operational"`
Title string `json:"title"` Title string `json:"title"`
} }
type SubmissionStatusType struct { type SubmissionStatusType struct {
Id string `json:"id"` Id string `json:"id"`
IsLive bool `json:"isLive"` IsLive bool `json:"is_live"`
Title string `json:"title"` Title string `json:"title"`
} }
type UsageType struct { type UsageType struct {
Id string `json:"id"` Id string `json:"id"`
IsAccessKeyRequired bool `json:"isAccessKeyRequired"` IsAccessKeyRequired bool `json:"is_access_key_required"`
IsMembershipRequired bool `json:"isMembershipRequired"` IsMembershipRequired bool `json:"is_membership_required"`
IsPayAtLocation bool `json:"isPayAtLocation"` IsPayAtLocation bool `json:"is_pay_at_location"`
Title string `json:"title"` Title string `json:"title"`
} }

View File

@@ -4,64 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Cache/api](htt
Endpoints: Endpoints:
## Increment
Increment a value (if it's a number). If key not found it is equivalent to set.
[https://m3o.com/cache/api#Increment](https://m3o.com/cache/api#Increment)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/cache"
)
// Increment a value (if it's a number). If key not found it is equivalent to set.
func IncrementAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Increment(&cache.IncrementRequest{
Key: "counter",
Value: 2,
})
fmt.Println(rsp, err)
}
```
## Decrement
Decrement a value (if it's a number). If key not found it is equivalent to set.
[https://m3o.com/cache/api#Decrement](https://m3o.com/cache/api#Decrement)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/cache"
)
// Decrement a value (if it's a number). If key not found it is equivalent to set.
func DecrementAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Decrement(&cache.DecrementRequest{
Key: "counter",
Value: 2,
})
fmt.Println(rsp, err)
}
```
## Set ## Set
Set an item in the cache. Overwrites any existing value already set. Set an item in the cache. Overwrites any existing value already set.
@@ -147,3 +89,61 @@ func DeleteAvalue() {
} }
``` ```
## Increment
Increment a value (if it's a number). If key not found it is equivalent to set.
[https://m3o.com/cache/api#Increment](https://m3o.com/cache/api#Increment)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/cache"
)
// Increment a value (if it's a number). If key not found it is equivalent to set.
func IncrementAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Increment(&cache.IncrementRequest{
Key: "counter",
Value: 2,
})
fmt.Println(rsp, err)
}
```
## Decrement
Decrement a value (if it's a number). If key not found it is equivalent to set.
[https://m3o.com/cache/api#Decrement](https://m3o.com/cache/api#Decrement)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/cache"
)
// Decrement a value (if it's a number). If key not found it is equivalent to set.
func DecrementAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Decrement(&cache.DecrementRequest{
Key: "counter",
Value: 2,
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,12 +4,12 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Db/api](https:
Endpoints: Endpoints:
## Create ## Update
Create a record in the database. Optionally include an "id" field otherwise it's set automatically. Update a record in the database. Include an "id" in the record to update.
[https://m3o.com/db/api#Create](https://m3o.com/db/api#Create) [https://m3o.com/db/api#Update](https://m3o.com/db/api#Update)
```go ```go
package example package example
@@ -21,50 +21,19 @@ import(
"go.m3o.com/db" "go.m3o.com/db"
) )
// Create a record in the database. Optionally include an "id" field otherwise it's set automatically. // Update a record in the database. Include an "id" in the record to update.
func CreateArecord() { func UpdateArecord() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Create(&db.CreateRequest{ rsp, err := dbService.Update(&db.UpdateRequest{
Record: map[string]interface{}{ Record: map[string]interface{}{
"id": "1", "id": "1",
"name": "Jane", "age": 43,
"age": 42,
"isActive": true,
}, },
Table: "users", Table: "users",
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
}
```
## Delete
Delete a record in the database by id.
[https://m3o.com/db/api#Delete](https://m3o.com/db/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Delete a record in the database by id.
func DeleteArecord() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Delete(&db.DeleteRequest{
Id: "1",
Table: "users",
})
fmt.Println(rsp, err)
} }
``` ```
## RenameTable ## RenameTable
@@ -96,12 +65,12 @@ To: "events_backup",
} }
``` ```
## ListTables ## Create
List tables in the DB Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
[https://m3o.com/db/api#ListTables](https://m3o.com/db/api#ListTables) [https://m3o.com/db/api#Create](https://m3o.com/db/api#Create)
```go ```go
package example package example
@@ -113,40 +82,15 @@ import(
"go.m3o.com/db" "go.m3o.com/db"
) )
// List tables in the DB // Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
func ListTables() { func CreateArecord() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.ListTables(&db.ListTablesRequest{ rsp, err := dbService.Create(&db.CreateRequest{
})
fmt.Println(rsp, err)
}
```
## Update
Update a record in the database. Include an "id" in the record to update.
[https://m3o.com/db/api#Update](https://m3o.com/db/api#Update)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Update a record in the database. Include an "id" in the record to update.
func UpdateArecord() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Update(&db.UpdateRequest{
Record: map[string]interface{}{ Record: map[string]interface{}{
"isActive": true,
"id": "1", "id": "1",
"age": 43, "name": "Jane",
"age": 42,
}, },
Table: "users", Table: "users",
@@ -182,6 +126,35 @@ Table: "users",
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
}
```
## Delete
Delete a record in the database by id.
[https://m3o.com/db/api#Delete](https://m3o.com/db/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Delete a record in the database by id.
func DeleteArecord() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Delete(&db.DeleteRequest{
Id: "1",
Table: "users",
})
fmt.Println(rsp, err)
} }
``` ```
## Truncate ## Truncate
@@ -268,3 +241,30 @@ func CountEntriesInAtable() {
} }
``` ```
## ListTables
List tables in the DB
[https://m3o.com/db/api#ListTables](https://m3o.com/db/api#ListTables)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// List tables in the DB
func ListTables() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.ListTables(&db.ListTablesRequest{
})
fmt.Println(rsp, err)
}
```

View File

@@ -12,10 +12,10 @@ func main() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN")) dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Create(&db.CreateRequest{ rsp, err := dbService.Create(&db.CreateRequest{
Record: map[string]interface{}{ Record: map[string]interface{}{
"id": "1",
"name": "Jane", "name": "Jane",
"age": 42, "age": 42,
"isActive": true, "isActive": true,
"id": "1",
}, },
Table: "users", Table: "users",
}) })

View File

@@ -4,61 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Emoji/api](htt
Endpoints: Endpoints:
## Find
Find an emoji by its alias e.g :beer:
[https://m3o.com/emoji/api#Find](https://m3o.com/emoji/api#Find)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/emoji"
)
// Find an emoji by its alias e.g :beer:
func FindEmoji() {
emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN"))
rsp, err := emojiService.Find(&emoji.FindRequest{
Alias: ":beer:",
})
fmt.Println(rsp, err)
}
```
## Flag
Get the flag for a country. Requires country code e.g GB for great britain
[https://m3o.com/emoji/api#Flag](https://m3o.com/emoji/api#Flag)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/emoji"
)
// Get the flag for a country. Requires country code e.g GB for great britain
func GetFlagByCountryCode() {
emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN"))
rsp, err := emojiService.Flag(&emoji.FlagRequest{
})
fmt.Println(rsp, err)
}
```
## Print ## Print
Print text and renders the emojis with aliases e.g Print text and renders the emojis with aliases e.g
@@ -119,3 +64,58 @@ To: "+44782669123",
} }
``` ```
## Find
Find an emoji by its alias e.g :beer:
[https://m3o.com/emoji/api#Find](https://m3o.com/emoji/api#Find)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/emoji"
)
// Find an emoji by its alias e.g :beer:
func FindEmoji() {
emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN"))
rsp, err := emojiService.Find(&emoji.FindRequest{
Alias: ":beer:",
})
fmt.Println(rsp, err)
}
```
## Flag
Get the flag for a country. Requires country code e.g GB for great britain
[https://m3o.com/emoji/api#Flag](https://m3o.com/emoji/api#Flag)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/emoji"
)
// Get the flag for a country. Requires country code e.g GB for great britain
func GetFlagByCountryCode() {
emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN"))
rsp, err := emojiService.Flag(&emoji.FlagRequest{
})
fmt.Println(rsp, err)
}
```

View File

@@ -12,9 +12,9 @@ func main() {
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN")) eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
rsp, err := eventService.Publish(&event.PublishRequest{ rsp, err := eventService.Publish(&event.PublishRequest{
Message: map[string]interface{}{ Message: map[string]interface{}{
"user": "john",
"id": "1", "id": "1",
"type": "signup", "type": "signup",
"user": "john",
}, },
Topic: "user", Topic: "user",
}) })

View File

@@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Forex/api](htt
Endpoints: Endpoints:
## History
Returns the data for the previous close
[https://m3o.com/forex/api#History](https://m3o.com/forex/api#History)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/forex"
)
// Returns the data for the previous close
func GetPreviousClose() {
forexService := forex.NewForexService(os.Getenv("M3O_API_TOKEN"))
rsp, err := forexService.History(&forex.HistoryRequest{
Symbol: "GBPUSD",
})
fmt.Println(rsp, err)
}
```
## Price ## Price
Get the latest price for a given forex ticker Get the latest price for a given forex ticker
@@ -60,31 +88,3 @@ func GetAfxQuote() {
} }
``` ```
## History
Returns the data for the previous close
[https://m3o.com/forex/api#History](https://m3o.com/forex/api#History)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/forex"
)
// Returns the data for the previous close
func GetPreviousClose() {
forexService := forex.NewForexService(os.Getenv("M3O_API_TOKEN"))
rsp, err := forexService.History(&forex.HistoryRequest{
Symbol: "GBPUSD",
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Helloworld/api
Endpoints: Endpoints:
## Call
Call returns a personalised "Hello $name" response
[https://m3o.com/helloworld/api#Call](https://m3o.com/helloworld/api#Call)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/helloworld"
)
// Call returns a personalised "Hello $name" response
func CallTheHelloworldService() {
helloworldService := helloworld.NewHelloworldService(os.Getenv("M3O_API_TOKEN"))
rsp, err := helloworldService.Call(&helloworld.CallRequest{
Name: "John",
})
fmt.Println(rsp, err)
}
```
## Stream ## Stream
Stream returns a stream of "Hello $name" responses Stream returns a stream of "Hello $name" responses
@@ -46,31 +74,3 @@ Name: "John",
} }
} }
``` ```
## Call
Call returns a personalised "Hello $name" response
[https://m3o.com/helloworld/api#Call](https://m3o.com/helloworld/api#Call)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/helloworld"
)
// Call returns a personalised "Hello $name" response
func CallTheHelloworldService() {
helloworldService := helloworld.NewHelloworldService(os.Getenv("M3O_API_TOKEN"))
rsp, err := helloworldService.Call(&helloworld.CallRequest{
Name: "John",
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,111 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Image/api](htt
Endpoints: Endpoints:
## Convert
Convert an image from one format (jpeg, png etc.) to an other either on the fly (from base64 to base64),
or by uploading the conversion result.
To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
with each parameter as a form field.
[https://m3o.com/image/api#Convert](https://m3o.com/image/api#Convert)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/image"
)
// Convert an image from one format (jpeg, png etc.) to an other either on the fly (from base64 to base64),
// or by uploading the conversion result.
// To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
// with each parameter as a form field.
func ConvertApngImageToAjpegTakenFromAurlAndSavedToAurlOnMicrosCdn() {
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
rsp, err := imageService.Convert(&image.ConvertRequest{
Name: "cat.jpeg",
Url: "somewebsite.com/cat.png",
})
fmt.Println(rsp, err)
}
```
## Upload
Upload an image by either sending a base64 encoded image to this endpoint or a URL.
To resize an image before uploading, see the Resize endpoint.
To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
with each parameter as a form field.
[https://m3o.com/image/api#Upload](https://m3o.com/image/api#Upload)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/image"
)
// Upload an image by either sending a base64 encoded image to this endpoint or a URL.
// To resize an image before uploading, see the Resize endpoint.
// To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
// with each parameter as a form field.
func UploadAbase64imageToMicrosCdn() {
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
rsp, err := imageService.Upload(&image.UploadRequest{
Base64: "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAx0lEQVR4nOzaMaoDMQyE4ZHj+x82vVdhwQoTkzKQEcwP5r0ihT7sbjUTeAJ4HCegXQJYfOYefOyjDuBiz3yjwJBoCIl6QZOeUjTC1Ix1IxEJXF9+0KWsf2bD4bn37OO/c/wuQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9Sa/NG94Tf3j4WBdaxudMEkn4IM2rZBA0wBrvo7aOcpj2emXvLeVt0IGm0GVXUj91mvAAAA//+V2CZl+4AKXwAAAABJRU5ErkJggg==",
Name: "cat.jpeg",
})
fmt.Println(rsp, err)
}
```
## Upload
Upload an image by either sending a base64 encoded image to this endpoint or a URL.
To resize an image before uploading, see the Resize endpoint.
To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
with each parameter as a form field.
[https://m3o.com/image/api#Upload](https://m3o.com/image/api#Upload)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/image"
)
// Upload an image by either sending a base64 encoded image to this endpoint or a URL.
// To resize an image before uploading, see the Resize endpoint.
// To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
// with each parameter as a form field.
func UploadAnImageFromAurlToMicrosCdn() {
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
rsp, err := imageService.Upload(&image.UploadRequest{
Name: "cat.jpeg",
Url: "somewebsite.com/cat.png",
})
fmt.Println(rsp, err)
}
```
## Delete ## Delete
Delete an image previously uploaded. Delete an image previously uploaded.
@@ -256,3 +151,108 @@ Width: 100,
} }
``` ```
## Convert
Convert an image from one format (jpeg, png etc.) to an other either on the fly (from base64 to base64),
or by uploading the conversion result.
To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
with each parameter as a form field.
[https://m3o.com/image/api#Convert](https://m3o.com/image/api#Convert)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/image"
)
// Convert an image from one format (jpeg, png etc.) to an other either on the fly (from base64 to base64),
// or by uploading the conversion result.
// To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
// with each parameter as a form field.
func ConvertApngImageToAjpegTakenFromAurlAndSavedToAurlOnMicrosCdn() {
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
rsp, err := imageService.Convert(&image.ConvertRequest{
Name: "cat.jpeg",
Url: "somewebsite.com/cat.png",
})
fmt.Println(rsp, err)
}
```
## Upload
Upload an image by either sending a base64 encoded image to this endpoint or a URL.
To resize an image before uploading, see the Resize endpoint.
To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
with each parameter as a form field.
[https://m3o.com/image/api#Upload](https://m3o.com/image/api#Upload)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/image"
)
// Upload an image by either sending a base64 encoded image to this endpoint or a URL.
// To resize an image before uploading, see the Resize endpoint.
// To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
// with each parameter as a form field.
func UploadAbase64imageToMicrosCdn() {
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
rsp, err := imageService.Upload(&image.UploadRequest{
Base64: "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAx0lEQVR4nOzaMaoDMQyE4ZHj+x82vVdhwQoTkzKQEcwP5r0ihT7sbjUTeAJ4HCegXQJYfOYefOyjDuBiz3yjwJBoCIl6QZOeUjTC1Ix1IxEJXF9+0KWsf2bD4bn37OO/c/wuQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9Sa/NG94Tf3j4WBdaxudMEkn4IM2rZBA0wBrvo7aOcpj2emXvLeVt0IGm0GVXUj91mvAAAA//+V2CZl+4AKXwAAAABJRU5ErkJggg==",
Name: "cat.jpeg",
})
fmt.Println(rsp, err)
}
```
## Upload
Upload an image by either sending a base64 encoded image to this endpoint or a URL.
To resize an image before uploading, see the Resize endpoint.
To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
with each parameter as a form field.
[https://m3o.com/image/api#Upload](https://m3o.com/image/api#Upload)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/image"
)
// Upload an image by either sending a base64 encoded image to this endpoint or a URL.
// To resize an image before uploading, see the Resize endpoint.
// To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
// with each parameter as a form field.
func UploadAnImageFromAurlToMicrosCdn() {
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
rsp, err := imageService.Upload(&image.UploadRequest{
Name: "cat.jpeg",
Url: "somewebsite.com/cat.png",
})
fmt.Println(rsp, err)
}
```

View File

@@ -12,9 +12,9 @@ func main() {
mqService := mq.NewMqService(os.Getenv("M3O_API_TOKEN")) mqService := mq.NewMqService(os.Getenv("M3O_API_TOKEN"))
rsp, err := mqService.Publish(&mq.PublishRequest{ rsp, err := mqService.Publish(&mq.PublishRequest{
Message: map[string]interface{}{ Message: map[string]interface{}{
"user": "john",
"id": "1", "id": "1",
"type": "signup", "type": "signup",
"user": "john",
}, },
Topic: "events", Topic: "events",
}) })

View File

@@ -4,93 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Notes/api](htt
Endpoints: Endpoints:
## Read
Read a note
[https://m3o.com/notes/api#Read](https://m3o.com/notes/api#Read)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/notes"
)
// Read a note
func ReadAnote() {
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
rsp, err := notesService.Read(&notes.ReadRequest{
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
})
fmt.Println(rsp, err)
}
```
## List
List all the notes
[https://m3o.com/notes/api#List](https://m3o.com/notes/api#List)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/notes"
)
// List all the notes
func ListAllNotes() {
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
rsp, err := notesService.List(&notes.ListRequest{
})
fmt.Println(rsp, err)
}
```
## Update
Update a note
[https://m3o.com/notes/api#Update](https://m3o.com/notes/api#Update)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/notes"
)
// Update a note
func UpdateAnote() {
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
rsp, err := notesService.Update(&notes.UpdateRequest{
Note: &notes.Note{
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
Text: "Updated note text",
Title: "Update Note",
},
})
fmt.Println(rsp, err)
}
```
## Delete ## Delete
Delete a note Delete a note
@@ -189,3 +102,90 @@ Title: "New Note",
} }
``` ```
## Read
Read a note
[https://m3o.com/notes/api#Read](https://m3o.com/notes/api#Read)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/notes"
)
// Read a note
func ReadAnote() {
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
rsp, err := notesService.Read(&notes.ReadRequest{
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
})
fmt.Println(rsp, err)
}
```
## List
List all the notes
[https://m3o.com/notes/api#List](https://m3o.com/notes/api#List)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/notes"
)
// List all the notes
func ListAllNotes() {
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
rsp, err := notesService.List(&notes.ListRequest{
})
fmt.Println(rsp, err)
}
```
## Update
Update a note
[https://m3o.com/notes/api#Update](https://m3o.com/notes/api#Update)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/notes"
)
// Update a note
func UpdateAnote() {
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
rsp, err := notesService.Update(&notes.UpdateRequest{
Note: &notes.Note{
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
Text: "Updated note text",
Title: "Update Note",
},
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,6 +4,33 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Stream/api](ht
Endpoints: Endpoints:
## ListChannels
List all the active channels
[https://m3o.com/stream/api#ListChannels](https://m3o.com/stream/api#ListChannels)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/stream"
)
// List all the active channels
func ListChannels() {
streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN"))
rsp, err := streamService.ListChannels(&stream.ListChannelsRequest{
})
fmt.Println(rsp, err)
}
```
## CreateChannel ## CreateChannel
Create a channel with a given name and description. Channels are created automatically but Create a channel with a given name and description. Channels are created automatically but
@@ -92,30 +119,3 @@ func ListMessages() {
} }
``` ```
## ListChannels
List all the active channels
[https://m3o.com/stream/api#ListChannels](https://m3o.com/stream/api#ListChannels)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/stream"
)
// List all the active channels
func ListChannels() {
streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN"))
rsp, err := streamService.ListChannels(&stream.ListChannelsRequest{
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,35 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Sunnah/api](ht
Endpoints: Endpoints:
## Collections
Get a list of available collections. A collection is
a compilation of hadiths collected and written by an author.
[https://m3o.com/sunnah/api#Collections](https://m3o.com/sunnah/api#Collections)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/sunnah"
)
// Get a list of available collections. A collection is
// a compilation of hadiths collected and written by an author.
func ListAvailableCollections() {
sunnahService := sunnah.NewSunnahService(os.Getenv("M3O_API_TOKEN"))
rsp, err := sunnahService.Collections(&sunnah.CollectionsRequest{
})
fmt.Println(rsp, err)
}
```
## Books ## Books
Get a list of books from within a collection. A book can contain many chapters Get a list of books from within a collection. A book can contain many chapters
@@ -123,3 +94,32 @@ Collection: "bukhari",
} }
``` ```
## Collections
Get a list of available collections. A collection is
a compilation of hadiths collected and written by an author.
[https://m3o.com/sunnah/api#Collections](https://m3o.com/sunnah/api#Collections)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/sunnah"
)
// Get a list of available collections. A collection is
// a compilation of hadiths collected and written by an author.
func ListAvailableCollections() {
sunnahService := sunnah.NewSunnahService(os.Getenv("M3O_API_TOKEN"))
rsp, err := sunnahService.Collections(&sunnah.CollectionsRequest{
})
fmt.Println(rsp, err)
}
```

View File

@@ -118,6 +118,53 @@ Id: "user-1",
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
}
```
## SendVerificationEmail
Send a verification email
to the user being signed up. Email from will be from 'noreply@email.m3ocontent.com',
but you can provide the title and contents.
The verification link will be injected in to the email as a template variable, $micro_verification_link.
Example: 'Hi there, welcome onboard! Use the link below to verify your email: $micro_verification_link'
The variable will be replaced with an actual url that will look similar to this:
'https://user.m3o.com/user/verify?token=a-verification-token&redirectUrl=your-redir-url'
[https://m3o.com/user/api#SendVerificationEmail](https://m3o.com/user/api#SendVerificationEmail)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Send a verification email
// to the user being signed up. Email from will be from 'noreply@email.m3ocontent.com',
// but you can provide the title and contents.
// The verification link will be injected in to the email as a template variable, $micro_verification_link.
// Example: 'Hi there, welcome onboard! Use the link below to verify your email: $micro_verification_link'
// The variable will be replaced with an actual url that will look similar to this:
// 'https://user.m3o.com/user/verify?token=a-verification-token&redirectUrl=your-redir-url'
func SendVerificationEmail() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.SendVerificationEmail(&user.SendVerificationEmailRequest{
Email: "joe@example.com",
FailureRedirectUrl: "https://m3o.com/verification-failed",
FromName: "Awesome Dot Com",
RedirectUrl: "https://m3o.com",
Subject: "Email verification",
TextContent: `Hi there,
Please verify your email by clicking this link: $micro_verification_link`,
})
fmt.Println(rsp, err)
} }
``` ```
## ResetPassword ## ResetPassword
@@ -149,35 +196,6 @@ NewPassword: "NewPassword1",
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
}
```
## VerifyEmail
Verify the email address of an account from a token sent in an email to the user.
[https://m3o.com/user/api#VerifyEmail](https://m3o.com/user/api#VerifyEmail)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Verify the email address of an account from a token sent in an email to the user.
func VerifyEmail() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.VerifyEmail(&user.VerifyEmailRequest{
Email: "joe@example.com",
Token: "012345",
})
fmt.Println(rsp, err)
} }
``` ```
## Delete ## Delete
@@ -206,37 +224,6 @@ func DeleteUserAccount() {
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
}
```
## Login
Login using username or email. The response will return a new session for successful login,
401 in the case of login failure and 500 for any other error
[https://m3o.com/user/api#Login](https://m3o.com/user/api#Login)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Login using username or email. The response will return a new session for successful login,
// 401 in the case of login failure and 500 for any other error
func LogAuserIn() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.Login(&user.LoginRequest{
Email: "joe@example.com",
Password: "Password1",
})
fmt.Println(rsp, err)
} }
``` ```
## List ## List
@@ -380,53 +367,6 @@ func ReadAccountByEmail() {
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
}
```
## SendVerificationEmail
Send a verification email
to the user being signed up. Email from will be from 'noreply@email.m3ocontent.com',
but you can provide the title and contents.
The verification link will be injected in to the email as a template variable, $micro_verification_link.
Example: 'Hi there, welcome onboard! Use the link below to verify your email: $micro_verification_link'
The variable will be replaced with an actual url that will look similar to this:
'https://user.m3o.com/user/verify?token=a-verification-token&redirectUrl=your-redir-url'
[https://m3o.com/user/api#SendVerificationEmail](https://m3o.com/user/api#SendVerificationEmail)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Send a verification email
// to the user being signed up. Email from will be from 'noreply@email.m3ocontent.com',
// but you can provide the title and contents.
// The verification link will be injected in to the email as a template variable, $micro_verification_link.
// Example: 'Hi there, welcome onboard! Use the link below to verify your email: $micro_verification_link'
// The variable will be replaced with an actual url that will look similar to this:
// 'https://user.m3o.com/user/verify?token=a-verification-token&redirectUrl=your-redir-url'
func SendVerificationEmail() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.SendVerificationEmail(&user.SendVerificationEmailRequest{
Email: "joe@example.com",
FailureRedirectUrl: "https://m3o.com/verification-failed",
FromName: "Awesome Dot Com",
RedirectUrl: "https://m3o.com",
Subject: "Email verification",
TextContent: `Hi there,
Please verify your email by clicking this link: $micro_verification_link`,
})
fmt.Println(rsp, err)
} }
``` ```
## SendPasswordResetEmail ## SendPasswordResetEmail
@@ -463,3 +403,63 @@ TextContent: `Hi there,
} }
``` ```
## VerifyEmail
Verify the email address of an account from a token sent in an email to the user.
[https://m3o.com/user/api#VerifyEmail](https://m3o.com/user/api#VerifyEmail)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Verify the email address of an account from a token sent in an email to the user.
func VerifyEmail() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.VerifyEmail(&user.VerifyEmailRequest{
Email: "joe@example.com",
Token: "012345",
})
fmt.Println(rsp, err)
}
```
## Login
Login using username or email. The response will return a new session for successful login,
401 in the case of login failure and 500 for any other error
[https://m3o.com/user/api#Login](https://m3o.com/user/api#Login)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Login using username or email. The response will return a new session for successful login,
// 401 in the case of login failure and 500 for any other error
func LogAuserIn() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.Login(&user.LoginRequest{
Email: "joe@example.com",
Password: "Password1",
})
fmt.Println(rsp, err)
}
```

View File

@@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Weather/api](h
Endpoints: Endpoints:
## Now
Get the current weather report for a location by postcode, city, zip code, ip address
[https://m3o.com/weather/api#Now](https://m3o.com/weather/api#Now)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/weather"
)
// Get the current weather report for a location by postcode, city, zip code, ip address
func GetCurrentWeather() {
weatherService := weather.NewWeatherService(os.Getenv("M3O_API_TOKEN"))
rsp, err := weatherService.Now(&weather.NowRequest{
Location: "london",
})
fmt.Println(rsp, err)
}
```
## Forecast ## Forecast
Get the weather forecast for the next 1-10 days Get the weather forecast for the next 1-10 days
@@ -33,31 +61,3 @@ Location: "London",
} }
``` ```
## Now
Get the current weather report for a location by postcode, city, zip code, ip address
[https://m3o.com/weather/api#Now](https://m3o.com/weather/api#Now)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/weather"
)
// Get the current weather report for a location by postcode, city, zip code, ip address
func GetCurrentWeather() {
weatherService := weather.NewWeatherService(os.Getenv("M3O_API_TOKEN"))
rsp, err := weatherService.Now(&weather.NowRequest{
Location: "london",
})
fmt.Println(rsp, err)
}
```

View File

@@ -81,9 +81,9 @@ type QuoteRequest struct {
type QuoteResponse struct { type QuoteResponse struct {
// the asking price // the asking price
AskPrice float64 `json:"askPrice"` AskPrice float64 `json:"ask_price"`
// the bidding price // the bidding price
BidPrice float64 `json:"bidPrice"` BidPrice float64 `json:"bid_price"`
// the forex symbol // the forex symbol
Symbol string `json:"symbol"` Symbol string `json:"symbol"`
// the UTC timestamp of the quote // the UTC timestamp of the quote

View File

@@ -83,7 +83,7 @@ type DeployRequest struct {
// if not provided, defaults to the name parameter // if not provided, defaults to the name parameter
Entrypoint string `json:"entrypoint"` Entrypoint string `json:"entrypoint"`
// environment variables to pass in at runtime // environment variables to pass in at runtime
EnvVars map[string]string `json:"envVars"` EnvVars map[string]string `json:"env_vars"`
// function name // function name
Name string `json:"name"` Name string `json:"name"`
// project is used for namespacing your functions // project is used for namespacing your functions
@@ -120,7 +120,7 @@ type DescribeResponse struct {
// The timeout for requests to the function // The timeout for requests to the function
Timeout string `json:"timeout"` Timeout string `json:"timeout"`
// The time at which the function was updated // The time at which the function was updated
UpdatedAt string `json:"updatedAt"` UpdatedAt string `json:"updated_at"`
} }
type Func struct { type Func struct {

View File

@@ -35,8 +35,8 @@ func (t *GeocodingService) Reverse(request *ReverseRequest) (*ReverseResponse, e
type Address struct { type Address struct {
City string `json:"city"` City string `json:"city"`
Country string `json:"country"` Country string `json:"country"`
LineOne string `json:"lineOne"` LineOne string `json:"line_one"`
LineTwo string `json:"lineTwo"` LineTwo string `json:"line_two"`
Postcode string `json:"postcode"` Postcode string `json:"postcode"`
} }

View File

@@ -26,7 +26,7 @@ func (t *GifsService) Search(request *SearchRequest) (*SearchResponse, error) {
type Gif struct { type Gif struct {
// URL used for embedding the GIF // URL used for embedding the GIF
EmbedUrl string `json:"embedUrl"` EmbedUrl string `json:"embed_url"`
// The ID of the GIF // The ID of the GIF
Id string `json:"id"` Id string `json:"id"`
// The different formats available for this GIF // The different formats available for this GIF
@@ -34,7 +34,7 @@ type Gif struct {
// The content rating for the GIF // The content rating for the GIF
Rating string `json:"rating"` Rating string `json:"rating"`
// A short URL for this GIF // A short URL for this GIF
ShortUrl string `json:"shortUrl"` ShortUrl string `json:"short_url"`
// The slug used in the GIF's URL // The slug used in the GIF's URL
Slug string `json:"slug"` Slug string `json:"slug"`
// The page on which this GIF was found // The page on which this GIF was found
@@ -49,17 +49,17 @@ type ImageFormat struct {
// height // height
Height int32 `json:"height"` Height int32 `json:"height"`
// size of the MP4 version // size of the MP4 version
Mp4size int32 `json:"mp4size"` Mp4Size int32 `json:"mp4_size"`
// URL to an MP4 version of the gif // URL to an MP4 version of the gif
Mp4url string `json:"mp4url"` Mp4Url string `json:"mp4_url"`
// size in bytes // size in bytes
Size int32 `json:"size"` Size int32 `json:"size"`
// URL of the gif // URL of the gif
Url string `json:"url"` Url string `json:"url"`
// size of the webp version // size of the webp version
WebpSize int32 `json:"webpSize"` WebpSize int32 `json:"webp_size"`
// URL to a webp version of the gif // URL to a webp version of the gif
WebpUrl string `json:"webpUrl"` WebpUrl string `json:"webp_url"`
// width // width
Width int32 `json:"width"` Width int32 `json:"width"`
} }
@@ -68,43 +68,43 @@ type ImageFormats struct {
// A downsized version of the GIF < 2MB // A downsized version of the GIF < 2MB
Downsized *ImageFormat `json:"downsized"` Downsized *ImageFormat `json:"downsized"`
// A downsized version of the GIF < 8MB // A downsized version of the GIF < 8MB
DownsizedLarge *ImageFormat `json:"downsizedLarge"` DownsizedLarge *ImageFormat `json:"downsized_large"`
// A downsized version of the GIF < 5MB // A downsized version of the GIF < 5MB
DownsizedMedium *ImageFormat `json:"downsizedMedium"` DownsizedMedium *ImageFormat `json:"downsized_medium"`
// A downsized version of the GIF < 200kb // A downsized version of the GIF < 200kb
DownsizedSmall *ImageFormat `json:"downsizedSmall"` DownsizedSmall *ImageFormat `json:"downsized_small"`
// Static image of the downsized version of the GIF // Static image of the downsized version of the GIF
DownsizedStill *ImageFormat `json:"downsizedStill"` DownsizedStill *ImageFormat `json:"downsized_still"`
// Version of the GIF with fixed height of 200 pixels. Good for mobile use // Version of the GIF with fixed height of 200 pixels. Good for mobile use
FixedHeight *ImageFormat `json:"fixedHeight"` FixedHeight *ImageFormat `json:"fixed_height"`
// Version of the GIF with fixed height of 200 pixels and number of frames reduced to 6 // Version of the GIF with fixed height of 200 pixels and number of frames reduced to 6
FixedHeightDownsampled *ImageFormat `json:"fixedHeightDownsampled"` FixedHeightDownsampled *ImageFormat `json:"fixed_height_downsampled"`
// Version of the GIF with fixed height of 100 pixels. Good for mobile keyboards // Version of the GIF with fixed height of 100 pixels. Good for mobile keyboards
FixedHeightSmall *ImageFormat `json:"fixedHeightSmall"` FixedHeightSmall *ImageFormat `json:"fixed_height_small"`
// Static image of the GIF with fixed height of 100 pixels // Static image of the GIF with fixed height of 100 pixels
FixedHeightSmallStill *ImageFormat `json:"fixedHeightSmallStill"` FixedHeightSmallStill *ImageFormat `json:"fixed_height_small_still"`
// Static image of the GIF with fixed height of 200 pixels // Static image of the GIF with fixed height of 200 pixels
FixedHeightStill *ImageFormat `json:"fixedHeightStill"` FixedHeightStill *ImageFormat `json:"fixed_height_still"`
// Version of the GIF with fixed width of 200 pixels. Good for mobile use // Version of the GIF with fixed width of 200 pixels. Good for mobile use
FixedWidth *ImageFormat `json:"fixedWidth"` FixedWidth *ImageFormat `json:"fixed_width"`
// Version of the GIF with fixed width of 200 pixels and number of frames reduced to 6 // Version of the GIF with fixed width of 200 pixels and number of frames reduced to 6
FixedWidthDownsampled *ImageFormat `json:"fixedWidthDownsampled"` FixedWidthDownsampled *ImageFormat `json:"fixed_width_downsampled"`
// Version of the GIF with fixed width of 100 pixels. Good for mobile keyboards // Version of the GIF with fixed width of 100 pixels. Good for mobile keyboards
FixedWidthSmall *ImageFormat `json:"fixedWidthSmall"` FixedWidthSmall *ImageFormat `json:"fixed_width_small"`
// Static image of the GIF with fixed width of 100 pixels // Static image of the GIF with fixed width of 100 pixels
FixedWidthSmallStill *ImageFormat `json:"fixedWidthSmallStill"` FixedWidthSmallStill *ImageFormat `json:"fixed_width_small_still"`
// Static image of the GIF with fixed width of 200 pixels // Static image of the GIF with fixed width of 200 pixels
FixedWidthStill *ImageFormat `json:"fixedWidthStill"` FixedWidthStill *ImageFormat `json:"fixed_width_still"`
// 15 second version of the GIF looping // 15 second version of the GIF looping
Looping *ImageFormat `json:"looping"` Looping *ImageFormat `json:"looping"`
// The original GIF. Good for desktop use // The original GIF. Good for desktop use
Original *ImageFormat `json:"original"` Original *ImageFormat `json:"original"`
// Static image of the original version of the GIF // Static image of the original version of the GIF
OriginalStill *ImageFormat `json:"originalStill"` OriginalStill *ImageFormat `json:"original_still"`
// mp4 version of the GIF <50kb displaying first 1-2 secs // mp4 version of the GIF <50kb displaying first 1-2 secs
Preview *ImageFormat `json:"preview"` Preview *ImageFormat `json:"preview"`
// Version of the GIF <50kb displaying first 1-2 secs // Version of the GIF <50kb displaying first 1-2 secs
PreviewGif *ImageFormat `json:"previewGif"` PreviewGif *ImageFormat `json:"preview_gif"`
} }
type Pagination struct { type Pagination struct {
@@ -113,7 +113,7 @@ type Pagination struct {
// position in pagination // position in pagination
Offset int32 `json:"offset"` Offset int32 `json:"offset"`
// total number of results available // total number of results available
TotalCount int32 `json:"totalCount"` TotalCount int32 `json:"total_count"`
} }
type SearchRequest struct { type SearchRequest struct {

View File

@@ -36,7 +36,7 @@ type SearchResponse struct {
type SearchResult struct { type SearchResult struct {
// abridged version of this search results URL, e.g. www.exampe.com // abridged version of this search results URL, e.g. www.exampe.com
DisplayUrl string `json:"displayUrl"` DisplayUrl string `json:"display_url"`
// id of the result // id of the result
Id string `json:"id"` Id string `json:"id"`
// kind of result; "search" // kind of result; "search"

View File

@@ -48,11 +48,11 @@ type Country struct {
type Holiday struct { type Holiday struct {
// the country this holiday occurs in // the country this holiday occurs in
CountryCode string `json:"countryCode"` CountryCode string `json:"country_code"`
// date of the holiday in yyyy-mm-dd format // date of the holiday in yyyy-mm-dd format
Date string `json:"date"` Date string `json:"date"`
// the local name of the holiday // the local name of the holiday
LocalName string `json:"localName"` LocalName string `json:"local_name"`
// the name of the holiday in English // the name of the holiday in English
Name string `json:"name"` Name string `json:"name"`
// the regions within the country that observe this holiday (if not all of them) // the regions within the country that observe this holiday (if not all of them)
@@ -63,7 +63,7 @@ type Holiday struct {
type ListRequest struct { type ListRequest struct {
// The 2 letter country code (as defined in ISO 3166-1 alpha-2) // The 2 letter country code (as defined in ISO 3166-1 alpha-2)
CountryCode string `json:"countryCode"` CountryCode string `json:"country_code"`
// The year to list holidays for // The year to list holidays for
Year int64 `json:"year,string"` Year int64 `json:"year,string"`
} }

View File

@@ -66,7 +66,7 @@ type ConvertRequest struct {
// output name of the image including extension, ie. "cat.png" // output name of the image including extension, ie. "cat.png"
Name string `json:"name"` Name string `json:"name"`
// make output a URL and not a base64 response // make output a URL and not a base64 response
OutputUrl bool `json:"outputUrl"` OutputUrl bool `json:"outputURL"`
// url of the image to resize // url of the image to resize
Url string `json:"url"` Url string `json:"url"`
} }
@@ -119,7 +119,7 @@ type ResizeRequest struct {
// output name of the image including extension, ie. "cat.png" // output name of the image including extension, ie. "cat.png"
Name string `json:"name"` Name string `json:"name"`
// make output a URL and not a base64 response // make output a URL and not a base64 response
OutputUrl bool `json:"outputUrl"` OutputUrl bool `json:"outputURL"`
// url of the image to resize // url of the image to resize
Url string `json:"url"` Url string `json:"url"`
Width int64 `json:"width,string"` Width int64 `json:"width,string"`

View File

@@ -52,9 +52,9 @@ func (t *QuranService) Verses(request *VersesRequest) (*VersesResponse, error) {
type Chapter struct { type Chapter struct {
// The arabic name of the chapter // The arabic name of the chapter
ArabicName string `json:"arabicName"` ArabicName string `json:"arabic_name"`
// The complex name of the chapter // The complex name of the chapter
ComplexName string `json:"complexName"` ComplexName string `json:"complex_name"`
// The id of the chapter as a number e.g 1 // The id of the chapter as a number e.g 1
Id int32 `json:"id"` Id int32 `json:"id"`
// The simple name of the chapter // The simple name of the chapter
@@ -62,13 +62,13 @@ type Chapter struct {
// The pages from and to e.g 1, 1 // The pages from and to e.g 1, 1
Pages []int32 `json:"pages"` Pages []int32 `json:"pages"`
// Should the chapter start with bismillah // Should the chapter start with bismillah
PrefixBismillah bool `json:"prefixBismillah"` PrefixBismillah bool `json:"prefix_bismillah"`
// The order in which it was revealed // The order in which it was revealed
RevelationOrder int32 `json:"revelationOrder"` RevelationOrder int32 `json:"revelation_order"`
// The place of revelation // The place of revelation
RevelationPlace string `json:"revelationPlace"` RevelationPlace string `json:"revelation_place"`
// The translated name // The translated name
TranslatedName string `json:"translatedName"` TranslatedName string `json:"translated_name"`
// The number of verses in the chapter // The number of verses in the chapter
Verses int32 `json:"verses"` Verses int32 `json:"verses"`
} }
@@ -97,9 +97,9 @@ type Result struct {
// The related translations to the text // The related translations to the text
Translations []Translation `json:"translations"` Translations []Translation `json:"translations"`
// The unique verse id across the Quran // The unique verse id across the Quran
VerseId int32 `json:"verseId"` VerseId int32 `json:"verse_id"`
// The verse key e.g 1:1 // The verse key e.g 1:1
VerseKey string `json:"verseKey"` VerseKey string `json:"verse_key"`
} }
type SearchRequest struct { type SearchRequest struct {
@@ -121,9 +121,9 @@ type SearchResponse struct {
// The results for the query // The results for the query
Results []Result `json:"results"` Results []Result `json:"results"`
// The total pages // The total pages
TotalPages int32 `json:"totalPages"` TotalPages int32 `json:"total_pages"`
// The total results returned // The total results returned
TotalResults int32 `json:"totalResults"` TotalResults int32 `json:"total_results"`
} }
type SummaryRequest struct { type SummaryRequest struct {
@@ -167,7 +167,7 @@ type Verse struct {
// The arabic text for this verse // The arabic text for this verse
Text string `json:"text"` Text string `json:"text"`
// The basic translation of the verse // The basic translation of the verse
TranslatedText string `json:"translatedText"` TranslatedText string `json:"translated_text"`
// The alternative translations for the verse // The alternative translations for the verse
Translations []Translation `json:"translations"` Translations []Translation `json:"translations"`
// The phonetic transliteration from arabic // The phonetic transliteration from arabic
@@ -199,14 +199,14 @@ type VersesResponse struct {
// The page requested // The page requested
Page int32 `json:"page"` Page int32 `json:"page"`
// The total pages // The total pages
TotalPages int32 `json:"totalPages"` TotalPages int32 `json:"total_pages"`
// The verses on the page // The verses on the page
Verses []Verse `json:"verses"` Verses []Verse `json:"verses"`
} }
type Word struct { type Word struct {
// The character type e.g word, end // The character type e.g word, end
CharType string `json:"charType"` CharType string `json:"char_type"`
// The QCF v2 font code // The QCF v2 font code
Code string `json:"code"` Code string `json:"code"`
// The id of the word within the verse // The id of the word within the verse

View File

@@ -98,8 +98,8 @@ type Intersection struct {
type Maneuver struct { type Maneuver struct {
Action string `json:"action"` Action string `json:"action"`
BearingAfter float64 `json:"bearingAfter"` BearingAfter float64 `json:"bearing_after"`
BearingBefore float64 `json:"bearingBefore"` BearingBefore float64 `json:"bearing_before"`
Direction string `json:"direction"` Direction string `json:"direction"`
Location *Point `json:"location"` Location *Point `json:"location"`
} }

View File

@@ -26,15 +26,15 @@ func (t *SpamService) Classify(request *ClassifyRequest) (*ClassifyResponse, err
type ClassifyRequest struct { type ClassifyRequest struct {
// The raw body of the email including headers etc per RFC 822. Alternatively, use the other parameters to correctly format the message // The raw body of the email including headers etc per RFC 822. Alternatively, use the other parameters to correctly format the message
EmailBody string `json:"emailBody"` EmailBody string `json:"email_body"`
// The email address it has been sent from // The email address it has been sent from
From string `json:"from"` From string `json:"from"`
// the HTML version of the email body // the HTML version of the email body
HtmlBody string `json:"htmlBody"` HtmlBody string `json:"html_body"`
// The subject of the email // The subject of the email
Subject string `json:"subject"` Subject string `json:"subject"`
// the plain text version of the email body // the plain text version of the email body
TextBody string `json:"textBody"` TextBody string `json:"text_body"`
// The email address it is being sent to // The email address it is being sent to
To string `json:"to"` To string `json:"to"`
} }
@@ -43,7 +43,7 @@ type ClassifyResponse struct {
// The rules that have contributed to this score // The rules that have contributed to this score
Details []string `json:"details"` Details []string `json:"details"`
// Is it spam? Returns true if its score is > 5 // Is it spam? Returns true if its score is > 5
IsSpam bool `json:"isSpam"` IsSpam bool `json:"is_spam"`
// The score evaluated for this email. A higher number means it is more likely to be spam // The score evaluated for this email. A higher number means it is more likely to be spam
Score float64 `json:"score"` Score float64 `json:"score"`
} }

View File

@@ -74,13 +74,13 @@ type HistoryResponse struct {
type Order struct { type Order struct {
// the asking price // the asking price
AskPrice float64 `json:"askPrice"` AskPrice float64 `json:"ask_price"`
// the ask size // the ask size
AskSize int32 `json:"askSize"` AskSize int32 `json:"ask_size"`
// the bidding price // the bidding price
BidPrice float64 `json:"bidPrice"` BidPrice float64 `json:"bid_price"`
// the bid size // the bid size
BidSize int32 `json:"bidSize"` BidSize int32 `json:"bid_size"`
// the UTC timestamp of the quote // the UTC timestamp of the quote
Timestamp string `json:"timestamp"` Timestamp string `json:"timestamp"`
} }
@@ -126,13 +126,13 @@ type QuoteRequest struct {
type QuoteResponse struct { type QuoteResponse struct {
// the asking price // the asking price
AskPrice float64 `json:"askPrice"` AskPrice float64 `json:"ask_price"`
// the ask size // the ask size
AskSize int32 `json:"askSize"` AskSize int32 `json:"ask_size"`
// the bidding price // the bidding price
BidPrice float64 `json:"bidPrice"` BidPrice float64 `json:"bid_price"`
// the bid size // the bid size
BidSize int32 `json:"bidSize"` BidSize int32 `json:"bid_size"`
// the stock symbol // the stock symbol
Symbol string `json:"symbol"` Symbol string `json:"symbol"`
// the UTC timestamp of the quote // the UTC timestamp of the quote

View File

@@ -53,7 +53,7 @@ type Channel struct {
// description for the channel // description for the channel
Description string `json:"description"` Description string `json:"description"`
// last activity time // last activity time
LastActive string `json:"lastActive"` LastActive string `json:"last_active"`
// name of the channel // name of the channel
Name string `json:"name"` Name string `json:"name"`
} }

View File

@@ -53,7 +53,7 @@ func (t *SunnahService) Hadiths(request *HadithsRequest) (*HadithsResponse, erro
type Book struct { type Book struct {
// arabic name of the book // arabic name of the book
ArabicName string `json:"arabicName"` ArabicName string `json:"arabic_name"`
// number of hadiths in the book // number of hadiths in the book
Hadiths int32 `json:"hadiths"` Hadiths int32 `json:"hadiths"`
// number of the book e.g 1 // number of the book e.g 1
@@ -86,7 +86,7 @@ type BooksResponse struct {
type Chapter struct { type Chapter struct {
// arabic title // arabic title
ArabicTitle string `json:"arabicTitle"` ArabicTitle string `json:"arabic_title"`
// the book number // the book number
Book int32 `json:"book"` Book int32 `json:"book"`
// the chapter id e.g 1 // the chapter id e.g 1
@@ -125,7 +125,7 @@ type ChaptersResponse struct {
type Collection struct { type Collection struct {
// Arabic title if available // Arabic title if available
ArabicTitle string `json:"arabicTitle"` ArabicTitle string `json:"arabic_title"`
// Total hadiths in the collection // Total hadiths in the collection
Hadiths int32 `json:"hadiths"` Hadiths int32 `json:"hadiths"`
// Name of the collection e.g bukhari // Name of the collection e.g bukhari
@@ -149,15 +149,15 @@ type CollectionsResponse struct {
type Hadith struct { type Hadith struct {
// the arabic chapter title // the arabic chapter title
ArabicChapterTitle string `json:"arabicChapterTitle"` ArabicChapterTitle string `json:"arabic_chapter_title"`
// the arabic text // the arabic text
ArabicText string `json:"arabicText"` ArabicText string `json:"arabic_text"`
// the chapter id // the chapter id
Chapter int32 `json:"chapter"` Chapter int32 `json:"chapter"`
// the chapter key // the chapter key
ChapterKey string `json:"chapterKey"` ChapterKey string `json:"chapter_key"`
// the chapter title // the chapter title
ChapterTitle string `json:"chapterTitle"` ChapterTitle string `json:"chapter_title"`
// hadith id // hadith id
Id int32 `json:"id"` Id int32 `json:"id"`
// hadith text // hadith text

View File

@@ -33,5 +33,5 @@ type ScreenshotRequest struct {
} }
type ScreenshotResponse struct { type ScreenshotResponse struct {
ImageUrl string `json:"imageUrl"` ImageUrl string `json:"imageURL"`
} }

View File

@@ -50,7 +50,7 @@ func (t *TwitterService) User(request *UserRequest) (*UserResponse, error) {
type Profile struct { type Profile struct {
// the account creation date // the account creation date
CreatedAt string `json:"createdAt"` CreatedAt string `json:"created_at"`
// the user description // the user description
Description string `json:"description"` Description string `json:"description"`
// the follower count // the follower count
@@ -58,7 +58,7 @@ type Profile struct {
// the user id // the user id
Id int64 `json:"id,string"` Id int64 `json:"id,string"`
// The user's profile picture // The user's profile picture
ImageUrl string `json:"imageUrl"` ImageUrl string `json:"image_url"`
// the user's location // the user's location
Location string `json:"location"` Location string `json:"location"`
// display name of the user // display name of the user
@@ -99,7 +99,7 @@ type Trend struct {
// name of the trend // name of the trend
Name string `json:"name"` Name string `json:"name"`
// the volume of tweets in last 24 hours // the volume of tweets in last 24 hours
TweetVolume int64 `json:"tweetVolume,string"` TweetVolume int64 `json:"tweet_volume,string"`
// the twitter url // the twitter url
Url string `json:"url"` Url string `json:"url"`
} }
@@ -114,13 +114,13 @@ type TrendsResponse struct {
type Tweet struct { type Tweet struct {
// time of tweet // time of tweet
CreatedAt string `json:"createdAt"` CreatedAt string `json:"created_at"`
// number of times favourited // number of times favourited
FavouritedCount int64 `json:"favouritedCount,string"` FavouritedCount int64 `json:"favourited_count,string"`
// id of the tweet // id of the tweet
Id int64 `json:"id,string"` Id int64 `json:"id,string"`
// number of times retweeted // number of times retweeted
RetweetedCount int64 `json:"retweetedCount,string"` RetweetedCount int64 `json:"retweeted_count,string"`
// text of the tweet // text of the tweet
Text string `json:"text"` Text string `json:"text"`
// username of the person who tweeted // username of the person who tweeted

View File

@@ -42,7 +42,7 @@ func (t *UrlService) Shorten(request *ShortenRequest) (*ShortenResponse, error)
type ListRequest struct { type ListRequest struct {
// filter by short URL, optional // filter by short URL, optional
ShortUrl string `json:"shortUrl"` ShortUrl string `json:"shortURL"`
} }
type ListResponse struct { type ListResponse struct {
@@ -52,28 +52,28 @@ type ListResponse struct {
type ProxyRequest struct { type ProxyRequest struct {
// short url ID, without the domain, eg. if your short URL is // short url ID, without the domain, eg. if your short URL is
// `m3o.one/u/someshorturlid` then pass in `someshorturlid` // `m3o.one/u/someshorturlid` then pass in `someshorturlid`
ShortUrl string `json:"shortUrl"` ShortUrl string `json:"shortURL"`
} }
type ProxyResponse struct { type ProxyResponse struct {
DestinationUrl string `json:"destinationUrl"` DestinationUrl string `json:"destinationURL"`
} }
type ShortenRequest struct { type ShortenRequest struct {
DestinationUrl string `json:"destinationUrl"` DestinationUrl string `json:"destinationURL"`
} }
type ShortenResponse struct { type ShortenResponse struct {
ShortUrl string `json:"shortUrl"` ShortUrl string `json:"shortURL"`
} }
type URLPair struct { type URLPair struct {
Created int64 `json:"created,string"` Created int64 `json:"created,string"`
DestinationUrl string `json:"destinationUrl"` DestinationUrl string `json:"destinationURL"`
// HitCount keeps track many times the short URL has been resolved. // HitCount keeps track many times the short URL has been resolved.
// Hitcount only gets saved to disk (database) after every 10th hit, so // Hitcount only gets saved to disk (database) after every 10th hit, so
// its not intended to be 100% accurate, more like an almost correct estimate. // its not intended to be 100% accurate, more like an almost correct estimate.
HitCount int64 `json:"hitCount,string"` HitCount int64 `json:"hitCount,string"`
Owner string `json:"owner"` Owner string `json:"owner"`
ShortUrl string `json:"shortUrl"` ShortUrl string `json:"shortURL"`
} }

View File

@@ -287,7 +287,7 @@ type Session struct {
type UpdatePasswordRequest struct { type UpdatePasswordRequest struct {
// confirm new password // confirm new password
ConfirmPassword string `json:"confirmPassword"` ConfirmPassword string `json:"confirm_password"`
// the new password // the new password
NewPassword string `json:"newPassword"` NewPassword string `json:"newPassword"`
// the old password // the old password

View File

@@ -31,33 +31,33 @@ type LookupRequest struct {
type LookupResponse struct { type LookupResponse struct {
// co2 emmissions // co2 emmissions
Co2emissions float64 `json:"co2emissions"` Co2Emissions float64 `json:"co2_emissions"`
// colour of vehicle // colour of vehicle
Colour string `json:"colour"` Colour string `json:"colour"`
// engine capacity // engine capacity
EngineCapacity int32 `json:"engineCapacity"` EngineCapacity int32 `json:"engine_capacity"`
// fuel type e.g petrol, diesel // fuel type e.g petrol, diesel
FuelType string `json:"fuelType"` FuelType string `json:"fuel_type"`
// date of last v5 issue // date of last v5 issue
LastV5issued string `json:"lastV5issued"` LastV5Issued string `json:"last_v5_issued"`
// make of vehicle // make of vehicle
Make string `json:"make"` Make string `json:"make"`
// month of first registration // month of first registration
MonthOfFirstRegistration string `json:"monthOfFirstRegistration"` MonthOfFirstRegistration string `json:"month_of_first_registration"`
// mot expiry // mot expiry
MotExpiry string `json:"motExpiry"` MotExpiry string `json:"mot_expiry"`
// mot status // mot status
MotStatus string `json:"motStatus"` MotStatus string `json:"mot_status"`
// registration number // registration number
Registration string `json:"registration"` Registration string `json:"registration"`
// tax due data // tax due data
TaxDueDate string `json:"taxDueDate"` TaxDueDate string `json:"tax_due_date"`
// tax status // tax status
TaxStatus string `json:"taxStatus"` TaxStatus string `json:"tax_status"`
// type approvale // type approvale
TypeApproval string `json:"typeApproval"` TypeApproval string `json:"type_approval"`
// wheel plan // wheel plan
Wheelplan string `json:"wheelplan"` Wheelplan string `json:"wheelplan"`
// year of manufacture // year of manufacture
YearOfManufacture int32 `json:"yearOfManufacture"` YearOfManufacture int32 `json:"year_of_manufacture"`
} }

View File

@@ -34,31 +34,31 @@ func (t *WeatherService) Now(request *NowRequest) (*NowResponse, error) {
type Forecast struct { type Forecast struct {
// the average temp in celsius // the average temp in celsius
AvgTempC float64 `json:"avgTempC"` AvgTempC float64 `json:"avg_temp_c"`
// the average temp in fahrenheit // the average temp in fahrenheit
AvgTempF float64 `json:"avgTempF"` AvgTempF float64 `json:"avg_temp_f"`
// chance of rain (percentage) // chance of rain (percentage)
ChanceOfRain int32 `json:"chanceOfRain"` ChanceOfRain int32 `json:"chance_of_rain"`
// forecast condition // forecast condition
Condition string `json:"condition"` Condition string `json:"condition"`
// date of the forecast // date of the forecast
Date string `json:"date"` Date string `json:"date"`
// the URL of forecast condition icon. Simply prefix with either http or https to use it // the URL of forecast condition icon. Simply prefix with either http or https to use it
IconUrl string `json:"iconUrl"` IconUrl string `json:"icon_url"`
// max temp in celsius // max temp in celsius
MaxTempC float64 `json:"maxTempC"` MaxTempC float64 `json:"max_temp_c"`
// max temp in fahrenheit // max temp in fahrenheit
MaxTempF float64 `json:"maxTempF"` MaxTempF float64 `json:"max_temp_f"`
// minimum temp in celsius // minimum temp in celsius
MinTempC float64 `json:"minTempC"` MinTempC float64 `json:"min_temp_c"`
// minimum temp in fahrenheit // minimum temp in fahrenheit
MinTempF float64 `json:"minTempF"` MinTempF float64 `json:"min_temp_f"`
// time of sunrise // time of sunrise
Sunrise string `json:"sunrise"` Sunrise string `json:"sunrise"`
// time of sunset // time of sunset
Sunset string `json:"sunset"` Sunset string `json:"sunset"`
// will it rain // will it rain
WillItRain bool `json:"willItRain"` WillItRain bool `json:"will_it_rain"`
} }
type ForecastRequest struct { type ForecastRequest struct {
@@ -76,7 +76,7 @@ type ForecastResponse struct {
// e.g 37.55 // e.g 37.55
Latitude float64 `json:"latitude"` Latitude float64 `json:"latitude"`
// the local time // the local time
LocalTime string `json:"localTime"` LocalTime string `json:"local_time"`
// location of the request // location of the request
Location string `json:"location"` Location string `json:"location"`
// e.g -77.46 // e.g -77.46
@@ -102,17 +102,17 @@ type NowResponse struct {
// whether its daytime // whether its daytime
Daytime bool `json:"daytime"` Daytime bool `json:"daytime"`
// feels like in celsius // feels like in celsius
FeelsLikeC float64 `json:"feelsLikeC"` FeelsLikeC float64 `json:"feels_like_c"`
// feels like in fahrenheit // feels like in fahrenheit
FeelsLikeF float64 `json:"feelsLikeF"` FeelsLikeF float64 `json:"feels_like_f"`
// the humidity percentage // the humidity percentage
Humidity int32 `json:"humidity"` Humidity int32 `json:"humidity"`
// the URL of the related icon. Simply prefix with either http or https to use it // the URL of the related icon. Simply prefix with either http or https to use it
IconUrl string `json:"iconUrl"` IconUrl string `json:"icon_url"`
// e.g 37.55 // e.g 37.55
Latitude float64 `json:"latitude"` Latitude float64 `json:"latitude"`
// the local time // the local time
LocalTime string `json:"localTime"` LocalTime string `json:"local_time"`
// location of the request // location of the request
Location string `json:"location"` Location string `json:"location"`
// e.g -77.46 // e.g -77.46
@@ -120,17 +120,17 @@ type NowResponse struct {
// region related to the location // region related to the location
Region string `json:"region"` Region string `json:"region"`
// temperature in celsius // temperature in celsius
TempC float64 `json:"tempC"` TempC float64 `json:"temp_c"`
// temperature in fahrenheit // temperature in fahrenheit
TempF float64 `json:"tempF"` TempF float64 `json:"temp_f"`
// timezone of the location // timezone of the location
Timezone string `json:"timezone"` Timezone string `json:"timezone"`
// wind degree // wind degree
WindDegree int32 `json:"windDegree"` WindDegree int32 `json:"wind_degree"`
// wind direction // wind direction
WindDirection string `json:"windDirection"` WindDirection string `json:"wind_direction"`
// wind in kph // wind in kph
WindKph float64 `json:"windKph"` WindKph float64 `json:"wind_kph"`
// wind in mph // wind in mph
WindMph float64 `json:"windMph"` WindMph float64 `json:"wind_mph"`
} }

View File

@@ -39,9 +39,9 @@ type SearchResult struct {
// none, upcoming, live, completed // none, upcoming, live, completed
Broadcasting string `json:"broadcasting"` Broadcasting string `json:"broadcasting"`
// the channel id // the channel id
ChannelId string `json:"channelId"` ChannelId string `json:"channel_id"`
// the channel title // the channel title
ChannelTitle string `json:"channelTitle"` ChannelTitle string `json:"channel_title"`
// the result description // the result description
Description string `json:"description"` Description string `json:"description"`
// id of the result // id of the result
@@ -49,7 +49,7 @@ type SearchResult struct {
// kind of result; "video", "channel", "playlist" // kind of result; "video", "channel", "playlist"
Kind string `json:"kind"` Kind string `json:"kind"`
// published at time // published at time
PublishedAt string `json:"publishedAt"` PublishedAt string `json:"published_at"`
// title of the result // title of the result
Title string `json:"title"` Title string `json:"title"`
// the associated url // the associated url