mirror of
https://github.com/kevin-DL/m3o-go.git
synced 2026-01-22 06:45:17 +00:00
Commit from m3o/m3o action
This commit is contained in:
@@ -18,8 +18,10 @@ type AddressService struct {
|
|||||||
|
|
||||||
// Lookup a list of UK addresses by postcode
|
// Lookup a list of UK addresses by postcode
|
||||||
func (t *AddressService) LookupPostcode(request *LookupPostcodeRequest) (*LookupPostcodeResponse, error) {
|
func (t *AddressService) LookupPostcode(request *LookupPostcodeRequest) (*LookupPostcodeResponse, error) {
|
||||||
|
|
||||||
rsp := &LookupPostcodeResponse{}
|
rsp := &LookupPostcodeResponse{}
|
||||||
return rsp, t.client.Call("address", "LookupPostcode", request, rsp)
|
return rsp, t.client.Call("address", "LookupPostcode", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type LookupPostcodeRequest struct {
|
type LookupPostcodeRequest struct {
|
||||||
|
|||||||
@@ -18,8 +18,10 @@ type AnswerService struct {
|
|||||||
|
|
||||||
// Ask a question and receive an instant answer
|
// Ask a question and receive an instant answer
|
||||||
func (t *AnswerService) Question(request *QuestionRequest) (*QuestionResponse, error) {
|
func (t *AnswerService) Question(request *QuestionRequest) (*QuestionResponse, error) {
|
||||||
|
|
||||||
rsp := &QuestionResponse{}
|
rsp := &QuestionResponse{}
|
||||||
return rsp, t.client.Call("answer", "Question", request, rsp)
|
return rsp, t.client.Call("answer", "Question", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type QuestionRequest struct {
|
type QuestionRequest struct {
|
||||||
|
|||||||
10
cache/cache.go
vendored
10
cache/cache.go
vendored
@@ -18,32 +18,42 @@ type CacheService struct {
|
|||||||
|
|
||||||
// Decrement a value (if it's a number). If key not found it is equivalent to set.
|
// Decrement a value (if it's a number). If key not found it is equivalent to set.
|
||||||
func (t *CacheService) Decrement(request *DecrementRequest) (*DecrementResponse, error) {
|
func (t *CacheService) Decrement(request *DecrementRequest) (*DecrementResponse, error) {
|
||||||
|
|
||||||
rsp := &DecrementResponse{}
|
rsp := &DecrementResponse{}
|
||||||
return rsp, t.client.Call("cache", "Decrement", request, rsp)
|
return rsp, t.client.Call("cache", "Decrement", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.
|
||||||
func (t *CacheService) Delete(request *DeleteRequest) (*DeleteResponse, error) {
|
func (t *CacheService) Delete(request *DeleteRequest) (*DeleteResponse, error) {
|
||||||
|
|
||||||
rsp := &DeleteResponse{}
|
rsp := &DeleteResponse{}
|
||||||
return rsp, t.client.Call("cache", "Delete", request, rsp)
|
return rsp, t.client.Call("cache", "Delete", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get an item from the cache by key. If key is not found, an empty response is returned.
|
// Get an item from the cache by key. If key is not found, an empty response is returned.
|
||||||
func (t *CacheService) Get(request *GetRequest) (*GetResponse, error) {
|
func (t *CacheService) Get(request *GetRequest) (*GetResponse, error) {
|
||||||
|
|
||||||
rsp := &GetResponse{}
|
rsp := &GetResponse{}
|
||||||
return rsp, t.client.Call("cache", "Get", request, rsp)
|
return rsp, t.client.Call("cache", "Get", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Increment a value (if it's a number). If key not found it is equivalent to set.
|
// Increment a value (if it's a number). If key not found it is equivalent to set.
|
||||||
func (t *CacheService) Increment(request *IncrementRequest) (*IncrementResponse, error) {
|
func (t *CacheService) Increment(request *IncrementRequest) (*IncrementResponse, error) {
|
||||||
|
|
||||||
rsp := &IncrementResponse{}
|
rsp := &IncrementResponse{}
|
||||||
return rsp, t.client.Call("cache", "Increment", request, rsp)
|
return rsp, t.client.Call("cache", "Increment", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set an item in the cache. Overwrites any existing value already set.
|
// Set an item in the cache. Overwrites any existing value already set.
|
||||||
func (t *CacheService) Set(request *SetRequest) (*SetResponse, error) {
|
func (t *CacheService) Set(request *SetRequest) (*SetResponse, error) {
|
||||||
|
|
||||||
rsp := &SetResponse{}
|
rsp := &SetResponse{}
|
||||||
return rsp, t.client.Call("cache", "Set", request, rsp)
|
return rsp, t.client.Call("cache", "Set", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type DecrementRequest struct {
|
type DecrementRequest struct {
|
||||||
|
|||||||
@@ -18,26 +18,34 @@ type CryptoService struct {
|
|||||||
|
|
||||||
// Returns the history for the previous close
|
// Returns the history for the previous close
|
||||||
func (t *CryptoService) History(request *HistoryRequest) (*HistoryResponse, error) {
|
func (t *CryptoService) History(request *HistoryRequest) (*HistoryResponse, error) {
|
||||||
|
|
||||||
rsp := &HistoryResponse{}
|
rsp := &HistoryResponse{}
|
||||||
return rsp, t.client.Call("crypto", "History", request, rsp)
|
return rsp, t.client.Call("crypto", "History", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get news related to a currency
|
// Get news related to a currency
|
||||||
func (t *CryptoService) News(request *NewsRequest) (*NewsResponse, error) {
|
func (t *CryptoService) News(request *NewsRequest) (*NewsResponse, error) {
|
||||||
|
|
||||||
rsp := &NewsResponse{}
|
rsp := &NewsResponse{}
|
||||||
return rsp, t.client.Call("crypto", "News", request, rsp)
|
return rsp, t.client.Call("crypto", "News", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the last price for a given crypto ticker
|
// Get the last price for a given crypto ticker
|
||||||
func (t *CryptoService) Price(request *PriceRequest) (*PriceResponse, error) {
|
func (t *CryptoService) Price(request *PriceRequest) (*PriceResponse, error) {
|
||||||
|
|
||||||
rsp := &PriceResponse{}
|
rsp := &PriceResponse{}
|
||||||
return rsp, t.client.Call("crypto", "Price", request, rsp)
|
return rsp, t.client.Call("crypto", "Price", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the last quote for a given crypto ticker
|
// Get the last quote for a given crypto ticker
|
||||||
func (t *CryptoService) Quote(request *QuoteRequest) (*QuoteResponse, error) {
|
func (t *CryptoService) Quote(request *QuoteRequest) (*QuoteResponse, error) {
|
||||||
|
|
||||||
rsp := &QuoteResponse{}
|
rsp := &QuoteResponse{}
|
||||||
return rsp, t.client.Call("crypto", "Quote", request, rsp)
|
return rsp, t.client.Call("crypto", "Quote", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Article struct {
|
type Article struct {
|
||||||
|
|||||||
@@ -18,26 +18,34 @@ type CurrencyService struct {
|
|||||||
|
|
||||||
// Codes returns the supported currency codes for the API
|
// Codes returns the supported currency codes for the API
|
||||||
func (t *CurrencyService) Codes(request *CodesRequest) (*CodesResponse, error) {
|
func (t *CurrencyService) Codes(request *CodesRequest) (*CodesResponse, error) {
|
||||||
|
|
||||||
rsp := &CodesResponse{}
|
rsp := &CodesResponse{}
|
||||||
return rsp, t.client.Call("currency", "Codes", request, rsp)
|
return rsp, t.client.Call("currency", "Codes", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert returns the currency conversion rate between two pairs e.g USD/GBP
|
// Convert returns the currency conversion rate between two pairs e.g USD/GBP
|
||||||
func (t *CurrencyService) Convert(request *ConvertRequest) (*ConvertResponse, error) {
|
func (t *CurrencyService) Convert(request *ConvertRequest) (*ConvertResponse, error) {
|
||||||
|
|
||||||
rsp := &ConvertResponse{}
|
rsp := &ConvertResponse{}
|
||||||
return rsp, t.client.Call("currency", "Convert", request, rsp)
|
return rsp, t.client.Call("currency", "Convert", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the historic rates for a currency on a given date
|
// Returns the historic rates for a currency on a given date
|
||||||
func (t *CurrencyService) History(request *HistoryRequest) (*HistoryResponse, error) {
|
func (t *CurrencyService) History(request *HistoryRequest) (*HistoryResponse, error) {
|
||||||
|
|
||||||
rsp := &HistoryResponse{}
|
rsp := &HistoryResponse{}
|
||||||
return rsp, t.client.Call("currency", "History", request, rsp)
|
return rsp, t.client.Call("currency", "History", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rates returns the currency rates for a given code e.g USD
|
// Rates returns the currency rates for a given code e.g USD
|
||||||
func (t *CurrencyService) Rates(request *RatesRequest) (*RatesResponse, error) {
|
func (t *CurrencyService) Rates(request *RatesRequest) (*RatesResponse, error) {
|
||||||
|
|
||||||
rsp := &RatesResponse{}
|
rsp := &RatesResponse{}
|
||||||
return rsp, t.client.Call("currency", "Rates", request, rsp)
|
return rsp, t.client.Call("currency", "Rates", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Code struct {
|
type Code struct {
|
||||||
|
|||||||
12
db/db.go
12
db/db.go
@@ -18,38 +18,50 @@ type DbService struct {
|
|||||||
|
|
||||||
// Count records in a table
|
// Count records in a table
|
||||||
func (t *DbService) Count(request *CountRequest) (*CountResponse, error) {
|
func (t *DbService) Count(request *CountRequest) (*CountResponse, error) {
|
||||||
|
|
||||||
rsp := &CountResponse{}
|
rsp := &CountResponse{}
|
||||||
return rsp, t.client.Call("db", "Count", request, rsp)
|
return rsp, t.client.Call("db", "Count", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
|
// Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
|
||||||
func (t *DbService) Create(request *CreateRequest) (*CreateResponse, error) {
|
func (t *DbService) Create(request *CreateRequest) (*CreateResponse, error) {
|
||||||
|
|
||||||
rsp := &CreateResponse{}
|
rsp := &CreateResponse{}
|
||||||
return rsp, t.client.Call("db", "Create", request, rsp)
|
return rsp, t.client.Call("db", "Create", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete a record in the database by id.
|
// Delete a record in the database by id.
|
||||||
func (t *DbService) Delete(request *DeleteRequest) (*DeleteResponse, error) {
|
func (t *DbService) Delete(request *DeleteRequest) (*DeleteResponse, error) {
|
||||||
|
|
||||||
rsp := &DeleteResponse{}
|
rsp := &DeleteResponse{}
|
||||||
return rsp, t.client.Call("db", "Delete", request, rsp)
|
return rsp, t.client.Call("db", "Delete", 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) {
|
||||||
|
|
||||||
rsp := &ReadResponse{}
|
rsp := &ReadResponse{}
|
||||||
return rsp, t.client.Call("db", "Read", request, rsp)
|
return rsp, t.client.Call("db", "Read", 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) {
|
||||||
|
|
||||||
rsp := &TruncateResponse{}
|
rsp := &TruncateResponse{}
|
||||||
return rsp, t.client.Call("db", "Truncate", request, rsp)
|
return rsp, t.client.Call("db", "Truncate", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.
|
||||||
func (t *DbService) Update(request *UpdateRequest) (*UpdateResponse, error) {
|
func (t *DbService) Update(request *UpdateRequest) (*UpdateResponse, error) {
|
||||||
|
|
||||||
rsp := &UpdateResponse{}
|
rsp := &UpdateResponse{}
|
||||||
return rsp, t.client.Call("db", "Update", request, rsp)
|
return rsp, t.client.Call("db", "Update", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type CountRequest struct {
|
type CountRequest struct {
|
||||||
|
|||||||
@@ -18,8 +18,10 @@ type EmailService struct {
|
|||||||
|
|
||||||
// Send an email by passing in from, to, subject, and a text or html body
|
// Send an email by passing in from, to, subject, and a text or html body
|
||||||
func (t *EmailService) Send(request *SendRequest) (*SendResponse, error) {
|
func (t *EmailService) Send(request *SendRequest) (*SendResponse, error) {
|
||||||
|
|
||||||
rsp := &SendResponse{}
|
rsp := &SendResponse{}
|
||||||
return rsp, t.client.Call("email", "Send", request, rsp)
|
return rsp, t.client.Call("email", "Send", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type SendRequest struct {
|
type SendRequest struct {
|
||||||
|
|||||||
@@ -18,27 +18,35 @@ type EmojiService struct {
|
|||||||
|
|
||||||
// Find an emoji by its alias e.g :beer:
|
// Find an emoji by its alias e.g :beer:
|
||||||
func (t *EmojiService) Find(request *FindRequest) (*FindResponse, error) {
|
func (t *EmojiService) Find(request *FindRequest) (*FindResponse, error) {
|
||||||
|
|
||||||
rsp := &FindResponse{}
|
rsp := &FindResponse{}
|
||||||
return rsp, t.client.Call("emoji", "Find", request, rsp)
|
return rsp, t.client.Call("emoji", "Find", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the flag for a country. Requires country code e.g GB for great britain
|
// Get the flag for a country. Requires country code e.g GB for great britain
|
||||||
func (t *EmojiService) Flag(request *FlagRequest) (*FlagResponse, error) {
|
func (t *EmojiService) Flag(request *FlagRequest) (*FlagResponse, error) {
|
||||||
|
|
||||||
rsp := &FlagResponse{}
|
rsp := &FlagResponse{}
|
||||||
return rsp, t.client.Call("emoji", "Flag", request, rsp)
|
return rsp, t.client.Call("emoji", "Flag", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print text and renders the emojis with aliases e.g
|
// Print text and renders the emojis with aliases e.g
|
||||||
// let's grab a :beer: becomes let's grab a 🍺
|
// let's grab a :beer: becomes let's grab a 🍺
|
||||||
func (t *EmojiService) Print(request *PrintRequest) (*PrintResponse, error) {
|
func (t *EmojiService) Print(request *PrintRequest) (*PrintResponse, error) {
|
||||||
|
|
||||||
rsp := &PrintResponse{}
|
rsp := &PrintResponse{}
|
||||||
return rsp, t.client.Call("emoji", "Print", request, rsp)
|
return rsp, t.client.Call("emoji", "Print", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send an emoji to anyone via SMS. Messages are sent in the form '<message> Sent from <from>'
|
// Send an emoji to anyone via SMS. Messages are sent in the form '<message> Sent from <from>'
|
||||||
func (t *EmojiService) Send(request *SendRequest) (*SendResponse, error) {
|
func (t *EmojiService) Send(request *SendRequest) (*SendResponse, error) {
|
||||||
|
|
||||||
rsp := &SendResponse{}
|
rsp := &SendResponse{}
|
||||||
return rsp, t.client.Call("emoji", "Send", request, rsp)
|
return rsp, t.client.Call("emoji", "Send", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type FindRequest struct {
|
type FindRequest struct {
|
||||||
|
|||||||
@@ -18,14 +18,18 @@ type EvchargersService struct {
|
|||||||
|
|
||||||
// Retrieve reference data as used by this API and in conjunction with the Search endpoint
|
// Retrieve reference data as used by this API and in conjunction with the Search endpoint
|
||||||
func (t *EvchargersService) ReferenceData(request *ReferenceDataRequest) (*ReferenceDataResponse, error) {
|
func (t *EvchargersService) ReferenceData(request *ReferenceDataRequest) (*ReferenceDataResponse, error) {
|
||||||
|
|
||||||
rsp := &ReferenceDataResponse{}
|
rsp := &ReferenceDataResponse{}
|
||||||
return rsp, t.client.Call("evchargers", "ReferenceData", request, rsp)
|
return rsp, t.client.Call("evchargers", "ReferenceData", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
||||||
func (t *EvchargersService) Search(request *SearchRequest) (*SearchResponse, error) {
|
func (t *EvchargersService) Search(request *SearchRequest) (*SearchResponse, error) {
|
||||||
|
|
||||||
rsp := &SearchResponse{}
|
rsp := &SearchResponse{}
|
||||||
return rsp, t.client.Call("evchargers", "Search", request, rsp)
|
return rsp, t.client.Call("evchargers", "Search", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Address struct {
|
type Address struct {
|
||||||
|
|||||||
@@ -17,21 +17,43 @@ type EventService struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Consume events from a given topic.
|
// Consume events from a given topic.
|
||||||
func (t *EventService) Consume(request *ConsumeRequest) (*ConsumeResponse, error) {
|
func (t *EventService) Consume(request *ConsumeRequest) (*ConsumeResponseStream, error) {
|
||||||
rsp := &ConsumeResponse{}
|
stream, err := t.client.Stream("event", "Consume", request)
|
||||||
return rsp, t.client.Call("event", "Consume", request, rsp)
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &ConsumeResponseStream{
|
||||||
|
stream: stream,
|
||||||
|
}, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
type ConsumeResponseStream struct {
|
||||||
|
stream *client.Stream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *ConsumeResponseStream) Recv() (*ConsumeResponse, error) {
|
||||||
|
var rsp ConsumeResponse
|
||||||
|
if err := t.stream.Recv(&rsp); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &rsp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Publish a event to the event stream.
|
// Publish a event to the event stream.
|
||||||
func (t *EventService) Publish(request *PublishRequest) (*PublishResponse, error) {
|
func (t *EventService) Publish(request *PublishRequest) (*PublishResponse, error) {
|
||||||
|
|
||||||
rsp := &PublishResponse{}
|
rsp := &PublishResponse{}
|
||||||
return rsp, t.client.Call("event", "Publish", request, rsp)
|
return rsp, t.client.Call("event", "Publish", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read stored events
|
// Read stored events
|
||||||
func (t *EventService) Read(request *ReadRequest) (*ReadResponse, error) {
|
func (t *EventService) Read(request *ReadRequest) (*ReadResponse, error) {
|
||||||
|
|
||||||
rsp := &ReadResponse{}
|
rsp := &ReadResponse{}
|
||||||
return rsp, t.client.Call("event", "Read", request, rsp)
|
return rsp, t.client.Call("event", "Read", request, rsp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ConsumeRequest struct {
|
type ConsumeRequest struct {
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Postcode: "SW1A 2AA",
|
Postcode: "SW1A 2AA",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Query: "microsoft",
|
Query: "microsoft",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"go.m3o.com/cache"
|
"go.m3o.com/cache"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Decrement a value (if it's a number)
|
// Decrement a value (if it's a number). If key not found it is equivalent to set.
|
||||||
func main() {
|
func main() {
|
||||||
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
|
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := cacheService.Decrement(&cache.DecrementRequest{
|
rsp, err := cacheService.Decrement(&cache.DecrementRequest{
|
||||||
@@ -15,4 +15,5 @@ func main() {
|
|||||||
Value: 2,
|
Value: 2,
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
3
examples/cache/delete/deleteAValue/main.go
vendored
3
examples/cache/delete/deleteAValue/main.go
vendored
@@ -7,11 +7,12 @@ import (
|
|||||||
"go.m3o.com/cache"
|
"go.m3o.com/cache"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Delete a value from the cache
|
// Delete a value from the cache. If key not found a success response is returned.
|
||||||
func main() {
|
func main() {
|
||||||
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
|
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := cacheService.Delete(&cache.DeleteRequest{
|
rsp, err := cacheService.Delete(&cache.DeleteRequest{
|
||||||
Key: "foo",
|
Key: "foo",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
3
examples/cache/get/getAValue/main.go
vendored
3
examples/cache/get/getAValue/main.go
vendored
@@ -7,11 +7,12 @@ import (
|
|||||||
"go.m3o.com/cache"
|
"go.m3o.com/cache"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Get an item from the cache by key
|
// Get an item from the cache by key. If key is not found, an empty response is returned.
|
||||||
func main() {
|
func main() {
|
||||||
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
|
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := cacheService.Get(&cache.GetRequest{
|
rsp, err := cacheService.Get(&cache.GetRequest{
|
||||||
Key: "foo",
|
Key: "foo",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"go.m3o.com/cache"
|
"go.m3o.com/cache"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Increment a value (if it's a number)
|
// Increment a value (if it's a number). If key not found it is equivalent to set.
|
||||||
func main() {
|
func main() {
|
||||||
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
|
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := cacheService.Increment(&cache.IncrementRequest{
|
rsp, err := cacheService.Increment(&cache.IncrementRequest{
|
||||||
@@ -15,4 +15,5 @@ func main() {
|
|||||||
Value: 2,
|
Value: 2,
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
1
examples/cache/set/setAValue/main.go
vendored
1
examples/cache/set/setAValue/main.go
vendored
@@ -15,4 +15,5 @@ func main() {
|
|||||||
Value: "bar",
|
Value: "bar",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Symbol: "BTCUSD",
|
Symbol: "BTCUSD",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Symbol: "BTCUSD",
|
Symbol: "BTCUSD",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Symbol: "BTCUSD",
|
Symbol: "BTCUSD",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Symbol: "BTCUSD",
|
Symbol: "BTCUSD",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,4 +12,5 @@ func main() {
|
|||||||
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
|
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := currencyService.Codes(¤cy.CodesRequest{})
|
rsp, err := currencyService.Codes(¤cy.CodesRequest{})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,4 +16,5 @@ func main() {
|
|||||||
To: "GBP",
|
To: "GBP",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,4 +15,5 @@ func main() {
|
|||||||
To: "GBP",
|
To: "GBP",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,4 +15,5 @@ func main() {
|
|||||||
Date: "2021-05-30",
|
Date: "2021-05-30",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Code: "USD",
|
Code: "USD",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,88 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Db/api](https:
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
## Delete
|
|
||||||
|
|
||||||
Delete a record in the database by id.
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/db/api#Delete](https://m3o.com/db/api#Delete)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/db"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Delete a record in the database by id.
|
|
||||||
func DeleteArecord() {
|
|
||||||
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := dbService.Delete(&db.DeleteRequest{
|
|
||||||
Id: "1",
|
|
||||||
Table: "users",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Truncate
|
|
||||||
|
|
||||||
Truncate the records in a table
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/db/api#Truncate](https://m3o.com/db/api#Truncate)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/db"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Truncate the records in a table
|
|
||||||
func TruncateTable() {
|
|
||||||
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := dbService.Truncate(&db.TruncateRequest{
|
|
||||||
Table: "users",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Count
|
|
||||||
|
|
||||||
Count records in a table
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/db/api#Count](https://m3o.com/db/api#Count)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/db"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Count records in a table
|
|
||||||
func CountEntriesInAtable() {
|
|
||||||
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := dbService.Count(&db.CountRequest{
|
|
||||||
Table: "users",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
## Create
|
## Create
|
||||||
|
|
||||||
Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
|
Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
|
||||||
@@ -178,3 +96,85 @@ Table: "users",
|
|||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
## Delete
|
||||||
|
|
||||||
|
Delete a record in the database by id.
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/db/api#Delete](https://m3o.com/db/api#Delete)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Delete a record in the database by id.
|
||||||
|
func DeleteArecord() {
|
||||||
|
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := dbService.Delete(&db.DeleteRequest{
|
||||||
|
Id: "1",
|
||||||
|
Table: "users",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Truncate
|
||||||
|
|
||||||
|
Truncate the records in a table
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/db/api#Truncate](https://m3o.com/db/api#Truncate)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Truncate the records in a table
|
||||||
|
func TruncateTable() {
|
||||||
|
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := dbService.Truncate(&db.TruncateRequest{
|
||||||
|
Table: "users",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Count
|
||||||
|
|
||||||
|
Count records in a table
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/db/api#Count](https://m3o.com/db/api#Count)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Count records in a table
|
||||||
|
func CountEntriesInAtable() {
|
||||||
|
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := dbService.Count(&db.CountRequest{
|
||||||
|
Table: "users",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Table: "users",
|
Table: "users",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,12 +12,13 @@ func main() {
|
|||||||
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := dbService.Create(&db.CreateRequest{
|
rsp, err := dbService.Create(&db.CreateRequest{
|
||||||
Record: map[string]interface{}{
|
Record: map[string]interface{}{
|
||||||
"isActive": true,
|
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"name": "Jane",
|
"name": "Jane",
|
||||||
"age": 42,
|
"age": 42,
|
||||||
|
"isActive": true,
|
||||||
},
|
},
|
||||||
Table: "users",
|
Table: "users",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,4 +15,5 @@ func main() {
|
|||||||
Table: "users",
|
Table: "users",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,4 +15,5 @@ func main() {
|
|||||||
Table: "users",
|
Table: "users",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Table: "users",
|
Table: "users",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,4 +18,5 @@ func main() {
|
|||||||
Table: "users",
|
Table: "users",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,4 +18,5 @@ func main() {
|
|||||||
Please verify your email by clicking this link: $micro_verification_link`,
|
Please verify your email by clicking this link: $micro_verification_link`,
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Alias: ":beer:",
|
Alias: ":beer:",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,4 +12,5 @@ func main() {
|
|||||||
emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN"))
|
emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := emojiService.Flag(&emoji.FlagRequest{})
|
rsp, err := emojiService.Flag(&emoji.FlagRequest{})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,4 +15,5 @@ func main() {
|
|||||||
Text: "let's grab a :beer:",
|
Text: "let's grab a :beer:",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,4 +16,5 @@ func main() {
|
|||||||
To: "+44782669123",
|
To: "+44782669123",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,4 +12,5 @@ func main() {
|
|||||||
evchargersService := evchargers.NewEvchargersService(os.Getenv("M3O_API_TOKEN"))
|
evchargersService := evchargers.NewEvchargersService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := evchargersService.ReferenceData(&evchargers.ReferenceDataRequest{})
|
rsp, err := evchargersService.ReferenceData(&evchargers.ReferenceDataRequest{})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Box: &evchargers.BoundingBox{},
|
Box: &evchargers.BoundingBox{},
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,4 +18,5 @@ func main() {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,4 +19,5 @@ func main() {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,33 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Event/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Read
|
||||||
|
|
||||||
|
Read stored events
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/event/api#Read](https://m3o.com/event/api#Read)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/event"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Read stored events
|
||||||
|
func ReadEventsOnAtopic() {
|
||||||
|
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := eventService.Read(&event.ReadRequest{
|
||||||
|
Topic: "user",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
}
|
||||||
|
```
|
||||||
## Publish
|
## Publish
|
||||||
|
|
||||||
Publish a event to the event stream.
|
Publish a event to the event stream.
|
||||||
@@ -63,30 +90,3 @@ func ConsumeFromAtopic() {
|
|||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Read
|
|
||||||
|
|
||||||
Read stored events
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/event/api#Read](https://m3o.com/event/api#Read)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/event"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Read stored events
|
|
||||||
func ReadEventsOnAtopic() {
|
|
||||||
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := eventService.Read(&event.ReadRequest{
|
|
||||||
Topic: "user",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -10,8 +10,22 @@ import (
|
|||||||
// Consume events from a given topic.
|
// Consume events from a given topic.
|
||||||
func main() {
|
func main() {
|
||||||
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
|
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := eventService.Consume(&event.ConsumeRequest{
|
|
||||||
|
stream, err := eventService.Consume(&event.ConsumeRequest{
|
||||||
Topic: "user",
|
Topic: "user",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for {
|
||||||
|
rsp, err := stream.Recv()
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(rsp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,4 +19,5 @@ func main() {
|
|||||||
Topic: "user",
|
Topic: "user",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Topic: "user",
|
Topic: "user",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,4 +15,5 @@ func main() {
|
|||||||
Project: "examples",
|
Project: "examples",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Project: "examples",
|
Project: "examples",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,4 +15,5 @@ func main() {
|
|||||||
Project: "examples",
|
Project: "examples",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,4 +18,5 @@ func main() {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Symbol: "GBPUSD",
|
Symbol: "GBPUSD",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Symbol: "GBPUSD",
|
Symbol: "GBPUSD",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Symbol: "GBPUSD",
|
Symbol: "GBPUSD",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,4 +15,5 @@ func main() {
|
|||||||
Request: map[string]interface{}{},
|
Request: map[string]interface{}{},
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,4 +15,5 @@ func main() {
|
|||||||
Project: "tests",
|
Project: "tests",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,4 +18,5 @@ func main() {
|
|||||||
Runtime: "nodejs14",
|
Runtime: "nodejs14",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,4 +15,5 @@ func main() {
|
|||||||
Project: "tests",
|
Project: "tests",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,4 +12,5 @@ func main() {
|
|||||||
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
|
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := functionService.List(&function.ListRequest{})
|
rsp, err := functionService.List(&function.ListRequest{})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,4 +17,5 @@ func main() {
|
|||||||
Postcode: "wc2b",
|
Postcode: "wc2b",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,4 +15,5 @@ func main() {
|
|||||||
Longitude: -0.1216235,
|
Longitude: -0.1216235,
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,4 +15,5 @@ func main() {
|
|||||||
Query: "dogs",
|
Query: "dogs",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Query: "how to make donuts",
|
Query: "how to make donuts",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Name: "John",
|
Name: "John",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,22 @@ import (
|
|||||||
// Stream returns a stream of "Hello $name" responses
|
// Stream returns a stream of "Hello $name" responses
|
||||||
func main() {
|
func main() {
|
||||||
helloworldService := helloworld.NewHelloworldService(os.Getenv("M3O_API_TOKEN"))
|
helloworldService := helloworld.NewHelloworldService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := helloworldService.Stream(&helloworld.StreamRequest{
|
|
||||||
|
stream, err := helloworldService.Stream(&helloworld.StreamRequest{
|
||||||
Name: "not supported",
|
Name: "not supported",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for {
|
||||||
|
rsp, err := stream.Recv()
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(rsp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,4 +12,5 @@ func main() {
|
|||||||
holidaysService := holidays.NewHolidaysService(os.Getenv("M3O_API_TOKEN"))
|
holidaysService := holidays.NewHolidaysService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := holidaysService.Countries(&holidays.CountriesRequest{})
|
rsp, err := holidaysService.Countries(&holidays.CountriesRequest{})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Year: 2022,
|
Year: 2022,
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Type: "bigflake",
|
Type: "bigflake",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Type: "shortid",
|
Type: "shortid",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Type: "snowflake",
|
Type: "snowflake",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Type: "uuid",
|
Type: "uuid",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,4 +12,5 @@ func main() {
|
|||||||
idService := id.NewIdService(os.Getenv("M3O_API_TOKEN"))
|
idService := id.NewIdService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := idService.Types(&id.TypesRequest{})
|
rsp, err := idService.Types(&id.TypesRequest{})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,66 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Image/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## 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)
|
||||||
|
}
|
||||||
|
```
|
||||||
## Resize
|
## 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.
|
Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
|
||||||
@@ -138,63 +198,3 @@ Url: "somewebsite.com/cat.png",
|
|||||||
fmt.Println(rsp, err)
|
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)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -16,4 +16,5 @@ func main() {
|
|||||||
Url: "somewebsite.com/cat.png",
|
Url: "somewebsite.com/cat.png",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,4 +18,5 @@ func main() {
|
|||||||
Width: 100,
|
Width: 100,
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,4 +22,5 @@ func main() {
|
|||||||
Width: 100,
|
Width: 100,
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,4 +19,5 @@ func main() {
|
|||||||
Width: 100,
|
Width: 100,
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,4 +16,5 @@ func main() {
|
|||||||
Name: "cat.jpeg",
|
Name: "cat.jpeg",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,4 +16,5 @@ func main() {
|
|||||||
Url: "somewebsite.com/cat.png",
|
Url: "somewebsite.com/cat.png",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Ip: "93.148.214.31",
|
Ip: "93.148.214.31",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,41 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Location/api](
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Save
|
||||||
|
|
||||||
|
Save an entity's current position
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/location/api#Save](https://m3o.com/location/api#Save)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/location"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Save an entity's current position
|
||||||
|
func SaveAnEntity() {
|
||||||
|
locationService := location.NewLocationService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := locationService.Save(&location.SaveRequest{
|
||||||
|
Entity: &location.Entity{
|
||||||
|
Id: "1",
|
||||||
|
Location: &location.Point{
|
||||||
|
Latitude: 51.511061,
|
||||||
|
Longitude: -0.120022,
|
||||||
|
Timestamp: 1622802761,
|
||||||
|
},
|
||||||
|
Type: "bike",
|
||||||
|
},
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
}
|
||||||
|
```
|
||||||
## Read
|
## Read
|
||||||
|
|
||||||
Read an entity by its ID
|
Read an entity by its ID
|
||||||
@@ -64,38 +99,3 @@ Type: "bike",
|
|||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Save
|
|
||||||
|
|
||||||
Save an entity's current position
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/location/api#Save](https://m3o.com/location/api#Save)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/location"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Save an entity's current position
|
|
||||||
func SaveAnEntity() {
|
|
||||||
locationService := location.NewLocationService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := locationService.Save(&location.SaveRequest{
|
|
||||||
Entity: &location.Entity{
|
|
||||||
Id: "1",
|
|
||||||
Location: &location.Point{
|
|
||||||
Latitude: 51.511061,
|
|
||||||
Longitude: -0.120022,
|
|
||||||
Timestamp: 1622802761,
|
|
||||||
},
|
|
||||||
Type: "bike",
|
|
||||||
},
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Id: "1",
|
Id: "1",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,4 +22,5 @@ func main() {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,4 +20,5 @@ func main() {
|
|||||||
Type: "bike",
|
Type: "bike",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,4 +19,5 @@ func main() {
|
|||||||
Topic: "events",
|
Topic: "events",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,22 @@ import (
|
|||||||
// Subscribe to messages for a given topic.
|
// Subscribe to messages for a given topic.
|
||||||
func main() {
|
func main() {
|
||||||
mqService := mq.NewMqService(os.Getenv("M3O_API_TOKEN"))
|
mqService := mq.NewMqService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := mqService.Subscribe(&mq.SubscribeRequest{
|
|
||||||
|
stream, err := mqService.Subscribe(&mq.SubscribeRequest{
|
||||||
Topic: "events",
|
Topic: "events",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for {
|
||||||
|
rsp, err := stream.Recv()
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(rsp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Notes/api](htt
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Create
|
||||||
|
|
||||||
|
Create a new note
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/notes/api#Create](https://m3o.com/notes/api#Create)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/notes"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Create a new note
|
||||||
|
func CreateAnote() {
|
||||||
|
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := notesService.Create(¬es.CreateRequest{
|
||||||
|
Text: "This is my note",
|
||||||
|
Title: "New Note",
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
}
|
||||||
|
```
|
||||||
## Read
|
## Read
|
||||||
|
|
||||||
Read a note
|
Read a note
|
||||||
@@ -142,31 +170,3 @@ func SubscribeToEvents() {
|
|||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Create
|
|
||||||
|
|
||||||
Create a new note
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/notes/api#Create](https://m3o.com/notes/api#Create)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/notes"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Create a new note
|
|
||||||
func CreateAnote() {
|
|
||||||
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := notesService.Create(¬es.CreateRequest{
|
|
||||||
Text: "This is my note",
|
|
||||||
Title: "New Note",
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Id: "asim@example.com",
|
Id: "asim@example.com",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,4 +15,5 @@ func main() {
|
|||||||
Id: "asim@example.com",
|
Id: "asim@example.com",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Postcode: "SW1A 2AA",
|
Postcode: "SW1A 2AA",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,4 +12,5 @@ func main() {
|
|||||||
postcodeService := postcode.NewPostcodeService(os.Getenv("M3O_API_TOKEN"))
|
postcodeService := postcode.NewPostcodeService(os.Getenv("M3O_API_TOKEN"))
|
||||||
rsp, err := postcodeService.Random(&postcode.RandomRequest{})
|
rsp, err := postcodeService.Random(&postcode.RandomRequest{})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Postcode: "SW1A 2AA",
|
Postcode: "SW1A 2AA",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Location: "london",
|
Location: "london",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,4 +15,5 @@ func main() {
|
|||||||
Text: "https://m3o.com/qr",
|
Text: "https://m3o.com/qr",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Language: "en",
|
Language: "en",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Query: "messenger",
|
Query: "messenger",
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ func main() {
|
|||||||
Chapter: 1,
|
Chapter: 1,
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,4 +16,5 @@ func main() {
|
|||||||
Chapter: 1,
|
Chapter: 1,
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,40 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Routing/api](h
|
|||||||
|
|
||||||
Endpoints:
|
Endpoints:
|
||||||
|
|
||||||
|
## Eta
|
||||||
|
|
||||||
|
Get the eta for a route from origin to destination. The eta is an estimated time based on car routes
|
||||||
|
|
||||||
|
|
||||||
|
[https://m3o.com/routing/api#Eta](https://m3o.com/routing/api#Eta)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package example
|
||||||
|
|
||||||
|
import(
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.m3o.com/routing"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get the eta for a route from origin to destination. The eta is an estimated time based on car routes
|
||||||
|
func EtaFromPointAtoPointB() {
|
||||||
|
routingService := routing.NewRoutingService(os.Getenv("M3O_API_TOKEN"))
|
||||||
|
rsp, err := routingService.Eta(&routing.EtaRequest{
|
||||||
|
Destination: &routing.Point{
|
||||||
|
Latitude: 52.529407,
|
||||||
|
Longitude: 13.397634,
|
||||||
|
},
|
||||||
|
Origin: &routing.Point{
|
||||||
|
Latitude: 52.517037,
|
||||||
|
Longitude: 13.38886,
|
||||||
|
},
|
||||||
|
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
}
|
||||||
|
```
|
||||||
## Directions
|
## Directions
|
||||||
|
|
||||||
Turn by turn directions from a start point to an end point including maneuvers and bearings
|
Turn by turn directions from a start point to an end point including maneuvers and bearings
|
||||||
@@ -72,37 +106,3 @@ Origin: &routing.Point{
|
|||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Eta
|
|
||||||
|
|
||||||
Get the eta for a route from origin to destination. The eta is an estimated time based on car routes
|
|
||||||
|
|
||||||
|
|
||||||
[https://m3o.com/routing/api#Eta](https://m3o.com/routing/api#Eta)
|
|
||||||
|
|
||||||
```go
|
|
||||||
package example
|
|
||||||
|
|
||||||
import(
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.m3o.com/routing"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Get the eta for a route from origin to destination. The eta is an estimated time based on car routes
|
|
||||||
func EtaFromPointAtoPointB() {
|
|
||||||
routingService := routing.NewRoutingService(os.Getenv("M3O_API_TOKEN"))
|
|
||||||
rsp, err := routingService.Eta(&routing.EtaRequest{
|
|
||||||
Destination: &routing.Point{
|
|
||||||
Latitude: 52.529407,
|
|
||||||
Longitude: 13.397634,
|
|
||||||
},
|
|
||||||
Origin: &routing.Point{
|
|
||||||
Latitude: 52.517037,
|
|
||||||
Longitude: 13.38886,
|
|
||||||
},
|
|
||||||
|
|
||||||
})
|
|
||||||
fmt.Println(rsp, err)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -21,4 +21,5 @@ func main() {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,4 +21,5 @@ func main() {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
fmt.Println(rsp, err)
|
fmt.Println(rsp, err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user