198 Commits

Author SHA1 Message Date
m3o-actions
fc990c84ab Commit from m3o/m3o action 2022-02-15 22:22:36 +00:00
m3o-actions
e9229571ad Commit from m3o/m3o action 2022-02-15 17:32:16 +00:00
Asim Aslam
b310d3e1e0 remove auto complete example 2022-02-15 17:26:40 +00:00
m3o-actions
3e8a30c33a Commit from m3o/m3o action 2022-02-15 15:30:41 +00:00
m3o-actions
d5b9efe74e Commit from m3o/m3o action 2022-02-15 15:10:47 +00:00
m3o-actions
da28af7166 Commit from m3o/m3o action 2022-02-15 13:03:21 +00:00
m3o-actions
cceeb16d81 Commit from m3o/m3o action 2022-02-15 12:41:05 +00:00
m3o-actions
a25cabc9be Commit from m3o/m3o action 2022-02-15 12:34:07 +00:00
m3o-actions
4ca21d5561 Commit from m3o/m3o action 2022-02-15 12:32:59 +00:00
m3o-actions
39fcaa24c0 Commit from m3o/m3o action 2022-02-15 12:16:34 +00:00
m3o-actions
fc1099c437 Commit from m3o/m3o action 2022-02-15 11:52:09 +00:00
m3o-actions
f3af3fa1ba Commit from m3o/m3o action 2022-02-15 11:36:20 +00:00
m3o-actions
03a3a1bb91 Commit from m3o/m3o action 2022-02-15 11:27:21 +00:00
m3o-actions
1c58bf602d Commit from m3o/m3o action 2022-02-15 11:04:19 +00:00
m3o-actions
02fc6f735a Commit from m3o/m3o action 2022-02-15 10:02:49 +00:00
m3o-actions
7ea20aefbd Commit from m3o/m3o action 2022-02-15 10:00:53 +00:00
m3o-actions
7698310d1a Commit from m3o/m3o action 2022-02-15 10:00:04 +00:00
m3o-actions
9685cb5d53 Commit from m3o/m3o action 2022-02-14 16:40:54 +00:00
m3o-actions
63fb62a55e Commit from m3o/m3o action 2022-02-14 15:40:49 +00:00
m3o-actions
56cdd3c583 Commit from m3o/m3o action 2022-02-14 14:12:45 +00:00
m3o-actions
97accc758e Commit from m3o/m3o action 2022-02-13 18:44:01 +00:00
m3o-actions
7e5fdc7d77 Commit from m3o/m3o action 2022-02-13 18:13:54 +00:00
m3o-actions
90f27882e8 Commit from m3o/m3o action 2022-02-11 15:10:20 +00:00
m3o-actions
70fd591952 Commit from m3o/m3o action 2022-02-11 14:43:11 +00:00
m3o-actions
7add4ca16b Commit from m3o/m3o action 2022-02-11 14:40:54 +00:00
m3o-actions
243d779a03 Commit from m3o/m3o action 2022-02-11 14:28:51 +00:00
m3o-actions
6b9caa1e59 Commit from m3o/m3o action 2022-02-11 14:27:47 +00:00
m3o-actions
2bbe49f716 Commit from m3o/m3o action 2022-02-10 20:54:17 +00:00
m3o-actions
046127532d Commit from m3o/m3o action 2022-02-09 22:11:39 +00:00
m3o-actions
2e14a4252f Commit from m3o/m3o action 2022-02-09 21:55:39 +00:00
m3o-actions
d1be4f25bc Commit from m3o/m3o action 2022-02-09 17:41:21 +00:00
m3o-actions
f38850c259 Commit from m3o/m3o action 2022-02-09 16:54:13 +00:00
m3o-actions
99979e1167 Commit from m3o/m3o action 2022-02-09 16:22:26 +00:00
m3o-actions
d144fd0b22 Commit from m3o/m3o action 2022-02-09 15:12:53 +00:00
m3o-actions
75cd109929 Commit from m3o/m3o action 2022-02-09 12:34:26 +00:00
m3o-actions
4cd429a8b3 Commit from m3o/m3o action 2022-02-09 12:32:09 +00:00
m3o-actions
aef44febce Commit from m3o/m3o action 2022-02-09 12:28:25 +00:00
m3o-actions
6446146553 Commit from m3o/m3o action 2022-02-09 10:44:26 +00:00
m3o-actions
f251e45b0b Commit from m3o/m3o action 2022-02-08 21:53:46 +00:00
m3o-actions
01f99e0b6d Commit from m3o/m3o action 2022-02-08 21:52:55 +00:00
m3o-actions
d9cabd803a Commit from m3o/m3o action 2022-02-08 21:50:47 +00:00
m3o-actions
064734211e Commit from m3o/m3o action 2022-02-08 21:49:28 +00:00
m3o-actions
d0aeac6b3c Commit from m3o/m3o action 2022-02-08 13:52:58 +00:00
m3o-actions
eb93a5a449 Commit from m3o/m3o action 2022-02-08 12:06:36 +00:00
m3o-actions
78d8e2fa1e Commit from m3o/m3o action 2022-02-07 16:49:25 +00:00
m3o-actions
6bca5af6c5 Commit from m3o/m3o action 2022-02-07 16:44:05 +00:00
m3o-actions
d132d7c27c Commit from m3o/m3o action 2022-02-07 16:25:19 +00:00
m3o-actions
6f3a7a4dd3 Commit from m3o/m3o action 2022-02-07 16:13:31 +00:00
m3o-actions
a2eb34e59a Commit from m3o/m3o action 2022-02-07 15:27:01 +00:00
m3o-actions
709e4180ec Commit from m3o/m3o action 2022-02-06 19:14:19 +00:00
m3o-actions
3abd701901 Commit from m3o/m3o action 2022-02-06 19:13:50 +00:00
m3o-actions
ea5aa65039 Commit from m3o/m3o action 2022-02-06 18:47:42 +00:00
m3o-actions
1ae6969f65 Commit from m3o/m3o action 2022-02-05 23:52:42 +00:00
m3o-actions
9901807b67 Commit from m3o/m3o action 2022-02-05 21:34:41 +00:00
m3o-actions
efb35c528c Commit from m3o/m3o action 2022-02-05 21:34:19 +00:00
m3o-actions
a64a7a6162 Commit from m3o/m3o action 2022-02-05 21:32:59 +00:00
m3o-actions
c7afdd237d Commit from m3o/m3o action 2022-02-05 21:32:06 +00:00
m3o-actions
6f5714dc73 Commit from m3o/m3o action 2022-02-03 22:42:38 +00:00
m3o-actions
6ce3f89757 Commit from m3o/m3o action 2022-02-03 22:02:09 +00:00
m3o-actions
3e655dea52 Commit from m3o/m3o action 2022-02-03 22:01:41 +00:00
m3o-actions
80ca5f8229 Commit from m3o/m3o action 2022-02-03 17:36:03 +00:00
m3o-actions
993c0b1e1c Commit from m3o/m3o action 2022-02-03 17:23:40 +00:00
m3o-actions
f7c6ac50e2 Commit from m3o/m3o action 2022-02-03 16:13:46 +00:00
m3o-actions
1f72651636 Commit from m3o/m3o action 2022-02-03 16:06:11 +00:00
m3o-actions
9f65103806 Commit from m3o/m3o action 2022-02-03 14:18:46 +00:00
m3o-actions
fb85cd000f Commit from m3o/m3o action 2022-02-03 11:32:32 +00:00
m3o-actions
e78ab622d6 Commit from m3o/m3o action 2022-02-03 11:21:15 +00:00
m3o-actions
84a739197e Commit from m3o/m3o action 2022-02-02 16:54:08 +00:00
m3o-actions
83d8cd3702 Commit from m3o/m3o action 2022-02-02 16:49:58 +00:00
m3o-actions
a94d784928 Commit from m3o/m3o action 2022-02-02 16:41:56 +00:00
m3o-actions
fd3a1063b0 Commit from m3o/m3o action 2022-02-02 16:32:36 +00:00
m3o-actions
2b935c2eb1 Commit from m3o/m3o action 2022-02-02 15:30:54 +00:00
m3o-actions
2d46dc2672 Commit from m3o/m3o action 2022-02-02 15:03:48 +00:00
m3o-actions
06f2db6618 Commit from m3o/m3o action 2022-02-02 12:14:14 +00:00
m3o-actions
c0731399ee Commit from m3o/m3o action 2022-02-02 11:33:16 +00:00
m3o-actions
9057f09e41 Commit from m3o/m3o action 2022-02-02 10:29:34 +00:00
m3o-actions
b7853960a4 Commit from m3o/m3o action 2022-02-01 17:25:12 +00:00
m3o-actions
1d96d4517b Commit from m3o/m3o action 2022-02-01 17:11:32 +00:00
m3o-actions
dd282e7ab9 Commit from m3o/m3o action 2022-02-01 15:16:59 +00:00
m3o-actions
8f3fe3d33c Commit from m3o/m3o action 2022-02-01 12:52:37 +00:00
m3o-actions
7e17640b3e Commit from m3o/m3o action 2022-02-01 12:14:35 +00:00
m3o-actions
a46a505a9f Commit from m3o/m3o action 2022-02-01 11:50:37 +00:00
m3o-actions
0a690f02d9 Commit from m3o/m3o action 2022-02-01 11:23:28 +00:00
m3o-actions
434a7615b7 Commit from m3o/m3o action 2022-02-01 11:12:15 +00:00
m3o-actions
7552377ffc Commit from m3o/m3o action 2022-02-01 08:52:03 +00:00
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
95 changed files with 2418 additions and 1188 deletions

