192 Commits
ci ... v0.2.0

Author SHA1 Message Date
m3o-actions
c362c676b2 Commit from m3o/m3o action 2021-11-18 13:02:12 +00:00
m3o-actions
9702ed5306 Commit from m3o/m3o action 2021-11-18 13:01:10 +00:00
m3o-actions
afe052b320 Commit from m3o/m3o action 2021-11-18 12:49:57 +00:00
Asim Aslam
a7879d3ff0 in travis test flag 2021-11-18 08:33:36 +00:00
Asim Aslam
45d3c6a791 remove broken examples 2021-11-18 08:32:29 +00:00
Asim Aslam
3760aaf9dd remove broken examples 2021-11-18 08:32:04 +00:00
m3o-actions
3953482915 Commit from m3o/m3o action 2021-11-17 22:21:48 +00:00
m3o-actions
9864b467b8 Commit from m3o/m3o action 2021-11-17 20:29:20 +00:00
m3o-actions
675871d282 Commit from m3o/m3o action 2021-11-17 20:17:39 +00:00
m3o-actions
3ac4947f91 Commit from m3o/m3o action 2021-11-17 20:15:24 +00:00
m3o-actions
3167558049 Commit from m3o/m3o action 2021-11-17 19:49:10 +00:00
m3o-actions
2958807fe2 Commit from m3o/m3o action 2021-11-17 16:59:11 +00:00
m3o-actions
8e553f6e16 Commit from m3o/m3o action 2021-11-17 16:56:17 +00:00
m3o-actions
bc769baed5 Commit from m3o/m3o action 2021-11-17 16:55:33 +00:00
m3o-actions
2ca79f5288 Commit from m3o/m3o action 2021-11-17 16:53:57 +00:00
m3o-actions
a22b8a3053 Commit from m3o/m3o action 2021-11-17 16:53:35 +00:00
m3o-actions
fd05c41d21 Commit from m3o/m3o action 2021-11-17 16:50:32 +00:00
m3o-actions
9bfc15e14a Commit from m3o/m3o action 2021-11-17 16:39:54 +00:00
m3o-actions
b522b298f3 Commit from m3o/m3o action 2021-11-17 16:29:53 +00:00
m3o-actions
14d247a66c Commit from m3o/m3o action 2021-11-17 12:37:29 +00:00
m3o-actions
ef2606dc60 Commit from m3o/m3o action 2021-11-17 12:28:02 +00:00
m3o-actions
be8f5aeae4 Commit from m3o/m3o action 2021-11-17 12:27:15 +00:00
m3o-actions
8dcea9e986 Commit from m3o/m3o action 2021-11-17 11:37:31 +00:00
m3o-actions
af0c644ac3 Commit from m3o/m3o action 2021-11-17 11:10:07 +00:00
m3o-actions
ebd60b1d5c Commit from m3o/m3o action 2021-11-17 10:49:59 +00:00
m3o-actions
38d4ff491f Commit from m3o/m3o action 2021-11-17 10:49:43 +00:00
m3o-actions
21395762be Commit from m3o/m3o action 2021-11-17 10:46:33 +00:00
m3o-actions
28a3532ecb Commit from m3o/m3o action 2021-11-17 10:43:23 +00:00
m3o-actions
7fec9491f1 Commit from m3o/m3o action 2021-11-17 10:34:05 +00:00
m3o-actions
ae8a49329f Commit from m3o/m3o action 2021-11-17 10:27:35 +00:00
m3o-actions
93af926271 Commit from m3o/m3o action 2021-11-17 10:20:05 +00:00
m3o-actions
40f0fb073d Commit from m3o/m3o action 2021-11-17 09:54:21 +00:00
m3o-actions
4c6a11492e Commit from m3o/m3o action 2021-11-17 09:06:03 +00:00
m3o-actions
e5f79370cd Commit from m3o/m3o action 2021-11-17 09:05:28 +00:00
m3o-actions
4e8f9de392 Commit from m3o/m3o action 2021-11-16 15:11:11 +00:00
m3o-actions
03b2b439e5 Commit from m3o/m3o action 2021-11-16 15:11:05 +00:00
m3o-actions
f1e6613177 Commit from m3o/m3o action 2021-11-16 14:48:52 +00:00
m3o-actions
ea7e43f6cd Commit from m3o/m3o action 2021-11-16 14:37:38 +00:00
m3o-actions
edd466a2f9 Commit from m3o/m3o action 2021-11-16 14:33:39 +00:00
m3o-actions
730ab1fa1e Commit from m3o/m3o action 2021-11-16 14:13:23 +00:00
m3o-actions
23dd049bf8 Commit from m3o/m3o action 2021-11-16 13:48:29 +00:00
m3o-actions
1947d31ee7 Commit from m3o/m3o action 2021-11-16 13:44:56 +00:00
m3o-actions
2b6719c9c6 Commit from m3o/m3o action 2021-11-16 13:40:43 +00:00
m3o-actions
00d34547f3 Commit from m3o/m3o action 2021-11-16 13:39:57 +00:00
m3o-actions
0f8436ce86 Commit from m3o/m3o action 2021-11-16 11:01:02 +00:00
m3o-actions
bb53f7cc48 Commit from m3o/m3o action 2021-11-16 10:46:34 +00:00
m3o-actions
9e5bed8e5a Commit from m3o/m3o action 2021-11-16 10:45:52 +00:00
m3o-actions
caac0f5355 Commit from m3o/m3o action 2021-11-16 10:36:24 +00:00
m3o-actions
5685e31a37 Commit from m3o/m3o action 2021-11-12 14:47:34 +00:00
m3o-actions
c43f57ce29 Commit from m3o/m3o action 2021-11-12 14:46:43 +00:00
m3o-actions
d9476960d4 Commit from m3o/m3o action 2021-11-11 23:36:13 +00:00
m3o-actions
3f583e059f Commit from m3o/m3o action 2021-11-11 23:27:10 +00:00
m3o-actions
bd1dcf3fed Commit from m3o/m3o action 2021-11-11 17:37:18 +00:00
m3o-actions
baff11e1d7 Commit from m3o/m3o action 2021-11-11 17:30:45 +00:00
m3o-actions
7c67ac14c2 Commit from m3o/m3o action 2021-11-11 17:12:21 +00:00
m3o-actions
fb8efda643 Commit from m3o/m3o action 2021-11-11 16:53:07 +00:00
m3o-actions
6fcd1d7028 Commit from m3o/m3o action 2021-11-11 16:30:48 +00:00
m3o-actions
02558a8f3f Commit from m3o/m3o action 2021-11-11 16:12:03 +00:00
m3o-actions
17f624b6a7 Commit from m3o/m3o action 2021-11-11 15:41:41 +00:00
m3o-actions
3f9d7cccf8 Commit from m3o/m3o action 2021-11-11 15:36:49 +00:00
m3o-actions
cb7f8b3403 Commit from m3o/m3o action 2021-11-11 15:27:20 +00:00
m3o-actions
072d96b1ca Commit from m3o/m3o action 2021-11-11 14:10:13 +00:00
m3o-actions
03a7225806 Commit from m3o/m3o action 2021-11-11 14:07:57 +00:00
m3o-actions
1083f55216 Commit from m3o/m3o action 2021-11-11 13:56:57 +00:00
m3o-actions
bd469033e2 Commit from m3o/m3o action 2021-11-11 13:46:49 +00:00
m3o-actions
b5f58efe8b Commit from m3o/m3o action 2021-11-11 12:45:56 +00:00
m3o-actions
018e87a593 Commit from m3o/m3o action 2021-11-11 12:43:36 +00:00
m3o-actions
07312f010e Commit from m3o/m3o action 2021-11-11 12:39:10 +00:00
m3o-actions
2321fde555 Commit from m3o/m3o action 2021-11-11 12:17:40 +00:00
m3o-actions
be676eff6c Commit from m3o/m3o action 2021-11-11 12:09:26 +00:00
m3o-actions
9dcc428a55 Commit from m3o/m3o action 2021-11-11 12:05:26 +00:00
m3o-actions
b6d8111005 Commit from m3o/m3o action 2021-11-11 12:02:51 +00:00
m3o-actions
1e54e284f6 Commit from m3o/m3o action 2021-11-11 11:59:54 +00:00
m3o-actions
d31fde4be4 Commit from m3o/m3o action 2021-11-11 11:51:18 +00:00
m3o-actions
d2adcc0208 Commit from m3o/m3o action 2021-11-11 11:19:50 +00:00
m3o-actions
956adcbced Commit from m3o/m3o action 2021-11-11 11:09:27 +00:00
m3o-actions
fab7b1892d Commit from m3o/m3o action 2021-11-11 11:02:04 +00:00
m3o-actions
7d037fe871 Commit from m3o/m3o action 2021-11-11 11:00:15 +00:00
m3o-actions
53a197a685 Commit from m3o/m3o action 2021-11-11 10:57:32 +00:00
m3o-actions
a7586670e6 Commit from m3o/m3o action 2021-11-11 10:56:43 +00:00
m3o-actions
2b5509db64 Commit from m3o/m3o action 2021-11-11 10:55:40 +00:00
m3o-actions
03a720c4d0 Commit from m3o/m3o action 2021-11-11 10:54:44 +00:00
m3o-actions
581945da61 Commit from m3o/m3o action 2021-11-11 10:26:25 +00:00
m3o-actions
d27ecddd94 Commit from m3o/m3o action 2021-11-11 10:13:24 +00:00
m3o-actions
034d9aa5ac Commit from m3o/m3o action 2021-11-10 23:58:27 +00:00
m3o-actions
328997c217 Commit from m3o/m3o action 2021-11-10 22:29:50 +00:00
m3o-actions
f87a55000e Commit from m3o/m3o action 2021-11-10 22:17:37 +00:00
m3o-actions
5ec5e88b61 Commit from m3o/m3o action 2021-11-10 16:26:02 +00:00
m3o-actions
d664134226 Commit from m3o/m3o action 2021-11-10 16:21:04 +00:00
m3o-actions
20bb0adb52 Commit from m3o/m3o action 2021-11-10 16:16:45 +00:00
m3o-actions
b32923c69c Commit from m3o/m3o action 2021-11-10 16:15:20 +00:00
m3o-actions
bb8552ac72 Commit from m3o/m3o action 2021-11-10 16:00:58 +00:00
m3o-actions
2e2264a045 Commit from m3o/m3o action 2021-11-10 15:58:48 +00:00
m3o-actions
8fbc04d515 Commit from m3o/m3o action 2021-11-10 15:50:32 +00:00
m3o-actions
6c77e113d7 Commit from m3o/m3o action 2021-11-10 13:54:12 +00:00
m3o-actions
be500e861e Commit from m3o/m3o action 2021-11-10 13:11:50 +00:00
m3o-actions
8217b63c9a Commit from m3o/m3o action 2021-11-10 13:06:03 +00:00
m3o-actions
5e75ed6f44 Commit from m3o/m3o action 2021-11-10 12:39:48 +00:00
m3o-actions
3ea4ec9b77 Commit from m3o/m3o action 2021-11-10 12:37:48 +00:00
m3o-actions
6715cd7575 Commit from m3o/m3o action 2021-11-10 12:31:16 +00:00
m3o-actions
36fa586811 Commit from m3o/m3o action 2021-11-10 12:19:48 +00:00
m3o-actions
f3c2a87ba8 Commit from m3o/m3o action 2021-11-10 11:57:00 +00:00
m3o-actions
48a07e015a Commit from m3o/m3o action 2021-11-10 11:32:49 +00:00
m3o-actions
2deeb0ca70 Commit from m3o/m3o action 2021-11-10 11:05:04 +00:00
m3o-actions
1305ec64f5 Commit from m3o/m3o action 2021-11-10 10:55:08 +00:00
Janos Dobronszki
120c1cfe31 Run idempotent exaples as tests in CI (#7) 2021-11-10 09:37:45 +00:00
m3o-actions
3c1c9769fb Commit from m3o/m3o action 2021-11-10 09:21:08 +00:00
m3o-actions
9404bd621a Commit from m3o/m3o action 2021-11-10 09:20:30 +00:00
m3o-actions
429d8543ba Commit from m3o/m3o action 2021-11-10 09:16:45 +00:00
m3o-actions
0515ac3485 Commit from m3o/m3o action 2021-11-10 09:03:04 +00:00
m3o-actions
36ebf2726c Commit from m3o/m3o action 2021-11-10 07:02:27 +00:00
m3o-actions
13eb3a674c Commit from m3o/m3o action 2021-11-10 06:57:47 +00:00
m3o-actions
b724299623 Commit from m3o/m3o action 2021-11-10 06:57:03 +00:00
m3o-actions
a2eea8e982 Commit from m3o/m3o action 2021-11-09 15:01:52 +00:00
m3o-actions
b36641e39e Commit from m3o/m3o action 2021-11-09 11:39:14 +00:00
m3o-actions
e9f001a53c Commit from m3o/m3o action 2021-11-09 11:10:41 +00:00
m3o-actions
80c683fa2a Commit from m3o/m3o action 2021-11-09 10:50:05 +00:00
m3o-actions
7b1ff7cdba Commit from m3o/m3o action 2021-11-09 10:41:16 +00:00
m3o-actions
93b0465212 Commit from m3o/m3o action 2021-11-09 10:23:33 +00:00
m3o-actions
0c2f5b7138 Commit from m3o/m3o action 2021-11-09 10:11:09 +00:00
m3o-actions
0d4aacf4c1 Commit from m3o/m3o action 2021-11-09 09:59:49 +00:00
m3o-actions
3cd6a304e8 Commit from m3o/m3o action 2021-11-09 09:55:58 +00:00
m3o-actions
5ed7ec293a Commit from m3o/m3o action 2021-11-09 00:12:20 +00:00
m3o-actions
b69dce32b5 Commit from m3o/m3o action 2021-11-09 00:08:05 +00:00
m3o-actions
24a8774b65 Commit from m3o/m3o action 2021-11-08 23:58:17 +00:00
m3o-actions
c70c849348 Commit from m3o/m3o action 2021-11-08 23:56:42 +00:00
m3o-actions
48a87453db Commit from m3o/m3o action 2021-11-08 23:50:31 +00:00
m3o-actions
d02ff341b9 Commit from m3o/m3o action 2021-11-08 23:45:01 +00:00
m3o-actions
e357681055 Commit from m3o/m3o action 2021-11-08 23:38:39 +00:00
m3o-actions
01728ef128 Commit from m3o/m3o action 2021-11-08 23:25:53 +00:00
m3o-actions
57653a725d Commit from m3o/m3o action 2021-11-08 23:13:03 +00:00
m3o-actions
ceba4eac78 Commit from m3o/m3o action 2021-11-08 23:00:09 +00:00
m3o-actions
e2457aa0ef Commit from m3o/m3o action 2021-11-08 22:49:41 +00:00
m3o-actions
eff7396cfd Commit from m3o/m3o action 2021-11-08 22:16:22 +00:00
m3o-actions
b6914f82d4 Commit from m3o/m3o action 2021-11-08 22:05:24 +00:00
m3o-actions
e3e358df0b Commit from m3o/m3o action 2021-11-08 21:58:01 +00:00
m3o-actions
78900e379e Commit from m3o/m3o action 2021-11-08 17:01:54 +00:00
m3o-actions
39cf329baa Commit from m3o/m3o action 2021-11-08 15:54:16 +00:00
m3o-actions
c4df401021 Commit from m3o/m3o action 2021-11-08 15:42:22 +00:00
m3o-actions
7d5d0555b3 Commit from m3o/m3o action 2021-11-08 15:01:27 +00:00
m3o-actions
16e313b176 Commit from m3o/m3o action 2021-11-08 13:23:33 +00:00
m3o-actions
f5e55c81b0 Commit from m3o/m3o action 2021-11-08 11:36:04 +00:00
m3o-actions
d0307610bc Commit from m3o/m3o action 2021-11-08 10:59:15 +00:00
m3o-actions
cab87b9b3e Commit from m3o/m3o action 2021-11-05 22:42:46 +00:00
m3o-actions
c18a866b71 Commit from m3o/m3o action 2021-11-05 18:00:15 +00:00
m3o-actions
5f43c72002 Commit from m3o/m3o action 2021-11-05 17:23:25 +00:00
m3o-actions
d9c5465869 Commit from m3o/m3o action 2021-11-05 15:43:54 +00:00
m3o-actions
bf17b77f32 Commit from m3o/m3o action 2021-11-05 15:16:17 +00:00
m3o-actions
dc963b5c18 Commit from m3o/m3o action 2021-11-05 14:46:52 +00:00
m3o-actions
d0c9e6f959 Commit from m3o/m3o action 2021-11-05 14:46:11 +00:00
m3o-actions
87139ca743 Commit from m3o/m3o action 2021-11-05 14:44:14 +00:00
m3o-actions
c9438a2715 Commit from m3o/m3o action 2021-11-05 14:44:10 +00:00
m3o-actions
fcf0cacf5f Commit from m3o/m3o action 2021-11-05 12:06:56 +00:00
m3o-actions
dd375dcb39 Commit from m3o/m3o action 2021-11-04 22:07:58 +00:00
m3o-actions
df176092d8 Commit from m3o/m3o action 2021-11-04 14:40:35 +00:00
m3o-actions
5c96743ac2 Commit from m3o/m3o action 2021-11-04 12:19:32 +00:00
m3o-actions
2293c9ffcd Commit from m3o/m3o action 2021-11-04 12:12:06 +00:00
m3o-actions
6814ff2132 Commit from m3o/m3o action 2021-11-04 11:33:12 +00:00
m3o-actions
3b0248b764 Commit from m3o/m3o action 2021-11-04 10:31:23 +00:00
m3o-actions
b71caa6818 Commit from m3o/m3o action 2021-11-04 09:47:59 +00:00
m3o-actions
857cdfd2ad Commit from m3o/m3o action 2021-11-04 09:42:11 +00:00
m3o-actions
de3da7ad78 Commit from m3o/m3o action 2021-11-04 00:34:55 +00:00
m3o-actions
9661bd5ae1 Commit from m3o/m3o action 2021-11-04 00:31:43 +00:00
m3o-actions
4ffa2e1a25 Commit from m3o/m3o action 2021-11-03 23:56:08 +00:00
m3o-actions
bab7357a54 Commit from m3o/m3o action 2021-11-03 23:51:59 +00:00
m3o-actions
e5e197566d Commit from m3o/m3o action 2021-11-03 23:44:49 +00:00
m3o-actions
e256e24571 Commit from m3o/m3o action 2021-11-03 23:27:18 +00:00
m3o-actions
a72108fe32 Commit from m3o/m3o action 2021-11-03 22:01:40 +00:00
m3o-actions
a88d369ab2 Commit from m3o/m3o action 2021-11-03 22:01:12 +00:00
m3o-actions
784c4e4c37 Commit from m3o/m3o action 2021-11-03 21:55:24 +00:00
m3o-actions
2e374bf3b0 Commit from m3o/m3o action 2021-11-03 21:49:35 +00:00
m3o-actions
36ea54da44 Commit from m3o/m3o action 2021-11-03 21:44:16 +00:00
m3o-actions
6a5d769c70 Commit from m3o/m3o action 2021-11-03 17:09:53 +00:00
m3o-actions
5963caaa3f Commit from m3o/m3o action 2021-11-03 17:03:09 +00:00
m3o-actions
611202c283 Commit from m3o/m3o action 2021-11-03 16:59:37 +00:00
m3o-actions
1645b031e1 Commit from m3o/m3o action 2021-11-03 16:20:20 +00:00
m3o-actions
d87e334dca Commit from m3o/m3o action 2021-11-03 16:08:32 +00:00
m3o-actions
9a245d66ac Commit from m3o/m3o action 2021-11-03 15:50:29 +00:00
m3o-actions
7335a0576f Commit from m3o/m3o action 2021-11-03 15:36:34 +00:00
m3o-actions
aecab5372c Commit from m3o/m3o action 2021-11-03 15:16:55 +00:00
m3o-actions
a3f66cea0b Commit from m3o/m3o action 2021-11-03 14:15:29 +00:00
m3o-actions
2a5dc16cef Commit from m3o/m3o action 2021-11-03 14:12:51 +00:00
m3o-actions
3af01580b7 Commit from m3o/m3o action 2021-11-03 14:00:31 +00:00
m3o-actions
49e533797f Commit from m3o/m3o action 2021-11-03 11:49:43 +00:00
m3o-actions
2283f13e57 Commit from m3o/m3o action 2021-11-03 11:19:16 +00:00
Janos Dobronszki
e59c2bcc38 Add CI (#6) 2021-11-03 10:28:07 +00:00
m3o-actions
c6b213570b Commit from m3o/m3o action 2021-11-03 10:19:08 +00:00
m3o-actions
8e6e73a8eb Commit from m3o/m3o action 2021-11-02 19:13:21 +00:00
m3o-actions
075c121632 Commit from m3o/m3o action 2021-11-02 18:38:37 +00:00
m3o-actions
99e2f22d5b Commit from m3o/m3o action 2021-11-02 18:37:33 +00:00
m3o-actions
8623e7fec8 Commit from m3o/m3o action 2021-11-02 16:43:32 +00:00
m3o-actions
114660a002 Commit from m3o/m3o action 2021-11-02 16:31:05 +00:00
258 changed files with 4788 additions and 814 deletions

View File

@@ -22,5 +22,10 @@ jobs:
env:
M3O_API_TOKEN: ${{ secrets.M3O_API_TOKEN }}
run: |
cd examples/helloworld/call/callTheHelloworldService
go run main.go
# stream is temporarily excluded as it hangs forever because test does not close connection
# @TODO remove "idempotent: true" from stream example
O=$(find . -name ".run" | grep -v stream | xargs -n1 dirname | xargs -n1 go run)
echo $O
if grep -q Detail "$O"; then
exit 1
fi

View File

@@ -18,8 +18,10 @@ type AddressService struct {
// Lookup a list of UK addresses by postcode
func (t *AddressService) LookupPostcode(request *LookupPostcodeRequest) (*LookupPostcodeResponse, error) {
rsp := &LookupPostcodeResponse{}
return rsp, t.client.Call("address", "LookupPostcode", request, rsp)
}
type LookupPostcodeRequest struct {

View File

@@ -18,8 +18,10 @@ type AnswerService struct {
// Ask a question and receive an instant answer
func (t *AnswerService) Question(request *QuestionRequest) (*QuestionResponse, error) {
rsp := &QuestionResponse{}
return rsp, t.client.Call("answer", "Question", request, rsp)
}
type QuestionRequest struct {

18
cache/cache.go vendored
View File

@@ -16,34 +16,44 @@ type CacheService struct {
client *client.Client
}
// Decrement a value (if it's a number)
// Decrement a value (if it's a number). If key not found it is equivalent to set.
func (t *CacheService) Decrement(request *DecrementRequest) (*DecrementResponse, error) {
rsp := &DecrementResponse{}
return rsp, t.client.Call("cache", "Decrement", request, rsp)
}
// Delete a value from the cache
// Delete a value from the cache. If key not found a success response is returned.
func (t *CacheService) Delete(request *DeleteRequest) (*DeleteResponse, error) {
rsp := &DeleteResponse{}
return rsp, t.client.Call("cache", "Delete", request, rsp)
}
// Get an item from the cache by key
// Get an item from the cache by key. If key is not found, an empty response is returned.
func (t *CacheService) Get(request *GetRequest) (*GetResponse, error) {
rsp := &GetResponse{}
return rsp, t.client.Call("cache", "Get", request, rsp)
}
// Increment a value (if it's a number)
// Increment a value (if it's a number). If key not found it is equivalent to set.
func (t *CacheService) Increment(request *IncrementRequest) (*IncrementResponse, error) {
rsp := &IncrementResponse{}
return rsp, t.client.Call("cache", "Increment", request, rsp)
}
// Set an item in the cache. Overwrites any existing value already set.
func (t *CacheService) Set(request *SetRequest) (*SetResponse, error) {
rsp := &SetResponse{}
return rsp, t.client.Call("cache", "Set", request, rsp)
}
type DecrementRequest struct {

View File

@@ -6,6 +6,10 @@ import (
)
func TestBasicCall(t *testing.T) {
if v := os.Getenv("IN_TRAVIS"); v == "yes" {
return
}
response := map[string]interface{}{}
if err := NewClient(&Options{
Token: os.Getenv("TOKEN"),

View File

@@ -18,26 +18,34 @@ type CryptoService struct {
// Returns the history for the previous close
func (t *CryptoService) History(request *HistoryRequest) (*HistoryResponse, error) {
rsp := &HistoryResponse{}
return rsp, t.client.Call("crypto", "History", request, rsp)
}
// Get news related to a currency
func (t *CryptoService) News(request *NewsRequest) (*NewsResponse, error) {
rsp := &NewsResponse{}
return rsp, t.client.Call("crypto", "News", request, rsp)
}
// Get the last price for a given crypto ticker
func (t *CryptoService) Price(request *PriceRequest) (*PriceResponse, error) {
rsp := &PriceResponse{}
return rsp, t.client.Call("crypto", "Price", request, rsp)
}
// Get the last quote for a given crypto ticker
func (t *CryptoService) Quote(request *QuoteRequest) (*QuoteResponse, error) {
rsp := &QuoteResponse{}
return rsp, t.client.Call("crypto", "Quote", request, rsp)
}
type Article struct {

View File

@@ -18,26 +18,34 @@ type CurrencyService struct {
// Codes returns the supported currency codes for the API
func (t *CurrencyService) Codes(request *CodesRequest) (*CodesResponse, error) {
rsp := &CodesResponse{}
return rsp, t.client.Call("currency", "Codes", request, rsp)
}
// Convert returns the currency conversion rate between two pairs e.g USD/GBP
func (t *CurrencyService) Convert(request *ConvertRequest) (*ConvertResponse, error) {
rsp := &ConvertResponse{}
return rsp, t.client.Call("currency", "Convert", request, rsp)
}
// Returns the historic rates for a currency on a given date
func (t *CurrencyService) History(request *HistoryRequest) (*HistoryResponse, error) {
rsp := &HistoryResponse{}
return rsp, t.client.Call("currency", "History", request, rsp)
}
// Rates returns the currency rates for a given code e.g USD
func (t *CurrencyService) Rates(request *RatesRequest) (*RatesResponse, error) {
rsp := &RatesResponse{}
return rsp, t.client.Call("currency", "Rates", request, rsp)
}
type Code struct {

View File

@@ -18,38 +18,74 @@ type DbService struct {
// Count records in a table
func (t *DbService) Count(request *CountRequest) (*CountResponse, error) {
rsp := &CountResponse{}
return rsp, t.client.Call("db", "Count", request, rsp)
}
// Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
func (t *DbService) Create(request *CreateRequest) (*CreateResponse, error) {
rsp := &CreateResponse{}
return rsp, t.client.Call("db", "Create", request, rsp)
}
// Delete a record in the database by id.
func (t *DbService) Delete(request *DeleteRequest) (*DeleteResponse, error) {
rsp := &DeleteResponse{}
return rsp, t.client.Call("db", "Delete", request, rsp)
}
// Drop a table in the DB
func (t *DbService) DropTable(request *DropTableRequest) (*DropTableResponse, error) {
rsp := &DropTableResponse{}
return rsp, t.client.Call("db", "DropTable", request, rsp)
}
// List tables in the DB
func (t *DbService) ListTables(request *ListTablesRequest) (*ListTablesResponse, error) {
rsp := &ListTablesResponse{}
return rsp, t.client.Call("db", "ListTables", request, rsp)
}
// Read data from a table. Lookup can be by ID or via querying any field in the record.
func (t *DbService) Read(request *ReadRequest) (*ReadResponse, error) {
rsp := &ReadResponse{}
return rsp, t.client.Call("db", "Read", request, rsp)
}
// Rename a table
func (t *DbService) RenameTable(request *RenameTableRequest) (*RenameTableResponse, error) {
rsp := &RenameTableResponse{}
return rsp, t.client.Call("db", "RenameTable", request, rsp)
}
// Truncate the records in a table
func (t *DbService) Truncate(request *TruncateRequest) (*TruncateResponse, error) {
rsp := &TruncateResponse{}
return rsp, t.client.Call("db", "Truncate", request, rsp)
}
// Update a record in the database. Include an "id" in the record to update.
func (t *DbService) Update(request *UpdateRequest) (*UpdateResponse, error) {
rsp := &UpdateResponse{}
return rsp, t.client.Call("db", "Update", request, rsp)
}
type CountRequest struct {
@@ -84,6 +120,21 @@ type DeleteRequest struct {
type DeleteResponse struct {
}
type DropTableRequest struct {
Table string `json:"table"`
}
type DropTableResponse struct {
}
type ListTablesRequest struct {
}
type ListTablesResponse struct {
// list of tables
Tables []string `json:"tables"`
}
type ReadRequest struct {
// Read by id. Equivalent to 'id == "your-id"'
Id string `json:"id"`
@@ -110,14 +161,21 @@ type ReadResponse struct {
Records []map[string]interface{} `json:"records"`
}
type RenameTableRequest struct {
// current table name
From string `json:"from"`
// new table name
To string `json:"to"`
}
type RenameTableResponse struct {
}
type TruncateRequest struct {
// Optional table name. Defaults to 'default'
Table string `json:"table"`
}
type TruncateResponse struct {
// The table truncated
Table string `json:"table"`
}
type UpdateRequest struct {

View File

@@ -18,8 +18,10 @@ type EmailService struct {
// Send an email by passing in from, to, subject, and a text or html body
func (t *EmailService) Send(request *SendRequest) (*SendResponse, error) {
rsp := &SendResponse{}
return rsp, t.client.Call("email", "Send", request, rsp)
}
type SendRequest struct {

View File

@@ -18,27 +18,35 @@ type EmojiService struct {
// Find an emoji by its alias e.g :beer:
func (t *EmojiService) Find(request *FindRequest) (*FindResponse, error) {
rsp := &FindResponse{}
return rsp, t.client.Call("emoji", "Find", request, rsp)
}
// Get the flag for a country. Requires country code e.g GB for great britain
func (t *EmojiService) Flag(request *FlagRequest) (*FlagResponse, error) {
rsp := &FlagResponse{}
return rsp, t.client.Call("emoji", "Flag", request, rsp)
}
// Print text and renders the emojis with aliases e.g
// let's grab a :beer: becomes let's grab a 🍺
func (t *EmojiService) Print(request *PrintRequest) (*PrintResponse, error) {
rsp := &PrintResponse{}
return rsp, t.client.Call("emoji", "Print", request, rsp)
}
// Send an emoji to anyone via SMS. Messages are sent in the form '<message> Sent from <from>'
func (t *EmojiService) Send(request *SendRequest) (*SendResponse, error) {
rsp := &SendResponse{}
return rsp, t.client.Call("emoji", "Send", request, rsp)
}
type FindRequest struct {

View File

@@ -18,14 +18,18 @@ type EvchargersService struct {
// Retrieve reference data as used by this API and in conjunction with the Search endpoint
func (t *EvchargersService) ReferenceData(request *ReferenceDataRequest) (*ReferenceDataResponse, error) {
rsp := &ReferenceDataResponse{}
return rsp, t.client.Call("evchargers", "ReferenceData", request, rsp)
}
// Search by giving a coordinate and a max distance, or bounding box and optional filters
func (t *EvchargersService) Search(request *SearchRequest) (*SearchResponse, error) {
rsp := &SearchResponse{}
return rsp, t.client.Call("evchargers", "Search", request, rsp)
}
type Address struct {

View File

@@ -16,16 +16,73 @@ type EventService struct {
client *client.Client
}
// Publish a message to the event stream.
func (t *EventService) Publish(request *PublishRequest) (*PublishResponse, error) {
rsp := &PublishResponse{}
return rsp, t.client.Call("event", "Publish", request, rsp)
// Consume events from a given topic.
func (t *EventService) Consume(request *ConsumeRequest) (*ConsumeResponseStream, error) {
stream, err := t.client.Stream("event", "Consume", request)
if err != nil {
return nil, err
}
return &ConsumeResponseStream{
stream: stream,
}, nil
}
// Subscribe to messages for a given topic.
func (t *EventService) Subscribe(request *SubscribeRequest) (*SubscribeResponse, error) {
rsp := &SubscribeResponse{}
return rsp, t.client.Call("event", "Subscribe", request, rsp)
type ConsumeResponseStream struct {
stream *client.Stream
}
func (t *ConsumeResponseStream) Recv() (*ConsumeResponse, error) {
var rsp ConsumeResponse
if err := t.stream.Recv(&rsp); err != nil {
return nil, err
}
return &rsp, nil
}
// Publish a event to the event stream.
func (t *EventService) Publish(request *PublishRequest) (*PublishResponse, error) {
rsp := &PublishResponse{}
return rsp, t.client.Call("event", "Publish", request, rsp)
}
// Read stored events
func (t *EventService) Read(request *ReadRequest) (*ReadResponse, error) {
rsp := &ReadResponse{}
return rsp, t.client.Call("event", "Read", request, rsp)
}
type ConsumeRequest struct {
// Optional group for the subscription
Group string `json:"group"`
// Optional offset to read from e.g "2006-01-02T15:04:05.999Z07:00"
Offset string `json:"offset"`
// The topic to subscribe to
Topic string `json:"topic"`
}
type ConsumeResponse struct {
// Unique message id
Id string `json:"id"`
// The next json message on the topic
Message map[string]interface{} `json:"message"`
// Timestamp of publishing
Timestamp string `json:"timestamp"`
// The topic subscribed to
Topic string `json:"topic"`
}
type Ev struct {
// event id
Id string `json:"id"`
// event message
Message map[string]interface{} `json:"message"`
// event timestamp
Timestamp string `json:"timestamp"`
}
type PublishRequest struct {
@@ -38,16 +95,16 @@ type PublishRequest struct {
type PublishResponse struct {
}
type SubscribeRequest struct {
// Optional group for the subscription
Group string `json:"group"`
// The topic to subscribe to
type ReadRequest struct {
// number of events to read; default 25
Limit int32 `json:"limit"`
// offset for the events; default 0
Offset int32 `json:"offset"`
// topic to read from
Topic string `json:"topic"`
}
type SubscribeResponse struct {
// The next json message on the topic
Message map[string]interface{} `json:"message"`
// The topic subscribed to
Topic string `json:"topic"`
type ReadResponse struct {
// the events
Events []Ev `json:"events"`
}

View File

@@ -29,5 +29,6 @@ func LookupPostcode() {
})
fmt.Println(rsp, err)
}
```

View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/address"
)
// Lookup a list of UK addresses by postcode
func main() {
addressService := address.NewAddressService(os.Getenv("M3O_API_TOKEN"))
rsp, err := addressService.LookupPostcode(&address.LookupPostcodeRequest{
Postcode: "SW1A 2AA",
})
fmt.Println(rsp, err)
}

View File

@@ -29,5 +29,6 @@ func AskAquestion() {
})
fmt.Println(rsp, err)
}
```

View File

View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/answer"
)
// Ask a question and receive an instant answer
func main() {
answerService := answer.NewAnswerService(os.Getenv("M3O_API_TOKEN"))
rsp, err := answerService.Question(&answer.QuestionRequest{
Query: "microsoft",
})
fmt.Println(rsp, err)
}

View File

@@ -4,62 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Cache/api](htt
Endpoints:
## Increment
Increment a value (if it's a number)
[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)
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)
[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)
func DecrementAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Decrement(&cache.DecrementRequest{
Key: "counter",
Value: 2,
})
fmt.Println(rsp, err)
}
```
## Set
Set an item in the cache. Overwrites any existing value already set.
@@ -86,11 +30,12 @@ Value: "bar",
})
fmt.Println(rsp, err)
}
```
## Get
Get an item from the cache by key
Get an item from the cache by key. If key is not found, an empty response is returned.
[https://m3o.com/cache/api#Get](https://m3o.com/cache/api#Get)
@@ -105,7 +50,7 @@ import(
"go.m3o.com/cache"
)
// Get an item from the cache by key
// Get an item from the cache by key. If key is not found, an empty response is returned.
func GetAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Get(&cache.GetRequest{
@@ -113,11 +58,12 @@ func GetAvalue() {
})
fmt.Println(rsp, err)
}
```
## Delete
Delete a value from the cache
Delete a value from the cache. If key not found a success response is returned.
[https://m3o.com/cache/api#Delete](https://m3o.com/cache/api#Delete)
@@ -132,7 +78,7 @@ import(
"go.m3o.com/cache"
)
// Delete a value from the cache
// Delete a value from the cache. If key not found a success response is returned.
func DeleteAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Delete(&cache.DeleteRequest{
@@ -140,5 +86,64 @@ func DeleteAvalue() {
})
fmt.Println(rsp, err)
}
```
## Increment
Increment a value (if it's a number). If key not found it is equivalent to set.
[https://m3o.com/cache/api#Increment](https://m3o.com/cache/api#Increment)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/cache"
)
// Increment a value (if it's a number). If key not found it is equivalent to set.
func IncrementAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Increment(&cache.IncrementRequest{
Key: "counter",
Value: 2,
})
fmt.Println(rsp, err)
}
```
## Decrement
Decrement a value (if it's a number). If key not found it is equivalent to set.
[https://m3o.com/cache/api#Decrement](https://m3o.com/cache/api#Decrement)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/cache"
)
// Decrement a value (if it's a number). If key not found it is equivalent to set.
func DecrementAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Decrement(&cache.DecrementRequest{
Key: "counter",
Value: 2,
})
fmt.Println(rsp, err)
}
```

View File

@@ -7,7 +7,7 @@ import (
"go.m3o.com/cache"
)
// Decrement a value (if it's a number)
// Decrement a value (if it's a number). If key not found it is equivalent to set.
func DecrementAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Decrement(&cache.DecrementRequest{

View File

@@ -0,0 +1,19 @@
package main
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 main() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Decrement(&cache.DecrementRequest{
Key: "counter",
Value: 2,
})
fmt.Println(rsp, err)
}

View File

@@ -7,7 +7,7 @@ import (
"go.m3o.com/cache"
)
// Delete a value from the cache
// Delete a value from the cache. If key not found a success response is returned.
func DeleteAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Delete(&cache.DeleteRequest{

18
examples/cache/delete/deleteAValue/main.go vendored Executable file
View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/cache"
)
// Delete a value from the cache. If key not found a success response is returned.
func main() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Delete(&cache.DeleteRequest{
Key: "foo",
})
fmt.Println(rsp, err)
}

View File

@@ -7,7 +7,7 @@ import (
"go.m3o.com/cache"
)
// Get an item from the cache by key
// Get an item from the cache by key. If key is not found, an empty response is returned.
func GetAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Get(&cache.GetRequest{

18
examples/cache/get/getAValue/main.go vendored Executable file
View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/cache"
)
// Get an item from the cache by key. If key is not found, an empty response is returned.
func main() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Get(&cache.GetRequest{
Key: "foo",
})
fmt.Println(rsp, err)
}

View File

@@ -7,7 +7,7 @@ import (
"go.m3o.com/cache"
)
// Increment a value (if it's a number)
// Increment a value (if it's a number). If key not found it is equivalent to set.
func IncrementAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Increment(&cache.IncrementRequest{

View File

@@ -0,0 +1,19 @@
package main
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 main() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Increment(&cache.IncrementRequest{
Key: "counter",
Value: 2,
})
fmt.Println(rsp, err)
}

0
examples/cache/set/setAValue/.run vendored Executable file
View File

19
examples/cache/set/setAValue/main.go vendored Executable file
View File

@@ -0,0 +1,19 @@
package main
import (
"fmt"
"os"
"go.m3o.com/cache"
)
// Set an item in the cache. Overwrites any existing value already set.
func main() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Set(&cache.SetRequest{
Key: "foo",
Value: "bar",
})
fmt.Println(rsp, err)
}

View File

@@ -4,60 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Crypto/api](ht
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
@@ -83,6 +29,7 @@ func GetAcryptocurrencyQuote() {
})
fmt.Println(rsp, err)
}
```
## History
@@ -110,5 +57,62 @@ func GetPreviousClose() {
})
fmt.Println(rsp, err)
}
```
## 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

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/crypto"
)
// Returns the history for the previous close
func main() {
cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cryptoService.History(&crypto.HistoryRequest{
Symbol: "BTCUSD",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/crypto"
)
// Get news related to a currency
func main() {
cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cryptoService.News(&crypto.NewsRequest{
Symbol: "BTCUSD",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/crypto"
)
// Get the last price for a given crypto ticker
func main() {
cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cryptoService.Price(&crypto.PriceRequest{
Symbol: "BTCUSD",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/crypto"
)
// Get the last quote for a given crypto ticker
func main() {
cryptoService := crypto.NewCryptoService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cryptoService.Quote(&crypto.QuoteRequest{
Symbol: "BTCUSD",
})
fmt.Println(rsp, err)
}

View File

@@ -4,6 +4,61 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Currency/api](
Endpoints:
## Codes
Codes returns the supported currency codes for the API
[https://m3o.com/currency/api#Codes](https://m3o.com/currency/api#Codes)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/currency"
)
// Codes returns the supported currency codes for the API
func GetSupportedCodes() {
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
rsp, err := currencyService.Codes(&currency.CodesRequest{
})
fmt.Println(rsp, err)
}
```
## Rates
Rates returns the currency rates for a given code e.g USD
[https://m3o.com/currency/api#Rates](https://m3o.com/currency/api#Rates)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/currency"
)
// Rates returns the currency rates for a given code e.g USD
func GetRatesForUsd() {
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
rsp, err := currencyService.Rates(&currency.RatesRequest{
Code: "USD",
})
fmt.Println(rsp, err)
}
```
## Convert
Convert returns the currency conversion rate between two pairs e.g USD/GBP
@@ -30,6 +85,7 @@ To: "GBP",
})
fmt.Println(rsp, err)
}
```
## Convert
@@ -59,6 +115,7 @@ To: "GBP",
})
fmt.Println(rsp, err)
}
```
## History
@@ -87,58 +144,6 @@ Date: "2021-05-30",
})
fmt.Println(rsp, err)
}
```
## Codes
Codes returns the supported currency codes for the API
[https://m3o.com/currency/api#Codes](https://m3o.com/currency/api#Codes)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/currency"
)
// Codes returns the supported currency codes for the API
func GetSupportedCodes() {
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
rsp, err := currencyService.Codes(&currency.CodesRequest{
})
fmt.Println(rsp, err)
}
```
## Rates
Rates returns the currency rates for a given code e.g USD
[https://m3o.com/currency/api#Rates](https://m3o.com/currency/api#Rates)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/currency"
)
// Rates returns the currency rates for a given code e.g USD
func GetRatesForUsd() {
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
rsp, err := currencyService.Rates(&currency.RatesRequest{
Code: "USD",
})
fmt.Println(rsp, err)
}
```

View File

@@ -0,0 +1,16 @@
package main
import (
"fmt"
"os"
"go.m3o.com/currency"
)
// Codes returns the supported currency codes for the API
func main() {
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
rsp, err := currencyService.Codes(&currency.CodesRequest{})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,20 @@
package main
import (
"fmt"
"os"
"go.m3o.com/currency"
)
// Convert returns the currency conversion rate between two pairs e.g USD/GBP
func main() {
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
rsp, err := currencyService.Convert(&currency.ConvertRequest{
Amount: 10,
From: "USD",
To: "GBP",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,19 @@
package main
import (
"fmt"
"os"
"go.m3o.com/currency"
)
// Convert returns the currency conversion rate between two pairs e.g USD/GBP
func main() {
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
rsp, err := currencyService.Convert(&currency.ConvertRequest{
From: "USD",
To: "GBP",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,19 @@
package main
import (
"fmt"
"os"
"go.m3o.com/currency"
)
// Returns the historic rates for a currency on a given date
func main() {
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
rsp, err := currencyService.History(&currency.HistoryRequest{
Code: "USD",
Date: "2021-05-30",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/currency"
)
// Rates returns the currency rates for a given code e.g USD
func main() {
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
rsp, err := currencyService.Rates(&currency.RatesRequest{
Code: "USD",
})
fmt.Println(rsp, err)
}

View File

@@ -4,12 +4,12 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Db/api](https:
Endpoints:
## Truncate
## ListTables
Truncate the records in a table
List tables in the DB
[https://m3o.com/db/api#Truncate](https://m3o.com/db/api#Truncate)
[https://m3o.com/db/api#ListTables](https://m3o.com/db/api#ListTables)
```go
package example
@@ -21,22 +21,22 @@ import(
"go.m3o.com/db"
)
// Truncate the records in a table
func TruncateTable() {
// List tables in the DB
func ListTables() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Truncate(&db.TruncateRequest{
Table: "users",
rsp, err := dbService.ListTables(&db.ListTablesRequest{
})
fmt.Println(rsp, err)
}
```
## Count
## RenameTable
Count records in a table
Rename a table
[https://m3o.com/db/api#Count](https://m3o.com/db/api#Count)
[https://m3o.com/db/api#RenameTable](https://m3o.com/db/api#RenameTable)
```go
package example
@@ -48,47 +48,16 @@ import(
"go.m3o.com/db"
)
// Count records in a table
func CountEntriesInAtable() {
// Rename a table
func RenameTable() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Count(&db.CountRequest{
Table: "users",
})
fmt.Println(rsp, err)
}
```
## Create
Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
[https://m3o.com/db/api#Create](https://m3o.com/db/api#Create)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
func CreateArecord() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Create(&db.CreateRequest{
Record: map[string]interface{}{
"name": "Jane",
"age": 42,
"isActive": true,
"id": "1",
},
Table: "users",
rsp, err := dbService.RenameTable(&db.RenameTableRequest{
From: "events",
To: "events_backup",
})
fmt.Println(rsp, err)
}
```
## Update
@@ -120,6 +89,7 @@ Table: "users",
})
fmt.Println(rsp, err)
}
```
## Read
@@ -148,6 +118,97 @@ Table: "users",
})
fmt.Println(rsp, err)
}
```
## DropTable
Drop a table in the DB
[https://m3o.com/db/api#DropTable](https://m3o.com/db/api#DropTable)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Drop a table in the DB
func DropTable() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.DropTable(&db.DropTableRequest{
Table: "users",
})
fmt.Println(rsp, err)
}
```
## Count
Count records in a table
[https://m3o.com/db/api#Count](https://m3o.com/db/api#Count)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Count records in a table
func CountEntriesInAtable() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Count(&db.CountRequest{
Table: "users",
})
fmt.Println(rsp, err)
}
```
## Create
Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
[https://m3o.com/db/api#Create](https://m3o.com/db/api#Create)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
func CreateArecord() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Create(&db.CreateRequest{
Record: map[string]interface{}{
"id": "1",
"name": "Jane",
"age": 42,
"isActive": true,
},
Table: "users",
})
fmt.Println(rsp, err)
}
```
## Delete
@@ -176,5 +237,34 @@ Table: "users",
})
fmt.Println(rsp, err)
}
```
## Truncate
Truncate the records in a table
[https://m3o.com/db/api#Truncate](https://m3o.com/db/api#Truncate)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Truncate the records in a table
func TruncateTable() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Truncate(&db.TruncateRequest{
Table: "users",
})
fmt.Println(rsp, err)
}
```

View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/db"
)
// Count records in a table
func main() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Count(&db.CountRequest{
Table: "users",
})
fmt.Println(rsp, err)
}

View File

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

View File

@@ -0,0 +1,24 @@
package main
import (
"fmt"
"os"
"go.m3o.com/db"
)
// Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
func main() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Create(&db.CreateRequest{
Record: map[string]interface{}{
"id": "1",
"name": "Jane",
"age": 42,
"isActive": true,
},
Table: "users",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,19 @@
package main
import (
"fmt"
"os"
"go.m3o.com/db"
)
// Delete a record in the database by id.
func main() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Delete(&db.DeleteRequest{
Id: "1",
Table: "users",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/db"
)
// Drop a table in the DB
func main() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.DropTable(&db.DropTableRequest{
Table: "users",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,16 @@
package main
import (
"fmt"
"os"
"go.m3o.com/db"
)
// List tables in the DB
func main() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.ListTables(&db.ListTablesRequest{})
fmt.Println(rsp, err)
}

View File

View File

@@ -0,0 +1,19 @@
package main
import (
"fmt"
"os"
"go.m3o.com/db"
)
// Read data from a table. Lookup can be by ID or via querying any field in the record.
func main() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Read(&db.ReadRequest{
Query: "age == 43",
Table: "users",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,19 @@
package main
import (
"fmt"
"os"
"go.m3o.com/db"
)
// Rename a table
func main() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.RenameTable(&db.RenameTableRequest{
From: "events",
To: "events_backup",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/db"
)
// Truncate the records in a table
func main() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Truncate(&db.TruncateRequest{
Table: "users",
})
fmt.Println(rsp, err)
}

View File

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

View File

@@ -0,0 +1,22 @@
package main
import (
"fmt"
"os"
"go.m3o.com/db"
)
// Update a record in the database. Include an "id" in the record to update.
func main() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Update(&db.UpdateRequest{
Record: map[string]interface{}{
"id": "1",
"age": 43,
},
Table: "users",
})
fmt.Println(rsp, err)
}

View File

@@ -33,5 +33,6 @@ Please verify your email by clicking this link: $micro_verification_link`,
})
fmt.Println(rsp, err)
}
```

View File

@@ -0,0 +1,22 @@
package main
import (
"fmt"
"os"
"go.m3o.com/email"
)
// Send an email by passing in from, to, subject, and a text or html body
func main() {
emailService := email.NewEmailService(os.Getenv("M3O_API_TOKEN"))
rsp, err := emailService.Send(&email.SendRequest{
From: "Awesome Dot Com",
Subject: "Email verification",
TextBody: `Hi there,
Please verify your email by clicking this link: $micro_verification_link`,
})
fmt.Println(rsp, err)
}

View File

@@ -4,6 +4,36 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Emoji/api](htt
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:
@@ -29,6 +59,7 @@ func FindEmoji() {
})
fmt.Println(rsp, err)
}
```
## Flag
@@ -55,6 +86,7 @@ func GetFlagByCountryCode() {
})
fmt.Println(rsp, err)
}
```
## Print
@@ -84,34 +116,6 @@ func PrintTextIncludingEmoji() {
})
fmt.Println(rsp, err)
}
```
## 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

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/emoji"
)
// Find an emoji by its alias e.g :beer:
func main() {
emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN"))
rsp, err := emojiService.Find(&emoji.FindRequest{
Alias: ":beer:",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,16 @@
package main
import (
"fmt"
"os"
"go.m3o.com/emoji"
)
// Get the flag for a country. Requires country code e.g GB for great britain
func main() {
emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN"))
rsp, err := emojiService.Flag(&emoji.FlagRequest{})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,19 @@
package main
import (
"fmt"
"os"
"go.m3o.com/emoji"
)
// Print text and renders the emojis with aliases e.g
// let's grab a :beer: becomes let's grab a 🍺
func main() {
emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN"))
rsp, err := emojiService.Print(&emoji.PrintRequest{
Text: "let's grab a :beer:",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,20 @@
package main
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 main() {
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

@@ -33,6 +33,7 @@ Location: &evchargers.Coordinates{
})
fmt.Println(rsp, err)
}
```
## Search
@@ -61,6 +62,7 @@ func SearchByBoundingBox() {
})
fmt.Println(rsp, err)
}
```
## Search
@@ -93,6 +95,7 @@ Location: &evchargers.Coordinates{
})
fmt.Println(rsp, err)
}
```
## ReferenceData
@@ -119,5 +122,6 @@ func GetReferenceData() {
})
fmt.Println(rsp, err)
}
```

View File

@@ -0,0 +1,16 @@
package main
import (
"fmt"
"os"
"go.m3o.com/evchargers"
)
// Retrieve reference data as used by this API and in conjunction with the Search endpoint
func main() {
evchargersService := evchargers.NewEvchargersService(os.Getenv("M3O_API_TOKEN"))
rsp, err := evchargersService.ReferenceData(&evchargers.ReferenceDataRequest{})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/evchargers"
)
// Search by giving a coordinate and a max distance, or bounding box and optional filters
func main() {
evchargersService := evchargers.NewEvchargersService(os.Getenv("M3O_API_TOKEN"))
rsp, err := evchargersService.Search(&evchargers.SearchRequest{
Box: &evchargers.BoundingBox{},
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,22 @@
package main
import (
"fmt"
"os"
"go.m3o.com/evchargers"
)
// Search by giving a coordinate and a max distance, or bounding box and optional filters
func main() {
evchargersService := evchargers.NewEvchargersService(os.Getenv("M3O_API_TOKEN"))
rsp, err := evchargersService.Search(&evchargers.SearchRequest{
Distance: 2000,
Location: &evchargers.Coordinates{
Latitude: 51.53336351319885,
Longitude: -0.0252,
},
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,23 @@
package main
import (
"fmt"
"os"
"go.m3o.com/evchargers"
)
// Search by giving a coordinate and a max distance, or bounding box and optional filters
func main() {
evchargersService := evchargers.NewEvchargersService(os.Getenv("M3O_API_TOKEN"))
rsp, err := evchargersService.Search(&evchargers.SearchRequest{
Distance: 2000,
Levels: []string{"3"},
Location: &evchargers.Coordinates{
Latitude: 51.53336351319885,
Longitude: -0.0252,
},
})
fmt.Println(rsp, err)
}

View File

@@ -6,7 +6,7 @@ Endpoints:
## Publish
Publish a message to the event stream.
Publish a event to the event stream.
[https://m3o.com/event/api#Publish](https://m3o.com/event/api#Publish)
@@ -21,27 +21,28 @@ import(
"go.m3o.com/event"
)
// Publish a message to the event stream.
func PublishAmessage() {
// Publish a event to the event stream.
func PublishAnEvent() {
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
rsp, err := eventService.Publish(&event.PublishRequest{
Message: map[string]interface{}{
"user": "john",
"id": "1",
"type": "signup",
"user": "john",
},
Topic: "user",
})
fmt.Println(rsp, err)
}
```
## Subscribe
## Consume
Subscribe to messages for a given topic.
Consume events from a given topic.
[https://m3o.com/event/api#Subscribe](https://m3o.com/event/api#Subscribe)
[https://m3o.com/event/api#Consume](https://m3o.com/event/api#Consume)
```go
package example
@@ -53,13 +54,55 @@ import(
"go.m3o.com/event"
)
// Subscribe to messages for a given topic.
func SubscribeToAtopic() {
// Consume events from a given topic.
func ConsumeFromAtopic() {
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
rsp, err := eventService.Subscribe(&event.SubscribeRequest{
stream, err := eventService.Consume(&event.ConsumeRequest{
Topic: "user",
})
if err != nil {
fmt.Println(err)
return
}
for {
rsp, err := stream.Recv()
if err != nil {
fmt.Println(err)
return
}
fmt.Println(rsp)
}
}
```
## Read
Read stored events
[https://m3o.com/event/api#Read](https://m3o.com/event/api#Read)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/event"
)
// Read stored events
func ReadEventsOnAtopic() {
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
rsp, err := eventService.Read(&event.ReadRequest{
Topic: "user",
})
fmt.Println(rsp, err)
}
```

View File

@@ -7,10 +7,10 @@ import (
"go.m3o.com/event"
)
// Subscribe to messages for a given topic.
func SubscribeToAtopic() {
// Consume events from a given topic.
func ConsumeFromAtopic() {
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
rsp, err := eventService.Subscribe(&event.SubscribeRequest{
rsp, err := eventService.Consume(&event.ConsumeRequest{
Topic: "user",
})
fmt.Println(rsp, err)

View File

@@ -0,0 +1,31 @@
package main
import (
"fmt"
"os"
"go.m3o.com/event"
)
// Consume events from a given topic.
func main() {
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
stream, err := eventService.Consume(&event.ConsumeRequest{
Topic: "user",
})
if err != nil {
fmt.Println(err)
return
}
for {
rsp, err := stream.Recv()
if err != nil {
fmt.Println(err)
return
}
fmt.Println(rsp)
}
}

View File

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

View File

@@ -0,0 +1,22 @@
package example
import (
"fmt"
"os"
"go.m3o.com/event"
)
// Publish a event to the event stream.
func PublishAnEvent() {
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
rsp, err := eventService.Publish(&event.PublishRequest{
Message: map[string]interface{}{
"id": "1",
"type": "signup",
"user": "john",
},
Topic: "user",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,23 @@
package main
import (
"fmt"
"os"
"go.m3o.com/event"
)
// Publish a event to the event stream.
func main() {
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
rsp, err := eventService.Publish(&event.PublishRequest{
Message: map[string]interface{}{
"user": "john",
"id": "1",
"type": "signup",
},
Topic: "user",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,17 @@
package example
import (
"fmt"
"os"
"go.m3o.com/event"
)
// Read stored events
func ReadEventsOnAtopic() {
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
rsp, err := eventService.Read(&event.ReadRequest{
Topic: "user",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/event"
)
// Read stored events
func main() {
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
rsp, err := eventService.Read(&event.ReadRequest{
Topic: "user",
})
fmt.Println(rsp, err)
}

View File

@@ -33,6 +33,7 @@ func SaveFile() {
})
fmt.Println(rsp, err)
}
```
## List
@@ -60,6 +61,7 @@ func ListFiles() {
})
fmt.Println(rsp, err)
}
```
## Delete
@@ -88,6 +90,7 @@ Project: "examples",
})
fmt.Println(rsp, err)
}
```
## Read
@@ -116,5 +119,6 @@ Project: "examples",
})
fmt.Println(rsp, err)
}
```

View File

@@ -0,0 +1,19 @@
package main
import (
"fmt"
"os"
"go.m3o.com/file"
)
// Delete a file by project name/path
func main() {
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

View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/file"
)
// List files by their project and optionally a path.
func main() {
fileService := file.NewFileService(os.Getenv("M3O_API_TOKEN"))
rsp, err := fileService.List(&file.ListRequest{
Project: "examples",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,19 @@
package main
import (
"fmt"
"os"
"go.m3o.com/file"
)
// Read a file by path
func main() {
fileService := file.NewFileService(os.Getenv("M3O_API_TOKEN"))
rsp, err := fileService.Read(&file.ReadRequest{
Path: "/document/text-files/file.txt",
Project: "examples",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,22 @@
package main
import (
"fmt"
"os"
"go.m3o.com/file"
)
// Save a file
func main() {
fileService := file.NewFileService(os.Getenv("M3O_API_TOKEN"))
rsp, err := fileService.Save(&file.SaveRequest{
File: &file.Record{
Content: "file content example",
Path: "/document/text-files/file.txt",
Project: "examples",
},
})
fmt.Println(rsp, err)
}

View File

@@ -4,6 +4,34 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Forex/api](htt
Endpoints:
## Price
Get the latest price for a given forex ticker
[https://m3o.com/forex/api#Price](https://m3o.com/forex/api#Price)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/forex"
)
// Get the latest price for a given forex ticker
func GetAnFxPrice() {
forexService := forex.NewForexService(os.Getenv("M3O_API_TOKEN"))
rsp, err := forexService.Price(&forex.PriceRequest{
Symbol: "GBPUSD",
})
fmt.Println(rsp, err)
}
```
## Quote
Get the latest quote for the forex
@@ -29,6 +57,7 @@ func GetAfxQuote() {
})
fmt.Println(rsp, err)
}
```
## History
@@ -56,32 +85,6 @@ func GetPreviousClose() {
})
fmt.Println(rsp, err)
}
```
## Price
Get the latest price for a given forex ticker
[https://m3o.com/forex/api#Price](https://m3o.com/forex/api#Price)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/forex"
)
// Get the latest price for a given forex ticker
func GetAnFxPrice() {
forexService := forex.NewForexService(os.Getenv("M3O_API_TOKEN"))
rsp, err := forexService.Price(&forex.PriceRequest{
Symbol: "GBPUSD",
})
fmt.Println(rsp, err)
}
```

View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/forex"
)
// Returns the data for the previous close
func main() {
forexService := forex.NewForexService(os.Getenv("M3O_API_TOKEN"))
rsp, err := forexService.History(&forex.HistoryRequest{
Symbol: "GBPUSD",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/forex"
)
// Get the latest price for a given forex ticker
func main() {
forexService := forex.NewForexService(os.Getenv("M3O_API_TOKEN"))
rsp, err := forexService.Price(&forex.PriceRequest{
Symbol: "GBPUSD",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/forex"
)
// Get the latest quote for the forex
func main() {
forexService := forex.NewForexService(os.Getenv("M3O_API_TOKEN"))
rsp, err := forexService.Quote(&forex.QuoteRequest{
Symbol: "GBPUSD",
})
fmt.Println(rsp, err)
}

View File

@@ -4,6 +4,35 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Function/api](
Endpoints:
## 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: "my-first-func",
Project: "tests",
})
fmt.Println(rsp, err)
}
```
## Deploy
Deploy a group of functions
@@ -33,6 +62,7 @@ Runtime: "nodejs14",
})
fmt.Println(rsp, err)
}
```
## Call
@@ -62,6 +92,7 @@ Request: map[string]interface{}{
})
fmt.Println(rsp, err)
}
```
## List
@@ -88,6 +119,7 @@ func ListFunctions() {
})
fmt.Println(rsp, err)
}
```
## Delete
@@ -116,33 +148,6 @@ Project: "tests",
})
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: "my-first-func",
Project: "tests",
})
fmt.Println(rsp, err)
}
```

View File

@@ -0,0 +1,19 @@
package main
import (
"fmt"
"os"
"go.m3o.com/function"
)
// Call a function by name
func main() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Call(&function.CallRequest{
Name: "my-first-func",
Request: map[string]interface{}{},
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,19 @@
package main
import (
"fmt"
"os"
"go.m3o.com/function"
)
// Delete a function by name
func main() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Delete(&function.DeleteRequest{
Name: "my-first-func",
Project: "tests",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,22 @@
package main
import (
"fmt"
"os"
"go.m3o.com/function"
)
// Deploy a group of functions
func main() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Deploy(&function.DeployRequest{
Entrypoint: "helloworld",
Name: "my-first-func",
Project: "tests",
Repo: "github.com/m3o/nodejs-function-example",
Runtime: "nodejs14",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,19 @@
package main
import (
"fmt"
"os"
"go.m3o.com/function"
)
// Get the info for a deployed function
func main() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Describe(&function.DescribeRequest{
Name: "my-first-func",
Project: "tests",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,16 @@
package main
import (
"fmt"
"os"
"go.m3o.com/function"
)
// List all the deployed functions
func main() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.List(&function.ListRequest{})
fmt.Println(rsp, err)
}

View File

@@ -32,6 +32,7 @@ Postcode: "wc2b",
})
fmt.Println(rsp, err)
}
```
## Reverse
@@ -60,5 +61,6 @@ Longitude: -0.1216235,
})
fmt.Println(rsp, err)
}
```

View File

@@ -0,0 +1,21 @@
package main
import (
"fmt"
"os"
"go.m3o.com/geocoding"
)
// Lookup returns a geocoded address including normalized address and gps coordinates. All fields are optional, provide more to get more accurate results
func main() {
geocodingService := geocoding.NewGeocodingService(os.Getenv("M3O_API_TOKEN"))
rsp, err := geocodingService.Lookup(&geocoding.LookupRequest{
Address: "10 russell st",
City: "london",
Country: "uk",
Postcode: "wc2b",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,19 @@
package main
import (
"fmt"
"os"
"go.m3o.com/geocoding"
)
// Reverse lookup an address from gps coordinates
func main() {
geocodingService := geocoding.NewGeocodingService(os.Getenv("M3O_API_TOKEN"))
rsp, err := geocodingService.Reverse(&geocoding.ReverseRequest{
Latitude: 51.5123064,
Longitude: -0.1216235,
})
fmt.Println(rsp, err)
}

View File

@@ -30,5 +30,6 @@ Query: "dogs",
})
fmt.Println(rsp, err)
}
```

View File

@@ -0,0 +1,19 @@
package main
import (
"fmt"
"os"
"go.m3o.com/gifs"
)
// Search for a GIF
func main() {
gifsService := gifs.NewGifsService(os.Getenv("M3O_API_TOKEN"))
rsp, err := gifsService.Search(&gifs.SearchRequest{
Limit: 2,
Query: "dogs",
})
fmt.Println(rsp, err)
}

View File

@@ -29,5 +29,6 @@ func SearchForVideos() {
})
fmt.Println(rsp, err)
}
```

View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/google"
)
// Search for videos on Google
func main() {
googleService := google.NewGoogleService(os.Getenv("M3O_API_TOKEN"))
rsp, err := googleService.Search(&google.SearchRequest{
Query: "how to make donuts",
})
fmt.Println(rsp, err)
}

View File

@@ -29,6 +29,7 @@ func CallTheHelloworldService() {
})
fmt.Println(rsp, err)
}
```
## Stream
@@ -49,12 +50,27 @@ import(
)
// Stream returns a stream of "Hello $name" responses
func StreamsAreCurrentlyTemporarilyNotSupportedInClients() {
func StreamsResponsesFromTheServerUsingWebsockets() {
helloworldService := helloworld.NewHelloworldService(os.Getenv("M3O_API_TOKEN"))
rsp, err := helloworldService.Stream(&helloworld.StreamRequest{
Name: "not supported",
stream, err := helloworldService.Stream(&helloworld.StreamRequest{
Messages: 10,
Name: "John",
})
fmt.Println(rsp, err)
if err != nil {
fmt.Println(err)
return
}
for {
rsp, err := stream.Recv()
if err != nil {
fmt.Println(err)
return
}
fmt.Println(rsp)
}
}
```

View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"go.m3o.com/helloworld"
)
// Call returns a personalised "Hello $name" response
func main() {
helloworldService := helloworld.NewHelloworldService(os.Getenv("M3O_API_TOKEN"))
rsp, err := helloworldService.Call(&helloworld.CallRequest{
Name: "John",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,31 @@
package main
import (
"fmt"
"os"
"go.m3o.com/helloworld"
)
// Stream returns a stream of "Hello $name" responses
func main() {
helloworldService := helloworld.NewHelloworldService(os.Getenv("M3O_API_TOKEN"))
stream, err := helloworldService.Stream(&helloworld.StreamRequest{
Name: "not supported",
})
if err != nil {
fmt.Println(err)
return
}
for {
rsp, err := stream.Recv()
if err != nil {
fmt.Println(err)
return
}
fmt.Println(rsp)
}
}

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