204 Commits
ci ... v0.4.0

Author SHA1 Message Date
m3o-actions
ed691ec515 Commit from m3o/m3o action 2021-11-22 12:25:01 +00:00
m3o-actions
c2fb06ae73 Commit from m3o/m3o action 2021-11-21 09:49:14 +00:00
m3o-actions
3d54b046da Commit from m3o/m3o action 2021-11-21 09:49:01 +00:00
m3o-actions
d33dbbf317 Commit from m3o/m3o action 2021-11-21 09:48:05 +00:00
m3o-actions
77a58e78bd Commit from m3o/m3o action 2021-11-19 14:29:44 +00:00
m3o-actions
c18f47ca4c Commit from m3o/m3o action 2021-11-19 12:14:30 +00:00
m3o-actions
33398d3eb8 Commit from m3o/m3o action 2021-11-19 11:58:09 +00:00
m3o-actions
bb46995e2f Commit from m3o/m3o action 2021-11-19 11:29:01 +00:00
m3o-actions
9c534ced3d Commit from m3o/m3o action 2021-11-19 11:06:58 +00:00
m3o-actions
15c55dec36 Commit from m3o/m3o action 2021-11-19 10:54:21 +00:00
m3o-actions
fb13c684fd Commit from m3o/m3o action 2021-11-18 13:50:00 +00:00
m3o-actions
65c906fbdc Commit from m3o/m3o action 2021-11-18 13:06:17 +00:00
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
259 changed files with 5097 additions and 1056 deletions

View File