View File

@@ -67,7 +67,7 @@ func (t *AppService) Resolve(request *ResolveRequest) (*ResolveResponse, error)
}
// Run an app from a source repo. Specify region etc.
// Run an app from source
func (t *AppService) Run(request *RunRequest) (*RunResponse, error) {
rsp := &RunResponse{}
@@ -150,7 +150,7 @@ type ResolveResponse struct {
type RunRequest struct {
// branch. defaults to master
Branch string `json:"branch"`
// associatede env vars to pass in
// associated env vars to pass in
EnvVars map[string]string `json:"env_vars"`
// name of the app
Name string `json:"name"`

16
cache/cache.go vendored
View File

@@ -9,6 +9,7 @@ type Cache interface {
Delete(*DeleteRequest) (*DeleteResponse, error)
Get(*GetRequest) (*GetResponse, error)
Increment(*IncrementRequest) (*IncrementResponse, error)
ListKeys(*ListKeysRequest) (*ListKeysResponse, error)
Set(*SetRequest) (*SetResponse, error)
}
@@ -56,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) {
@@ -116,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"`
}

View File

@@ -5,7 +5,9 @@ import (
)
type Email interface {
Parse(*ParseRequest) (*ParseResponse, error)
Send(*SendRequest) (*SendResponse, error)
Validate(*ValidateRequest) (*ValidateResponse, error)
}
func NewEmailService(token string) *EmailService {
@@ -20,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) {
@@ -28,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"`
@@ -45,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

@@ -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,9 +1,95 @@
# 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:
## List
List all the apps
[https://m3o.com/app/api#List](https://m3o.com/app/api#List)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/app"
)
// List all the apps
func ListTheApps() {
appService := app.NewAppService(os.Getenv("M3O_API_TOKEN"))
rsp, err := appService.List(&app.ListRequest{
})
fmt.Println(rsp, err)
}
```
## Run
Run an app from source
[https://m3o.com/app/api#Run](https://m3o.com/app/api#Run)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/app"
)
// Run an app from source
func RunAnApp() {
appService := app.NewAppService(os.Getenv("M3O_API_TOKEN"))
rsp, err := appService.Run(&app.RunRequest{
Branch: "master",
Name: "helloworld",
Port: 8080,
Region: "europe-west1",
Repo: "github.com/asim/helloworld",
})
fmt.Println(rsp, err)
}
```
## Regions
Return the support regions
[https://m3o.com/app/api#Regions](https://m3o.com/app/api#Regions)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/app"
)
// Return the support regions
func ListRegions() {
appService := app.NewAppService(os.Getenv("M3O_API_TOKEN"))
rsp, err := appService.Regions(&app.RegionsRequest{
})
fmt.Println(rsp, err)
}
```
## Status
Get the status of an app
@@ -144,89 +230,3 @@ func ReserveAppName() {
}
```
## List
List all the apps
[https://m3o.com/app/api#List](https://m3o.com/app/api#List)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/app"
)
// List all the apps
func ListTheApps() {
appService := app.NewAppService(os.Getenv("M3O_API_TOKEN"))
rsp, err := appService.List(&app.ListRequest{
})
fmt.Println(rsp, err)
}
```
## Run
Run an app from a source repo. Specify region etc.
[https://m3o.com/app/api#Run](https://m3o.com/app/api#Run)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/app"
)
// Run an app from a source repo. Specify region etc.
func RunAnApp() {
appService := app.NewAppService(os.Getenv("M3O_API_TOKEN"))
rsp, err := appService.Run(&app.RunRequest{
Branch: "master",
Name: "helloworld",
Port: 8080,
Region: "europe-west1",
Repo: "github.com/asim/helloworld",
})
fmt.Println(rsp, err)
}
```
## Regions
Return the support regions
[https://m3o.com/app/api#Regions](https://m3o.com/app/api#Regions)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/app"
)
// Return the support regions
func ListRegions() {
appService := app.NewAppService(os.Getenv("M3O_API_TOKEN"))
rsp, err := appService.Regions(&app.RegionsRequest{
})
fmt.Println(rsp, err)
}
```

View File

@@ -7,7 +7,7 @@ import (
"go.m3o.com/app"
)
// Run an app from a source repo. Specify region etc.
// Run an app from source
func main() {
appService := app.NewAppService(os.Getenv("M3O_API_TOKEN"))
rsp, err := appService.Run(&app.RunRequest{

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,9 +1,94 @@
# 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:
## Increment
Increment a value (if it's a number). If key not found it is equivalent to set.
[https://m3o.com/cache/api#Increment](https://m3o.com/cache/api#Increment)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/cache"
)
// Increment a value (if it's a number). If key not found it is equivalent to set.
func IncrementAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Increment(&cache.IncrementRequest{
Key: "counter",
Value: 2,
})
fmt.Println(rsp, err)
}
```
## Decrement
Decrement a value (if it's a number). If key not found it is equivalent to set.
[https://m3o.com/cache/api#Decrement](https://m3o.com/cache/api#Decrement)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/cache"
)
// Decrement a value (if it's a number). If key not found it is equivalent to set.
func DecrementAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Decrement(&cache.DecrementRequest{
Key: "counter",
Value: 2,
})
fmt.Println(rsp, err)
}
```
## 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)
}
```
## Set
Set an item in the cache. Overwrites any existing value already set.
@@ -89,61 +174,3 @@ func DeleteAvalue() {
}
```
## Increment
Increment a value (if it's a number). If key not found it is equivalent to set.
[https://m3o.com/cache/api#Increment](https://m3o.com/cache/api#Increment)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/cache"
)
// Increment a value (if it's a number). If key not found it is equivalent to set.
func IncrementAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Increment(&cache.IncrementRequest{
Key: "counter",
Value: 2,
})
fmt.Println(rsp, err)
}
```
## Decrement
Decrement a value (if it's a number). If key not found it is equivalent to set.
[https://m3o.com/cache/api#Decrement](https://m3o.com/cache/api#Decrement)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/cache"
)
// Decrement a value (if it's a number). If key not found it is equivalent to set.
func DecrementAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Decrement(&cache.DecrementRequest{
Key: "counter",
Value: 2,
})
fmt.Println(rsp, err)
}
```

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)
}

View File

@@ -1,9 +1,93 @@
# Contact
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Contact/api](https://m3o.com/Contact/api).
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/contact/api](https://m3o.com/contact/api).
Endpoints:
## 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)
}
```
## Create
@@ -133,87 +217,3 @@ func GetAcontact() {
}
```
## 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

@@ -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,6 +1,6 @@
# 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:

View File

@@ -1,9 +1,38 @@
# 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:
## 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)
}
```
## Delete
Delete a record in the database by id.
@@ -33,12 +62,12 @@ Table: "example",
}
```
## Update
## ListTables
Update a record in the database. Include an "id" in the record to update.
List tables in the DB
[https://m3o.com/db/api#Update](https://m3o.com/db/api#Update)
[https://m3o.com/db/api#ListTables](https://m3o.com/db/api#ListTables)
```go
package example
@@ -50,15 +79,10 @@ import(
"go.m3o.com/db"
)
// Update a record in the database. Include an "id" in the record to update.
func UpdateArecord() {
// List tables in the DB
func ListTables() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Update(&db.UpdateRequest{
Record: map[string]interface{}{
"id": "1",
"age": 43,
},
Table: "example",
rsp, err := dbService.ListTables(&db.ListTablesRequest{
})
fmt.Println(rsp, err)
@@ -176,62 +200,6 @@ func CountEntriesInAtable() {
})
fmt.Println(rsp, err)
}
```
## ListTables
List tables in the DB
[https://m3o.com/db/api#ListTables](https://m3o.com/db/api#ListTables)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// List tables in the DB
func ListTables() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.ListTables(&db.ListTablesRequest{
})
fmt.Println(rsp, err)
}
```
## 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)
}
```
## Create
@@ -268,3 +236,35 @@ Table: "example",
}
```
## 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)
}
```

View File

@@ -12,8 +12,8 @@ func main() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Update(&db.UpdateRequest{
Record: map[string]interface{}{
"id": "1",
"age": 43,
"id": "1",
},
Table: "example",
})

View File

@@ -1,9 +1,65 @@
# 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:
## 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)
}
```
## 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

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,9 +1,39 @@
# 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:
## Send
Send an emoji to anyone via SMS. Messages are sent in the form '<message> Sent from <from>'
[https://m3o.com/emoji/api#Send](https://m3o.com/emoji/api#Send)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/emoji"
)
// Send an emoji to anyone via SMS. Messages are sent in the form '<message> Sent from <from>'
func SendAtextContainingAnEmojiToAnyoneViaSms() {
emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN"))
rsp, err := emojiService.Send(&emoji.SendRequest{
From: "Alice",
Message: "let's grab a :beer:",
To: "+44782669123",
})
fmt.Println(rsp, err)
}
```
## Find
Find an emoji by its alias e.g :beer:
@@ -89,33 +119,3 @@ func PrintTextIncludingEmoji() {
}
```
## Send
Send an emoji to anyone via SMS. Messages are sent in the form '<message> Sent from <from>'
[https://m3o.com/emoji/api#Send](https://m3o.com/emoji/api#Send)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/emoji"
)
// Send an emoji to anyone via SMS. Messages are sent in the form '<message> Sent from <from>'
func SendAtextContainingAnEmojiToAnyoneViaSms() {
emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN"))
rsp, err := emojiService.Send(&emoji.SendRequest{
From: "Alice",
Message: "let's grab a :beer:",
To: "+44782669123",
})
fmt.Println(rsp, err)
}
```

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,6 +1,6 @@
# 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:

View File

@@ -1,38 +1,9 @@
# 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:
## Delete
Delete a file by project name/path
[https://m3o.com/file/api#Delete](https://m3o.com/file/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/file"
)
// Delete a file by project name/path
func DeleteFile() {
fileService := file.NewFileService(os.Getenv("M3O_API_TOKEN"))
rsp, err := fileService.Delete(&file.DeleteRequest{
Path: "/document/text-files/file.txt",
Project: "examples",
})
fmt.Println(rsp, err)
}
```
## Save
Save a file
@@ -122,3 +93,32 @@ Project: "examples",
}
```
## Delete
Delete a file by project name/path
[https://m3o.com/file/api#Delete](https://m3o.com/file/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/file"
)
// Delete a file by project name/path
func DeleteFile() {
fileService := file.NewFileService(os.Getenv("M3O_API_TOKEN"))
rsp, err := fileService.Delete(&file.DeleteRequest{
Path: "/document/text-files/file.txt",
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,68 +1,9 @@
# 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:
## 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)
}
```
## List
List all the deployed functions
@@ -88,123 +29,6 @@ func ListFunctions() {
})
fmt.Println(rsp, err)
}
```
## Regions
Return a list of supported regions
[https://m3o.com/function/api#Regions](https://m3o.com/function/api#Regions)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Return a list of supported regions
func ListRegions() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Regions(&function.RegionsRequest{
})
fmt.Println(rsp, err)
}
```
## Deploy
Deploy a group of functions
[https://m3o.com/function/api#Deploy](https://m3o.com/function/api#Deploy)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Deploy a group of functions
func DeployAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Deploy(&function.DeployRequest{
Branch: "main",
Entrypoint: "Helloworld",
Name: "helloworld",
Region: "europe-west1",
Repo: "https://github.com/m3o/m3o",
Runtime: "go116",
Subfolder: "examples/go-function",
})
fmt.Println(rsp, err)
}
```
## Delete
Delete a function by name
[https://m3o.com/function/api#Delete](https://m3o.com/function/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Delete a function by name
func DeleteAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Delete(&function.DeleteRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
}
```
## Describe
Get the info for a deployed function
[https://m3o.com/function/api#Describe](https://m3o.com/function/api#Describe)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Get the info for a deployed function
func DescribeFunctionStatus() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Describe(&function.DescribeRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
}
```
## Reserve
@@ -263,3 +87,179 @@ func ProxyUrl() {
}
```
## Deploy
Deploy a group of functions
[https://m3o.com/function/api#Deploy](https://m3o.com/function/api#Deploy)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Deploy a group of functions
func DeployAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Deploy(&function.DeployRequest{
Branch: "main",
Entrypoint: "Helloworld",
Name: "helloworld",
Region: "europe-west1",
Repo: "https://github.com/m3o/m3o",
Runtime: "go116",
Subfolder: "examples/go-function",
})
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)
}
```
## Delete
Delete a function by name
[https://m3o.com/function/api#Delete](https://m3o.com/function/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Delete a function by name
func DeleteAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Delete(&function.DeleteRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
}
```
## Describe
Get the info for a deployed function
[https://m3o.com/function/api#Describe](https://m3o.com/function/api#Describe)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Get the info for a deployed function
func DescribeFunctionStatus() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Describe(&function.DescribeRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
}
```
## Regions
Return a list of supported regions
[https://m3o.com/function/api#Regions](https://m3o.com/function/api#Regions)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Return a list of supported regions
func ListRegions() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Regions(&function.RegionsRequest{
})
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)
}
```

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,6 +1,6 @@
# 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:

View File

@@ -1,107 +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:
## Upload
Upload an image by either sending a base64 encoded image to this endpoint or a URL.
To resize an image before uploading, see the Resize endpoint.
To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
with each parameter as a form field.
[https://m3o.com/image/api#Upload](https://m3o.com/image/api#Upload)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/image"
)
// Upload an image by either sending a base64 encoded image to this endpoint or a URL.
// To resize an image before uploading, see the Resize endpoint.
// To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
// with each parameter as a form field.
func UploadAbase64imageToMicrosCdn() {
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
rsp, err := imageService.Upload(&image.UploadRequest{
Base64: "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAx0lEQVR4nOzaMaoDMQyE4ZHj+x82vVdhwQoTkzKQEcwP5r0ihT7sbjUTeAJ4HCegXQJYfOYefOyjDuBiz3yjwJBoCIl6QZOeUjTC1Ix1IxEJXF9+0KWsf2bD4bn37OO/c/wuQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9Sa/NG94Tf3j4WBdaxudMEkn4IM2rZBA0wBrvo7aOcpj2emXvLeVt0IGm0GVXUj91mvAAAA//+V2CZl+4AKXwAAAABJRU5ErkJggg==",
Name: "cat.jpeg",
})
fmt.Println(rsp, err)
}
```
## Upload
Upload an image by either sending a base64 encoded image to this endpoint or a URL.
To resize an image before uploading, see the Resize endpoint.
To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
with each parameter as a form field.
[https://m3o.com/image/api#Upload](https://m3o.com/image/api#Upload)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/image"
)
// Upload an image by either sending a base64 encoded image to this endpoint or a URL.
// To resize an image before uploading, see the Resize endpoint.
// To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
// with each parameter as a form field.
func UploadAnImageFromAurlToMicrosCdn() {
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
rsp, err := imageService.Upload(&image.UploadRequest{
Name: "cat.jpeg",
Url: "somewebsite.com/cat.png",
})
fmt.Println(rsp, err)
}
```
## Delete
Delete 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 +158,101 @@ Url: "somewebsite.com/cat.png",
}
```
## Upload
Upload an image by either sending a base64 encoded image to this endpoint or a URL.
To resize an image before uploading, see the Resize endpoint.
To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
with each parameter as a form field.
[https://m3o.com/image/api#Upload](https://m3o.com/image/api#Upload)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/image"
)
// Upload an image by either sending a base64 encoded image to this endpoint or a URL.
// To resize an image before uploading, see the Resize endpoint.
// To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
// with each parameter as a form field.
func UploadAbase64imageToMicrosCdn() {
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
rsp, err := imageService.Upload(&image.UploadRequest{
Base64: "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAx0lEQVR4nOzaMaoDMQyE4ZHj+x82vVdhwQoTkzKQEcwP5r0ihT7sbjUTeAJ4HCegXQJYfOYefOyjDuBiz3yjwJBoCIl6QZOeUjTC1Ix1IxEJXF9+0KWsf2bD4bn37OO/c/wuQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9QyRC1D1DJELUPUMkQtQ9Sa/NG94Tf3j4WBdaxudMEkn4IM2rZBA0wBrvo7aOcpj2emXvLeVt0IGm0GVXUj91mvAAAA//+V2CZl+4AKXwAAAABJRU5ErkJggg==",
Name: "cat.jpeg",
})
fmt.Println(rsp, err)
}
```
## Upload
Upload an image by either sending a base64 encoded image to this endpoint or a URL.
To resize an image before uploading, see the Resize endpoint.
To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
with each parameter as a form field.
[https://m3o.com/image/api#Upload](https://m3o.com/image/api#Upload)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/image"
)
// Upload an image by either sending a base64 encoded image to this endpoint or a URL.
// To resize an image before uploading, see the Resize endpoint.
// To use the file parameter you need to send the request as a multipart/form-data rather than the usual application/json
// with each parameter as a form field.
func UploadAnImageFromAurlToMicrosCdn() {
imageService := image.NewImageService(os.Getenv("M3O_API_TOKEN"))
rsp, err := imageService.Upload(&image.UploadRequest{
Name: "cat.jpeg",
Url: "somewebsite.com/cat.png",
})
fmt.Println(rsp, err)
}
```
## Delete
Delete 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,6 +1,6 @@
# 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:

34
examples/minecraft/README.md Executable file
View File

@@ -0,0 +1,34 @@
# Minecraft
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/minecraft/api](https://m3o.com/minecraft/api).
Endpoints:
## Ping
Ping a minecraft server
[https://m3o.com/minecraft/api#Ping](https://m3o.com/minecraft/api#Ping)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/minecraft"
)
// Ping a minecraft server
func PingAminecraftServer() {
minecraftService := minecraft.NewMinecraftService(os.Getenv("M3O_API_TOKEN"))
rsp, err := minecraftService.Ping(&minecraft.PingRequest{
Address: "funcraft.net",
})
fmt.Println(rsp, err)
}
```

