166 Commits

Author SHA1 Message Date
m3o-actions
cdb937b2cb Commit from m3o/m3o action 2022-01-31 18:10:43 +00:00
m3o-actions
fbf39cc693 Commit from m3o/m3o action 2022-01-31 16:18:59 +00:00
m3o-actions
1729996181 Commit from m3o/m3o action 2022-01-31 11:37:39 +00:00
m3o-actions
5fe1678ec5 Commit from m3o/m3o action 2022-01-31 11:31:42 +00:00
m3o-actions
8b790bd9b9 Commit from m3o/m3o action 2022-01-30 13:20:18 +00:00
m3o-actions
a9bcb78aa8 Commit from m3o/m3o action 2022-01-29 13:34:03 +00:00
m3o-actions
b3fd38731e Commit from m3o/m3o action 2022-01-29 13:32:49 +00:00
m3o-actions
ad326fd0b8 Commit from m3o/m3o action 2022-01-29 13:12:25 +00:00
m3o-actions
3ffe702d02 Commit from m3o/m3o action 2022-01-28 16:51:25 +00:00
m3o-actions
27a90b388a Commit from m3o/m3o action 2022-01-28 16:44:19 +00:00
m3o-actions
edfebe05df Commit from m3o/m3o action 2022-01-28 12:45:06 +00:00
m3o-actions
13441363d5 Commit from m3o/m3o action 2022-01-28 12:26:49 +00:00
m3o-actions
c5d206122c Commit from m3o/m3o action 2022-01-28 12:23:16 +00:00
m3o-actions
909ac3d71f Commit from m3o/m3o action 2022-01-28 11:45:42 +00:00
m3o-actions
3e8a881233 Commit from m3o/m3o action 2022-01-28 11:38:06 +00:00
m3o-actions
da1038343f Commit from m3o/m3o action 2022-01-28 11:07:21 +00:00
m3o-actions
fe7b620e59 Commit from m3o/m3o action 2022-01-27 14:31:56 +00:00
m3o-actions
58278dc08b Commit from m3o/m3o action 2022-01-26 20:25:51 +00:00
m3o-actions
362f73dca1 Commit from m3o/m3o action 2022-01-26 20:15:25 +00:00
m3o-actions
3cb3b40901 Commit from m3o/m3o action 2022-01-26 20:04:43 +00:00
m3o-actions
0aca22c769 Commit from m3o/m3o action 2022-01-26 19:15:56 +00:00
m3o-actions
9547c26947 Commit from m3o/m3o action 2022-01-26 13:06:45 +00:00
m3o-actions
9cd82a849f Commit from m3o/m3o action 2022-01-24 18:17:02 +00:00
m3o-actions
f142eddbb9 Commit from m3o/m3o action 2022-01-23 17:54:02 +00:00
m3o-actions
81eb8a213a Commit from m3o/m3o action 2022-01-23 09:47:29 +00:00
m3o-actions
79a9c94139 Commit from m3o/m3o action 2022-01-23 09:46:54 +00:00
m3o-actions
4a6b4ddbaa Commit from m3o/m3o action 2022-01-23 09:10:40 +00:00
m3o-actions
4646555d94 Commit from m3o/m3o action 2022-01-23 09:09:54 +00:00
m3o-actions
87d4ae480a Commit from m3o/m3o action 2022-01-23 09:09:16 +00:00
m3o-actions
f2c03ac414 Commit from m3o/m3o action 2022-01-23 09:08:22 +00:00
m3o-actions
00ad5f2668 Commit from m3o/m3o action 2022-01-21 15:55:22 +00:00
m3o-actions
5890e989e4 Commit from m3o/m3o action 2022-01-20 18:46:25 +00:00
m3o-actions
e7f0fd6434 Commit from m3o/m3o action 2022-01-20 15:13:38 +00:00
m3o-actions
d52ecd7232 Commit from m3o/m3o action 2022-01-20 15:13:18 +00:00
m3o-actions
3fd0023e27 Commit from m3o/m3o action 2022-01-20 08:15:38 +00:00
m3o-actions
83740822e1 Commit from m3o/m3o action 2022-01-20 08:06:17 +00:00
m3o-actions
7a4f8f2faa Commit from m3o/m3o action 2022-01-20 08:03:44 +00:00
m3o-actions
5db5bff7e5 Commit from m3o/m3o action 2022-01-20 07:58:53 +00:00
m3o-actions
bc3256a02a Commit from m3o/m3o action 2022-01-20 07:54:44 +00:00
m3o-actions
d346494459 Commit from m3o/m3o action 2022-01-20 07:52:53 +00:00
m3o-actions
847b17a423 Commit from m3o/m3o action 2022-01-19 21:52:39 +00:00
m3o-actions
051b7e8db7 Commit from m3o/m3o action 2022-01-19 21:51:49 +00:00
m3o-actions
ef53cae138 Commit from m3o/m3o action 2022-01-19 19:39:03 +00:00
m3o-actions
9c5e2fc5dd Commit from m3o/m3o action 2022-01-19 19:38:00 +00:00
m3o-actions
fbbc6fce2b Commit from m3o/m3o action 2022-01-19 18:45:46 +00:00
m3o-actions
75931d518a Commit from m3o/m3o action 2022-01-19 18:45:22 +00:00
m3o-actions
76e85f7e0a Commit from m3o/m3o action 2022-01-19 18:45:02 +00:00
m3o-actions
b4f72abd73 Commit from m3o/m3o action 2022-01-19 18:39:51 +00:00
m3o-actions
c9ddd8776c Commit from m3o/m3o action 2022-01-19 18:15:52 +00:00
m3o-actions
4e9cd04448 Commit from m3o/m3o action 2022-01-19 15:06:00 +00:00
m3o-actions
e4472e76bc Commit from m3o/m3o action 2022-01-19 10:30:21 +00:00
m3o-actions
b89a529672 Commit from m3o/m3o action 2022-01-18 14:54:20 +00:00
m3o-actions
1c567f0eff Commit from m3o/m3o action 2022-01-18 13:29:33 +00:00
m3o-actions
42b9941d93 Commit from m3o/m3o action 2022-01-18 09:21:40 +00:00
m3o-actions
ee0f545030 Commit from m3o/m3o action 2022-01-17 15:32:27 +00:00
m3o-actions
59a3c3c3a8 Commit from m3o/m3o action 2022-01-17 14:13:41 +00:00
m3o-actions
081b4bc7dd Commit from m3o/m3o action 2022-01-17 11:48:03 +00:00
m3o-actions
c296523bb2 Commit from m3o/m3o action 2022-01-17 11:42:01 +00:00
m3o-actions
fe83bf7d18 Commit from m3o/m3o action 2022-01-17 11:34:48 +00:00
m3o-actions
f68c53a04d Commit from m3o/m3o action 2022-01-15 21:05:12 +00:00
m3o-actions
04d7bf8148 Commit from m3o/m3o action 2022-01-15 20:59:52 +00:00
m3o-actions
a83b25a9aa Commit from m3o/m3o action 2022-01-15 20:55:42 +00:00
m3o-actions
b48eab72b9 Commit from m3o/m3o action 2022-01-15 20:55:33 +00:00
m3o-actions
8a600b6131 Commit from m3o/m3o action 2022-01-15 20:54:42 +00:00
m3o-actions
8408429e9b Commit from m3o/m3o action 2022-01-15 20:53:15 +00:00
m3o-actions
20a3a5bfd7 Commit from m3o/m3o action 2022-01-15 20:53:01 +00:00
m3o-actions
f01a912eb3 Commit from m3o/m3o action 2022-01-15 20:48:02 +00:00
m3o-actions
eebea56166 Commit from m3o/m3o action 2022-01-15 20:46:39 +00:00
m3o-actions
2d8f3d735d Commit from m3o/m3o action 2022-01-14 17:42:50 +00:00
m3o-actions
ccc5de5cda Commit from m3o/m3o action 2022-01-14 17:42:44 +00:00
m3o-actions
863b60c7db Commit from m3o/m3o action 2022-01-14 16:09:20 +00:00
m3o-actions
5caf581eff Commit from m3o/m3o action 2022-01-14 09:11:51 +00:00
m3o-actions
2dda68b677 Commit from m3o/m3o action 2022-01-14 09:11:13 +00:00
m3o-actions
8967d7aed8 Commit from m3o/m3o action 2022-01-13 14:13:38 +00:00
m3o-actions
88ec3b1629 Commit from m3o/m3o action 2022-01-13 13:23:08 +00:00
m3o-actions
3b8973592b Commit from m3o/m3o action 2022-01-13 11:39:07 +00:00
m3o-actions
af71fa56b0 Commit from m3o/m3o action 2022-01-13 11:00:05 +00:00
m3o-actions
1a6e2f4cb5 Commit from m3o/m3o action 2022-01-12 15:03:53 +00:00
m3o-actions
9abf8b4e6a Commit from m3o/m3o action 2022-01-12 14:17:28 +00:00
m3o-actions
74d67fe903 Commit from m3o/m3o action 2022-01-12 10:23:25 +00:00
m3o-actions
f9a04eab0b Commit from m3o/m3o action 2022-01-12 10:10:29 +00:00
m3o-actions
ecbcaa1f37 Commit from m3o/m3o action 2022-01-12 10:08:41 +00:00
m3o-actions
fc9078369c Commit from m3o/m3o action 2022-01-12 10:03:46 +00:00
m3o-actions
9fb8b7249a Commit from m3o/m3o action 2022-01-12 09:46:51 +00:00
m3o-actions
f238a3dde3 Commit from m3o/m3o action 2022-01-12 09:44:30 +00:00
m3o-actions
06e0e031f0 Commit from m3o/m3o action 2022-01-11 15:53:58 +00:00
m3o-actions
4671615268 Commit from m3o/m3o action 2022-01-11 14:33:46 +00:00
m3o-actions
50abf5f044 Commit from m3o/m3o action 2022-01-11 12:33:30 +00:00
m3o-actions
7ebbac3eb1 Commit from m3o/m3o action 2022-01-10 20:48:03 +00:00
m3o-actions
cff39c86e7 Commit from m3o/m3o action 2022-01-10 15:39:42 +00:00
m3o-actions
200da05cf0 Commit from m3o/m3o action 2022-01-10 15:13:17 +00:00
m3o-actions
0a2f0eb713 Commit from m3o/m3o action 2022-01-10 09:20:34 +00:00
m3o-actions
0d1952d41a Commit from m3o/m3o action 2022-01-07 12:55:10 +00:00
m3o-actions
4eaa0d7a79 Commit from m3o/m3o action 2022-01-07 12:48:23 +00:00
m3o-actions
fc3cf88dd1 Commit from m3o/m3o action 2022-01-07 11:59:24 +00:00
m3o-actions
4029f043af Commit from m3o/m3o action 2022-01-07 11:55:38 +00:00
m3o-actions
768c3a7277 Commit from m3o/m3o action 2022-01-07 11:09:48 +00:00
Dominic Wong
1b6f533cda remove search example 2022-01-07 11:05:22 +00:00
m3o-actions
23efeb1b54 Commit from m3o/m3o action 2022-01-06 22:20:09 +00:00
m3o-actions
28be83a1a3 Commit from m3o/m3o action 2022-01-06 22:09:57 +00:00
m3o-actions
163098f65c Commit from m3o/m3o action 2022-01-06 18:20:05 +00:00
m3o-actions
d75eee6adc Commit from m3o/m3o action 2022-01-06 17:04:52 +00:00
m3o-actions
f62afe5c72 Commit from m3o/m3o action 2022-01-06 17:00:05 +00:00
m3o-actions
05dcddb482 Commit from m3o/m3o action 2022-01-06 16:59:33 +00:00
m3o-actions
96bb1b0a89 Commit from m3o/m3o action 2022-01-06 16:57:05 +00:00
m3o-actions
3a49edfecc Commit from m3o/m3o action 2022-01-06 16:50:27 +00:00
m3o-actions
e8cd7403b7 Commit from m3o/m3o action 2022-01-06 16:44:20 +00:00
m3o-actions
8bba336dd3 Commit from m3o/m3o action 2022-01-06 15:23:27 +00:00
m3o-actions
a8b28f6b2a Commit from m3o/m3o action 2022-01-06 14:52:18 +00:00
m3o-actions
c919eb0016 Commit from m3o/m3o action 2022-01-06 11:30:48 +00:00
m3o-actions
6443d9822b Commit from m3o/m3o action 2022-01-06 11:14:12 +00:00
m3o-actions
cd580f41a7 Commit from m3o/m3o action 2022-01-06 11:13:13 +00:00
m3o-actions
f21152e1ed Commit from m3o/m3o action 2022-01-05 15:30:45 +00:00
m3o-actions
27e13d2b6c Commit from m3o/m3o action 2021-12-29 13:41:36 +00:00
m3o-actions
8561aa8205 Commit from m3o/m3o action 2021-12-28 10:50:15 +00:00
m3o-actions
f051277b48 Commit from m3o/m3o action 2021-12-28 10:47:34 +00:00
m3o-actions
1132b4809a Commit from m3o/m3o action 2021-12-28 07:23:23 +00:00
m3o-actions
85ff0bf56f Commit from m3o/m3o action 2021-12-23 09:07:13 +00:00
m3o-actions
f362f68c54 Commit from m3o/m3o action 2021-12-22 10:20:20 +00:00
m3o-actions
063e059d70 Commit from m3o/m3o action 2021-12-21 14:18:03 +00:00
m3o-actions
1773d164e4 Commit from m3o/m3o action 2021-12-21 11:38:52 +00:00
m3o-actions
a835eaddc4 Commit from m3o/m3o action 2021-12-21 11:38:29 +00:00
m3o-actions
a905d67b2c Commit from m3o/m3o action 2021-12-21 11:37:33 +00:00
m3o-actions
9c1ae9e4d2 Commit from m3o/m3o action 2021-12-21 11:36:48 +00:00
m3o-actions
5daed5e997 Commit from m3o/m3o action 2021-12-21 11:36:33 +00:00
m3o-actions
7c8a6f80de Commit from m3o/m3o action 2021-12-21 11:27:10 +00:00
Asim Aslam
05097a471d Remove contact examples 2021-12-21 11:16:46 +00:00
m3o-actions
3d0f9dda4b Commit from m3o/m3o action 2021-12-21 10:51:03 +00:00
m3o-actions
36d8023ada Commit from m3o/m3o action 2021-12-21 09:21:58 +00:00
m3o-actions
b135490f0e Commit from m3o/m3o action 2021-12-20 20:02:20 +00:00
m3o-actions
a97ced0f02 Commit from m3o/m3o action 2021-12-20 19:53:22 +00:00
m3o-actions
002380be31 Commit from m3o/m3o action 2021-12-20 14:22:15 +00:00
m3o-actions
1211b1b74e Commit from m3o/m3o action 2021-12-20 11:10:57 +00:00
m3o-actions
9a39681342 Commit from m3o/m3o action 2021-12-17 16:16:32 +00:00
m3o-actions
fd12523b0d Commit from m3o/m3o action 2021-12-17 15:38:23 +00:00
m3o-actions
4822495226 Commit from m3o/m3o action 2021-12-17 15:26:23 +00:00
m3o-actions
9cfa252f59 Commit from m3o/m3o action 2021-12-17 14:57:36 +00:00
m3o-actions
ab4602b369 Commit from m3o/m3o action 2021-12-17 14:01:44 +00:00
m3o-actions
9c97fbb4da Commit from m3o/m3o action 2021-12-17 13:02:04 +00:00
m3o-actions
3c853a2cbc Commit from m3o/m3o action 2021-12-17 10:03:03 +00:00
m3o-actions
ed1603b391 Commit from m3o/m3o action 2021-12-17 09:58:48 +00:00
m3o-actions
6ba5ad8ce4 Commit from m3o/m3o action 2021-12-17 09:34:07 +00:00
m3o-actions
24b609b070 Commit from m3o/m3o action 2021-12-17 09:29:22 +00:00
m3o-actions
801e983f3a Commit from m3o/m3o action 2021-12-17 09:28:01 +00:00
m3o-actions
c3e28cbc66 Commit from m3o/m3o action 2021-12-17 09:26:50 +00:00
m3o-actions
c4e0fe407e Commit from m3o/m3o action 2021-12-17 09:25:23 +00:00
m3o-actions
43e6f37402 Commit from m3o/m3o action 2021-12-17 09:24:04 +00:00
m3o-actions
9036b95fd2 Commit from m3o/m3o action 2021-12-17 09:20:58 +00:00
m3o-actions
937cb915ac Commit from m3o/m3o action 2021-12-17 09:14:47 +00:00
m3o-actions
da2b23fbab Commit from m3o/m3o action 2021-12-17 08:08:27 +00:00
m3o-actions
4de67b6746 Commit from m3o/m3o action 2021-12-16 21:02:03 +00:00
m3o-actions
75ba0d6c3a Commit from m3o/m3o action 2021-12-16 19:51:32 +00:00
Asim Aslam
873ba7f939 fix examples 2021-12-16 19:47:04 +00:00
m3o-actions
a6c66fb76a Commit from m3o/m3o action 2021-12-16 19:24:48 +00:00
m3o-actions
292001f3f2 Commit from m3o/m3o action 2021-12-16 19:22:42 +00:00
m3o-actions
d7e95f687f Commit from m3o/m3o action 2021-12-16 17:34:25 +00:00
m3o-actions
32496fe696 Commit from m3o/m3o action 2021-12-16 17:18:38 +00:00
m3o-actions
86803cc1e2 Commit from m3o/m3o action 2021-12-16 17:03:59 +00:00
m3o-actions
3f24078efb Commit from m3o/m3o action 2021-12-16 17:00:50 +00:00
m3o-actions
bb753c4504 Commit from m3o/m3o action 2021-12-16 16:55:04 +00:00
m3o-actions
3c6466378c Commit from m3o/m3o action 2021-12-16 15:49:00 +00:00
m3o-actions
d921922cd9 Commit from m3o/m3o action 2021-12-16 15:17:46 +00:00
m3o-actions
d2230e009d Commit from m3o/m3o action 2021-12-16 15:16:44 +00:00
m3o-actions
536e9cfe77 Commit from m3o/m3o action 2021-12-16 15:06:05 +00:00
m3o-actions
c707489b7a Commit from m3o/m3o action 2021-12-16 14:52:39 +00:00
m3o-actions
1a28fb54f9 Commit from m3o/m3o action 2021-12-16 12:53:53 +00:00
143 changed files with 2873 additions and 1138 deletions

