aboutsummaryrefslogtreecommitdiff
path: root/src/client/apis/hypothesis/HypothesisApiUtils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/apis/hypothesis/HypothesisApiUtils.ts')
-rw-r--r--src/client/apis/hypothesis/HypothesisApiUtils.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/client/apis/hypothesis/HypothesisApiUtils.ts b/src/client/apis/hypothesis/HypothesisApiUtils.ts
new file mode 100644
index 000000000..dc7e1f988
--- /dev/null
+++ b/src/client/apis/hypothesis/HypothesisApiUtils.ts
@@ -0,0 +1,17 @@
+export namespace Hypothesis {
+ export const getAnnotation = async (username: String, searchParam: String) => {
+ const base = 'https://api.hypothes.is/api/search';
+ const request = base + `?user=acct:${username}@hypothes.is&text=${searchParam}`;
+ console.log("DASH Querying " + request);
+ const response = await fetch(request);
+ if (response.ok) {
+ return response.json();
+ } else {
+ throw new Error('DASH: Error in GET request');
+ }
+ };
+
+ export const makeAnnotationUrl = (annotationId: string, baseUrl: string) => {
+ return `https://hyp.is/${annotationId}/${baseUrl}`;
+ };
+} \ No newline at end of file