@@ -22,5 +22,10 @@ jobs:
env: env:
M3O_API_TOKEN: ${{ secrets.M3O_API_TOKEN }} M3O_API_TOKEN: ${{ secrets.M3O_API_TOKEN }}
run: | run: |
cd examples/helloworld/call/callTheHelloworldService # stream is temporarily excluded as it hangs forever because test does not close connection
go run main.go # @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 // Lookup a list of UK addresses by postcode
func (t *AddressService) LookupPostcode(request *LookupPostcodeRequest) (*LookupPostcodeResponse, error) { func (t *AddressService) LookupPostcode(request *LookupPostcodeRequest) (*LookupPostcodeResponse, error) {
rsp := &LookupPostcodeResponse{} rsp := &LookupPostcodeResponse{}
return rsp, t.client.Call("address", "LookupPostcode", request, rsp) return rsp, t.client.Call("address", "LookupPostcode", request, rsp)
} }
type LookupPostcodeRequest struct { type LookupPostcodeRequest struct {
@@ -33,13 +35,13 @@ type LookupPostcodeResponse struct {
type Record struct { type Record struct {
// building name // building name
BuildingName string `json:"buildingName"` BuildingName string `json:"building_name"`
// the county // the county
County string `json:"county"` County string `json:"county"`
// line one of address // line one of address
LineOne string `json:"lineOne"` LineOne string `json:"line_one"`
// line two of address // line two of address
LineTwo string `json:"lineTwo"` LineTwo string `json:"line_two"`
// dependent locality // dependent locality
Locality string `json:"locality"` Locality string `json:"locality"`
// organisation if present // organisation if present

View File

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

18
cache/cache.go vendored
View File

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

View File

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

View File

@@ -18,26 +18,34 @@ type CryptoService struct {
// Returns the history for the previous close // Returns the history for the previous close
func (t *CryptoService) History(request *HistoryRequest) (*HistoryResponse, error) { func (t *CryptoService) History(request *HistoryRequest) (*HistoryResponse, error) {
rsp := &HistoryResponse{} rsp := &HistoryResponse{}
return rsp, t.client.Call("crypto", "History", request, rsp) return rsp, t.client.Call("crypto", "History", request, rsp)
} }
// Get news related to a currency // Get news related to a currency
func (t *CryptoService) News(request *NewsRequest) (*NewsResponse, error) { func (t *CryptoService) News(request *NewsRequest) (*NewsResponse, error) {
rsp := &NewsResponse{} rsp := &NewsResponse{}
return rsp, t.client.Call("crypto", "News", request, rsp) return rsp, t.client.Call("crypto", "News", request, rsp)
} }
// Get the last price for a given crypto ticker // Get the last price for a given crypto ticker
func (t *CryptoService) Price(request *PriceRequest) (*PriceResponse, error) { func (t *CryptoService) Price(request *PriceRequest) (*PriceResponse, error) {
rsp := &PriceResponse{} rsp := &PriceResponse{}
return rsp, t.client.Call("crypto", "Price", request, rsp) return rsp, t.client.Call("crypto", "Price", request, rsp)
} }
// Get the last quote for a given crypto ticker // Get the last quote for a given crypto ticker
func (t *CryptoService) Quote(request *QuoteRequest) (*QuoteResponse, error) { func (t *CryptoService) Quote(request *QuoteRequest) (*QuoteResponse, error) {
rsp := &QuoteResponse{} rsp := &QuoteResponse{}
return rsp, t.client.Call("crypto", "Quote", request, rsp) return rsp, t.client.Call("crypto", "Quote", request, rsp)
} }
type Article struct { type Article struct {
@@ -106,13 +114,13 @@ type QuoteRequest struct {
type QuoteResponse struct { type QuoteResponse struct {
// the asking price // the asking price
AskPrice float64 `json:"askPrice"` AskPrice float64 `json:"ask_price"`
// the ask size // the ask size
AskSize float64 `json:"askSize"` AskSize float64 `json:"ask_size"`
// the bidding price // the bidding price
BidPrice float64 `json:"bidPrice"` BidPrice float64 `json:"bid_price"`
// the bid size // the bid size
BidSize float64 `json:"bidSize"` BidSize float64 `json:"bid_size"`
// the crypto symbol // the crypto symbol
Symbol string `json:"symbol"` Symbol string `json:"symbol"`
// the UTC timestamp of the quote // the UTC timestamp of the quote

View File

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

View File

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

View File

@@ -18,21 +18,23 @@ type EmailService struct {
// Send an email by passing in from, to, subject, and a text or html body // Send an email by passing in from, to, subject, and a text or html body
func (t *EmailService) Send(request *SendRequest) (*SendResponse, error) { func (t *EmailService) Send(request *SendRequest) (*SendResponse, error) {
rsp := &SendResponse{} rsp := &SendResponse{}
return rsp, t.client.Call("email", "Send", request, rsp) return rsp, t.client.Call("email", "Send", request, rsp)
} }
type SendRequest struct { type SendRequest struct {
// the display name of the sender // the display name of the sender
From string `json:"from"` From string `json:"from"`
// the html body // the html body
HtmlBody string `json:"htmlBody"` HtmlBody string `json:"html_body"`
// an optional reply to email address // an optional reply to email address
ReplyTo string `json:"replyTo"` ReplyTo string `json:"reply_to"`
// the email subject // the email subject
Subject string `json:"subject"` Subject string `json:"subject"`
// the text body // the text body
TextBody string `json:"textBody"` TextBody string `json:"text_body"`
// the email address of the recipient // the email address of the recipient
To string `json:"to"` To string `json:"to"`
} }

View File

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

View File

@@ -18,62 +18,66 @@ type EvchargersService struct {
// Retrieve reference data as used by this API and in conjunction with the Search endpoint // Retrieve reference data as used by this API and in conjunction with the Search endpoint
func (t *EvchargersService) ReferenceData(request *ReferenceDataRequest) (*ReferenceDataResponse, error) { func (t *EvchargersService) ReferenceData(request *ReferenceDataRequest) (*ReferenceDataResponse, error) {
rsp := &ReferenceDataResponse{} rsp := &ReferenceDataResponse{}
return rsp, t.client.Call("evchargers", "ReferenceData", request, rsp) return rsp, t.client.Call("evchargers", "ReferenceData", request, rsp)
} }
// Search by giving a coordinate and a max distance, or bounding box and optional filters // Search by giving a coordinate and a max distance, or bounding box and optional filters
func (t *EvchargersService) Search(request *SearchRequest) (*SearchResponse, error) { func (t *EvchargersService) Search(request *SearchRequest) (*SearchResponse, error) {
rsp := &SearchResponse{} rsp := &SearchResponse{}
return rsp, t.client.Call("evchargers", "Search", request, rsp) return rsp, t.client.Call("evchargers", "Search", request, rsp)
} }
type Address struct { type Address struct {
// Any comments about how to access the charger // Any comments about how to access the charger
AccessComments string `json:"accessComments"` AccessComments string `json:"access_comments"`
AddressLine1 string `json:"addressLine1"` AddressLine1 string `json:"address_line_1"`
AddressLine2 string `json:"addressLine2"` AddressLine2 string `json:"address_line_2"`
Country *Country `json:"country"` Country *Country `json:"country"`
CountryId string `json:"countryId"` CountryId string `json:"country_id"`
LatLng string `json:"latLng"` LatLng string `json:"lat_lng"`
Location *Coordinates `json:"location"` Location *Coordinates `json:"location"`
Postcode string `json:"postcode"` Postcode string `json:"postcode"`
StateOrProvince string `json:"stateOrProvince"` StateOrProvince string `json:"state_or_province"`
Title string `json:"title"` Title string `json:"title"`
Town string `json:"town"` Town string `json:"town"`
} }
type BoundingBox struct { type BoundingBox struct {
BottomLeft *Coordinates `json:"bottomLeft"` BottomLeft *Coordinates `json:"bottom_left"`
TopRight *Coordinates `json:"topRight"` TopRight *Coordinates `json:"top_right"`
} }
type ChargerType struct { type ChargerType struct {
Comments string `json:"comments"` Comments string `json:"comments"`
Id string `json:"id"` Id string `json:"id"`
// Is this 40KW+ // Is this 40KW+
IsFastChargeCapable bool `json:"isFastChargeCapable"` IsFastChargeCapable bool `json:"is_fast_charge_capable"`
Title string `json:"title"` Title string `json:"title"`
} }
type CheckinStatusType struct { type CheckinStatusType struct {
Id string `json:"id"` Id string `json:"id"`
IsAutomated bool `json:"isAutomated"` IsAutomated bool `json:"is_automated"`
IsPositive bool `json:"isPositive"` IsPositive bool `json:"is_positive"`
Title string `json:"title"` Title string `json:"title"`
} }
type Connection struct { type Connection struct {
// The amps offered // The amps offered
Amps float64 `json:"amps"` Amps float64 `json:"amps"`
ConnectionType *ConnectionType `json:"connectionType"` ConnectionType *ConnectionType `json:"connection_type"`
// The ID of the connection type // The ID of the connection type
ConnectionTypeId string `json:"connectionTypeId"` ConnectionTypeId string `json:"connection_type_id"`
// The current // The current
Current string `json:"current"` Current string `json:"current"`
Level *ChargerType `json:"level"` Level *ChargerType `json:"level"`
// The level of charging power available // The level of charging power available
LevelId string `json:"levelId"` LevelId string `json:"level_id"`
// The power in KW // The power in KW
Power float64 `json:"power"` Power float64 `json:"power"`
Reference string `json:"reference"` Reference string `json:"reference"`
@@ -82,10 +86,10 @@ type Connection struct {
} }
type ConnectionType struct { type ConnectionType struct {
FormalName string `json:"formalName"` FormalName string `json:"formal_name"`
Id string `json:"id"` Id string `json:"id"`
IsDiscontinued bool `json:"isDiscontinued"` IsDiscontinued bool `json:"is_discontinued"`
IsObsolete bool `json:"isObsolete"` IsObsolete bool `json:"is_obsolete"`
Title string `json:"title"` Title string `json:"title"`
} }
@@ -95,9 +99,9 @@ type Coordinates struct {
} }
type Country struct { type Country struct {
ContinentCode string `json:"continentCode"` ContinentCode string `json:"continent_code"`
Id string `json:"id"` Id string `json:"id"`
IsoCode string `json:"isoCode"` IsoCode string `json:"iso_code"`
Title string `json:"title"` Title string `json:"title"`
} }
@@ -109,7 +113,7 @@ type CurrentType struct {
type DataProvider struct { type DataProvider struct {
Comments string `json:"comments"` Comments string `json:"comments"`
DataProviderStatusType *DataProviderStatusType `json:"dataProviderStatusType"` DataProviderStatusType *DataProviderStatusType `json:"data_provider_status_type"`
Id string `json:"id"` Id string `json:"id"`
// How is this data licensed // How is this data licensed
License string `json:"license"` License string `json:"license"`
@@ -119,19 +123,19 @@ type DataProvider struct {
type DataProviderStatusType struct { type DataProviderStatusType struct {
Id string `json:"id"` Id string `json:"id"`
IsProviderEnabled bool `json:"isProviderEnabled"` IsProviderEnabled bool `json:"is_provider_enabled"`
Title string `json:"title"` Title string `json:"title"`
} }
type Operator struct { type Operator struct {
Comments string `json:"comments"` Comments string `json:"comments"`
ContactEmail string `json:"contactEmail"` ContactEmail string `json:"contact_email"`
FaultReportEmail string `json:"faultReportEmail"` FaultReportEmail string `json:"fault_report_email"`
Id string `json:"id"` Id string `json:"id"`
// Is this operator a private individual vs a company // Is this operator a private individual vs a company
IsPrivateIndividual bool `json:"isPrivateIndividual"` IsPrivateIndividual bool `json:"is_private_individual"`
PhonePrimary string `json:"phonePrimary"` PhonePrimary string `json:"phone_primary"`
PhoneSecondary string `json:"phoneSecondary"` PhoneSecondary string `json:"phone_secondary"`
Title string `json:"title"` Title string `json:"title"`
Website string `json:"website"` Website string `json:"website"`
} }
@@ -144,19 +148,19 @@ type Poi struct {
// The cost of charging // The cost of charging
Cost string `json:"cost"` Cost string `json:"cost"`
// The ID of the data provider // The ID of the data provider
DataProviderId string `json:"dataProviderId"` DataProviderId string `json:"data_provider_id"`
// The ID of the charger // The ID of the charger
Id string `json:"id"` Id string `json:"id"`
// The number of charging points // The number of charging points
NumPoints int64 `json:"numPoints,string"` NumPoints int64 `json:"num_points,string"`
// The operator // The operator
Operator *Operator `json:"operator"` Operator *Operator `json:"operator"`
// The ID of the operator of the charger // The ID of the operator of the charger
OperatorId string `json:"operatorId"` OperatorId string `json:"operator_id"`
// The type of usage // The type of usage
UsageType *UsageType `json:"usageType"` UsageType *UsageType `json:"usage_type"`
// The type of usage for this charger point (is it public, membership required, etc) // The type of usage for this charger point (is it public, membership required, etc)
UsageTypeId string `json:"usageTypeId"` UsageTypeId string `json:"usage_type_id"`
} }
type ReferenceDataRequest struct { type ReferenceDataRequest struct {
@@ -164,36 +168,36 @@ type ReferenceDataRequest struct {
type ReferenceDataResponse struct { type ReferenceDataResponse struct {
// The types of charger // The types of charger
ChargerTypes *ChargerType `json:"chargerTypes"` ChargerTypes *ChargerType `json:"charger_types"`
// The types of checkin status // The types of checkin status
CheckinStatusTypes *CheckinStatusType `json:"checkinStatusTypes"` CheckinStatusTypes *CheckinStatusType `json:"checkin_status_types"`
// The types of connection // The types of connection
ConnectionTypes *ConnectionType `json:"connectionTypes"` ConnectionTypes *ConnectionType `json:"connection_types"`
// The countries // The countries
Countries []Country `json:"countries"` Countries []Country `json:"countries"`
// The types of current // The types of current
CurrentTypes *CurrentType `json:"currentTypes"` CurrentTypes *CurrentType `json:"current_types"`
// The providers of the charger data // The providers of the charger data
DataProviders *DataProvider `json:"dataProviders"` DataProviders *DataProvider `json:"data_providers"`
// The companies operating the chargers // The companies operating the chargers
Operators []Operator `json:"operators"` Operators []Operator `json:"operators"`
// The status of the charger // The status of the charger
StatusTypes *StatusType `json:"statusTypes"` StatusTypes *StatusType `json:"status_types"`
// The status of a submission // The status of a submission
SubmissionStatusTypes *SubmissionStatusType `json:"submissionStatusTypes"` SubmissionStatusTypes *SubmissionStatusType `json:"submission_status_types"`
// The different types of usage // The different types of usage
UsageTypes *UsageType `json:"usageTypes"` UsageTypes *UsageType `json:"usage_types"`
// The types of user comment // The types of user comment
UserCommentTypes *UserCommentType `json:"userCommentTypes"` UserCommentTypes *UserCommentType `json:"user_comment_types"`
} }
type SearchRequest struct { type SearchRequest struct {
// Bounding box to search within (top left and bottom right coordinates) // Bounding box to search within (top left and bottom right coordinates)
Box *BoundingBox `json:"box"` Box *BoundingBox `json:"box"`
// IDs of the connection type // IDs of the connection type
ConnectionTypes string `json:"connectionTypes"` ConnectionTypes string `json:"connection_types"`
// Country ID // Country ID
CountryId string `json:"countryId"` CountryId string `json:"country_id"`
// Search distance from point in metres, defaults to 5000m // Search distance from point in metres, defaults to 5000m
Distance int64 `json:"distance,string"` Distance int64 `json:"distance,string"`
// Supported charging levels // Supported charging levels
@@ -201,13 +205,13 @@ type SearchRequest struct {
// Coordinates from which to begin search // Coordinates from which to begin search
Location *Coordinates `json:"location"` Location *Coordinates `json:"location"`
// Maximum number of results to return, defaults to 100 // Maximum number of results to return, defaults to 100
MaxResults int64 `json:"maxResults,string"` MaxResults int64 `json:"max_results,string"`
// Minimum power in KW. Note: data not available for many chargers // Minimum power in KW. Note: data not available for many chargers
MinPower int64 `json:"minPower,string"` MinPower int64 `json:"min_power,string"`
// IDs of the the EV charger operator // IDs of the the EV charger operator
Operators []string `json:"operators"` Operators []string `json:"operators"`
// Usage of the charge point (is it public, membership required, etc) // Usage of the charge point (is it public, membership required, etc)
UsageTypes string `json:"usageTypes"` UsageTypes string `json:"usage_types"`
} }
type SearchResponse struct { type SearchResponse struct {
@@ -216,21 +220,21 @@ type SearchResponse struct {
type StatusType struct { type StatusType struct {
Id string `json:"id"` Id string `json:"id"`
IsOperational bool `json:"isOperational"` IsOperational bool `json:"is_operational"`
Title string `json:"title"` Title string `json:"title"`
} }
type SubmissionStatusType struct { type SubmissionStatusType struct {
Id string `json:"id"` Id string `json:"id"`
IsLive bool `json:"isLive"` IsLive bool `json:"is_live"`
Title string `json:"title"` Title string `json:"title"`
} }
type UsageType struct { type UsageType struct {
Id string `json:"id"` Id string `json:"id"`
IsAccessKeyRequired bool `json:"isAccessKeyRequired"` IsAccessKeyRequired bool `json:"is_access_key_required"`
IsMembershipRequired bool `json:"isMembershipRequired"` IsMembershipRequired bool `json:"is_membership_required"`
IsPayAtLocation bool `json:"isPayAtLocation"` IsPayAtLocation bool `json:"is_pay_at_location"`
Title string `json:"title"` Title string `json:"title"`
} }

View File

@@ -16,16 +16,73 @@ type EventService struct {
client *client.Client client *client.Client
} }
// Publish a message to the event stream. // Consume events from a given topic.
func (t *EventService) Publish(request *PublishRequest) (*PublishResponse, error) { func (t *EventService) Consume(request *ConsumeRequest) (*ConsumeResponseStream, error) {
rsp := &PublishResponse{} stream, err := t.client.Stream("event", "Consume", request)
return rsp, t.client.Call("event", "Publish", request, rsp) if err != nil {
return nil, err
}
return &ConsumeResponseStream{
stream: stream,
}, nil
} }
// Subscribe to messages for a given topic. type ConsumeResponseStream struct {
func (t *EventService) Subscribe(request *SubscribeRequest) (*SubscribeResponse, error) { stream *client.Stream
rsp := &SubscribeResponse{} }
return rsp, t.client.Call("event", "Subscribe", request, rsp)
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 { type PublishRequest struct {
@@ -38,16 +95,16 @@ type PublishRequest struct {
type PublishResponse struct { type PublishResponse struct {
} }
type SubscribeRequest struct { type ReadRequest struct {
// Optional group for the subscription // number of events to read; default 25
Group string `json:"group"` Limit int32 `json:"limit"`
// The topic to subscribe to // offset for the events; default 0
Offset int32 `json:"offset"`
// topic to read from
Topic string `json:"topic"` Topic string `json:"topic"`
} }
type SubscribeResponse struct { type ReadResponse struct {
// The next json message on the topic // the events
Message map[string]interface{} `json:"message"` Events []Ev `json:"events"`
// The topic subscribed to
Topic string `json:"topic"`
} }

View File

@@ -29,5 +29,6 @@ func LookupPostcode() {
}) })
fmt.Println(rsp, err) 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) 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: 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
Set an item in the cache. Overwrites any existing value already set. Set an item in the cache. Overwrites any existing value already set.
@@ -86,11 +30,12 @@ Value: "bar",
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
} }
``` ```
## Get ## 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) [https://m3o.com/cache/api#Get](https://m3o.com/cache/api#Get)
@@ -105,7 +50,7 @@ import(
"go.m3o.com/cache" "go.m3o.com/cache"
) )
// Get an item from the cache by key // Get an item from the cache by key. If key is not found, an empty response is returned.
func GetAvalue() { func GetAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN")) cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Get(&cache.GetRequest{ rsp, err := cacheService.Get(&cache.GetRequest{
@@ -113,11 +58,12 @@ func GetAvalue() {
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
} }
``` ```
## Delete ## 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) [https://m3o.com/cache/api#Delete](https://m3o.com/cache/api#Delete)
@@ -132,7 +78,7 @@ import(
"go.m3o.com/cache" "go.m3o.com/cache"
) )
// Delete a value from the cache // Delete a value from the cache. If key not found a success response is returned.
func DeleteAvalue() { func DeleteAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN")) cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Delete(&cache.DeleteRequest{ rsp, err := cacheService.Delete(&cache.DeleteRequest{
@@ -140,5 +86,64 @@ func DeleteAvalue() {
}) })
fmt.Println(rsp, err) 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" "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() { func DecrementAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN")) cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Decrement(&cache.DecrementRequest{ rsp, err := cacheService.Decrement(&cache.DecrementRequest{

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" "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() { func DeleteAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN")) cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Delete(&cache.DeleteRequest{ rsp, err := cacheService.Delete(&cache.DeleteRequest{

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" "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() { func GetAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN")) cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Get(&cache.GetRequest{ rsp, err := cacheService.Get(&cache.GetRequest{

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" "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() { func IncrementAvalue() {
cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN")) cacheService := cache.NewCacheService(os.Getenv("M3O_API_TOKEN"))
rsp, err := cacheService.Increment(&cache.IncrementRequest{ rsp, err := cacheService.Increment(&cache.IncrementRequest{

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: 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 ## Quote
Get the last quote for a given crypto ticker Get the last quote for a given crypto ticker
@@ -83,6 +29,7 @@ func GetAcryptocurrencyQuote() {
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
} }
``` ```
## History ## History
@@ -110,5 +57,62 @@ func GetPreviousClose() {
}) })
fmt.Println(rsp, err) 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: 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
Convert returns the currency conversion rate between two pairs e.g USD/GBP Convert returns the currency conversion rate between two pairs e.g USD/GBP
@@ -30,6 +85,7 @@ To: "GBP",
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
} }
``` ```
## Convert ## Convert
@@ -59,6 +115,7 @@ To: "GBP",
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
} }
``` ```
## History ## History
@@ -87,58 +144,6 @@ Date: "2021-05-30",
}) })
fmt.Println(rsp, err) 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,93 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Db/api](https:
Endpoints: Endpoints:
## Truncate
Truncate the records in a table
[https://m3o.com/db/api#Truncate](https://m3o.com/db/api#Truncate)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Truncate the records in a table
func TruncateTable() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Truncate(&db.TruncateRequest{
Table: "users",
})
fmt.Println(rsp, err)
}
```
## Count
Count records in a table
[https://m3o.com/db/api#Count](https://m3o.com/db/api#Count)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Count records in a table
func CountEntriesInAtable() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Count(&db.CountRequest{
Table: "users",
})
fmt.Println(rsp, err)
}
```
## Create
Create 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",
})
fmt.Println(rsp, err)
}
```
## Update ## Update
Update a record in the database. Include an "id" in the record to update. Update a record in the database. Include an "id" in the record to update.
@@ -120,6 +33,70 @@ Table: "users",
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
}
```
## RenameTable
Rename a table
[https://m3o.com/db/api#RenameTable](https://m3o.com/db/api#RenameTable)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Rename a table
func RenameTable() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.RenameTable(&db.RenameTableRequest{
From: "events",
To: "events_backup",
})
fmt.Println(rsp, err)
}
```
## Create
Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
[https://m3o.com/db/api#Create](https://m3o.com/db/api#Create)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
func CreateArecord() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Create(&db.CreateRequest{
Record: map[string]interface{}{
"isActive": true,
"id": "1",
"name": "Jane",
"age": 42,
},
Table: "users",
})
fmt.Println(rsp, err)
} }
``` ```
## Read ## Read
@@ -148,6 +125,7 @@ Table: "users",
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
} }
``` ```
## Delete ## Delete
@@ -176,5 +154,117 @@ Table: "users",
}) })
fmt.Println(rsp, err) 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)
}
```
## 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)
}
```
## 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)
} }
``` ```

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")) dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Create(&db.CreateRequest{ rsp, err := dbService.Create(&db.CreateRequest{
Record: map[string]interface{}{ Record: map[string]interface{}{
"isActive": true,
"id": "1", "id": "1",
"name": "Jane", "name": "Jane",
"age": 42, "age": 42,
"isActive": true,
}, },
Table: "users", Table: "users",
}) })

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")) dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Update(&db.UpdateRequest{ rsp, err := dbService.Update(&db.UpdateRequest{
Record: map[string]interface{}{ Record: map[string]interface{}{
"age": 43,
"id": "1", "id": "1",
"age": 43,
}, },
Table: "users", 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) 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,59 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Emoji/api](htt
Endpoints: Endpoints:
## Find
Find an emoji by its alias e.g :beer:
[https://m3o.com/emoji/api#Find](https://m3o.com/emoji/api#Find)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/emoji"
)
// Find an emoji by its alias e.g :beer:
func FindEmoji() {
emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN"))
rsp, err := emojiService.Find(&emoji.FindRequest{
Alias: ":beer:",
})
fmt.Println(rsp, err)
}
```
## Flag
Get the flag for a country. Requires country code e.g GB for great britain
[https://m3o.com/emoji/api#Flag](https://m3o.com/emoji/api#Flag)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/emoji"
)
// Get the flag for a country. Requires country code e.g GB for great britain
func GetFlagByCountryCode() {
emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN"))
rsp, err := emojiService.Flag(&emoji.FlagRequest{
})
fmt.Println(rsp, err)
}
```
## Print ## Print
Print text and renders the emojis with aliases e.g Print text and renders the emojis with aliases e.g
@@ -84,6 +31,7 @@ func PrintTextIncludingEmoji() {
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
} }
``` ```
## Send ## Send
@@ -113,5 +61,61 @@ To: "+44782669123",
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
}
```
## Find
Find an emoji by its alias e.g :beer:
[https://m3o.com/emoji/api#Find](https://m3o.com/emoji/api#Find)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/emoji"
)
// Find an emoji by its alias e.g :beer:
func FindEmoji() {
emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN"))
rsp, err := emojiService.Find(&emoji.FindRequest{
Alias: ":beer:",
})
fmt.Println(rsp, err)
}
```
## Flag
Get the flag for a country. Requires country code e.g GB for great britain
[https://m3o.com/emoji/api#Flag](https://m3o.com/emoji/api#Flag)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/emoji"
)
// Get the flag for a country. Requires country code e.g GB for great britain
func GetFlagByCountryCode() {
emojiService := emoji.NewEmojiService(os.Getenv("M3O_API_TOKEN"))
rsp, err := emojiService.Flag(&emoji.FlagRequest{
})
fmt.Println(rsp, err)
} }
``` ```

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) fmt.Println(rsp, err)
} }
``` ```
## Search ## Search
@@ -61,6 +62,7 @@ func SearchByBoundingBox() {
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
} }
``` ```
## Search ## Search
@@ -93,6 +95,7 @@ Location: &evchargers.Coordinates{
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
} }
``` ```
## ReferenceData ## ReferenceData
@@ -119,5 +122,6 @@ func GetReferenceData() {
}) })
fmt.Println(rsp, err) 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
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) [https://m3o.com/event/api#Publish](https://m3o.com/event/api#Publish)
@@ -21,27 +21,28 @@ import(
"go.m3o.com/event" "go.m3o.com/event"
) )
// Publish a message to the event stream. // Publish a event to the event stream.
func PublishAmessage() { func PublishAnEvent() {
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN")) eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
rsp, err := eventService.Publish(&event.PublishRequest{ rsp, err := eventService.Publish(&event.PublishRequest{
Message: map[string]interface{}{ Message: map[string]interface{}{
"user": "john",
"id": "1", "id": "1",
"type": "signup", "type": "signup",
"user": "john",
}, },
Topic: "user", Topic: "user",
}) })
fmt.Println(rsp, err) 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 ```go
package example package example
@@ -53,13 +54,55 @@ import(
"go.m3o.com/event" "go.m3o.com/event"
) )
// Subscribe to messages for a given topic. // Consume events from a given topic.
func SubscribeToAtopic() { func ConsumeFromAtopic() {
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN")) 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", Topic: "user",
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
} }
``` ```

View File

@@ -7,10 +7,10 @@ import (
"go.m3o.com/event" "go.m3o.com/event"
) )
// Subscribe to messages for a given topic. // Consume events from a given topic.
func SubscribeToAtopic() { func ConsumeFromAtopic() {
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN")) eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
rsp, err := eventService.Subscribe(&event.SubscribeRequest{ rsp, err := eventService.Consume(&event.ConsumeRequest{
Topic: "user", Topic: "user",
}) })
fmt.Println(rsp, err) 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")) eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
rsp, err := eventService.Publish(&event.PublishRequest{ rsp, err := eventService.Publish(&event.PublishRequest{
Message: map[string]interface{}{ Message: map[string]interface{}{
"user": "john",
"id": "1", "id": "1",
"type": "signup", "type": "signup",
"user": "john",
}, },
Topic: "user", Topic: "user",
}) })

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{}{
"id": "1",
"type": "signup",
"user": "john",
},
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) fmt.Println(rsp, err)
} }
``` ```
## List ## List
@@ -60,6 +61,7 @@ func ListFiles() {
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
} }
``` ```
## Delete ## Delete
@@ -88,6 +90,7 @@ Project: "examples",
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
} }
``` ```
## Read ## Read
@@ -116,5 +119,6 @@ Project: "examples",
}) })
fmt.Println(rsp, err) 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,33 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Forex/api](htt
Endpoints: Endpoints:
## Quote
Get the latest quote for the forex
[https://m3o.com/forex/api#Quote](https://m3o.com/forex/api#Quote)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/forex"
)
// Get the latest quote for the forex
func GetAfxQuote() {
forexService := forex.NewForexService(os.Getenv("M3O_API_TOKEN"))
rsp, err := forexService.Quote(&forex.QuoteRequest{
Symbol: "GBPUSD",
})
fmt.Println(rsp, err)
}
```
## History ## History
Returns the data for the previous close Returns the data for the previous close
@@ -56,6 +29,7 @@ func GetPreviousClose() {
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
} }
``` ```
## Price ## Price
@@ -83,5 +57,34 @@ func GetAnFxPrice() {
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
}
```
## Quote
Get the latest quote for the forex
[https://m3o.com/forex/api#Quote](https://m3o.com/forex/api#Quote)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/forex"
)
// Get the latest quote for the forex
func GetAfxQuote() {
forexService := forex.NewForexService(os.Getenv("M3O_API_TOKEN"))
rsp, err := forexService.Quote(&forex.QuoteRequest{
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

@@ -33,6 +33,7 @@ Runtime: "nodejs14",
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
} }
``` ```
## Call ## Call
@@ -62,6 +63,7 @@ Request: map[string]interface{}{
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
} }
``` ```
## List ## List
@@ -88,6 +90,7 @@ func ListFunctions() {
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
} }
``` ```
## Delete ## Delete
@@ -116,6 +119,7 @@ Project: "tests",
}) })
fmt.Println(rsp, err) fmt.Println(rsp, err)
} }
``` ```
## Describe ## Describe
@@ -144,5 +148,6 @@ Project: "tests",
}) })
fmt.Println(rsp, err) 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) fmt.Println(rsp, err)
} }
``` ```
## Reverse ## Reverse
@@ -60,5 +61,6 @@ Longitude: -0.1216235,
}) })
fmt.Println(rsp, err) 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) 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) 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) fmt.Println(rsp, err)
} }
``` ```
## Stream ## Stream
@@ -49,12 +50,27 @@ import(
) )
// Stream returns a stream of "Hello $name" responses // Stream returns a stream of "Hello $name" responses
func StreamsAreCurrentlyTemporarilyNotSupportedInClients() { func StreamsResponsesFromTheServerUsingWebsockets() {
helloworldService := helloworld.NewHelloworldService(os.Getenv("M3O_API_TOKEN")) 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