View File

@@ -0,0 +1,17 @@
package main
import (
"fmt"
"os"
"go.m3o.com/minecraft"
)
// Ping a minecraft server
func main() {
minecraftService := minecraft.NewMinecraftService(os.Getenv("M3O_API_TOKEN"))
rsp, err := minecraftService.Ping(&minecraft.PingRequest{
Address: "funcraft.net",
})
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,6 +1,6 @@
# 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:

View File

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

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,6 +1,6 @@
# 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:

View File

@@ -1,6 +1,6 @@
# 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:

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:

90
examples/ping/README.md Executable file
View File

@@ -0,0 +1,90 @@
# Ping
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/ping/api](https://m3o.com/ping/api).
Endpoints:
## Tcp
Ping a TCP port is open
[https://m3o.com/ping/api#Tcp](https://m3o.com/ping/api#Tcp)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/ping"
)
// Ping a TCP port is open
func DialAtcpAddress() {
pingService := ping.NewPingService(os.Getenv("M3O_API_TOKEN"))
rsp, err := pingService.Tcp(&ping.TcpRequest{
Address: "google.com:80",
})
fmt.Println(rsp, err)
}
```
## Url
Ping a HTTP URL
[https://m3o.com/ping/api#Url](https://m3o.com/ping/api#Url)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/ping"
)
// Ping a HTTP URL
func CheckAurl() {
pingService := ping.NewPingService(os.Getenv("M3O_API_TOKEN"))
rsp, err := pingService.Url(&ping.UrlRequest{
Address: "google.com",
})
fmt.Println(rsp, err)
}
```
## Ip
Ping an IP address
[https://m3o.com/ping/api#Ip](https://m3o.com/ping/api#Ip)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/ping"
)
// Ping an IP address
func PingAnIp() {
pingService := ping.NewPingService(os.Getenv("M3O_API_TOKEN"))
rsp, err := pingService.Ip(&ping.IpRequest{
Address: "google.com",
})
fmt.Println(rsp, err)
}
```

View File

@@ -0,0 +1,17 @@
package main
import (
"fmt"
"os"
"go.m3o.com/ping"
)
// Ping an IP address
func main() {
pingService := ping.NewPingService(os.Getenv("M3O_API_TOKEN"))
rsp, err := pingService.Ip(&ping.IpRequest{
Address: "google.com",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,17 @@
package main
import (
"fmt"
"os"
"go.m3o.com/ping"
)
// Ping a TCP port is open
func main() {
pingService := ping.NewPingService(os.Getenv("M3O_API_TOKEN"))
rsp, err := pingService.Tcp(&ping.TcpRequest{
Address: "google.com:80",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,17 @@
package main
import (
"fmt"
"os"
"go.m3o.com/ping"
)
// Ping a HTTP URL
func main() {
pingService := ping.NewPingService(os.Getenv("M3O_API_TOKEN"))
rsp, err := pingService.Url(&ping.UrlRequest{
Address: "google.com",
})
fmt.Println(rsp, err)
}

65
examples/place/README.md Executable file
View File

@@ -0,0 +1,65 @@
# Place
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/place/api](https://m3o.com/place/api).
Endpoints:
## Nearby
Find places nearby using a location
[https://m3o.com/place/api#Nearby](https://m3o.com/place/api#Nearby)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/place"
)
// Find places nearby using a location
func FindPlacesNearby() {
placeService := place.NewPlaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := placeService.Nearby(&place.NearbyRequest{
Keyword: "tesco",
Location: "51.5074577,-0.1297515",
Type: "store",
})
fmt.Println(rsp, err)
}
```
## Search
Search for places by text query
[https://m3o.com/place/api#Search](https://m3o.com/place/api#Search)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/place"
)
// Search for places by text query
func SearchForPlaces() {
placeService := place.NewPlaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := placeService.Search(&place.SearchRequest{
Location: "51.5074577,-0.1297515",
Query: "food",
})
fmt.Println(rsp, err)
}
```

View File

@@ -0,0 +1,19 @@
package main
import (
"fmt"
"os"
"go.m3o.com/place"
)
// Find places nearby using a location
func main() {
placeService := place.NewPlaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := placeService.Nearby(&place.NearbyRequest{
Keyword: "tesco",
Location: "51.5074577,-0.1297515",
Type: "store",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/place"
)
// Search for places by text query
func main() {
placeService := place.NewPlaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := placeService.Search(&place.SearchRequest{
Location: "51.5074577,-0.1297515",
Query: "food",
})
fmt.Println(rsp, err)
}

View File

@@ -1,6 +1,6 @@
# 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:

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,64 +1,9 @@
# 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:
## List
List the saved RSS fields
[https://m3o.com/rss/api#List](https://m3o.com/rss/api#List)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/rss"
)
// List the saved RSS fields
func ListRssFeeds() {
rssService := rss.NewRssService(os.Getenv("M3O_API_TOKEN"))
rsp, err := rssService.List(&rss.ListRequest{
})
fmt.Println(rsp, err)
}
```
## Remove
Remove an RSS feed by name
[https://m3o.com/rss/api#Remove](https://m3o.com/rss/api#Remove)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/rss"
)
// Remove an RSS feed by name
func RemoveAfeed() {
rssService := rss.NewRssService(os.Getenv("M3O_API_TOKEN"))
rsp, err := rssService.Remove(&rss.RemoveRequest{
Name: "bbc",
})
fmt.Println(rsp, err)
}
```
## Add
Add a new RSS feed with a name, url, and category
@@ -117,3 +62,58 @@ func ReadAfeed() {
}
```
## List
List the saved RSS fields
[https://m3o.com/rss/api#List](https://m3o.com/rss/api#List)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/rss"
)
// List the saved RSS fields
func ListRssFeeds() {
rssService := rss.NewRssService(os.Getenv("M3O_API_TOKEN"))
rsp, err := rssService.List(&rss.ListRequest{
})
fmt.Println(rsp, err)
}
```
## Remove
Remove an RSS feed by name
[https://m3o.com/rss/api#Remove](https://m3o.com/rss/api#Remove)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/rss"
)
// Remove an RSS feed by name
func RemoveAfeed() {
rssService := rss.NewRssService(os.Getenv("M3O_API_TOKEN"))
rsp, err := rssService.Remove(&rss.RemoveRequest{
Name: "bbc",
})
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
## Delete
Vote to have the Search api launched faster!
Delete a document given its ID
[https://m3o.com/search/api#Vote](https://m3o.com/search/api#Vote)
[https://m3o.com/search/api#Delete](https://m3o.com/search/api#Delete)
```go
package example
@@ -21,11 +21,191 @@ import(
"go.m3o.com/search"
)
// Vote to have the Search api launched faster!
func VoteForTheApi() {
// Delete a document given its ID
func DeleteAdocument() {
searchService := search.NewSearchService(os.Getenv("M3O_API_TOKEN"))
rsp, err := searchService.Vote(&search.VoteRequest{
Message: "Launch it!",
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)
}
```
## Index
Index a document i.e. insert a document to search for.
[https://m3o.com/search/api#Index](https://m3o.com/search/api#Index)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/search"
)
// Index a document i.e. insert a document to search for.
func IndexAdocument() {
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)
}
```
## 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)

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{}{
"age": 37,
"starsign": "Leo",
"name": "John Doe",
},
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,67 @@
# 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:
## Update
Update an object. If an object with this name does not exist, creates a new one.
[https://m3o.com/space/api#Update](https://m3o.com/space/api#Update)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/space"
)
// Update an object. If an object with this name does not exist, creates a new one.
func UpdateAnObject() {
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := spaceService.Update(&space.UpdateRequest{
Name: "images/file.jpg",
Object: "<file bytes>",
Visibility: "public",
})
fmt.Println(rsp, err)
}
```
## Delete
Delete an object from space
[https://m3o.com/space/api#Delete](https://m3o.com/space/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/space"
)
// Delete an object from space
func DeleteAnObject() {
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := spaceService.Delete(&space.DeleteRequest{
Name: "images/file.jpg",
})
fmt.Println(rsp, err)
}
```
## List
List the objects in space
@@ -174,61 +232,3 @@ Visibility: "public",
}
```
## Update
Update an object. If an object with this name does not exist, creates a new one.
[https://m3o.com/space/api#Update](https://m3o.com/space/api#Update)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/space"
)
// Update an object. If an object with this name does not exist, creates a new one.
func UpdateAnObject() {
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := spaceService.Update(&space.UpdateRequest{
Name: "images/file.jpg",
Object: "<file bytes>",
Visibility: "public",
})
fmt.Println(rsp, err)
}
```
## Delete
Delete an object from space
[https://m3o.com/space/api#Delete](https://m3o.com/space/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/space"
)
// Delete an object from space
func DeleteAnObject() {
spaceService := space.NewSpaceService(os.Getenv("M3O_API_TOKEN"))
rsp, err := spaceService.Delete(&space.DeleteRequest{
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,6 +1,6 @@
# 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:

View File

@@ -1,36 +1,9 @@
# 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:
## ListChannels
List all the active channels
[https://m3o.com/stream/api#ListChannels](https://m3o.com/stream/api#ListChannels)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/stream"
)
// List all the active channels
func ListChannels() {
streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN"))
rsp, err := streamService.ListChannels(&stream.ListChannelsRequest{
})
fmt.Println(rsp, err)
}
```
## CreateChannel
Create a channel with a given name and description. Channels are created automatically but
@@ -119,3 +92,30 @@ func ListMessages() {
}
```
## ListChannels
List all the active channels
[https://m3o.com/stream/api#ListChannels](https://m3o.com/stream/api#ListChannels)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/stream"
)
// List all the active channels
func ListChannels() {
streamService := stream.NewStreamService(os.Getenv("M3O_API_TOKEN"))
rsp, err := streamService.ListChannels(&stream.ListChannelsRequest{
})
fmt.Println(rsp, err)
}
```

View File

@@ -1,68 +1,9 @@
# 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.
@@ -123,3 +64,62 @@ 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,9 +1,37 @@
# 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:
## User
Get a user's twitter profile
[https://m3o.com/twitter/api#User](https://m3o.com/twitter/api#User)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/twitter"
)
// Get a user's twitter profile
func GetAusersTwitterProfile() {
twitterService := twitter.NewTwitterService(os.Getenv("M3O_API_TOKEN"))
rsp, err := twitterService.User(&twitter.UserRequest{
Username: "crufter",
})
fmt.Println(rsp, err)
}
```
## Timeline
Get the timeline for a given user
@@ -88,31 +116,3 @@ func GetTheCurrentGlobalTrendingTopics() {
}
```
## User
Get a user's twitter profile
[https://m3o.com/twitter/api#User](https://m3o.com/twitter/api#User)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/twitter"
)
// Get a user's twitter profile
func GetAusersTwitterProfile() {
twitterService := twitter.NewTwitterService(os.Getenv("M3O_API_TOKEN"))
rsp, err := twitterService.User(&twitter.UserRequest{
Username: "crufter",
})
fmt.Println(rsp, err)
}
```

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,16 +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:
## Login
## Delete
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
Delete an account by id
[https://m3o.com/user/api#Login](https://m3o.com/user/api#Login)
[https://m3o.com/user/api#Delete](https://m3o.com/user/api#Delete)
```go
package example
@@ -22,42 +21,11 @@ import(
"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() {
// Delete an account by id
func DeleteUserAccount() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.Login(&user.LoginRequest{
Email: "joe@example.com",
Password: "Password1",
})
fmt.Println(rsp, err)
}
```
## List
List 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,
rsp, err := userService.Delete(&user.DeleteRequest{
Id: "8b98acbe-0b6a-4d66-a414-5ffbf666786f",
})
fmt.Println(rsp, err)
@@ -97,45 +65,16 @@ Click here to access your account $micro_verification_link`,
})
fmt.Println(rsp, err)
}
```
## VerifyEmail
Verify the email address of an account from a token sent in an email to the user.
[https://m3o.com/user/api#VerifyEmail](https://m3o.com/user/api#VerifyEmail)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Verify the email address of an account from a token sent in an email to the user.
func VerifyEmail() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.VerifyEmail(&user.VerifyEmailRequest{
Email: "joe@example.com",
Token: "012345",
})
fmt.Println(rsp, err)
}
```
## SendVerificationEmail
Send a verification email
to the user being signed up. Email from will be from 'noreply@email.m3ocontent.com',
but you can provide the title and contents.
The verification link will be injected in to the email as a template variable, $micro_verification_link.
Example: 'Hi there, welcome onboard! Use the link below to verify your email: $micro_verification_link'
The variable will be replaced with an actual url that will look similar to this:
Send a verification email to a user.
Email "from" will be 'noreply@email.m3ocontent.com'.
The verification link will be injected in the email
as a template variable, $micro_verification_link e.g
'Welcome to M3O! Use the link below to verify your email: $micro_verification_link'
The variable will be replaced with a url similar to:
'https://user.m3o.com/user/verify?token=a-verification-token&redirectUrl=your-redir-url'
@@ -151,12 +90,12 @@ 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:
// Send a verification email to a user.
// Email "from" will be 'noreply@email.m3ocontent.com'.
// The verification link will be injected in the email
// as a template variable, $micro_verification_link e.g
// 'Welcome to M3O! Use the link below to verify your email: $micro_verification_link'
// The variable will be replaced with a url similar to:
// 'https://user.m3o.com/user/verify?token=a-verification-token&redirectUrl=your-redir-url'
func SendVerificationEmail() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
@@ -173,101 +112,6 @@ Please verify your email by clicking this link: $micro_verification_link`,
})
fmt.Println(rsp, err)
}
```
## ResetPassword
Reset password with the code sent by the "SendPasswordResetEmail" endoint.
[https://m3o.com/user/api#ResetPassword](https://m3o.com/user/api#ResetPassword)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Reset password with the code sent by the "SendPasswordResetEmail" endoint.
func ResetPassword() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.ResetPassword(&user.ResetPasswordRequest{
Code: "012345",
ConfirmPassword: "NewPassword1",
Email: "joe@example.com",
NewPassword: "NewPassword1",
})
fmt.Println(rsp, err)
}
```
## 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)
}
```
## UpdatePassword
Update the account password
[https://m3o.com/user/api#UpdatePassword](https://m3o.com/user/api#UpdatePassword)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Update the account password
func UpdateTheAccountPassword() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.UpdatePassword(&user.UpdatePasswordRequest{
ConfirmPassword: "Password2",
NewPassword: "Password2",
OldPassword: "Password1",
})
fmt.Println(rsp, err)
}
```
## Read
@@ -352,6 +196,37 @@ func ReadAccountByEmail() {
})
fmt.Println(rsp, err)
}
```
## UpdatePassword
Update the account password
[https://m3o.com/user/api#UpdatePassword](https://m3o.com/user/api#UpdatePassword)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Update the account password
func UpdateTheAccountPassword() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.UpdatePassword(&user.UpdatePasswordRequest{
ConfirmPassword: "Password2",
NewPassword: "Password2",
OldPassword: "Password1",
UserId: "user-1",
})
fmt.Println(rsp, err)
}
```
## SendPasswordResetEmail
@@ -386,6 +261,34 @@ TextContent: `Hi there,
})
fmt.Println(rsp, err)
}
```
## VerifyEmail
Verify the email address of an account from a token sent in an email to the user.
[https://m3o.com/user/api#VerifyEmail](https://m3o.com/user/api#VerifyEmail)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Verify the email address of an account from a token sent in an email to the user.
func VerifyEmail() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.VerifyEmail(&user.VerifyEmailRequest{
Token: "012345",
})
fmt.Println(rsp, err)
}
```
## ReadSession
@@ -416,12 +319,12 @@ func ReadAsessionByTheSessionId() {
}
```
## Update
## List
Update the account username or email
List all users. Returns a paged list of results
[https://m3o.com/user/api#Update](https://m3o.com/user/api#Update)
[https://m3o.com/user/api#List](https://m3o.com/user/api#List)
```go
package example
@@ -433,24 +336,27 @@ import(
"go.m3o.com/user"
)
// Update the account username or email
func UpdateAnAccount() {
// List all users. Returns a paged list of results
func ListAllUsers() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.Update(&user.UpdateRequest{
Email: "joe+2@example.com",
Id: "user-1",
rsp, err := userService.List(&user.ListRequest{
Limit: 100,
Offset: 0,
})
fmt.Println(rsp, err)
}
```
## Delete
## VerifyToken
Delete an account by id
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#Delete](https://m3o.com/user/api#Delete)
[https://m3o.com/user/api#VerifyToken](https://m3o.com/user/api#VerifyToken)
```go
package example
@@ -462,39 +368,14 @@ import(
"go.m3o.com/user"
)
// Delete an account by id
func DeleteUserAccount() {
// 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.Delete(&user.DeleteRequest{
Id: "8b98acbe-0b6a-4d66-a414-5ffbf666786f",
})
fmt.Println(rsp, err)
}
```
## Logout
Logout a user account
[https://m3o.com/user/api#Logout](https://m3o.com/user/api#Logout)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Logout a user account
func LogAuserOut() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.Logout(&user.LogoutRequest{
SessionId: "df91a612-5b24-4634-99ff-240220ab8f55",
rsp, err := userService.VerifyToken(&user.VerifyTokenRequest{
Token: "EdsUiidouJJJLldjlloofUiorkojflsWWdld",
})
fmt.Println(rsp, err)
@@ -532,3 +413,122 @@ Username: "joe",
}
```
## 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)
}
```
## Logout
Logout a user account
[https://m3o.com/user/api#Logout](https://m3o.com/user/api#Logout)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Logout a user account
func LogAuserOut() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.Logout(&user.LogoutRequest{
SessionId: "df91a612-5b24-4634-99ff-240220ab8f55",
})
fmt.Println(rsp, err)
}
```
## Update
Update the account username or email
[https://m3o.com/user/api#Update](https://m3o.com/user/api#Update)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/user"
)
// Update the account username or email
func UpdateAnAccount() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.Update(&user.UpdateRequest{
Email: "joe+2@example.com",
Id: "user-1",
})
fmt.Println(rsp, err)
}
```

View File

@@ -7,12 +7,12 @@ 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:
// Send a verification email to a user.
// Email "from" will be 'noreply@email.m3ocontent.com'.
// The verification link will be injected in the email
// as a template variable, $micro_verification_link e.g
// 'Welcome to M3O! Use the link below to verify your email: $micro_verification_link'
// The variable will be replaced with a url similar to:
// 'https://user.m3o.com/user/verify?token=a-verification-token&redirectUrl=your-redir-url'
func main() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))

View File

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

View File

@@ -11,7 +11,6 @@ import (
func main() {
userService := user.NewUserService(os.Getenv("M3O_API_TOKEN"))
rsp, err := userService.VerifyEmail(&user.VerifyEmailRequest{
Email: "joe@example.com",
Token: "012345",
})
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,37 +1,9 @@
# 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:
## Embed
Embed a YouTube video
[https://m3o.com/youtube/api#Embed](https://m3o.com/youtube/api#Embed)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/youtube"
)
// Embed a YouTube video
func EmbedAyoutubeVideo() {
youtubeService := youtube.NewYoutubeService(os.Getenv("M3O_API_TOKEN"))
rsp, err := youtubeService.Embed(&youtube.EmbedRequest{
Url: "https://www.youtube.com/watch?v=GWRWZu7XsJ0",
})
fmt.Println(rsp, err)
}
```
## Search
Search for videos on YouTube
@@ -60,3 +32,31 @@ func SearchForVideos() {
}
```
## Embed
Embed a YouTube video
[https://m3o.com/youtube/api#Embed](https://m3o.com/youtube/api#Embed)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/youtube"
)
// Embed a YouTube video
func EmbedAyoutubeVideo() {
youtubeService := youtube.NewYoutubeService(os.Getenv("M3O_API_TOKEN"))
rsp, err := youtubeService.Embed(&youtube.EmbedRequest{
Url: "https://www.youtube.com/watch?v=GWRWZu7XsJ0",
})
fmt.Println(rsp, err)
}
```

View File

@@ -108,8 +108,13 @@ type Record struct {
}
type SaveRequest struct {
// The file to save
File *Record `json:"file"`
// Make the file public: true or false
Public bool `json:"public"`
}
type SaveResponse struct {
// The permalink for the file if made public
Url string `json:"url"`
}

12
m3o.go
View File

@@ -6,6 +6,7 @@ import (
"go.m3o.com/app"
"go.m3o.com/avatar"
"go.m3o.com/cache"
"go.m3o.com/carbon"
"go.m3o.com/contact"
"go.m3o.com/crypto"
"go.m3o.com/currency"
@@ -27,12 +28,15 @@ import (
"go.m3o.com/ip"
"go.m3o.com/joke"
"go.m3o.com/location"
"go.m3o.com/minecraft"
"go.m3o.com/movie"
"go.m3o.com/mq"
"go.m3o.com/news"
"go.m3o.com/nft"
"go.m3o.com/notes"
"go.m3o.com/otp"
"go.m3o.com/ping"
"go.m3o.com/place"
"go.m3o.com/postcode"
"go.m3o.com/prayer"
"go.m3o.com/qr"
@@ -67,6 +71,7 @@ func NewClient(token string) *Client {
AppService: app.NewAppService(token),
AvatarService: avatar.NewAvatarService(token),
CacheService: cache.NewCacheService(token),
CarbonService: carbon.NewCarbonService(token),
ContactService: contact.NewContactService(token),
CryptoService: crypto.NewCryptoService(token),
CurrencyService: currency.NewCurrencyService(token),
@@ -88,12 +93,15 @@ func NewClient(token string) *Client {
IpService: ip.NewIpService(token),
JokeService: joke.NewJokeService(token),
LocationService: location.NewLocationService(token),
MinecraftService: minecraft.NewMinecraftService(token),
MovieService: movie.NewMovieService(token),
MqService: mq.NewMqService(token),
NewsService: news.NewNewsService(token),
NftService: nft.NewNftService(token),
NotesService: notes.NewNotesService(token),
OtpService: otp.NewOtpService(token),
PingService: ping.NewPingService(token),
PlaceService: place.NewPlaceService(token),
PostcodeService: postcode.NewPostcodeService(token),
PrayerService: prayer.NewPrayerService(token),
QrService: qr.NewQrService(token),
@@ -128,6 +136,7 @@ type Client struct {
AppService *app.AppService
AvatarService *avatar.AvatarService
CacheService *cache.CacheService
CarbonService *carbon.CarbonService
ContactService *contact.ContactService
CryptoService *crypto.CryptoService
CurrencyService *currency.CurrencyService
@@ -149,12 +158,15 @@ type Client struct {
IpService *ip.IpService
JokeService *joke.JokeService
LocationService *location.LocationService
MinecraftService *minecraft.MinecraftService
MovieService *movie.MovieService
MqService *mq.MqService
NewsService *news.NewsService
NftService *nft.NftService
NotesService *notes.NotesService
OtpService *otp.OtpService
PingService *ping.PingService
PlaceService *place.PlaceService
PostcodeService *postcode.PostcodeService
PrayerService *prayer.PrayerService
QrService *qr.QrService

60
minecraft/minecraft.go Executable file
View File

@@ -0,0 +1,60 @@
package minecraft
import (
"go.m3o.com/client"
)
type Minecraft interface {
Ping(*PingRequest) (*PingResponse, error)
}
func NewMinecraftService(token string) *MinecraftService {
return &MinecraftService{
client: client.NewClient(&client.Options{
Token: token,
}),
}
}
type MinecraftService struct {
client *client.Client
}
// Ping a minecraft server
func (t *MinecraftService) Ping(request *PingRequest) (*PingResponse, error) {
rsp := &PingResponse{}
return rsp, t.client.Call("minecraft", "Ping", request, rsp)
}
type PingRequest struct {
// address of the server
Address string `json:"address"`
}
type PingResponse struct {
// Favicon in base64
Favicon string `json:"favicon"`
// Latency (ms) between us and the server (EU)
Latency int32 `json:"latency"`
// Max players ever
MaxPlayers int32 `json:"max_players"`
// Message of the day
Motd string `json:"motd"`
// Number of players online
Players int32 `json:"players"`
// Protocol number of the server
Protocol int32 `json:"protocol"`
// List of connected players
Sample []PlayerSample `json:"sample"`
// Version of the server
Version string `json:"version"`
}
type PlayerSample struct {
// name of the player
Name string `json:"name"`
// unique id of player
Uuid string `json:"uuid"`
}

87
ping/ping.go Executable file
View File

@@ -0,0 +1,87 @@
package ping
import (
"go.m3o.com/client"
)
type Ping interface {
Ip(*IpRequest) (*IpResponse, error)
Tcp(*TcpRequest) (*TcpResponse, error)
Url(*UrlRequest) (*UrlResponse, error)
}
func NewPingService(token string) *PingService {
return &PingService{
client: client.NewClient(&client.Options{
Token: token,
}),
}
}
type PingService struct {
client *client.Client
}
// Ping an IP address
func (t *PingService) Ip(request *IpRequest) (*IpResponse, error) {
rsp := &IpResponse{}
return rsp, t.client.Call("ping", "Ip", request, rsp)
}
// Ping a TCP port is open
func (t *PingService) Tcp(request *TcpRequest) (*TcpResponse, error) {
rsp := &TcpResponse{}
return rsp, t.client.Call("ping", "Tcp", request, rsp)
}
// Ping a HTTP URL
func (t *PingService) Url(request *UrlRequest) (*UrlResponse, error) {
rsp := &UrlResponse{}
return rsp, t.client.Call("ping", "Url", request, rsp)
}
type IpRequest struct {
// address to ping
Address string `json:"address"`
}
type IpResponse struct {
// average latency e.g 10ms
Latency string `json:"latency"`
// response status
Status string `json:"status"`
}
type TcpRequest struct {
// address to dial
Address string `json:"address"`
// optional data to send
Data string `json:"data"`
}
type TcpResponse struct {
// response data if any
Data string `json:"data"`
// response status
Status string `json:"status"`
}
type UrlRequest struct {
// address to use
Address string `json:"address"`
// method of the call
Method string `json:"method"`
}
type UrlResponse struct {
// the response code
Code int32 `json:"code"`
// the response status
Status string `json:"status"`
}

103
place/place.go Executable file
View File

@@ -0,0 +1,103 @@
package place
import (
"go.m3o.com/client"
)
type Place interface {
Nearby(*NearbyRequest) (*NearbyResponse, error)
Search(*SearchRequest) (*SearchResponse, error)
}
func NewPlaceService(token string) *PlaceService {
return &PlaceService{
client: client.NewClient(&client.Options{
Token: token,
}),
}
}
type PlaceService struct {
client *client.Client
}
// Find places nearby using a location
func (t *PlaceService) Nearby(request *NearbyRequest) (*NearbyResponse, error) {
rsp := &NearbyResponse{}
return rsp, t.client.Call("place", "Nearby", request, rsp)
}
// Search for places by text query
func (t *PlaceService) Search(request *SearchRequest) (*SearchResponse, error) {
rsp := &SearchResponse{}
return rsp, t.client.Call("place", "Search", request, rsp)
}
type AutocompleteRequest struct {
}
type AutocompleteResponse struct {
}
type NearbyRequest struct {
// Keyword to include in the search
Keyword string `json:"keyword"`
// specify the location by lat,lng e.g -33.8670522,-151.1957362
Location string `json:"location"`
// Name of the place to search for
Name string `json:"name"`
// Whether the place is open now
OpenNow bool `json:"open_now"`
// radius in meters within which to search
Radius int32 `json:"radius"`
// Type of place. https://developers.google.com/maps/documentation/places/web-service/supported_types
Type string `json:"type"`
}
type NearbyResponse struct {
Results []Result `json:"results"`
}
type Result struct {
// address of place
Address string `json:"address"`
// url of an icon
IconUrl string `json:"icon_url"`
// lat/lng of place
Location string `json:"location"`
// name of the place
Name string `json:"name"`
// open now
OpenNow bool `json:"open_now"`
// opening hours
OpeningHours string `json:"opening_hours"`
// rating from 1.0 to 5.0
Rating float64 `json:"rating"`
// type of location
Type string `json:"type"`
// feature types
Types []string `json:"types"`
// simplified address
Vicinity string `json:"vicinity"`
}
type SearchRequest struct {
// the location by lat,lng e.g -33.8670522,-151.1957362
Location string `json:"location"`
// Whether the place is open now
OpenNow bool `json:"open_now"`
// the text string on which to search, for example: "restaurant"
Query string `json:"query"`
// radius in meters within which to search
Radius int32 `json:"radius"`
// Type of place. https://developers.google.com/maps/documentation/places/web-service/supported_types
Type string `json:"type"`
}
type SearchResponse struct {
Results []Result `json:"results"`
}

View File

@@ -5,7 +5,11 @@ import (
)
type Search interface {
Vote(*VoteRequest) (*VoteResponse, error)
CreateIndex(*CreateIndexRequest) (*CreateIndexResponse, error)
DeleteIndex(*DeleteIndexRequest) (*DeleteIndexResponse, error)
Delete(*DeleteRequest) (*DeleteResponse, error)
Index(*IndexRequest) (*IndexResponse, error)
Search(*SearchRequest) (*SearchResponse, error)
}
func NewSearchService(token string) *SearchService {
@@ -20,20 +24,105 @@ type SearchService struct {
client *client.Client
}
// Vote to have the Search api launched faster!
func (t *SearchService) Vote(request *VoteRequest) (*VoteResponse, error) {
// Create an index by name
func (t *SearchService) CreateIndex(request *CreateIndexRequest) (*CreateIndexResponse, error) {
rsp := &VoteResponse{}
return rsp, t.client.Call("search", "Vote", request, rsp)
rsp := &CreateIndexResponse{}
return rsp, t.client.Call("search", "CreateIndex", request, rsp)
}
type VoteRequest struct {
// optional message
Message string `json:"message"`
// Delete an index by name
func (t *SearchService) DeleteIndex(request *DeleteIndexRequest) (*DeleteIndexResponse, error) {
rsp := &DeleteIndexResponse{}
return rsp, t.client.Call("search", "DeleteIndex", request, rsp)
}
type VoteResponse struct {
// response message
Message string `json:"message"`
// Delete a document given its ID
func (t *SearchService) Delete(request *DeleteRequest) (*DeleteResponse, error) {
rsp := &DeleteResponse{}
return rsp, t.client.Call("search", "Delete", request, rsp)
}
// Index a document i.e. insert a document to search for.
func (t *SearchService) Index(request *IndexRequest) (*IndexResponse, error) {
rsp := &IndexResponse{}
return rsp, t.client.Call("search", "Index", request, rsp)
}
// Search for documents in a given in index
func (t *SearchService) Search(request *SearchRequest) (*SearchResponse, error) {
rsp := &SearchResponse{}
return rsp, t.client.Call("search", "Search", request, rsp)
}
type CreateIndexRequest struct {
// The name of the index
Index string `json:"index"`
}
type CreateIndexResponse struct {
}
type DeleteIndexRequest struct {
// The name of the index to delete
Index string `json:"index"`
}
type DeleteIndexResponse struct {
}
type DeleteRequest struct {
// The ID of the document to delete
Id string `json:"id"`
// The index the document belongs to
Index string `json:"index"`
}
type DeleteResponse struct {
}
type Document struct {
// The JSON contents of the document
Contents map[string]interface{} `json:"contents"`
// The ID for this document. If blank, one will be generated
Id string `json:"id"`
}
type Field struct {
// The name of the field. Use a `.` separator to define nested fields e.g. foo.bar
Name string `json:"name"`
// The type of the field - string, number
Type string `json:"type"`
}
type IndexRequest struct {
// The document to index
Document *Document `json:"document"`
// The index this document belongs to
Index string `json:"index"`
}
type IndexResponse struct {
Id string `json:"id"`
}
type SearchRequest struct {
// The index the document belongs to
Index string `json:"index"`
// The query. See docs for query language examples
Query string `json:"query"`
}
type SearchResponse struct {
// The matching documents
Documents []Document `json:"documents"`
}

View File

@@ -116,12 +116,12 @@ func (t *UserService) SendPasswordResetEmail(request *SendPasswordResetEmailRequ
}
// 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:
// Send a verification email to a user.
// Email "from" will be 'noreply@email.m3ocontent.com'.
// The verification link will be injected in the email
// as a template variable, $micro_verification_link e.g
// 'Welcome to M3O! Use the link below to verify your email: $micro_verification_link'
// The variable will be replaced with a url similar to:
// 'https://user.m3o.com/user/verify?token=a-verification-token&redirectUrl=your-redir-url'
func (t *UserService) SendVerificationEmail(request *SendVerificationEmailRequest) (*SendVerificationEmailResponse, error) {
@@ -316,10 +316,12 @@ type SendPasswordResetEmailResponse struct {
type SendVerificationEmailRequest struct {
// email address to send the verification code
Email string `json:"email"`
Email string `json:"email"`
// The url to redirect to incase of failure
FailureRedirectUrl string `json:"failureRedirectUrl"`
// Display name of the sender for the email. Note: the email address will still be 'noreply@email.m3ocontent.com'
FromName string `json:"fromName"`
FromName string `json:"fromName"`
// The url to redirect to after successful verification
RedirectUrl string `json:"redirectUrl"`
// subject of the email
Subject string `json:"subject"`
@@ -371,8 +373,6 @@ type UpdateResponse struct {
}
type VerifyEmailRequest struct {
// the email address to verify
Email string `json:"email"`
// The token from the verification email
Token string `json:"token"`
}