View File

@@ -4,6 +4,10 @@ import (
"go.m3o.com/client"
)
type Address interface {
LookupPostcode(*LookupPostcodeRequest) (*LookupPostcodeResponse, error)
}
func NewAddressService(token string) *AddressService {
return &AddressService{
client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,10 @@ import (
"go.m3o.com/client"
)
type Answer interface {
Question(*QuestionRequest) (*QuestionResponse, error)
}
func NewAnswerService(token string) *AnswerService {
return &AnswerService{
client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,17 @@ import (
"go.m3o.com/client"
)
type App interface {
Delete(*DeleteRequest) (*DeleteResponse, error)
List(*ListRequest) (*ListResponse, error)
Regions(*RegionsRequest) (*RegionsResponse, error)
Reserve(*ReserveRequest) (*ReserveResponse, error)
Resolve(*ResolveRequest) (*ResolveResponse, error)
Run(*RunRequest) (*RunResponse, error)
Status(*StatusRequest) (*StatusResponse, error)
Update(*UpdateRequest) (*UpdateResponse, error)
}
func NewAppService(token string) *AppService {
return &AppService{
client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,10 @@ import (
"go.m3o.com/client"
)
type Avatar interface {
Generate(*GenerateRequest) (*GenerateResponse, error)
}
func NewAvatarService(token string) *AvatarService {
return &AvatarService{
client: client.NewClient(&client.Options{

24
cache/cache.go vendored
View File

@@ -4,6 +4,15 @@ import (
"go.m3o.com/client"
)
type Cache interface {
Decrement(*DecrementRequest) (*DecrementResponse, error)
Delete(*DeleteRequest) (*DeleteResponse, error)
Get(*GetRequest) (*GetResponse, error)
Increment(*IncrementRequest) (*IncrementResponse, error)
ListKeys(*ListKeysRequest) (*ListKeysResponse, error)
Set(*SetRequest) (*SetResponse, error)
}
func NewCacheService(token string) *CacheService {
return &CacheService{
client: client.NewClient(&client.Options{
@@ -48,6 +57,14 @@ func (t *CacheService) Increment(request *IncrementRequest) (*IncrementResponse,
}
// List all the available keys
func (t *CacheService) ListKeys(request *ListKeysRequest) (*ListKeysResponse, error) {
rsp := &ListKeysResponse{}
return rsp, t.client.Call("cache", "ListKeys", request, rsp)
}
// Set an item in the cache. Overwrites any existing value already set.
func (t *CacheService) Set(request *SetRequest) (*SetResponse, error) {
@@ -108,6 +125,13 @@ type IncrementResponse struct {
Value int64 `json:"value,string"`
}
type ListKeysRequest struct {
}
type ListKeysResponse struct {
Keys []string `json:"keys"`
}
type SetRequest struct {
// The key to update
Key string `json:"key"`

52
carbon/carbon.go Executable file
View File

@@ -0,0 +1,52 @@
package carbon
import (
"go.m3o.com/client"
)
type Carbon interface {
Offset(*OffsetRequest) (*OffsetResponse, error)
}
func NewCarbonService(token string) *CarbonService {
return &CarbonService{
client: client.NewClient(&client.Options{
Token: token,
}),
}
}
type CarbonService struct {
client *client.Client
}
// Purchase 1KG (0.001 tonne) of carbon offsets in a single request
func (t *CarbonService) Offset(request *OffsetRequest) (*OffsetResponse, error) {
rsp := &OffsetResponse{}
return rsp, t.client.Call("carbon", "Offset", request, rsp)
}
type OffsetRequest struct {
}
type OffsetResponse struct {
// the metric used e.g KG or Tonnes
Metric string `json:"metric"`
// projects it was allocated to
Projects []Project `json:"projects"`
// number of tonnes
Tonnes float64 `json:"tonnes"`
// number of units purchased
Units int32 `json:"units"`
}
type Project struct {
// name of the project
Name string `json:"name"`
// percentage that went to this
Percentage float64 `json:"percentage"`
// amount in tonnes
Tonnes float64 `json:"tonnes"`
}

200
contact/contact.go Executable file
View File

@@ -0,0 +1,200 @@
package contact
import (
"go.m3o.com/client"
)
type Contact interface {
Create(*CreateRequest) (*CreateResponse, error)
Delete(*DeleteRequest) (*DeleteResponse, error)
List(*ListRequest) (*ListResponse, error)
Read(*ReadRequest) (*ReadResponse, error)
Update(*UpdateRequest) (*UpdateResponse, error)
}
func NewContactService(token string) *ContactService {
return &ContactService{
client: client.NewClient(&client.Options{
Token: token,
}),
}
}
type ContactService struct {
client *client.Client
}
//
func (t *ContactService) Create(request *CreateRequest) (*CreateResponse, error) {
rsp := &CreateResponse{}
return rsp, t.client.Call("contact", "Create", request, rsp)
}
//
func (t *ContactService) Delete(request *DeleteRequest) (*DeleteResponse, error) {
rsp := &DeleteResponse{}
return rsp, t.client.Call("contact", "Delete", request, rsp)
}
//
func (t *ContactService) List(request *ListRequest) (*ListResponse, error) {
rsp := &ListResponse{}
return rsp, t.client.Call("contact", "List", request, rsp)
}
//
func (t *ContactService) Read(request *ReadRequest) (*ReadResponse, error) {
rsp := &ReadResponse{}
return rsp, t.client.Call("contact", "Read", request, rsp)
}
//
func (t *ContactService) Update(request *UpdateRequest) (*UpdateResponse, error) {
rsp := &UpdateResponse{}
return rsp, t.client.Call("contact", "Update", request, rsp)
}
type Address struct {
// the label of the address
Label string `json:"label"`
// the address location
Location string `json:"location"`
}
type ContactInfo struct {
// the address
Addresses []Address `json:"addresses"`
// the birthday
Birthday string `json:"birthday"`
// create date string in RFC3339
CreatedAt string `json:"created_at"`
// the emails
Emails []Email `json:"emails"`
// contact id
Id string `json:"id"`
// the contact links
Links []Link `json:"links"`
// the contact name
Name string `json:"name"`
// note of the contact
Note string `json:"note"`
// the phone numbers
Phones []Phone `json:"phones"`
// the social media username
SocialMedias *SocialMedia `json:"social_medias"`
// update date string in RFC3339
UpdatedAt string `json:"updated_at"`
}
type CreateRequest struct {
// optional, location
Addresses []Address `json:"addresses"`
// optional, birthday
Birthday string `json:"birthday"`
// optional, emails
Emails []Email `json:"emails"`
// optional, links
Links []Link `json:"links"`
// required, the name of the contact
Name string `json:"name"`
// optional, note of the contact
Note string `json:"note"`
// optional, phone numbers
Phones []Phone `json:"phones"`
// optional, social media
SocialMedias *SocialMedia `json:"social_medias"`
}
type CreateResponse struct {
Contact *ContactInfo `json:"contact"`
}
type DeleteRequest struct {
// the id of the contact
Id string `json:"id"`
}
type DeleteResponse struct {
}
type Email struct {
// the email address
Address string `json:"address"`
// the label of the email
Label string `json:"label"`
}
type Link struct {
// the label of the link
Label string `json:"label"`
// the url of the contact
Url string `json:"url"`
}
type ListRequest struct {
// optional, default is 30
Limit int32 `json:"limit"`
// optional
Offset int32 `json:"offset"`
}
type ListResponse struct {
Contacts []ContactInfo `json:"contacts"`
}
type Phone struct {
// the label of the phone number
Label string `json:"label"`
// phone number
Number string `json:"number"`
}
type ReadRequest struct {
Id string `json:"id"`
}
type ReadResponse struct {
Contact *ContactInfo `json:"contact"`
}
type SocialMedia struct {
// the label of the social
Label string `json:"label"`
// the username of social media
Username string `json:"username"`
}
type UpdateRequest struct {
// optional, addresses
Addresses []Address `json:"addresses"`
// optional, birthday
Birthday string `json:"birthday"`
// optional, emails
Emails []Email `json:"emails"`
// required, the contact id
Id string `json:"id"`
// optional, links
Links []Link `json:"links"`
// required, the name
Name string `json:"name"`
// optional, note
Note string `json:"note"`
// optional, phone number
Phones []Phone `json:"phones"`
// optional, social media
SocialMedias *SocialMedia `json:"social_medias"`
}
type UpdateResponse struct {
Contact *ContactInfo `json:"contact"`
}

View File

@@ -4,6 +4,13 @@ import (
"go.m3o.com/client"
)
type Crypto interface {
History(*HistoryRequest) (*HistoryResponse, error)
News(*NewsRequest) (*NewsResponse, error)
Price(*PriceRequest) (*PriceResponse, error)
Quote(*QuoteRequest) (*QuoteResponse, error)
}
func NewCryptoService(token string) *CryptoService {
return &CryptoService{
client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,13 @@ import (
"go.m3o.com/client"
)
type Currency interface {
Codes(*CodesRequest) (*CodesResponse, error)
Convert(*ConvertRequest) (*ConvertResponse, error)
History(*HistoryRequest) (*HistoryResponse, error)
Rates(*RatesRequest) (*RatesResponse, error)
}
func NewCurrencyService(token string) *CurrencyService {
return &CurrencyService{
client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,18 @@ import (
"go.m3o.com/client"
)
type Db interface {
Count(*CountRequest) (*CountResponse, error)
Create(*CreateRequest) (*CreateResponse, error)
Delete(*DeleteRequest) (*DeleteResponse, error)
DropTable(*DropTableRequest) (*DropTableResponse, error)
ListTables(*ListTablesRequest) (*ListTablesResponse, error)
Read(*ReadRequest) (*ReadResponse, error)
RenameTable(*RenameTableRequest) (*RenameTableResponse, error)
Truncate(*TruncateRequest) (*TruncateResponse, error)
Update(*UpdateRequest) (*UpdateResponse, error)
}
func NewDbService(token string) *DbService {
return &DbService{
client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,12 @@ import (
"go.m3o.com/client"
)
type Email interface {
Parse(*ParseRequest) (*ParseResponse, error)
Send(*SendRequest) (*SendResponse, error)
Validate(*ValidateRequest) (*ValidateResponse, error)
}
func NewEmailService(token string) *EmailService {
return &EmailService{
client: client.NewClient(&client.Options{
@@ -16,6 +22,14 @@ type EmailService struct {
client *client.Client
}
// Parse an RFC5322 address e.g "Joe Blogs <joe@example.com>"
func (t *EmailService) Parse(request *ParseRequest) (*ParseResponse, error) {
rsp := &ParseResponse{}
return rsp, t.client.Call("email", "Parse", request, rsp)
}
// Send an email by passing in from, to, subject, and a text or html body
func (t *EmailService) Send(request *SendRequest) (*SendResponse, error) {
@@ -24,6 +38,26 @@ func (t *EmailService) Send(request *SendRequest) (*SendResponse, error) {
}
// Validate an email address format
func (t *EmailService) Validate(request *ValidateRequest) (*ValidateResponse, error) {
rsp := &ValidateResponse{}
return rsp, t.client.Call("email", "Validate", request, rsp)
}
type ParseRequest struct {
// The address to parse. Can be of the format "Joe Blogs <joe@example.com>" or "joe@example.com"
Address string `json:"address"`
}
type ParseResponse struct {
// the email address
Address string `json:"address"`
// associated name e.g Joe Blogs
Name string `json:"name"`
}
type SendRequest struct {
// the display name of the sender
From string `json:"from"`
@@ -41,3 +75,11 @@ type SendRequest struct {
type SendResponse struct {
}
type ValidateRequest struct {
Address string `json:"address"`
}
type ValidateResponse struct {
IsValid bool `json:"is_valid"`
}

View File

@@ -4,6 +4,13 @@ import (
"go.m3o.com/client"
)
type Emoji interface {
Find(*FindRequest) (*FindResponse, error)
Flag(*FlagRequest) (*FlagResponse, error)
Print(*PrintRequest) (*PrintResponse, error)
Send(*SendRequest) (*SendResponse, error)
}
func NewEmojiService(token string) *EmojiService {
return &EmojiService{
client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,11 @@ import (
"go.m3o.com/client"
)
type Evchargers interface {
ReferenceData(*ReferenceDataRequest) (*ReferenceDataResponse, error)
Search(*SearchRequest) (*SearchResponse, error)
}
func NewEvchargersService(token string) *EvchargersService {
return &EvchargersService{
client: client.NewClient(&client.Options{

View File

@@ -4,6 +4,12 @@ import (
"go.m3o.com/client"
)
type Event interface {
Consume(*ConsumeRequest) (*ConsumeResponseStream, error)
Publish(*PublishRequest) (*PublishResponse, error)
Read(*ReadRequest) (*ReadResponse, error)
}
func NewEventService(token string) *EventService {
return &EventService{
client: client.NewClient(&client.Options{

View File

@@ -1,6 +1,6 @@
# Address
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Address/api](https://m3o.com/Address/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/address/api](https://m3o.com/address/api).
Endpoints:

View File

@@ -1,6 +1,6 @@
# Answer
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Answer/api](https://m3o.com/Answer/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/answer/api](https://m3o.com/answer/api).
Endpoints:

View File

@@ -1,37 +1,9 @@
# App
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/App/api](https://m3o.com/App/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/app/api](https://m3o.com/app/api).
Endpoints:
## Update
Update the app. The latest source code will be downloaded, built and deployed.
[https://m3o.com/app/api#Update](https://m3o.com/app/api#Update)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/app"
)
// Update the app. The latest source code will be downloaded, built and deployed.
func UpdateAnApp() {
appService := app.NewAppService(os.Getenv("M3O_API_TOKEN"))
rsp, err := appService.Update(&app.UpdateRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
}
```
## Delete
Delete an app
@@ -230,3 +202,31 @@ func ResolveAppById() {
}
```
## Update
Update the app. The latest source code will be downloaded, built and deployed.
[https://m3o.com/app/api#Update](https://m3o.com/app/api#Update)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/app"
)
// Update the app. The latest source code will be downloaded, built and deployed.
func UpdateAnApp() {
appService := app.NewAppService(os.Getenv("M3O_API_TOKEN"))
rsp, err := appService.Update(&app.UpdateRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
}
```

View File

@@ -1,6 +1,6 @@
# Avatar
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Avatar/api](https://m3o.com/Avatar/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/avatar/api](https://m3o.com/avatar/api).
Endpoints:
@@ -25,9 +25,9 @@ import(
func GenerateAvatarAndReturnBase64stringOfTheAvatar() {
avatarService := avatar.NewAvatarService(os.Getenv("M3O_API_TOKEN"))
rsp, err := avatarService.Generate(&avatar.GenerateRequest{
Format: "png",
Format: "jpeg",
Gender: "female",
Upload: true,
Upload: false,
Username: "",
})
@@ -56,9 +56,9 @@ import(
func GenerateAnAvatarAndUploadTheAvatarToMicrosCdn() {
avatarService := avatar.NewAvatarService(os.Getenv("M3O_API_TOKEN"))
rsp, err := avatarService.Generate(&avatar.GenerateRequest{
Format: "jpeg",
Format: "png",
Gender: "female",
Upload: false,
Upload: true,
Username: "",
})

View File

@@ -11,9 +11,9 @@ import (
func main() {
avatarService := avatar.NewAvatarService(os.Getenv("M3O_API_TOKEN"))
rsp, err := avatarService.Generate(&avatar.GenerateRequest{
Format: "jpeg",
Format: "png",
Gender: "female",
Upload: false,
Upload: true,
Username: "",
})
fmt.Println(rsp, err)

View File

@@ -11,9 +11,9 @@ import (
func main() {
avatarService := avatar.NewAvatarService(os.Getenv("M3O_API_TOKEN"))
rsp, err := avatarService.Generate(&avatar.GenerateRequest{
Format: "png",
Format: "jpeg",
Gender: "female",
Upload: true,
Upload: false,
Username: "",
})
fmt.Println(rsp, err)

View File

@@ -1,6 +1,6 @@
# Cache
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Cache/api](https://m3o.com/Cache/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/cache/api](https://m3o.com/cache/api).
Endpoints:
@@ -147,3 +147,30 @@ Value: 2,
}
```
## ListKeys
List all the available keys
[https://m3o.com/cache/api#ListKeys](https://m3o.com/cache/api#ListKeys)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/cache"
)
// List all the available keys
func ListTheKeys() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.ListKeys(&cache.ListKeysRequest{
})
fmt.Println(rsp, err)
}
```

15
examples/cache/listKeys/listTheKeys/main.go vendored Executable file
View File

@@ -0,0 +1,15 @@
package main
import (
"fmt"
"os"
"go.m3o.com/cache"
)
// List all the available keys
func main() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.ListKeys(&cache.ListKeysRequest{})
fmt.Println(rsp, err)
}

33
examples/carbon/README.md Executable file
View File

@@ -0,0 +1,33 @@
# Carbon
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/carbon/api](https://m3o.com/carbon/api).
Endpoints:
## Offset
Purchase 1KG (0.001 tonne) of carbon offsets in a single request
[https://m3o.com/carbon/api#Offset](https://m3o.com/carbon/api#Offset)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/carbon"
)
// Purchase 1KG (0.001 tonne) of carbon offsets in a single request
func OffsetCarbon() {
carbonService := carbon.NewCarbonService(os.Getenv("M3O_API_TOKEN"))
rsp, err := carbonService.Offset(&carbon.OffsetRequest{
})
fmt.Println(rsp, err)
}
```

View File

@@ -0,0 +1,15 @@
package main
import (
"fmt"
"os"
"go.m3o.com/carbon"
)
// Purchase 1KG (0.001 tonne) of carbon offsets in a single request
func main() {
carbonService := carbon.NewCarbonService(os.Getenv("M3O_API_TOKEN"))
rsp, err := carbonService.Offset(&carbon.OffsetRequest{})
fmt.Println(rsp, err)
}

219
examples/contact/README.md Executable file
View File

@@ -0,0 +1,219 @@
# Contact
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/contact/api](https://m3o.com/contact/api).
Endpoints:
## Create
[https://m3o.com/contact/api#Create](https://m3o.com/contact/api#Create)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/contact"
)
//
func CreateAcontact() {
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
rsp, err := contactService.Create(&contact.CreateRequest{
Addresses: []contact.Address{
contact.Address{
Label: "company address",
Location: "123 street address",
}},
Birthday: "1995-01-01",
Emails: []contact.Email{
contact.Email{
Address: "home@example.com",
Label: "home",
}},
Links: []contact.Link{
contact.Link{
Label: "blog",
Url: "https://blog.joe.me",
}},
Name: "joe",
Note: "this person is very important",
Phones: []contact.Phone{
contact.Phone{
Label: "home",
Number: "010-12345678",
}},
})
fmt.Println(rsp, err)
}
```
## Update
[https://m3o.com/contact/api#Update](https://m3o.com/contact/api#Update)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/contact"
)
//
func UpdateAcontact() {
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
rsp, err := contactService.Update(&contact.UpdateRequest{
Addresses: []contact.Address{
contact.Address{
Label: "company address",
Location: "123 street address",
}},
Birthday: "1995-01-01",
Emails: []contact.Email{
contact.Email{
Address: "home@example.com",
Label: "home",
}},
Id: "42e48a3c-6221-11ec-96d2-acde48001122",
Links: []contact.Link{
contact.Link{
Label: "blog",
Url: "https://blog.joe.me",
}},
Name: "joe",
Note: "this person is very important",
Phones: []contact.Phone{
contact.Phone{
Label: "home",
Number: "010-12345678",
}},
})
fmt.Println(rsp, err)
}
```
## Read
[https://m3o.com/contact/api#Read](https://m3o.com/contact/api#Read)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/contact"
)
//
func GetAcontact() {
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
rsp, err := contactService.Read(&contact.ReadRequest{
Id: "42e48a3c-6221-11ec-96d2-acde48001122",
})
fmt.Println(rsp, err)
}
```
## Delete
[https://m3o.com/contact/api#Delete](https://m3o.com/contact/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/contact"
)
//
func DeleteAcontact() {
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
rsp, err := contactService.Delete(&contact.DeleteRequest{
Id: "42e48a3c-6221-11ec-96d2-acde48001122",
})
fmt.Println(rsp, err)
}
```
## List
[https://m3o.com/contact/api#List](https://m3o.com/contact/api#List)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/contact"
)
//
func ListContactsWithDefaultOffsetAndLimitDefaultLimitIs20() {
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
rsp, err := contactService.List(&contact.ListRequest{
})
fmt.Println(rsp, err)
}
```
## List
[https://m3o.com/contact/api#List](https://m3o.com/contact/api#List)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/contact"
)
//
func ListContactsWithSpecificOffsetAndLimit() {
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
rsp, err := contactService.List(&contact.ListRequest{
Limit: 1,
Offset: 1,
})
fmt.Println(rsp, err)
}
```

View File

@@ -0,0 +1,39 @@
package main
import (
"fmt"
"os"
"go.m3o.com/contact"
)
//
func main() {
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
rsp, err := contactService.Create(&contact.CreateRequest{
Addresses: []contact.Address{
contact.Address{
Label: "company address",
Location: "123 street address",
}},
Birthday: "1995-01-01",
Emails: []contact.Email{
contact.Email{
Address: "home@example.com",
Label: "home",
}},
Links: []contact.Link{
contact.Link{
Label: "blog",
Url: "https://blog.joe.me",
}},
Name: "joe",
Note: "this person is very important",
Phones: []contact.Phone{
contact.Phone{
Label: "home",
Number: "010-12345678",
}},
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,17 @@
package main
import (
"fmt"
"os"
"go.m3o.com/contact"
)
//
func main() {
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
rsp, err := contactService.Delete(&contact.DeleteRequest{
Id: "42e48a3c-6221-11ec-96d2-acde48001122",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,15 @@
package main
import (
"fmt"
"os"
"go.m3o.com/contact"
)
//
func main() {
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
rsp, err := contactService.List(&contact.ListRequest{})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/contact"
)
//
func main() {
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
rsp, err := contactService.List(&contact.ListRequest{
Limit: 1,
Offset: 1,
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,17 @@
package main
import (
"fmt"
"os"
"go.m3o.com/contact"
)
//
func main() {
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
rsp, err := contactService.Read(&contact.ReadRequest{
Id: "42e48a3c-6221-11ec-96d2-acde48001122",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,40 @@
package main
import (
"fmt"
"os"
"go.m3o.com/contact"
)
//
func main() {
contactService := contact.NewContactService(os.Getenv("M3O_API_TOKEN"))
rsp, err := contactService.Update(&contact.UpdateRequest{
Addresses: []contact.Address{
contact.Address{
Label: "company address",
Location: "123 street address",
}},
Birthday: "1995-01-01",
Emails: []contact.Email{
contact.Email{
Address: "home@example.com",
Label: "home",
}},
Id: "42e48a3c-6221-11ec-96d2-acde48001122",
Links: []contact.Link{
contact.Link{
Label: "blog",
Url: "https://blog.joe.me",
}},
Name: "joe",
Note: "this person is very important",
Phones: []contact.Phone{
contact.Phone{
Label: "home",
Number: "010-12345678",
}},
})
fmt.Println(rsp, err)
}

View File

@@ -1,65 +1,9 @@
# Crypto
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Crypto/api](https://m3o.com/Crypto/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/crypto/api](https://m3o.com/crypto/api).
Endpoints:
## News
Get news related to a currency
[https://m3o.com/crypto/api#News](https://m3o.com/crypto/api#News)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/crypto"
)
// Get news related to a currency
func GetCryptocurrencyNews() {
cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cryptoService.News(&crypto.NewsRequest{
Symbol: "BTCUSD",
})
fmt.Println(rsp, err)
}
```
## Price
Get the last price for a given crypto ticker
[https://m3o.com/crypto/api#Price](https://m3o.com/crypto/api#Price)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/crypto"
)
// Get the last price for a given crypto ticker
func GetCryptocurrencyPrice() {
cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cryptoService.Price(&crypto.PriceRequest{
Symbol: "BTCUSD",
})
fmt.Println(rsp, err)
}
```
## Quote
Get the last quote for a given crypto ticker
@@ -116,3 +60,59 @@ func GetPreviousClose() {
}
```
## News
Get news related to a currency
[https://m3o.com/crypto/api#News](https://m3o.com/crypto/api#News)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/crypto"
)
// Get news related to a currency
func GetCryptocurrencyNews() {
cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cryptoService.News(&crypto.NewsRequest{
Symbol: "BTCUSD",
})
fmt.Println(rsp, err)
}
```
## Price
Get the last price for a given crypto ticker
[https://m3o.com/crypto/api#Price](https://m3o.com/crypto/api#Price)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/crypto"
)
// Get the last price for a given crypto ticker
func GetCryptocurrencyPrice() {
cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cryptoService.Price(&crypto.PriceRequest{
Symbol: "BTCUSD",
})
fmt.Println(rsp, err)
}
```

View File

@@ -1,9 +1,68 @@
# Currency
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Currency/api](https://m3o.com/Currency/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/currency/api](https://m3o.com/currency/api).
Endpoints:
## Convert
Convert returns the currency conversion rate between two pairs e.g USD/GBP
[https://m3o.com/currency/api#Convert](https://m3o.com/currency/api#Convert)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/currency"
)
// Convert returns the currency conversion rate between two pairs e.g USD/GBP
func ConvertUsdToGbp() {
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
rsp, err := currencyService.Convert(&currency.ConvertRequest{
From: "USD",
To: "GBP",
})
fmt.Println(rsp, err)
}
```
## Convert
Convert returns the currency conversion rate between two pairs e.g USD/GBP
[https://m3o.com/currency/api#Convert](https://m3o.com/currency/api#Convert)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/currency"
)
// Convert returns the currency conversion rate between two pairs e.g USD/GBP
func Convert10usdToGbp() {
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
rsp, err := currencyService.Convert(&currency.ConvertRequest{
Amount: 10,
From: "USD",
To: "GBP",
})
fmt.Println(rsp, err)
}
```
## History
Returns the historic rates for a currency on a given date
@@ -88,62 +147,3 @@ func GetRatesForUsd() {
}
```
## Convert
Convert returns the currency conversion rate between two pairs e.g USD/GBP
[https://m3o.com/currency/api#Convert](https://m3o.com/currency/api#Convert)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/currency"
)
// Convert returns the currency conversion rate between two pairs e.g USD/GBP
func ConvertUsdToGbp() {
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
rsp, err := currencyService.Convert(&currency.ConvertRequest{
From: "USD",
To: "GBP",
})
fmt.Println(rsp, err)
}
```
## Convert
Convert returns the currency conversion rate between two pairs e.g USD/GBP
[https://m3o.com/currency/api#Convert](https://m3o.com/currency/api#Convert)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/currency"
)
// Convert returns the currency conversion rate between two pairs e.g USD/GBP
func Convert10usdToGbp() {
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
rsp, err := currencyService.Convert(&currency.ConvertRequest{
Amount: 10,
From: "USD",
To: "GBP",
})
fmt.Println(rsp, err)
}
```

View File

@@ -1,9 +1,41 @@
# Db
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Db/api](https://m3o.com/Db/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/db/api](https://m3o.com/db/api).
Endpoints:
## Update
Update a record in the database. Include an "id" in the record to update.
[https://m3o.com/db/api#Update](https://m3o.com/db/api#Update)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Update a record in the database. Include an "id" in the record to update.
func UpdateArecord() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Update(&db.UpdateRequest{
Record: map[string]interface{}{
"id": "1",
"age": 43,
},
Table: "example",
})
fmt.Println(rsp, err)
}
```
## Read
Read data from a table. Lookup can be by ID or via querying any field in the record.
@@ -59,63 +91,6 @@ func DropTable() {
})
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: "examples2",
To: "examples3",
})
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: "example",
})
fmt.Println(rsp, err)
}
```
## Count
@@ -205,38 +180,6 @@ Table: "example",
})
fmt.Println(rsp, err)
}
```
## Update
Update a record in the database. Include an "id" in the record to update.
[https://m3o.com/db/api#Update](https://m3o.com/db/api#Update)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Update a record in the database. Include an "id" in the record to update.
func UpdateArecord() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Update(&db.UpdateRequest{
Record: map[string]interface{}{
"id": "1",
"age": 43,
},
Table: "example",
})
fmt.Println(rsp, err)
}
```
## Delete
@@ -268,3 +211,60 @@ Table: "example",
}
```
## 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: "example",
})
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: "examples2",
To: "examples3",
})
fmt.Println(rsp, err)
}
```

View File

@@ -1,9 +1,37 @@
# Email
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Email/api](https://m3o.com/Email/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/email/api](https://m3o.com/email/api).
Endpoints:
## Validate
Validate an email address format
[https://m3o.com/email/api#Validate](https://m3o.com/email/api#Validate)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/email"
)
// Validate an email address format
func ValidateEmail() {
emailService := email.NewEmailService(os.Getenv("M3O_API_TOKEN"))
rsp, err := emailService.Validate(&email.ValidateRequest{
Address: "joe@example.com",
})
fmt.Println(rsp, err)
}
```
## Send
Send an email by passing in from, to, subject, and a text or html body
@@ -36,3 +64,31 @@ Please verify your email by clicking this link: $micro_verification_link`,
}
```
## Parse
Parse an RFC5322 address e.g "Joe Blogs <joe@example.com>"
[https://m3o.com/email/api#Parse](https://m3o.com/email/api#Parse)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/email"
)
// Parse an RFC5322 address e.g "Joe Blogs <joe@example.com>"
func ParseEmail() {
emailService := email.NewEmailService(os.Getenv("M3O_API_TOKEN"))
rsp, err := emailService.Parse(&email.ParseRequest{
Address: "Joe Blogs <joe@example.com>",
})
fmt.Println(rsp, err)
}
```

View File

@@ -0,0 +1,17 @@
package main
import (
"fmt"
"os"
"go.m3o.com/email"
)
// Parse an RFC5322 address e.g "Joe Blogs <joe@example.com>"
func main() {
emailService := email.NewEmailService(os.Getenv("M3O_API_TOKEN"))
rsp, err := emailService.Parse(&email.ParseRequest{
Address: "Joe Blogs <joe@example.com>",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,17 @@
package main
import (
"fmt"
"os"
"go.m3o.com/email"
)
// Validate an email address format
func main() {
emailService := email.NewEmailService(os.Getenv("M3O_API_TOKEN"))
rsp, err := emailService.Validate(&email.ValidateRequest{
Address: "joe@example.com",
})
fmt.Println(rsp, err)
}

View File

@@ -1,6 +1,6 @@
# Emoji
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Emoji/api](https://m3o.com/Emoji/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/emoji/api](https://m3o.com/emoji/api).
Endpoints:

View File

@@ -1,6 +1,6 @@
# Evchargers
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Evchargers/api](https://m3o.com/Evchargers/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/evchargers/api](https://m3o.com/evchargers/api).
Endpoints:

View File

@@ -1,42 +1,9 @@
# Event
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Event/api](https://m3o.com/Event/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/event/api](https://m3o.com/event/api).
Endpoints:
## Publish
Publish a event to the event stream.
[https://m3o.com/event/api#Publish](https://m3o.com/event/api#Publish)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/event"
)
// Publish a event to the event stream.
func PublishAnEvent() {
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
rsp, err := eventService.Publish(&event.PublishRequest{
Message: map[string]interface{}{
"id": "1",
"type": "signup",
"user": "john",
},
Topic: "user",
})
fmt.Println(rsp, err)
}
```
## Consume
Consume events from a given topic.
@@ -106,3 +73,36 @@ func ReadEventsOnAtopic() {
}
```
## Publish
Publish a event to the event stream.
[https://m3o.com/event/api#Publish](https://m3o.com/event/api#Publish)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/event"
)
// Publish a event to the event stream.
func PublishAnEvent() {
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
rsp, err := eventService.Publish(&event.PublishRequest{
Message: map[string]interface{}{
"id": "1",
"type": "signup",
"user": "john",
},
Topic: "user",
})
fmt.Println(rsp, err)
}
```

View File

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

View File

@@ -1,9 +1,37 @@
# File
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/File/api](https://m3o.com/File/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/file/api](https://m3o.com/file/api).
Endpoints:
## List
List files by their project and optionally a path.
[https://m3o.com/file/api#List](https://m3o.com/file/api#List)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/file"
)
// List files by their project and optionally a path.
func ListFiles() {
fileService := file.NewFileService(os.Getenv("M3O_API_TOKEN"))
rsp, err := fileService.List(&file.ListRequest{
Project: "examples",
})
fmt.Println(rsp, err)
}
```
## Read
Read a file by path
@@ -94,31 +122,3 @@ func SaveFile() {
}
```
## List
List files by their project and optionally a path.
[https://m3o.com/file/api#List](https://m3o.com/file/api#List)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/file"
)
// List files by their project and optionally a path.
func ListFiles() {
fileService := file.NewFileService(os.Getenv("M3O_API_TOKEN"))
rsp, err := fileService.List(&file.ListRequest{
Project: "examples",
})
fmt.Println(rsp, err)
}
```

View File

@@ -1,6 +1,6 @@
# Forex
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Forex/api](https://m3o.com/Forex/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/forex/api](https://m3o.com/forex/api).
Endpoints:

View File

@@ -1,9 +1,37 @@
# Function
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Function/api](https://m3o.com/Function/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/function/api](https://m3o.com/function/api).
Endpoints:
## Reserve
Reserve function names and resources beyond free quota
[https://m3o.com/function/api#Reserve](https://m3o.com/function/api#Reserve)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Reserve function names and resources beyond free quota
func ReserveAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Reserve(&function.ReserveRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
}
```
## Deploy
Deploy a group of functions
@@ -25,22 +53,25 @@ import(
func DeployAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Deploy(&function.DeployRequest{
Entrypoint: "helloworld",
Branch: "main",
Entrypoint: "Helloworld",
Name: "helloworld",
Repo: "github.com/m3o/nodejs-function-example",
Runtime: "nodejs14",
Region: "europe-west1",
Repo: "https://github.com/m3o/m3o",
Runtime: "go116",
Subfolder: "examples/go-function",
})
fmt.Println(rsp, err)
}
```
## Update
## Regions
Update a function
Return a list of supported regions
[https://m3o.com/function/api#Update](https://m3o.com/function/api#Update)
[https://m3o.com/function/api#Regions](https://m3o.com/function/api#Regions)
```go
package example
@@ -52,44 +83,10 @@ import(
"go.m3o.com/function"
)
// Update a function
func UpdateAfunction() {
// Return a list of supported regions
func ListRegions() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Update(&function.UpdateRequest{
Entrypoint: "helloworld",
Name: "helloworld",
Repo: "github.com/m3o/nodejs-function-example",
Runtime: "nodejs14",
})
fmt.Println(rsp, err)
}
```
## Call
Call a function by name
[https://m3o.com/function/api#Call](https://m3o.com/function/api#Call)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Call a function by name
func CallAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Call(&function.CallRequest{
Name: "helloworld",
Request: map[string]interface{}{
},
rsp, err := functionService.Regions(&function.RegionsRequest{
})
fmt.Println(rsp, err)
@@ -179,3 +176,90 @@ func DescribeFunctionStatus() {
}
```
## Proxy
Return the backend url for proxying
[https://m3o.com/function/api#Proxy](https://m3o.com/function/api#Proxy)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Return the backend url for proxying
func ProxyUrl() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Proxy(&function.ProxyRequest{
Id: "helloworld",
})
fmt.Println(rsp, err)
}
```
## Update
Update a function. Downloads the source, builds and redeploys
[https://m3o.com/function/api#Update](https://m3o.com/function/api#Update)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Update a function. Downloads the source, builds and redeploys
func UpdateAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Update(&function.UpdateRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
}
```
## Call
Call a function by name
[https://m3o.com/function/api#Call](https://m3o.com/function/api#Call)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Call a function by name
func CallAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Call(&function.CallRequest{
Name: "helloworld",
Request: map[string]interface{}{
"name": "Alice",
},
})
fmt.Println(rsp, err)
}
```

View File

@@ -11,8 +11,10 @@ import (
func main() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Call(&function.CallRequest{
Name: "helloworld",
Request: map[string]interface{}{},
Name: "helloworld",
Request: map[string]interface{}{
"name": "Alice",
},
})
fmt.Println(rsp, err)
}

View File

@@ -11,8 +11,7 @@ import (
func DeleteAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Delete(&function.DeleteRequest{
Name: "my-first-func",
Project: "tests",
Name: "my-first-func",
})
fmt.Println(rsp, err)
}

View File

@@ -13,7 +13,6 @@ func DeployAfunction() {
rsp, err := functionService.Deploy(&function.DeployRequest{
Entrypoint: "helloworld",
Name: "my-first-func",
Project: "tests",
Repo: "github.com/m3o/nodejs-function-example",
Runtime: "nodejs14",
})

View File

@@ -11,10 +11,13 @@ import (
func main() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Deploy(&function.DeployRequest{
Entrypoint: "helloworld",
Branch: "main",
Entrypoint: "Helloworld",
Name: "helloworld",
Repo: "github.com/m3o/nodejs-function-example",
Runtime: "nodejs14",
Region: "europe-west1",
Repo: "https://github.com/m3o/m3o",
Runtime: "go116",
Subfolder: "examples/go-function",
})
fmt.Println(rsp, err)
}

View File

@@ -11,8 +11,7 @@ import (
func DescribeFunctionStatus() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Describe(&function.DescribeRequest{
Name: "my-first-func",
Project: "tests",
Name: "my-first-func",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,17 @@
package main
import (
"fmt"
"os"
"go.m3o.com/function"
)
// Return the backend url for proxying
func main() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Proxy(&function.ProxyRequest{
Id: "helloworld",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,15 @@
package main
import (
"fmt"
"os"
"go.m3o.com/function"
)
// Return a list of supported regions
func main() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Regions(&function.RegionsRequest{})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,17 @@
package main
import (
"fmt"
"os"
"go.m3o.com/function"
)
// Reserve function names and resources beyond free quota
func main() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Reserve(&function.ReserveRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
}

View File

@@ -7,14 +7,11 @@ import (
"go.m3o.com/function"
)
// Update a function
// Update a function. Downloads the source, builds and redeploys
func main() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Update(&function.UpdateRequest{
Entrypoint: "helloworld",
Name: "helloworld",
Repo: "github.com/m3o/nodejs-function-example",
Runtime: "nodejs14",
Name: "helloworld",
})
fmt.Println(rsp, err)
}

View File

@@ -1,6 +1,6 @@
# Geocoding
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Geocoding/api](https://m3o.com/Geocoding/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/geocoding/api](https://m3o.com/geocoding/api).
Endpoints:

View File

@@ -1,6 +1,6 @@
# Gifs
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Gifs/api](https://m3o.com/Gifs/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/gifs/api](https://m3o.com/gifs/api).
Endpoints:

View File

@@ -1,6 +1,6 @@
# Google
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Google/api](https://m3o.com/Google/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/google/api](https://m3o.com/google/api).
Endpoints:

View File

@@ -1,6 +1,6 @@
# Helloworld
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Helloworld/api](https://m3o.com/Helloworld/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/helloworld/api](https://m3o.com/helloworld/api).
Endpoints:

View File

@@ -1,6 +1,6 @@
# Holidays
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Holidays/api](https://m3o.com/Holidays/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/holidays/api](https://m3o.com/holidays/api).
Endpoints:

View File

@@ -1,36 +1,9 @@
# Id
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Id/api](https://m3o.com/Id/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/id/api](https://m3o.com/id/api).
Endpoints:
## Types
List the types of IDs available. No query params needed.
[https://m3o.com/id/api#Types](https://m3o.com/id/api#Types)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/id"
)
// List the types of IDs available. No query params needed.
func ListTheTypesOfIdsAvailable() {
idService := id.NewIdService(os.Getenv("M3O_API_TOKEN"))
rsp, err := idService.Types(&id.TypesRequest{
})
fmt.Println(rsp, err)
}
```
## Generate
Generate a unique ID. Defaults to uuid.
@@ -143,3 +116,30 @@ func GenerateAbigflakeId() {
}
```
## Types
List the types of IDs available. No query params needed.
[https://m3o.com/id/api#Types](https://m3o.com/id/api#Types)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/id"
)
// List the types of IDs available. No query params needed.
func ListTheTypesOfIdsAvailable() {
idService := id.NewIdService(os.Getenv("M3O_API_TOKEN"))
rsp, err := idService.Types(&id.TypesRequest{
})
fmt.Println(rsp, err)
}
```

View File

@@ -1,37 +1,9 @@
# Image
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Image/api](https://m3o.com/Image/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/image/api](https://m3o.com/image/api).
Endpoints:
## Delete
Delete an image previously uploaded.
[https://m3o.com/image/api#Delete](https://m3o.com/image/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/image"
)
// Delete an image previously uploaded.
func DeleteAnUploadedImage() {
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
rsp, err := imageService.Delete(&image.DeleteRequest{
Url: "https://cdn.m3ocontent.com/micro/images/micro/41e23b39-48dd-42b6-9738-79a313414bb8/cat.png",
})
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.
@@ -256,3 +228,31 @@ Url: "somewebsite.com/cat.png",
}
```
## Delete
Delete an image previously uploaded.
[https://m3o.com/image/api#Delete](https://m3o.com/image/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/image"
)
// Delete an image previously uploaded.
func DeleteAnUploadedImage() {
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
rsp, err := imageService.Delete(&image.DeleteRequest{
Url: "https://cdn.m3ocontent.com/micro/images/micro/41e23b39-48dd-42b6-9738-79a313414bb8/cat.png",
})
fmt.Println(rsp, err)
}
```

View File

@@ -1,6 +1,6 @@
# Ip
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Ip/api](https://m3o.com/Ip/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/ip/api](https://m3o.com/ip/api).
Endpoints:

View File

@@ -1,6 +1,6 @@
# Joke
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Joke/api](https://m3o.com/Joke/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/joke/api](https://m3o.com/joke/api).
Endpoints:

View File

@@ -1,45 +1,9 @@
# Location
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Location/api](https://m3o.com/Location/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/location/api](https://m3o.com/location/api).
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 an entity by its ID
@@ -102,3 +66,39 @@ Type: "bike",
}
```
## 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)
}
```

View File

@@ -1,6 +1,6 @@
# Movie
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Movie/api](https://m3o.com/Movie/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/movie/api](https://m3o.com/movie/api).
Endpoints:

View File

@@ -1,42 +1,9 @@
# Mq
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Mq/api](https://m3o.com/Mq/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/mq/api](https://m3o.com/mq/api).
Endpoints:
## Publish
Publish a message. Specify a topic to group messages for a specific topic.
[https://m3o.com/mq/api#Publish](https://m3o.com/mq/api#Publish)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/mq"
)
// Publish a message. Specify a topic to group messages for a specific topic.
func PublishAmessage() {
mqService := mq.NewMqService(os.Getenv("M3O_API_TOKEN"))
rsp, err := mqService.Publish(&mq.PublishRequest{
Message: map[string]interface{}{
"type": "signup",
"user": "john",
"id": "1",
},
Topic: "events",
})
fmt.Println(rsp, err)
}
```
## Subscribe
Subscribe to messages for a given topic.
@@ -78,3 +45,36 @@ func SubscribeToAtopic() {
}
}
```
## Publish
Publish a message. Specify a topic to group messages for a specific topic.
[https://m3o.com/mq/api#Publish](https://m3o.com/mq/api#Publish)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/mq"
)
// Publish a message. Specify a topic to group messages for a specific topic.
func PublishAmessage() {
mqService := mq.NewMqService(os.Getenv("M3O_API_TOKEN"))
rsp, err := mqService.Publish(&mq.PublishRequest{
Message: map[string]interface{}{
"id": "1",
"type": "signup",
"user": "john",
},
Topic: "events",
})
fmt.Println(rsp, err)
}
```

View File

@@ -1,6 +1,6 @@
# News
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/News/api](https://m3o.com/News/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/news/api](https://m3o.com/news/api).
Endpoints:

View File

@@ -1,38 +1,9 @@
# Nft
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Nft/api](https://m3o.com/Nft/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/nft/api](https://m3o.com/nft/api).
Endpoints:
## Create
Create your own NFT (coming soon)
[https://m3o.com/nft/api#Create](https://m3o.com/nft/api#Create)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/nft"
)
// Create your own NFT (coming soon)
func CreateAnNft() {
nftService := nft.NewNftService(os.Getenv("M3O_API_TOKEN"))
rsp, err := nftService.Create(&nft.CreateRequest{
Description: "The epic monkey island character",
Name: "Guybrush Threepwood",
})
fmt.Println(rsp, err)
}
```
## Collections
Get a list of collections
@@ -89,3 +60,32 @@ func GetAlistOfAssets() {
}
```
## Create
Create your own NFT (coming soon)
[https://m3o.com/nft/api#Create](https://m3o.com/nft/api#Create)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/nft"
)
// Create your own NFT (coming soon)
func CreateAnNft() {
nftService := nft.NewNftService(os.Getenv("M3O_API_TOKEN"))
rsp, err := nftService.Create(&nft.CreateRequest{
Description: "The epic monkey island character",
Name: "Guybrush Threepwood",
})
fmt.Println(rsp, err)
}
```

View File

@@ -1,37 +1,9 @@
# Notes
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Notes/api](https://m3o.com/Notes/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/notes/api](https://m3o.com/notes/api).
Endpoints:
## Read
Read a note
[https://m3o.com/notes/api#Read](https://m3o.com/notes/api#Read)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/notes"
)
// Read a note
func ReadAnote() {
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
rsp, err := notesService.Read(&notes.ReadRequest{
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
})
fmt.Println(rsp, err)
}
```
## List
List all the notes
@@ -189,3 +161,31 @@ Title: "New Note",
}
```
## Read
Read a note
[https://m3o.com/notes/api#Read](https://m3o.com/notes/api#Read)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/notes"
)
// Read a note
func ReadAnote() {
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
rsp, err := notesService.Read(&notes.ReadRequest{
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
})
fmt.Println(rsp, err)
}
```

View File

@@ -1,6 +1,6 @@
# Otp
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Otp/api](https://m3o.com/Otp/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/otp/api](https://m3o.com/otp/api).
Endpoints:

View File

@@ -1,37 +1,9 @@
# Postcode
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Postcode/api](https://m3o.com/Postcode/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/postcode/api](https://m3o.com/postcode/api).
Endpoints:
## Validate
Validate a postcode.
[https://m3o.com/postcode/api#Validate](https://m3o.com/postcode/api#Validate)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/postcode"
)
// Validate a postcode.
func ReturnArandomPostcodeAndItsInformation() {
postcodeService := postcode.NewPostcodeService(os.Getenv("M3O_API_TOKEN"))
rsp, err := postcodeService.Validate(&postcode.ValidateRequest{
Postcode: "SW1A 2AA",
})
fmt.Println(rsp, err)
}
```
## Lookup
Lookup a postcode to retrieve the related region, county, etc
@@ -87,3 +59,31 @@ func ReturnArandomPostcodeAndItsInformation() {
}
```
## Validate
Validate a postcode.
[https://m3o.com/postcode/api#Validate](https://m3o.com/postcode/api#Validate)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/postcode"
)
// Validate a postcode.
func ReturnArandomPostcodeAndItsInformation() {
postcodeService := postcode.NewPostcodeService(os.Getenv("M3O_API_TOKEN"))
rsp, err := postcodeService.Validate(&postcode.ValidateRequest{
Postcode: "SW1A 2AA",
})
fmt.Println(rsp, err)
}
```

View File

@@ -1,6 +1,6 @@
# Prayer
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Prayer/api](https://m3o.com/Prayer/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/prayer/api](https://m3o.com/prayer/api).
Endpoints:

View File

@@ -1,6 +1,6 @@
# Qr
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Qr/api](https://m3o.com/Qr/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/qr/api](https://m3o.com/qr/api).
Endpoints:

View File

@@ -1,6 +1,6 @@
# Quran
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Quran/api](https://m3o.com/Quran/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/quran/api](https://m3o.com/quran/api).
Endpoints:

View File

@@ -1,6 +1,6 @@
# Routing
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Routing/api](https://m3o.com/Routing/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/routing/api](https://m3o.com/routing/api).
Endpoints:

View File

@@ -1,9 +1,39 @@
# Rss
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Rss/api](https://m3o.com/Rss/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/rss/api](https://m3o.com/rss/api).
Endpoints:
## Add
Add a new RSS feed with a name, url, and category
[https://m3o.com/rss/api#Add](https://m3o.com/rss/api#Add)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/rss"
)
// Add a new RSS feed with a name, url, and category
func AddAnewFeed() {
rssService := rss.NewRssService(os.Getenv("M3O_API_TOKEN"))
rsp, err := rssService.Add(&rss.AddRequest{
Category: "news",
Name: "bbc",
Url: "http://feeds.bbci.co.uk/news/rss.xml",
})
fmt.Println(rsp, err)
}
```
## Feed
Get an RSS feed by name. If no name is given, all feeds are returned. Default limit is 25 entries.
@@ -87,33 +117,3 @@ func RemoveAfeed() {
}
```
## Add
Add a new RSS feed with a name, url, and category
[https://m3o.com/rss/api#Add](https://m3o.com/rss/api#Add)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/rss"
)
// Add a new RSS feed with a name, url, and category
func AddAnewFeed() {
rssService := rss.NewRssService(os.Getenv("M3O_API_TOKEN"))
rsp, err := rssService.Add(&rss.AddRequest{
Category: "news",
Name: "bbc",
Url: "http://feeds.bbci.co.uk/news/rss.xml",
})
fmt.Println(rsp, err)
}
```

View File

@@ -1,15 +1,15 @@
# Search
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Search/api](https://m3o.com/Search/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/search/api](https://m3o.com/search/api).
Endpoints:
## Vote
## Index
Vote to have the Search api launched faster!
Index a document i.e. insert a document to search for.
[https://m3o.com/search/api#Vote](https://m3o.com/search/api#Vote)
[https://m3o.com/search/api#Index](https://m3o.com/search/api#Index)
```go
package example
@@ -21,11 +21,191 @@ import(
"go.m3o.com/search"
)
// Vote to have the Search api launched faster!
func VoteForTheApi() {
// Index a document i.e. insert a document to search for.
func IndexAdocument() {
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
rsp, err := searchService.Vote(&search.VoteRequest{
Message: "Launch it!",
rsp, err := searchService.Index(&search.IndexRequest{
Document: &search.Document{
Contents: map[string]interface{}{
"name": "John Doe",
"age": 37,
"starsign": "Leo",
},
Id: "1234",
},
Index: "customers",
})
fmt.Println(rsp, err)
}
```
## Search
Search for documents in a given in index
[https://m3o.com/search/api#Search](https://m3o.com/search/api#Search)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/search"
)
// Search for documents in a given in index
func SearchForAdocument() {
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
rsp, err := searchService.Search(&search.SearchRequest{
Index: "customers",
Query: "name == 'John'",
})
fmt.Println(rsp, err)
}
```
## Search
Search for documents in a given in index
[https://m3o.com/search/api#Search](https://m3o.com/search/api#Search)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/search"
)
// Search for documents in a given in index
func SearchOnMultipleFieldsand() {
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
rsp, err := searchService.Search(&search.SearchRequest{
Index: "customers",
Query: "name == 'John' AND starsign == 'Leo'",
})
fmt.Println(rsp, err)
}
```
## Search
Search for documents in a given in index
[https://m3o.com/search/api#Search](https://m3o.com/search/api#Search)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/search"
)
// Search for documents in a given in index
func SearchOnMultipleFieldsor() {
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
rsp, err := searchService.Search(&search.SearchRequest{
Index: "customers",
Query: "name == 'John' OR name == 'Jane'",
})
fmt.Println(rsp, err)
}
```
## Delete
Delete a document given its ID
[https://m3o.com/search/api#Delete](https://m3o.com/search/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/search"
)
// Delete a document given its ID
func DeleteAdocument() {
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
rsp, err := searchService.Delete(&search.DeleteRequest{
Id: "1234",
Index: "customers",
})
fmt.Println(rsp, err)
}
```
## CreateIndex
Create an index by name
[https://m3o.com/search/api#CreateIndex](https://m3o.com/search/api#CreateIndex)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/search"
)
// Create an index by name
func CreateAnIndex() {
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
rsp, err := searchService.CreateIndex(&search.CreateIndexRequest{
Index: "customers",
})
fmt.Println(rsp, err)
}
```
## DeleteIndex
Delete an index by name
[https://m3o.com/search/api#DeleteIndex](https://m3o.com/search/api#DeleteIndex)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/search"
)
// Delete an index by name
func DeleteAnIndex() {
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
rsp, err := searchService.DeleteIndex(&search.DeleteIndexRequest{
Index: "customers",
})
fmt.Println(rsp, err)

View File

@@ -7,11 +7,11 @@ import (
"go.m3o.com/search"
)
// Vote to have the Search api launched faster!
// Create an index by name
func main() {
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
rsp, err := searchService.Vote(&search.VoteRequest{
Message: "Launch it!",
rsp, err := searchService.CreateIndex(&search.CreateIndexRequest{
Index: "customers",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/search"
)
// Delete a document given its ID
func main() {
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
rsp, err := searchService.Delete(&search.DeleteRequest{
Id: "1234",
Index: "customers",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,17 @@
package main
import (
"fmt"
"os"
"go.m3o.com/search"
)
// Delete an index by name
func main() {
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
rsp, err := searchService.DeleteIndex(&search.DeleteIndexRequest{
Index: "customers",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,25 @@
package main
import (
"fmt"
"os"
"go.m3o.com/search"
)
// Index a document i.e. insert a document to search for.
func main() {
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
rsp, err := searchService.Index(&search.IndexRequest{
Document: &search.Document{
Contents: map[string]interface{}{
"name": "John Doe",
"age": 37,
"starsign": "Leo",
},
Id: "1234",
},
Index: "customers",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/search"
)
// Search for documents in a given in index
func main() {
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
rsp, err := searchService.Search(&search.SearchRequest{
Index: "customers",
Query: "name == 'John'",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/search"
)
// Search for documents in a given in index
func main() {
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
rsp, err := searchService.Search(&search.SearchRequest{
Index: "customers",
Query: "name == 'John' AND starsign == 'Leo'",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/search"
)
// Search for documents in a given in index
func main() {
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
rsp, err := searchService.Search(&search.SearchRequest{
Index: "customers",
Query: "name == 'John' OR name == 'Jane'",
})
fmt.Println(rsp, err)
}

View File

@@ -1,6 +1,6 @@
# Sentiment
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Sentiment/api](https://m3o.com/Sentiment/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/sentiment/api](https://m3o.com/sentiment/api).
Endpoints:

View File

@@ -1,6 +1,6 @@
# Sms
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Sms/api](https://m3o.com/Sms/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/sms/api](https://m3o.com/sms/api).
Endpoints:

View File

@@ -1,9 +1,65 @@
# Space
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Space/api](https://m3o.com/Space/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/space/api](https://m3o.com/space/api).
Endpoints:
## Head
Retrieve meta information about an object
[https://m3o.com/space/api#Head](https://m3o.com/space/api#Head)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/space"
)
// Retrieve meta information about an object
func HeadAnObject() {
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := spaceService.Head(&space.HeadRequest{
Name: "images/file.jpg",
})
fmt.Println(rsp, err)
}
```
## Read
Read an object in space
[https://m3o.com/space/api#Read](https://m3o.com/space/api#Read)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/space"
)
// Read an object in space
func ReadAnObject() {
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := spaceService.Read(&space.ReadRequest{
Name: "images/file.jpg",
})
fmt.Println(rsp, err)
}
```
## Download
Download an object via a presigned url
@@ -176,59 +232,3 @@ func ListObjectsWithPrefix() {
}
```
## Head
Retrieve meta information about an object
[https://m3o.com/space/api#Head](https://m3o.com/space/api#Head)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/space"
)
// Retrieve meta information about an object
func HeadAnObject() {
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := spaceService.Head(&space.HeadRequest{
Name: "images/file.jpg",
})
fmt.Println(rsp, err)
}
```
## Read
Read an object in space
[https://m3o.com/space/api#Read](https://m3o.com/space/api#Read)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/space"
)
// Read an object in space
func ReadAnObject() {
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := spaceService.Read(&space.ReadRequest{
Name: "images/file.jpg",
})
fmt.Println(rsp, err)
}
```

View File

@@ -1,6 +1,6 @@
# Spam
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Spam/api](https://m3o.com/Spam/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/spam/api](https://m3o.com/spam/api).
Endpoints:

View File

@@ -1,9 +1,37 @@
# Stock
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Stock/api](https://m3o.com/Stock/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/stock/api](https://m3o.com/stock/api).
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
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)
}
```

View File

@@ -1,6 +1,6 @@
# Stream
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Stream/api](https://m3o.com/Stream/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/stream/api](https://m3o.com/stream/api).
Endpoints:

View File

@@ -1,9 +1,68 @@
# Sunnah
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Sunnah/api](https://m3o.com/Sunnah/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/sunnah/api](https://m3o.com/sunnah/api).
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
Get a list of books from within a collection. A book can contain many chapters
each with its own hadiths.
[https://m3o.com/sunnah/api#Books](https://m3o.com/sunnah/api#Books)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/sunnah"
)
// Get a list of books from within a collection. A book can contain many chapters
// each with its own hadiths.
func GetTheBooksWithinAcollection() {
sunnahService := sunnah.NewSunnahService(os.Getenv("M3O_API_TOKEN"))
rsp, err := sunnahService.Books(&sunnah.BooksRequest{
Collection: "bukhari",
})
fmt.Println(rsp, err)
}
```
## Chapters
Get all the chapters of a given book within a collection.
@@ -64,62 +123,3 @@ 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)
}
```
## Books
Get a list of books from within a collection. A book can contain many chapters
each with its own hadiths.
[https://m3o.com/sunnah/api#Books](https://m3o.com/sunnah/api#Books)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/sunnah"
)
// Get a list of books from within a collection. A book can contain many chapters
// each with its own hadiths.
func GetTheBooksWithinAcollection() {
sunnahService := sunnah.NewSunnahService(os.Getenv("M3O_API_TOKEN"))
rsp, err := sunnahService.Books(&sunnah.BooksRequest{
Collection: "bukhari",
})
fmt.Println(rsp, err)
}
```

View File

@@ -1,6 +1,6 @@
# Thumbnail
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Thumbnail/api](https://m3o.com/Thumbnail/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/thumbnail/api](https://m3o.com/thumbnail/api).
Endpoints:

View File

@@ -1,6 +1,6 @@
# Time
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Time/api](https://m3o.com/Time/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/time/api](https://m3o.com/time/api).
Endpoints:

View File

@@ -1,6 +1,6 @@
# Translate
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Translate/api](https://m3o.com/Translate/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/translate/api](https://m3o.com/translate/api).
Endpoints:

View File

@@ -1,6 +1,6 @@
# Twitter
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Twitter/api](https://m3o.com/Twitter/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/twitter/api](https://m3o.com/twitter/api).
Endpoints:

View File

@@ -1,6 +1,6 @@
# Url
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Url/api](https://m3o.com/Url/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/url/api](https://m3o.com/url/api).
Endpoints:

View File

@@ -1,15 +1,15 @@
# User
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/User/api](https://m3o.com/User/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/user/api](https://m3o.com/user/api).
Endpoints:
## SendMagicLink
## ReadSession
Login using email only - Passwordless
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#SendMagicLink](https://m3o.com/user/api#SendMagicLink)
[https://m3o.com/user/api#ReadSession](https://m3o.com/user/api#ReadSession)
```go
package example
@@ -21,18 +21,161 @@ import(
"go.m3o.com/user"
)
// Login using email only - Passwordless
func SendAmagicLink() {
// 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.SendMagicLink(&user.SendMagicLinkRequest{
Address: "www.example.com",
Email: "joe@example.com",
Endpoint: "verifytoken",
FromName: "Awesome Dot Com",
Subject: "MagicLink to access your account",
TextContent: `Hi there,
rsp, err := userService.ReadSession(&user.ReadSessionRequest{
SessionId: "df91a612-5b24-4634-99ff-240220ab8f55",
Click here to access your account $micro_verification_link`,
})
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)
}
```
## 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)
}
```
## Login
Login using username or email. The response will return a new session for successful login,
401 in the case of login failure and 500 for any other error
[https://m3o.com/user/api#Login](https://m3o.com/user/api#Login)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Login using username or email. The response will return a new session for successful login,
// 401 in the case of login failure and 500 for any other error
func LogAuserIn() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.Login(&user.LoginRequest{
Email: "joe@example.com",
Password: "Password1",
})
fmt.Println(rsp, err)
}
```
## 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)
}
```
## 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)
@@ -123,18 +266,12 @@ func ReadAccountByEmail() {
}
```
## SendVerificationEmail
## UpdatePassword
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'
Update the account password
[https://m3o.com/user/api#SendVerificationEmail](https://m3o.com/user/api#SendVerificationEmail)
[https://m3o.com/user/api#UpdatePassword](https://m3o.com/user/api#UpdatePassword)
```go
package example
@@ -146,24 +283,82 @@ import(
"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() {
// Update the account password
func UpdateTheAccountPassword() {
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,
rsp, err := userService.UpdatePassword(&user.UpdatePasswordRequest{
ConfirmPassword: "Password2",
NewPassword: "Password2",
OldPassword: "Password1",
UserId: "user-1",
Please verify your email by clicking this link: $micro_verification_link`,
})
fmt.Println(rsp, err)
}
```
## VerifyToken
Check whether the token attached to MagicLink is valid or not.
Ideally, you need to call this endpoint from your http request
handler that handles the endpoint which is specified in the
SendMagicLink request.
[https://m3o.com/user/api#VerifyToken](https://m3o.com/user/api#VerifyToken)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Check whether the token attached to MagicLink is valid or not.
// Ideally, you need to call this endpoint from your http request
// handler that handles the endpoint which is specified in the
// SendMagicLink request.
func VerifyAtoken() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.VerifyToken(&user.VerifyTokenRequest{
Token: "EdsUiidouJJJLldjlloofUiorkojflsWWdld",
})
fmt.Println(rsp, err)
}
```
## SendPasswordResetEmail
Send an email with a verification code to reset password.
Call "ResetPassword" endpoint once user provides the code.
[https://m3o.com/user/api#SendPasswordResetEmail](https://m3o.com/user/api#SendPasswordResetEmail)
```go
package example
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 SendPasswordResetEmail() {
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)
@@ -227,12 +422,12 @@ func LogAuserOut() {
}
```
## List
## SendMagicLink
List all users. Returns a paged list of results
Login using email only - Passwordless
[https://m3o.com/user/api#List](https://m3o.com/user/api#List)
[https://m3o.com/user/api#SendMagicLink](https://m3o.com/user/api#SendMagicLink)
```go
package example
@@ -244,105 +439,18 @@ import(
"go.m3o.com/user"
)
// List all users. Returns a paged list of results
func ListAllUsers() {
// Login using email only - Passwordless
func SendAmagicLink() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.List(&user.ListRequest{
Limit: 100,
Offset: 0,
rsp, err := userService.SendMagicLink(&user.SendMagicLinkRequest{
Address: "www.example.com",
Email: "joe@example.com",
Endpoint: "verifytoken",
FromName: "Awesome Dot Com",
Subject: "MagicLink to access your account",
TextContent: `Hi there,
})
fmt.Println(rsp, err)
}
```
## VerifyToken
Check whether the token attached to MagicLink is valid or not.
Ideally, you need to call this endpoint from your http request
handler that handles the endpoint which is specified in the
SendMagicLink request.
[https://m3o.com/user/api#VerifyToken](https://m3o.com/user/api#VerifyToken)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Check whether the token attached to MagicLink is valid or not.
// Ideally, you need to call this endpoint from your http request
// handler that handles the endpoint which is specified in the
// SendMagicLink request.
func VerifyAtoken() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.VerifyToken(&user.VerifyTokenRequest{
Token: "EdsUiidouJJJLldjlloofUiorkojflsWWdld",
})
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",
Click here to access your account $micro_verification_link`,
})
fmt.Println(rsp, err)
@@ -378,12 +486,18 @@ Id: "user-1",
}
```
## UpdatePassword
## SendVerificationEmail
Update the account password
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#UpdatePassword](https://m3o.com/user/api#UpdatePassword)
[https://m3o.com/user/api#SendVerificationEmail](https://m3o.com/user/api#SendVerificationEmail)
```go
package example
@@ -395,137 +509,24 @@ import(
"go.m3o.com/user"
)
// Update the account password
func UpdateTheAccountPassword() {
// 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.UpdatePassword(&user.UpdatePasswordRequest{
ConfirmPassword: "Password2",
NewPassword: "Password2",
OldPassword: "Password1",
})
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)
}
```
## SendPasswordResetEmail
Send an email with a verification code to reset password.
Call "ResetPassword" endpoint once user provides the code.
[https://m3o.com/user/api#SendPasswordResetEmail](https://m3o.com/user/api#SendPasswordResetEmail)
```go
package example
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 SendPasswordResetEmail() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.SendPasswordResetEmail(&user.SendPasswordResetEmailRequest{
rsp, err := userService.SendVerificationEmail(&user.SendVerificationEmailRequest{
Email: "joe@example.com",
FailureRedirectUrl: "https://m3o.com/verification-failed",
FromName: "Awesome Dot Com",
Subject: "Password reset",
RedirectUrl: "https://m3o.com",
Subject: "Email verification",
TextContent: `Hi there,
click here to reset your password: myapp.com/reset/code?=$code`,
})
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)
}
```
## Login
Login using username or email. The response will return a new session for successful login,
401 in the case of login failure and 500 for any other error
[https://m3o.com/user/api#Login](https://m3o.com/user/api#Login)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Login using username or email. The response will return a new session for successful login,
// 401 in the case of login failure and 500 for any other error
func LogAuserIn() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.Login(&user.LoginRequest{
Email: "joe@example.com",
Password: "Password1",
Please verify your email by clicking this link: $micro_verification_link`,
})
fmt.Println(rsp, err)

View File

@@ -14,6 +14,7 @@ func main() {
ConfirmPassword: "Password2",
NewPassword: "Password2",
OldPassword: "Password1",
UserId: "user-1",
})
fmt.Println(rsp, err)
}

View File

@@ -1,6 +1,6 @@
# Vehicle
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Vehicle/api](https://m3o.com/Vehicle/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/vehicle/api](https://m3o.com/vehicle/api).
Endpoints:

View File

@@ -1,6 +1,6 @@
# Weather
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Weather/api](https://m3o.com/Weather/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/weather/api](https://m3o.com/weather/api).
Endpoints:

View File

@@ -1,6 +1,6 @@
# Youtube
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Youtube/api](https://m3o.com/Youtube/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/youtube/api](https://m3o.com/youtube/api).
Endpoints:

Some files were not shown because too many files have changed in this diff Show More