mirror of
https://github.com/kevin-DL/m3o-go.git
synced 2026-01-24 07:25:35 +00:00
Compare commits
128 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed691ec515 | ||
|
|
c2fb06ae73 | ||
|
|
3d54b046da | ||
|
|
d33dbbf317 | ||
|
|
77a58e78bd | ||
|
|
c18f47ca4c | ||
|
|
33398d3eb8 | ||
|
|
bb46995e2f | ||
|
|
9c534ced3d | ||
|
|
15c55dec36 | ||
|
|
fb13c684fd | ||
|
|
65c906fbdc | ||
|
|
c362c676b2 | ||
|
|
9702ed5306 | ||
|
|
afe052b320 | ||
|
|
a7879d3ff0 | ||
|
|
45d3c6a791 | ||
|
|
3760aaf9dd | ||
|
|
3953482915 | ||
|
|
9864b467b8 | ||
|
|
675871d282 | ||
|
|
3ac4947f91 | ||
|
|
3167558049 | ||
|
|
2958807fe2 | ||
|
|
8e553f6e16 | ||
|
|
bc769baed5 | ||
|
|
2ca79f5288 | ||
|
|
a22b8a3053 | ||
|
|
fd05c41d21 | ||
|
|
9bfc15e14a | ||
|
|
b522b298f3 | ||
|
|
14d247a66c | ||
|
|
ef2606dc60 | ||
|
|
be8f5aeae4 | ||
|
|
8dcea9e986 | ||
|
|
af0c644ac3 | ||
|
|
ebd60b1d5c | ||
|
|
38d4ff491f | ||
|
|
21395762be | ||
|
|
28a3532ecb | ||
|
|
7fec9491f1 | ||
|
|
ae8a49329f | ||
|
|
93af926271 | ||
|
|
40f0fb073d | ||
|
|
4c6a11492e | ||
|
|
e5f79370cd | ||
|
|
4e8f9de392 | ||
|
|
03b2b439e5 | ||
|
|
f1e6613177 | ||
|
|
ea7e43f6cd | ||
|
|
edd466a2f9 | ||
|
|
730ab1fa1e | ||
|
|
23dd049bf8 | ||
|
|
1947d31ee7 | ||
|
|
2b6719c9c6 | ||
|
|
00d34547f3 | ||
|
|
0f8436ce86 | ||
|
|
bb53f7cc48 | ||
|
|
9e5bed8e5a | ||
|
|
caac0f5355 | ||
|
|
5685e31a37 | ||
|
|
c43f57ce29 | ||
|
|
d9476960d4 | ||
|
|
3f583e059f | ||
|
|
bd1dcf3fed | ||
|
|
baff11e1d7 | ||
|
|
7c67ac14c2 | ||
|
|
fb8efda643 | ||
|
|
6fcd1d7028 | ||
|
|
02558a8f3f | ||
|
|
17f624b6a7 | ||
|
|
3f9d7cccf8 | ||
|
|
cb7f8b3403 | ||
|
|
072d96b1ca | ||
|
|
03a7225806 | ||
|
|
1083f55216 | ||
|
|
bd469033e2 | ||
|
|
b5f58efe8b | ||
|
|
018e87a593 | ||
|
|
07312f010e | ||
|
|
2321fde555 | ||
|
|
be676eff6c | ||
|
|
9dcc428a55 | ||
|
|
b6d8111005 | ||
|
|
1e54e284f6 | ||
|
|
d31fde4be4 | ||
|
|
d2adcc0208 | ||
|
|
956adcbced | ||
|
|
fab7b1892d | ||
|
|
7d037fe871 | ||
|
|
53a197a685 | ||
|
|
a7586670e6 | ||
|
|
2b5509db64 | ||
|
|
03a720c4d0 | ||
|
|
581945da61 | ||
|
|
d27ecddd94 | ||
|
|
034d9aa5ac | ||
|
|
328997c217 | ||
|
|
f87a55000e | ||
|
|
5ec5e88b61 | ||
|
|
d664134226 | ||
|
|
20bb0adb52 | ||
|
|
b32923c69c | ||
|
|
bb8552ac72 | ||
|
|
2e2264a045 | ||
|
|
8fbc04d515 | ||
|
|
6c77e113d7 | ||
|
|
be500e861e | ||
|
|
8217b63c9a | ||
|
|
5e75ed6f44 | ||
|
|
3ea4ec9b77 | ||
|
|
6715cd7575 | ||
|
|
36fa586811 | ||
|
|
f3c2a87ba8 | ||
|
|
48a07e015a | ||
|
|
2deeb0ca70 | ||
|
|
1305ec64f5 | ||
|
|
120c1cfe31 | ||
|
|
3c1c9769fb | ||
|
|
9404bd621a | ||
|
|
429d8543ba | ||
|
|
0515ac3485 | ||
|
|
36ebf2726c | ||
|
|
13eb3a674c | ||
|
|
b724299623 | ||
|
|
a2eea8e982 | ||
|
|
b36641e39e | ||
|
|
e9f001a53c |
@@ -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
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestBasicCall(t *testing.T) {
|
func TestBasicCall(t *testing.T) {
|
||||||
|
if v := os.Getenv("IN_TRAVIS"); v == "yes" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
response := map[string]interface{}{}
|
response := map[string]interface{}{}
|
||||||
if err := NewClient(&Options{
|
if err := NewClient(&Options{
|
||||||
Token: os.Getenv("TOKEN"),
|
Token: os.Getenv("TOKEN"),
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
52
db/db.go
52
db/db.go
@@ -40,6 +40,22 @@ func (t *DbService) Delete(request *DeleteRequest) (*DeleteResponse, error) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Drop a table in the DB
|
||||||
|
func (t *DbService) DropTable(request *DropTableRequest) (*DropTableResponse, error) {
|
||||||
|
|
||||||
|
rsp := &DropTableResponse{}
|
||||||
|
return rsp, t.client.Call("db", "DropTable", request, rsp)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// List tables in the DB
|
||||||
|
func (t *DbService) ListTables(request *ListTablesRequest) (*ListTablesResponse, error) {
|
||||||
|
|
||||||
|
rsp := &ListTablesResponse{}
|
||||||
|
return rsp, t.client.Call("db", "ListTables", request, rsp)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Read data from a table. Lookup can be by ID or via querying any field in the record.
|
// Read data from a table. Lookup can be by ID or via querying any field in the record.
|
||||||
func (t *DbService) Read(request *ReadRequest) (*ReadResponse, error) {
|
func (t *DbService) Read(request *ReadRequest) (*ReadResponse, error) {
|
||||||
|
|
||||||
@@ -48,6 +64,14 @@ func (t *DbService) Read(request *ReadRequest) (*ReadResponse, error) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rename a table
|
||||||
|
func (t *DbService) RenameTable(request *RenameTableRequest) (*RenameTableResponse, error) {
|
||||||
|
|
||||||
|
rsp := &RenameTableResponse{}
|
||||||
|
return rsp, t.client.Call("db", "RenameTable", request, rsp)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Truncate the records in a table
|
// Truncate the records in a table
|
||||||
func (t *DbService) Truncate(request *TruncateRequest) (*TruncateResponse, error) {
|
func (t *DbService) Truncate(request *TruncateRequest) (*TruncateResponse, error) {
|
||||||
|
|
||||||
@@ -96,6 +120,21 @@ type DeleteRequest struct {
|
|||||||
type DeleteResponse struct {
|
type DeleteResponse struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type DropTableRequest struct {
|
||||||
|
Table string `json:"table"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DropTableResponse struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type ListTablesRequest struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type ListTablesResponse struct {
|
||||||
|
// list of tables
|
||||||
|
Tables []string `json:"tables"`
|
||||||
|
}
|
||||||
|
|
||||||
type ReadRequest struct {
|
type ReadRequest struct {
|
||||||
// Read by id. Equivalent to 'id == "your-id"'
|
// Read by id. Equivalent to 'id == "your-id"'
|
||||||
Id string `json:"id"`
|
Id string `json:"id"`
|
||||||
@@ -122,14 +161,21 @@ type ReadResponse struct {
|
|||||||
Records []map[string]interface{} `json:"records"`
|
Records []map[string]interface{} `json:"records"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type RenameTableRequest struct {
|
||||||
|
// current table name
|
||||||
|
From string `json:"from"`
|
||||||
|
// new table name
|
||||||
|
To string `json:"to"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type RenameTableResponse struct {
|
||||||
|
}
|
||||||
|
|
||||||
type TruncateRequest struct {
|
type TruncateRequest struct {
|
||||||
// Optional table name. Defaults to 'default'
|
|
||||||
Table string `json:"table"`
|
Table string `json:"table"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type TruncateResponse struct {
|
type TruncateResponse struct {
|
||||||
// The table truncated
|
|
||||||
Table string `json:"table"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateRequest struct {
|
type UpdateRequest struct {
|
||||||
|
|||||||
@@ -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"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
114
examples/cache/README.md
vendored
114
examples/cache/README.md
vendored
@@ -4,6 +4,63 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Cache/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Set
|
||||||
|
|
||||||
|
Set an item in the cache. Overwrites any existing value already set.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/cache/api#Set](https://m3o.com/cache/api#Set)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/cache"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Set an item in the cache. Overwrites any existing value already set.
|
||||||
|
func SetAvalue() {
|
||||||
|
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := cacheService.Set(&cache.SetRequest{
|
||||||
|
Key: "foo",
|
||||||
|
Value: "bar",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Get
|
||||||
|
|
||||||
|
Get an item from the cache by key. If key is not found, an empty response is returned.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/cache/api#Get](https://m3o.com/cache/api#Get)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/cache"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get an item from the cache by key. If key is not found, an empty response is returned.
|
||||||
|
func GetAvalue() {
|
||||||
|
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := cacheService.Get(&cache.GetRequest{
|
||||||
|
Key: "foo",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Delete
|
## Delete
|
||||||
|
|
||||||
Delete a value from the cache. If key not found a success response is returned.
|
Delete a value from the cache. If key not found a success response is returned.
|
||||||
@@ -90,60 +147,3 @@ Value: 2,
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Set
|
|
||||||
|
|
||||||
Set an item in the cache. Overwrites any existing value already set.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/cache/api#Set](https://m3o.com/cache/api#Set)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/cache"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Set an item in the cache. Overwrites any existing value already set.
|
|
||||||
func SetAvalue() {
|
|
||||||
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := cacheService.Set(&cache.SetRequest{
|
|
||||||
Key: "foo",
|
|
||||||
Value: "bar",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Get
|
|
||||||
|
|
||||||
Get an item from the cache by key. If key is not found, an empty response is returned.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/cache/api#Get](https://m3o.com/cache/api#Get)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/cache"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Get an item from the cache by key. If key is not found, an empty response is returned.
|
|
||||||
func GetAvalue() {
|
|
||||||
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := cacheService.Get(&cache.GetRequest{
|
|
||||||
Key: "foo",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Crypto/api](ht
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Quote
|
||||||
|
|
||||||
|
Get the last quote for a given crypto ticker
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/crypto/api#Quote](https://m3o.com/crypto/api#Quote)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/crypto"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get the last quote for a given crypto ticker
|
||||||
|
func GetAcryptocurrencyQuote() {
|
||||||
|
cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := cryptoService.Quote(&crypto.QuoteRequest{
|
||||||
|
Symbol: "BTCUSD",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## History
|
## History
|
||||||
|
|
||||||
Returns the history for the previous close
|
Returns the history for the previous close
|
||||||
@@ -88,31 +116,3 @@ func GetCryptocurrencyPrice() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Quote
|
|
||||||
|
|
||||||
Get the last quote for a given crypto ticker
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/crypto/api#Quote](https://m3o.com/crypto/api#Quote)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/crypto"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Get the last quote for a given crypto ticker
|
|
||||||
func GetAcryptocurrencyQuote() {
|
|
||||||
cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := cryptoService.Quote(&crypto.QuoteRequest{
|
|
||||||
Symbol: "BTCUSD",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,40 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Db/api](https:
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## Create
|
|
||||||
|
|
||||||
Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/db/api#Create](https://m3o.com/db/api#Create)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/db"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
|
|
||||||
func CreateArecord() {
|
|
||||||
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := dbService.Create(&db.CreateRequest{
|
|
||||||
Record: map[string]interface{}{
|
|
||||||
"id": "1",
|
|
||||||
"name": "Jane",
|
|
||||||
"age": 42,
|
|
||||||
"isActive": true,
|
|
||||||
},
|
|
||||||
Table: "users",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Update
|
## Update
|
||||||
|
|
||||||
Update a record in the database. Include an "id" in the record to update.
|
Update a record in the database. Include an "id" in the record to update.
|
||||||
@@ -68,6 +34,69 @@ Table: "users",
|
|||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## RenameTable
|
||||||
|
|
||||||
|
Rename a table
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/db/api#RenameTable](https://m3o.com/db/api#RenameTable)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Rename a table
|
||||||
|
func RenameTable() {
|
||||||
|
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := dbService.RenameTable(&db.RenameTableRequest{
|
||||||
|
From: "events",
|
||||||
|
To: "events_backup",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Create
|
||||||
|
|
||||||
|
Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/db/api#Create](https://m3o.com/db/api#Create)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
|
||||||
|
func CreateArecord() {
|
||||||
|
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := dbService.Create(&db.CreateRequest{
|
||||||
|
Record: map[string]interface{}{
|
||||||
|
"isActive": true,
|
||||||
|
"id": "1",
|
||||||
|
"name": "Jane",
|
||||||
|
"age": 42,
|
||||||
|
},
|
||||||
|
Table: "users",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Read
|
## Read
|
||||||
@@ -154,6 +183,34 @@ func TruncateTable() {
|
|||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## DropTable
|
||||||
|
|
||||||
|
Drop a table in the DB
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/db/api#DropTable](https://m3o.com/db/api#DropTable)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Drop a table in the DB
|
||||||
|
func DropTable() {
|
||||||
|
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := dbService.DropTable(&db.DropTableRequest{
|
||||||
|
Table: "users",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Count
|
## Count
|
||||||
@@ -184,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)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
18
examples/db/dropTable/dropTable/main.go
Executable file
18
examples/db/dropTable/dropTable/main.go
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Drop a table in the DB
|
||||||
|
func main() {
|
||||||
|
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := dbService.DropTable(&db.DropTableRequest{
|
||||||
|
Table: "users",
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
16
examples/db/listTables/listTables/main.go
Executable file
16
examples/db/listTables/listTables/main.go
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
// List tables in the DB
|
||||||
|
func main() {
|
||||||
|
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := dbService.ListTables(&db.ListTablesRequest{})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
19
examples/db/renameTable/renameTable/main.go
Executable file
19
examples/db/renameTable/renameTable/main.go
Executable file
@@ -0,0 +1,19 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Rename a table
|
||||||
|
func main() {
|
||||||
|
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := dbService.RenameTable(&db.RenameTableRequest{
|
||||||
|
From: "events",
|
||||||
|
To: "events_backup",
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -4,33 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Evchargers/api
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## ReferenceData
|
|
||||||
|
|
||||||
Retrieve reference data as used by this API and in conjunction with the Search endpoint
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/evchargers/api#ReferenceData](https://m3o.com/evchargers/api#ReferenceData)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/evchargers"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Retrieve reference data as used by this API and in conjunction with the Search endpoint
|
|
||||||
func GetReferenceData() {
|
|
||||||
evchargersService := evchargers.NewEvchargersService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := evchargersService.ReferenceData(&evchargers.ReferenceDataRequest{
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Search
|
## Search
|
||||||
|
|
||||||
Search by giving a coordinate and a max distance, or bounding box and optional filters
|
Search by giving a coordinate and a max distance, or bounding box and optional filters
|
||||||
@@ -125,3 +98,30 @@ Location: &evchargers.Coordinates{
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## ReferenceData
|
||||||
|
|
||||||
|
Retrieve reference data as used by this API and in conjunction with the Search endpoint
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/evchargers/api#ReferenceData](https://m3o.com/evchargers/api#ReferenceData)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/evchargers"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Retrieve reference data as used by this API and in conjunction with the Search endpoint
|
||||||
|
func GetReferenceData() {
|
||||||
|
evchargersService := evchargers.NewEvchargersService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := evchargersService.ReferenceData(&evchargers.ReferenceDataRequest{
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ func PublishAnEvent() {
|
|||||||
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",
|
||||||
|
|
||||||
|
|||||||
@@ -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",
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
package example
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/event"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Subscribe to messages for a given topic.
|
|
||||||
func SubscribeToAtopic() {
|
|
||||||
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := eventService.Subscribe(&event.SubscribeRequest{
|
|
||||||
Topic: "user",
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
}
|
|
||||||
@@ -4,35 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/File/api](http
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## Read
|
|
||||||
|
|
||||||
Read a file by path
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/file/api#Read](https://m3o.com/file/api#Read)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/file"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Read a file by path
|
|
||||||
func ReadFile() {
|
|
||||||
fileService := file.NewFileService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := fileService.Read(&file.ReadRequest{
|
|
||||||
Path: "/document/text-files/file.txt",
|
|
||||||
Project: "examples",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Save
|
## Save
|
||||||
|
|
||||||
Save a file
|
Save a file
|
||||||
@@ -122,3 +93,32 @@ Project: "examples",
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## Read
|
||||||
|
|
||||||
|
Read a file by path
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/file/api#Read](https://m3o.com/file/api#Read)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/file"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Read a file by path
|
||||||
|
func ReadFile() {
|
||||||
|
fileService := file.NewFileService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := fileService.Read(&file.ReadRequest{
|
||||||
|
Path: "/document/text-files/file.txt",
|
||||||
|
Project: "examples",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -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)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,206 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Image/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## Resize
|
|
||||||
|
|
||||||
Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
|
||||||
If one of width or height is 0, the image aspect ratio is preserved.
|
|
||||||
Optional cropping.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/image/api#Resize](https://m3o.com/image/api#Resize)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/image"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
|
||||||
// If one of width or height is 0, the image aspect ratio is preserved.
|
|
||||||
// Optional cropping.
|
|
||||||
func Base64toHostedImage() {
|
|
||||||
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := imageService.Resize(&image.ResizeRequest{
|
|
||||||
Base64: "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",
|
|
||||||
Height: 100,
|
|
||||||
Name: "cat.png",
|
|
||||||
Width: 100,
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Resize
|
|
||||||
|
|
||||||
Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
|
||||||
If one of width or height is 0, the image aspect ratio is preserved.
|
|
||||||
Optional cropping.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/image/api#Resize](https://m3o.com/image/api#Resize)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/image"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
|
||||||
// If one of width or height is 0, the image aspect ratio is preserved.
|
|
||||||
// Optional cropping.
|
|
||||||
func Base64toBase64image() {
|
|
||||||
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := imageService.Resize(&image.ResizeRequest{
|
|
||||||
Base64: "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",
|
|
||||||
Height: 100,
|
|
||||||
Width: 100,
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Resize
|
|
||||||
|
|
||||||
Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
|
||||||
If one of width or height is 0, the image aspect ratio is preserved.
|
|
||||||
Optional cropping.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/image/api#Resize](https://m3o.com/image/api#Resize)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/image"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
|
||||||
// If one of width or height is 0, the image aspect ratio is preserved.
|
|
||||||
// Optional cropping.
|
|
||||||
func Base64toBase64imageWithCropping() {
|
|
||||||
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := imageService.Resize(&image.ResizeRequest{
|
|
||||||
Base64: "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",
|
|
||||||
CropOptions: &image.CropOptions{
|
|
||||||
Height: 50,
|
|
||||||
Width: 50,
|
|
||||||
},
|
|
||||||
Height: 100,
|
|
||||||
Width: 100,
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## 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.
|
|
||||||
|
|
||||||
|
|
||||||
[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.
|
|
||||||
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.
|
|
||||||
|
|
||||||
|
|
||||||
[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.
|
|
||||||
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.
|
|
||||||
|
|
||||||
|
|
||||||
[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.
|
|
||||||
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.
|
||||||
@@ -232,3 +32,227 @@ func DeleteAnUploadedImage() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## Resize
|
||||||
|
|
||||||
|
Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
||||||
|
If one of width or height is 0, the image aspect ratio is preserved.
|
||||||
|
Optional cropping.
|
||||||
|
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#Resize](https://m3o.com/image/api#Resize)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/image"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
||||||
|
// If one of width or height is 0, the image aspect ratio is preserved.
|
||||||
|
// Optional cropping.
|
||||||
|
// 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 Base64toHostedImage() {
|
||||||
|
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := imageService.Resize(&image.ResizeRequest{
|
||||||
|
Base64: "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",
|
||||||
|
Height: 100,
|
||||||
|
Name: "cat.png",
|
||||||
|
Width: 100,
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Resize
|
||||||
|
|
||||||
|
Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
||||||
|
If one of width or height is 0, the image aspect ratio is preserved.
|
||||||
|
Optional cropping.
|
||||||
|
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#Resize](https://m3o.com/image/api#Resize)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/image"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
||||||
|
// If one of width or height is 0, the image aspect ratio is preserved.
|
||||||
|
// Optional cropping.
|
||||||
|
// 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 Base64toBase64image() {
|
||||||
|
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := imageService.Resize(&image.ResizeRequest{
|
||||||
|
Base64: "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",
|
||||||
|
Height: 100,
|
||||||
|
Width: 100,
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Resize
|
||||||
|
|
||||||
|
Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
||||||
|
If one of width or height is 0, the image aspect ratio is preserved.
|
||||||
|
Optional cropping.
|
||||||
|
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#Resize](https://m3o.com/image/api#Resize)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/image"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
||||||
|
// If one of width or height is 0, the image aspect ratio is preserved.
|
||||||
|
// Optional cropping.
|
||||||
|
// 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 Base64toBase64imageWithCropping() {
|
||||||
|
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := imageService.Resize(&image.ResizeRequest{
|
||||||
|
Base64: "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",
|
||||||
|
CropOptions: &image.CropOptions{
|
||||||
|
Height: 50,
|
||||||
|
Width: 50,
|
||||||
|
},
|
||||||
|
Height: 100,
|
||||||
|
Width: 100,
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## 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)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import (
|
|||||||
|
|
||||||
// Convert an image from one format (jpeg, png etc.) to an other either on the fly (from base64 to base64),
|
// 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.
|
// 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 main() {
|
func main() {
|
||||||
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := imageService.Convert(&image.ConvertRequest{
|
rsp, err := imageService.Convert(&image.ConvertRequest{
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import (
|
|||||||
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
||||||
// If one of width or height is 0, the image aspect ratio is preserved.
|
// If one of width or height is 0, the image aspect ratio is preserved.
|
||||||
// Optional cropping.
|
// Optional cropping.
|
||||||
|
// 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 main() {
|
func main() {
|
||||||
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := imageService.Resize(&image.ResizeRequest{
|
rsp, err := imageService.Resize(&image.ResizeRequest{
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import (
|
|||||||
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
||||||
// If one of width or height is 0, the image aspect ratio is preserved.
|
// If one of width or height is 0, the image aspect ratio is preserved.
|
||||||
// Optional cropping.
|
// Optional cropping.
|
||||||
|
// 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 main() {
|
func main() {
|
||||||
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := imageService.Resize(&image.ResizeRequest{
|
rsp, err := imageService.Resize(&image.ResizeRequest{
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import (
|
|||||||
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
||||||
// If one of width or height is 0, the image aspect ratio is preserved.
|
// If one of width or height is 0, the image aspect ratio is preserved.
|
||||||
// Optional cropping.
|
// Optional cropping.
|
||||||
|
// 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 main() {
|
func main() {
|
||||||
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := imageService.Resize(&image.ResizeRequest{
|
rsp, err := imageService.Resize(&image.ResizeRequest{
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import (
|
|||||||
|
|
||||||
// Upload an image by either sending a base64 encoded image to this endpoint or a URL.
|
// 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 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 main() {
|
func main() {
|
||||||
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := imageService.Upload(&image.UploadRequest{
|
rsp, err := imageService.Upload(&image.UploadRequest{
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import (
|
|||||||
|
|
||||||
// Upload an image by either sending a base64 encoded image to this endpoint or a URL.
|
// 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 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 main() {
|
func main() {
|
||||||
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := imageService.Upload(&image.UploadRequest{
|
rsp, err := imageService.Upload(&image.UploadRequest{
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
package example
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/notes"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Specify the note to events
|
|
||||||
func SubscribeToEvents() {
|
|
||||||
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := notesService.Subscribe(¬es.SubscribeRequest{
|
|
||||||
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
}
|
|
||||||
63
examples/spam/README.md
Executable file
63
examples/spam/README.md
Executable file
@@ -0,0 +1,63 @@
|
|||||||
|
# Spam
|
||||||
|
|
||||||
|
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Spam/api](https://m3o.com/Spam/api).
|
||||||
|
|
||||||
|
Endpoints:
|
||||||
|
|
||||||
|
## Classify
|
||||||
|
|
||||||
|
Check whether an email is likely to be spam based on its attributes
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/spam/api#Classify](https://m3o.com/spam/api#Classify)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/spam"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Check whether an email is likely to be spam based on its attributes
|
||||||
|
func ClassifyAnEmail() {
|
||||||
|
spamService := spam.NewSpamService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := spamService.Classify(&spam.ClassifyRequest{
|
||||||
|
From: "noreply@m3o.com",
|
||||||
|
Subject: "Welcome",
|
||||||
|
To: "hello@example.com",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Classify
|
||||||
|
|
||||||
|
Check whether an email is likely to be spam based on its attributes
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/spam/api#Classify](https://m3o.com/spam/api#Classify)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/spam"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Check whether an email is likely to be spam based on its attributes
|
||||||
|
func ClassifyAnEmailUsingTheRawData() {
|
||||||
|
spamService := spam.NewSpamService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := spamService.Classify(&spam.ClassifyRequest{
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
20
examples/spam/classify/classifyAnEmail/main.go
Executable file
20
examples/spam/classify/classifyAnEmail/main.go
Executable file
@@ -0,0 +1,20 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/spam"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Check whether an email is likely to be spam based on its attributes
|
||||||
|
func main() {
|
||||||
|
spamService := spam.NewSpamService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := spamService.Classify(&spam.ClassifyRequest{
|
||||||
|
From: "noreply@m3o.com",
|
||||||
|
Subject: "Welcome",
|
||||||
|
To: "hello@example.com",
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
16
examples/spam/classify/classifyAnEmailUsingTheRawData/main.go
Executable file
16
examples/spam/classify/classifyAnEmailUsingTheRawData/main.go
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/spam"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Check whether an email is likely to be spam based on its attributes
|
||||||
|
func main() {
|
||||||
|
spamService := spam.NewSpamService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := spamService.Classify(&spam.ClassifyRequest{})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Stock/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Price
|
||||||
|
|
||||||
|
Get the last price for a given stock ticker
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/stock/api#Price](https://m3o.com/stock/api#Price)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/stock"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get the last price for a given stock ticker
|
||||||
|
func GetAstockPrice() {
|
||||||
|
stockService := stock.NewStockService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := stockService.Price(&stock.PriceRequest{
|
||||||
|
Symbol: "AAPL",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
## Quote
|
## Quote
|
||||||
|
|
||||||
Get the last quote for the stock
|
Get the last quote for the stock
|
||||||
@@ -93,31 +121,3 @@ Stock: "AAPL",
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Price
|
|
||||||
|
|
||||||
Get the last price for a given stock ticker
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/stock/api#Price](https://m3o.com/stock/api#Price)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/stock"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Get the last price for a given stock ticker
|
|
||||||
func GetAstockPrice() {
|
|
||||||
stockService := stock.NewStockService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := stockService.Price(&stock.PriceRequest{
|
|
||||||
Symbol: "AAPL",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -4,63 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Stream/api](ht
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## SendMessage
|
|
||||||
|
|
||||||
Send a message to the stream.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/stream/api#SendMessage](https://m3o.com/stream/api#SendMessage)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/stream"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Send a message to the stream.
|
|
||||||
func SendMessage() {
|
|
||||||
streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := streamService.SendMessage(&stream.SendMessageRequest{
|
|
||||||
Channel: "general",
|
|
||||||
Text: "Hey checkout this tweet https://twitter.com/m3oservices/status/1455291054295498752",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## ListMessages
|
|
||||||
|
|
||||||
List messages for a given channel
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/stream/api#ListMessages](https://m3o.com/stream/api#ListMessages)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/stream"
|
|
||||||
)
|
|
||||||
|
|
||||||
// List messages for a given channel
|
|
||||||
func ListMessages() {
|
|
||||||
streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := streamService.ListMessages(&stream.ListMessagesRequest{
|
|
||||||
Channel: "general",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## ListChannels
|
## ListChannels
|
||||||
|
|
||||||
List all the active channels
|
List all the active channels
|
||||||
@@ -119,3 +62,60 @@ Name: "general",
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## SendMessage
|
||||||
|
|
||||||
|
Send a message to the stream.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/stream/api#SendMessage](https://m3o.com/stream/api#SendMessage)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/stream"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Send a message to the stream.
|
||||||
|
func SendMessage() {
|
||||||
|
streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := streamService.SendMessage(&stream.SendMessageRequest{
|
||||||
|
Channel: "general",
|
||||||
|
Text: "Hey checkout this tweet https://twitter.com/m3oservices/status/1455291054295498752",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## ListMessages
|
||||||
|
|
||||||
|
List messages for a given channel
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/stream/api#ListMessages](https://m3o.com/stream/api#ListMessages)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/stream"
|
||||||
|
)
|
||||||
|
|
||||||
|
// List messages for a given channel
|
||||||
|
func ListMessages() {
|
||||||
|
streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := streamService.ListMessages(&stream.ListMessagesRequest{
|
||||||
|
Channel: "general",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
package example
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/stream"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Publish a message to the stream. Specify a topic to group messages for a specific topic.
|
|
||||||
func PublishAmessage() {
|
|
||||||
streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := streamService.Publish(&stream.PublishRequest{
|
|
||||||
Message: map[string]interface{}{
|
|
||||||
"id": "1",
|
|
||||||
"type": "signup",
|
|
||||||
"user": "john",
|
|
||||||
},
|
|
||||||
Topic: "events",
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/stream"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Publish a message to the stream. Specify a topic to group messages for a specific topic.
|
|
||||||
func main() {
|
|
||||||
streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := streamService.Publish(&stream.PublishRequest{
|
|
||||||
Message: map[string]interface{}{
|
|
||||||
"id": "1",
|
|
||||||
"type": "signup",
|
|
||||||
"user": "john",
|
|
||||||
},
|
|
||||||
Topic: "events",
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package example
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/stream"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Subscribe to messages for a given topic.
|
|
||||||
func SubscribeToAtopic() {
|
|
||||||
streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := streamService.Subscribe(&stream.SubscribeRequest{
|
|
||||||
Topic: "events",
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/stream"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Subscribe to messages for a given topic.
|
|
||||||
func main() {
|
|
||||||
streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := streamService.Subscribe(&stream.SubscribeRequest{
|
|
||||||
Topic: "events",
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
}
|
|
||||||
@@ -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)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ func TakeScreenshotOfAurl() {
|
|||||||
thumbnailService := thumbnail.NewThumbnailService(os.Getenv("M3O_API_TOKEN"))
|
thumbnailService := thumbnail.NewThumbnailService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := thumbnailService.Screenshot(&thumbnail.ScreenshotRequest{
|
rsp, err := thumbnailService.Screenshot(&thumbnail.ScreenshotRequest{
|
||||||
Height: 600,
|
Height: 600,
|
||||||
Url: "https://m3o.com",
|
Url: "https://google.com",
|
||||||
Width: 600,
|
Width: 600,
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ func main() {
|
|||||||
thumbnailService := thumbnail.NewThumbnailService(os.Getenv("M3O_API_TOKEN"))
|
thumbnailService := thumbnail.NewThumbnailService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := thumbnailService.Screenshot(&thumbnail.ScreenshotRequest{
|
rsp, err := thumbnailService.Screenshot(&thumbnail.ScreenshotRequest{
|
||||||
Height: 600,
|
Height: 600,
|
||||||
Url: "https://m3o.com",
|
Url: "https://google.com",
|
||||||
Width: 600,
|
Width: 600,
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|||||||
@@ -4,37 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/User/api](http
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## 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: "mySecretPass123",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Logout
|
## Logout
|
||||||
|
|
||||||
Logout a user account
|
Logout a user account
|
||||||
@@ -56,7 +25,66 @@ import(
|
|||||||
func LogAuserOut() {
|
func LogAuserOut() {
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := userService.Logout(&user.LogoutRequest{
|
rsp, err := userService.Logout(&user.LogoutRequest{
|
||||||
SessionId: "sds34s34s34-s34s34-s43s43s34-s4s34s",
|
SessionId: "df91a612-5b24-4634-99ff-240220ab8f55",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## ReadSession
|
||||||
|
|
||||||
|
Read a session by the session id. In the event it has expired or is not found and error is returned.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/user/api#ReadSession](https://m3o.com/user/api#ReadSession)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Read a session by the session id. In the event it has expired or is not found and error is returned.
|
||||||
|
func ReadAsessionByTheSessionId() {
|
||||||
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := userService.ReadSession(&user.ReadSessionRequest{
|
||||||
|
SessionId: "df91a612-5b24-4634-99ff-240220ab8f55",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Create
|
||||||
|
|
||||||
|
Create a new user account. The email address and username for the account must be unique.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/user/api#Create](https://m3o.com/user/api#Create)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Create a new user account. The email address and username for the account must be unique.
|
||||||
|
func CreateAnAccount() {
|
||||||
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := userService.Create(&user.CreateRequest{
|
||||||
|
Email: "joe@example.com",
|
||||||
|
Id: "user-1",
|
||||||
|
Password: "Password1",
|
||||||
|
Username: "joe",
|
||||||
|
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
@@ -84,8 +112,143 @@ import(
|
|||||||
func UpdateAnAccount() {
|
func UpdateAnAccount() {
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := userService.Update(&user.UpdateRequest{
|
rsp, err := userService.Update(&user.UpdateRequest{
|
||||||
Email: "joeotheremail@example.com",
|
Email: "joe+2@example.com",
|
||||||
Id: "usrid-1",
|
Id: "user-1",
|
||||||
|
|
||||||
|
})
|
||||||
|
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
|
||||||
|
|
||||||
|
Reset password with the code sent by the "SendPasswordResetEmail" endoint.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/user/api#ResetPassword](https://m3o.com/user/api#ResetPassword)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Reset password with the code sent by the "SendPasswordResetEmail" endoint.
|
||||||
|
func ResetPassword() {
|
||||||
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := userService.ResetPassword(&user.ResetPasswordRequest{
|
||||||
|
Code: "012345",
|
||||||
|
ConfirmPassword: "NewPassword1",
|
||||||
|
Email: "joe@example.com",
|
||||||
|
NewPassword: "NewPassword1",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Delete
|
||||||
|
|
||||||
|
Delete an account by id
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/user/api#Delete](https://m3o.com/user/api#Delete)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Delete an account by id
|
||||||
|
func DeleteUserAccount() {
|
||||||
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := userService.Delete(&user.DeleteRequest{
|
||||||
|
Id: "8b98acbe-0b6a-4d66-a414-5ffbf666786f",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## List
|
||||||
|
|
||||||
|
List all users. Returns a paged list of results
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/user/api#List](https://m3o.com/user/api#List)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
// List all users. Returns a paged list of results
|
||||||
|
func ListAllUsers() {
|
||||||
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := userService.List(&user.ListRequest{
|
||||||
|
Limit: 100,
|
||||||
|
Offset: 0,
|
||||||
|
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
@@ -113,9 +276,9 @@ import(
|
|||||||
func UpdateTheAccountPassword() {
|
func UpdateTheAccountPassword() {
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := userService.UpdatePassword(&user.UpdatePasswordRequest{
|
rsp, err := userService.UpdatePassword(&user.UpdatePasswordRequest{
|
||||||
ConfirmPassword: "myEvenMoreSecretPass123",
|
ConfirmPassword: "Password2",
|
||||||
NewPassword: "myEvenMoreSecretPass123",
|
NewPassword: "Password2",
|
||||||
OldPassword: "mySecretPass123",
|
OldPassword: "Password1",
|
||||||
|
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
@@ -143,7 +306,7 @@ import(
|
|||||||
func ReadAnAccountById() {
|
func ReadAnAccountById() {
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := userService.Read(&user.ReadRequest{
|
rsp, err := userService.Read(&user.ReadRequest{
|
||||||
Id: "usrid-1",
|
Id: "user-1",
|
||||||
|
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
@@ -171,7 +334,7 @@ import(
|
|||||||
func ReadAccountByUsernameOrEmail() {
|
func ReadAccountByUsernameOrEmail() {
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := userService.Read(&user.ReadRequest{
|
rsp, err := userService.Read(&user.ReadRequest{
|
||||||
Username: "usrname-1",
|
Username: "joe",
|
||||||
|
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
@@ -206,18 +369,13 @@ func ReadAccountByEmail() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## SendVerificationEmail
|
## SendPasswordResetEmail
|
||||||
|
|
||||||
Send a verification email
|
Send an email with a verification code to reset password.
|
||||||
to the user being signed up. Email from will be from 'support@m3o.com',
|
Call "ResetPassword" endpoint once user provides the code.
|
||||||
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)
|
[https://m3o.com/user/api#SendPasswordResetEmail](https://m3o.com/user/api#SendPasswordResetEmail)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package example
|
package example
|
||||||
@@ -229,83 +387,16 @@ import(
|
|||||||
"go.m3o.com/user"
|
"go.m3o.com/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Send a verification email
|
// Send an email with a verification code to reset password.
|
||||||
// to the user being signed up. Email from will be from 'support@m3o.com',
|
// Call "ResetPassword" endpoint once user provides the code.
|
||||||
// but you can provide the title and contents.
|
func SendPasswordResetEmail() {
|
||||||
// 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"))
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := userService.SendVerificationEmail(&user.SendVerificationEmailRequest{
|
rsp, err := userService.SendPasswordResetEmail(&user.SendPasswordResetEmailRequest{
|
||||||
Email: "joe@example.com",
|
Email: "joe@example.com",
|
||||||
FailureRedirectUrl: "https://m3o.com/verification-failed",
|
|
||||||
FromName: "Awesome Dot Com",
|
FromName: "Awesome Dot Com",
|
||||||
RedirectUrl: "https://m3o.com",
|
Subject: "Password reset",
|
||||||
Subject: "Email verification",
|
|
||||||
TextContent: `Hi there,
|
TextContent: `Hi there,
|
||||||
|
click here to reset your password: myapp.com/reset/code?=$code`,
|
||||||
Please verify your email by clicking this link: $micro_verification_link`,
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Delete
|
|
||||||
|
|
||||||
Delete an account by id
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/user/api#Delete](https://m3o.com/user/api#Delete)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/user"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Delete an account by id
|
|
||||||
func DeleteUserAccount() {
|
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := userService.Delete(&user.DeleteRequest{
|
|
||||||
Id: "fdf34f34f34-f34f34-f43f43f34-f4f34f",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Create
|
|
||||||
|
|
||||||
Create a new user account. The email address and username for the account must be unique.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/user/api#Create](https://m3o.com/user/api#Create)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/user"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Create a new user account. The email address and username for the account must be unique.
|
|
||||||
func CreateAnAccount() {
|
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := userService.Create(&user.CreateRequest{
|
|
||||||
Email: "joe@example.com",
|
|
||||||
Id: "usrid-1",
|
|
||||||
Password: "mySecretPass123",
|
|
||||||
Username: "usrname-1",
|
|
||||||
|
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
@@ -333,19 +424,21 @@ import(
|
|||||||
func VerifyEmail() {
|
func VerifyEmail() {
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := userService.VerifyEmail(&user.VerifyEmailRequest{
|
rsp, err := userService.VerifyEmail(&user.VerifyEmailRequest{
|
||||||
Token: "t2323t232t",
|
Email: "joe@example.com",
|
||||||
|
Token: "012345",
|
||||||
|
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## ReadSession
|
## Login
|
||||||
|
|
||||||
Read a session by the session id. In the event it has expired or is not found and error is returned.
|
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#ReadSession](https://m3o.com/user/api#ReadSession)
|
[https://m3o.com/user/api#Login](https://m3o.com/user/api#Login)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package example
|
package example
|
||||||
@@ -357,11 +450,13 @@ import(
|
|||||||
"go.m3o.com/user"
|
"go.m3o.com/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Read a session by the session id. In the event it has expired or is not found and error is returned.
|
// Login using username or email. The response will return a new session for successful login,
|
||||||
func ReadAsessionByTheSessionId() {
|
// 401 in the case of login failure and 500 for any other error
|
||||||
|
func LogAuserIn() {
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := userService.ReadSession(&user.ReadSessionRequest{
|
rsp, err := userService.Login(&user.LoginRequest{
|
||||||
SessionId: "sds34s34s34-s34s34-s43s43s34-s4s34s",
|
Email: "joe@example.com",
|
||||||
|
Password: "Password1",
|
||||||
|
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ func main() {
|
|||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := userService.Create(&user.CreateRequest{
|
rsp, err := userService.Create(&user.CreateRequest{
|
||||||
Email: "joe@example.com",
|
Email: "joe@example.com",
|
||||||
Id: "usrid-1",
|
Id: "user-1",
|
||||||
Password: "mySecretPass123",
|
Password: "Password1",
|
||||||
Username: "usrname-1",
|
Username: "joe",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
func main() {
|
func main() {
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := userService.Delete(&user.DeleteRequest{
|
rsp, err := userService.Delete(&user.DeleteRequest{
|
||||||
Id: "fdf34f34f34-f34f34-f43f43f34-f4f34f",
|
Id: "8b98acbe-0b6a-4d66-a414-5ffbf666786f",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
|||||||
19
examples/user/list/listAllUsers/main.go
Executable file
19
examples/user/list/listAllUsers/main.go
Executable file
@@ -0,0 +1,19 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
// List all users. Returns a paged list of results
|
||||||
|
func main() {
|
||||||
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := userService.List(&user.ListRequest{
|
||||||
|
Limit: 100,
|
||||||
|
Offset: 0,
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -13,7 +13,7 @@ func main() {
|
|||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := userService.Login(&user.LoginRequest{
|
rsp, err := userService.Login(&user.LoginRequest{
|
||||||
Email: "joe@example.com",
|
Email: "joe@example.com",
|
||||||
Password: "mySecretPass123",
|
Password: "Password1",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
func main() {
|
func main() {
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := userService.Logout(&user.LogoutRequest{
|
rsp, err := userService.Logout(&user.LogoutRequest{
|
||||||
SessionId: "sds34s34s34-s34s34-s43s43s34-s4s34s",
|
SessionId: "df91a612-5b24-4634-99ff-240220ab8f55",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
func main() {
|
func main() {
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := userService.Read(&user.ReadRequest{
|
rsp, err := userService.Read(&user.ReadRequest{
|
||||||
Username: "usrname-1",
|
Username: "joe",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
func main() {
|
func main() {
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := userService.Read(&user.ReadRequest{
|
rsp, err := userService.Read(&user.ReadRequest{
|
||||||
Id: "usrid-1",
|
Id: "user-1",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
func main() {
|
func main() {
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := userService.ReadSession(&user.ReadSessionRequest{
|
rsp, err := userService.ReadSession(&user.ReadSessionRequest{
|
||||||
SessionId: "sds34s34s34-s34s34-s43s43s34-s4s34s",
|
SessionId: "df91a612-5b24-4634-99ff-240220ab8f55",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
|||||||
21
examples/user/resetPassword/resetPassword/main.go
Executable file
21
examples/user/resetPassword/resetPassword/main.go
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Reset password with the code sent by the "SendPasswordResetEmail" endoint.
|
||||||
|
func main() {
|
||||||
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := userService.ResetPassword(&user.ResetPasswordRequest{
|
||||||
|
Code: "012345",
|
||||||
|
ConfirmPassword: "NewPassword1",
|
||||||
|
Email: "joe@example.com",
|
||||||
|
NewPassword: "NewPassword1",
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
23
examples/user/sendPasswordResetEmail/sendPasswordResetEmail/main.go
Executable file
23
examples/user/sendPasswordResetEmail/sendPasswordResetEmail/main.go
Executable file
@@ -0,0 +1,23 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Send an email with a verification code to reset password.
|
||||||
|
// Call "ResetPassword" endpoint once user provides the code.
|
||||||
|
func main() {
|
||||||
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := userService.SendPasswordResetEmail(&user.SendPasswordResetEmailRequest{
|
||||||
|
Email: "joe@example.com",
|
||||||
|
FromName: "Awesome Dot Com",
|
||||||
|
Subject: "Password reset",
|
||||||
|
TextContent: `Hi there,
|
||||||
|
click here to reset your password: myapp.com/reset/code?=$code`,
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Send a verification email
|
// Send a verification email
|
||||||
// to the user being signed up. Email from will be from 'support@m3o.com',
|
// to the user being signed up. Email from will be from 'noreply@email.m3ocontent.com',
|
||||||
// but you can provide the title and contents.
|
// 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.
|
// 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'
|
// Example: 'Hi there, welcome onboard! Use the link below to verify your email: $micro_verification_link'
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import (
|
|||||||
func main() {
|
func main() {
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := userService.Update(&user.UpdateRequest{
|
rsp, err := userService.Update(&user.UpdateRequest{
|
||||||
Email: "joeotheremail@example.com",
|
Email: "joe+2@example.com",
|
||||||
Id: "usrid-1",
|
Id: "user-1",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ import (
|
|||||||
func main() {
|
func main() {
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := userService.UpdatePassword(&user.UpdatePasswordRequest{
|
rsp, err := userService.UpdatePassword(&user.UpdatePasswordRequest{
|
||||||
ConfirmPassword: "myEvenMoreSecretPass123",
|
ConfirmPassword: "Password2",
|
||||||
NewPassword: "myEvenMoreSecretPass123",
|
NewPassword: "Password2",
|
||||||
OldPassword: "mySecretPass123",
|
OldPassword: "Password1",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ import (
|
|||||||
func main() {
|
func main() {
|
||||||
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := userService.VerifyEmail(&user.VerifyEmailRequest{
|
rsp, err := userService.VerifyEmail(&user.VerifyEmailRequest{
|
||||||
Token: "t2323t232t",
|
Email: "joe@example.com",
|
||||||
|
Token: "012345",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
46
gifs/gifs.go
46
gifs/gifs.go
@@ -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 {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ type SearchResponse struct {
|
|||||||
|
|
||||||
type SearchResult struct {
|
type SearchResult struct {
|
||||||
// abridged version of this search result’s URL, e.g. www.exampe.com
|
// abridged version of this search result’s 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"
|
||||||
|
|||||||
@@ -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"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ type ImageService struct {
|
|||||||
|
|
||||||
// Convert an image from one format (jpeg, png etc.) to an other either on the fly (from base64 to base64),
|
// 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.
|
// 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 (t *ImageService) Convert(request *ConvertRequest) (*ConvertResponse, error) {
|
func (t *ImageService) Convert(request *ConvertRequest) (*ConvertResponse, error) {
|
||||||
|
|
||||||
rsp := &ConvertResponse{}
|
rsp := &ConvertResponse{}
|
||||||
@@ -36,6 +38,8 @@ func (t *ImageService) Delete(request *DeleteRequest) (*DeleteResponse, error) {
|
|||||||
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
||||||
// If one of width or height is 0, the image aspect ratio is preserved.
|
// If one of width or height is 0, the image aspect ratio is preserved.
|
||||||
// Optional cropping.
|
// Optional cropping.
|
||||||
|
// 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 (t *ImageService) Resize(request *ResizeRequest) (*ResizeResponse, error) {
|
func (t *ImageService) Resize(request *ResizeRequest) (*ResizeResponse, error) {
|
||||||
|
|
||||||
rsp := &ResizeResponse{}
|
rsp := &ResizeResponse{}
|
||||||
@@ -45,6 +49,8 @@ func (t *ImageService) Resize(request *ResizeRequest) (*ResizeResponse, error) {
|
|||||||
|
|
||||||
// Upload an image by either sending a base64 encoded image to this endpoint or a URL.
|
// 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 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 (t *ImageService) Upload(request *UploadRequest) (*UploadResponse, error) {
|
func (t *ImageService) Upload(request *UploadRequest) (*UploadResponse, error) {
|
||||||
|
|
||||||
rsp := &UploadResponse{}
|
rsp := &UploadResponse{}
|
||||||
@@ -55,10 +61,12 @@ func (t *ImageService) Upload(request *UploadRequest) (*UploadResponse, error) {
|
|||||||
type ConvertRequest struct {
|
type ConvertRequest struct {
|
||||||
// base64 encoded image to resize,
|
// base64 encoded image to resize,
|
||||||
Base64 string `json:"base64"`
|
Base64 string `json:"base64"`
|
||||||
|
// The image file to convert
|
||||||
|
File string `json:"file"`
|
||||||
// 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"`
|
||||||
}
|
}
|
||||||
@@ -105,11 +113,13 @@ type ResizeRequest struct {
|
|||||||
// if provided, after resize, the image
|
// if provided, after resize, the image
|
||||||
// will be cropped
|
// will be cropped
|
||||||
CropOptions *CropOptions `json:"cropOptions"`
|
CropOptions *CropOptions `json:"cropOptions"`
|
||||||
Height int64 `json:"height,string"`
|
// The image file to resize
|
||||||
|
File string `json:"file"`
|
||||||
|
Height int64 `json:"height,string"`
|
||||||
// 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"`
|
||||||
@@ -123,6 +133,8 @@ type ResizeResponse struct {
|
|||||||
type UploadRequest struct {
|
type UploadRequest struct {
|
||||||
// Base64 encoded image to upload,
|
// Base64 encoded image to upload,
|
||||||
Base64 string `json:"base64"`
|
Base64 string `json:"base64"`
|
||||||
|
// The image file to upload
|
||||||
|
File string `json:"file"`
|
||||||
// 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"`
|
||||||
// URL of the image to upload
|
// URL of the image to upload
|
||||||
|
|||||||
3
m3o.go
3
m3o.go
@@ -34,6 +34,7 @@ import (
|
|||||||
"go.m3o.com/rss"
|
"go.m3o.com/rss"
|
||||||
"go.m3o.com/sentiment"
|
"go.m3o.com/sentiment"
|
||||||
"go.m3o.com/sms"
|
"go.m3o.com/sms"
|
||||||
|
"go.m3o.com/spam"
|
||||||
"go.m3o.com/stock"
|
"go.m3o.com/stock"
|
||||||
"go.m3o.com/stream"
|
"go.m3o.com/stream"
|
||||||
"go.m3o.com/sunnah"
|
"go.m3o.com/sunnah"
|
||||||
@@ -84,6 +85,7 @@ func NewClient(token string) *Client {
|
|||||||
RssService: rss.NewRssService(token),
|
RssService: rss.NewRssService(token),
|
||||||
SentimentService: sentiment.NewSentimentService(token),
|
SentimentService: sentiment.NewSentimentService(token),
|
||||||
SmsService: sms.NewSmsService(token),
|
SmsService: sms.NewSmsService(token),
|
||||||
|
SpamService: spam.NewSpamService(token),
|
||||||
StockService: stock.NewStockService(token),
|
StockService: stock.NewStockService(token),
|
||||||
StreamService: stream.NewStreamService(token),
|
StreamService: stream.NewStreamService(token),
|
||||||
SunnahService: sunnah.NewSunnahService(token),
|
SunnahService: sunnah.NewSunnahService(token),
|
||||||
@@ -134,6 +136,7 @@ type Client struct {
|
|||||||
RssService *rss.RssService
|
RssService *rss.RssService
|
||||||
SentimentService *sentiment.SentimentService
|
SentimentService *sentiment.SentimentService
|
||||||
SmsService *sms.SmsService
|
SmsService *sms.SmsService
|
||||||
|
SpamService *spam.SpamService
|
||||||
StockService *stock.StockService
|
StockService *stock.StockService
|
||||||
StreamService *stream.StreamService
|
StreamService *stream.StreamService
|
||||||
SunnahService *sunnah.SunnahService
|
SunnahService *sunnah.SunnahService
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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"`
|
||||||
}
|
}
|
||||||
|
|||||||
49
spam/spam.go
Executable file
49
spam/spam.go
Executable file
@@ -0,0 +1,49 @@
|
|||||||
|
package spam
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go.m3o.com/client"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewSpamService(token string) *SpamService {
|
||||||
|
return &SpamService{
|
||||||
|
client: client.NewClient(&client.Options{
|
||||||
|
Token: token,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type SpamService struct {
|
||||||
|
client *client.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check whether an email is likely to be spam based on its attributes
|
||||||
|
func (t *SpamService) Classify(request *ClassifyRequest) (*ClassifyResponse, error) {
|
||||||
|
|
||||||
|
rsp := &ClassifyResponse{}
|
||||||
|
return rsp, t.client.Call("spam", "Classify", request, rsp)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
EmailBody string `json:"email_body"`
|
||||||
|
// The email address it has been sent from
|
||||||
|
From string `json:"from"`
|
||||||
|
// the HTML version of the email body
|
||||||
|
HtmlBody string `json:"html_body"`
|
||||||
|
// The subject of the email
|
||||||
|
Subject string `json:"subject"`
|
||||||
|
// the plain text version of the email body
|
||||||
|
TextBody string `json:"text_body"`
|
||||||
|
// The email address it is being sent to
|
||||||
|
To string `json:"to"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ClassifyResponse struct {
|
||||||
|
// The rules that have contributed to this score
|
||||||
|
Details []string `json:"details"`
|
||||||
|
// Is it spam? Returns true if its score is > 5
|
||||||
|
IsSpam bool `json:"is_spam"`
|
||||||
|
// The score evaluated for this email. A higher number means it is more likely to be spam
|
||||||
|
Score float64 `json:"score"`
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -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"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -33,5 +33,5 @@ type ScreenshotRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ScreenshotResponse struct {
|
type ScreenshotResponse struct {
|
||||||
ImageUrl string `json:"imageUrl"`
|
ImageUrl string `json:"imageURL"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
14
url/url.go
14
url/url.go
@@ -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"`
|
||||||
}
|
}
|
||||||
|
|||||||
79
user/user.go
79
user/user.go
@@ -32,6 +32,14 @@ func (t *UserService) Delete(request *DeleteRequest) (*DeleteResponse, error) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// List all users. Returns a paged list of results
|
||||||
|
func (t *UserService) List(request *ListRequest) (*ListResponse, error) {
|
||||||
|
|
||||||
|
rsp := &ListResponse{}
|
||||||
|
return rsp, t.client.Call("user", "List", request, rsp)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Login using username or email. The response will return a new session for successful 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
|
// 401 in the case of login failure and 500 for any other error
|
||||||
func (t *UserService) Login(request *LoginRequest) (*LoginResponse, error) {
|
func (t *UserService) Login(request *LoginRequest) (*LoginResponse, error) {
|
||||||
@@ -65,8 +73,25 @@ func (t *UserService) ReadSession(request *ReadSessionRequest) (*ReadSessionResp
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset password with the code sent by the "SendPasswordResetEmail" endoint.
|
||||||
|
func (t *UserService) ResetPassword(request *ResetPasswordRequest) (*ResetPasswordResponse, error) {
|
||||||
|
|
||||||
|
rsp := &ResetPasswordResponse{}
|
||||||
|
return rsp, t.client.Call("user", "ResetPassword", request, rsp)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send an email with a verification code to reset password.
|
||||||
|
// Call "ResetPassword" endpoint once user provides the code.
|
||||||
|
func (t *UserService) SendPasswordResetEmail(request *SendPasswordResetEmailRequest) (*SendPasswordResetEmailResponse, error) {
|
||||||
|
|
||||||
|
rsp := &SendPasswordResetEmailResponse{}
|
||||||
|
return rsp, t.client.Call("user", "SendPasswordResetEmail", request, rsp)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Send a verification email
|
// Send a verification email
|
||||||
// to the user being signed up. Email from will be from 'support@m3o.com',
|
// to the user being signed up. Email from will be from 'noreply@email.m3ocontent.com',
|
||||||
// but you can provide the title and contents.
|
// 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.
|
// 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'
|
// Example: 'Hi there, welcome onboard! Use the link below to verify your email: $micro_verification_link'
|
||||||
@@ -147,6 +172,17 @@ type DeleteRequest struct {
|
|||||||
type DeleteResponse struct {
|
type DeleteResponse struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ListRequest struct {
|
||||||
|
// Maximum number of records to return. Default limit is 25.
|
||||||
|
// Maximum limit is 1000. Anything higher will return an error.
|
||||||
|
Limit int32 `json:"limit"`
|
||||||
|
Offset int32 `json:"offset"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ListResponse struct {
|
||||||
|
Users []Account `json:"users"`
|
||||||
|
}
|
||||||
|
|
||||||
type LoginRequest struct {
|
type LoginRequest struct {
|
||||||
// The email address of the user
|
// The email address of the user
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
@@ -162,6 +198,7 @@ type LoginResponse struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type LogoutRequest struct {
|
type LogoutRequest struct {
|
||||||
|
// the session id for the user to logout
|
||||||
SessionId string `json:"sessionId"`
|
SessionId string `json:"sessionId"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,16 +224,48 @@ type ReadSessionRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ReadSessionResponse struct {
|
type ReadSessionResponse struct {
|
||||||
|
// the session for the user
|
||||||
Session *Session `json:"session"`
|
Session *Session `json:"session"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ResetPasswordRequest struct {
|
||||||
|
// The code from the verification email
|
||||||
|
Code string `json:"code"`
|
||||||
|
// confirm new password
|
||||||
|
ConfirmPassword string `json:"confirmPassword"`
|
||||||
|
// the email to reset the password for
|
||||||
|
Email string `json:"email"`
|
||||||
|
// the new password
|
||||||
|
NewPassword string `json:"newPassword"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ResetPasswordResponse struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type SendPasswordResetEmailRequest struct {
|
||||||
|
// email address to send reset for
|
||||||
|
Email string `json:"email"`
|
||||||
|
// Display name of the sender for the email. Note: the email address will still be 'noreply@email.m3ocontent.com'
|
||||||
|
FromName string `json:"fromName"`
|
||||||
|
// subject of the email
|
||||||
|
Subject string `json:"subject"`
|
||||||
|
// Text content of the email. Don't forget to include the string '$code' which will be replaced by the real verification link
|
||||||
|
// HTML emails are not available currently.
|
||||||
|
TextContent string `json:"textContent"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SendPasswordResetEmailResponse struct {
|
||||||
|
}
|
||||||
|
|
||||||
type SendVerificationEmailRequest struct {
|
type SendVerificationEmailRequest struct {
|
||||||
|
// email address to send the verification code
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
FailureRedirectUrl string `json:"failureRedirectUrl"`
|
FailureRedirectUrl string `json:"failureRedirectUrl"`
|
||||||
// Display name of the sender for the email. Note: the email address will still be 'support@m3o.com'
|
// Display name of the sender for the email. Note: the email address will still be 'noreply@email.m3ocontent.com'
|
||||||
FromName string `json:"fromName"`
|
FromName string `json:"fromName"`
|
||||||
RedirectUrl string `json:"redirectUrl"`
|
RedirectUrl string `json:"redirectUrl"`
|
||||||
Subject string `json:"subject"`
|
// subject of the email
|
||||||
|
Subject string `json:"subject"`
|
||||||
// Text content of the email. Don't forget to include the string '$micro_verification_link' which will be replaced by the real verification link
|
// Text content of the email. Don't forget to include the string '$micro_verification_link' which will be replaced by the real verification link
|
||||||
// HTML emails are not available currently.
|
// HTML emails are not available currently.
|
||||||
TextContent string `json:"textContent"`
|
TextContent string `json:"textContent"`
|
||||||
@@ -218,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
|
||||||
@@ -245,6 +314,8 @@ type UpdateResponse struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type VerifyEmailRequest struct {
|
type VerifyEmailRequest struct {
|
||||||
|
// the email address to verify
|
||||||
|
Email string `json:"email"`
|
||||||
// The token from the verification email
|
// The token from the verification email
|
||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user