From 10c663e7a54061f26cd0db742dfd29deac8976b7 Mon Sep 17 00:00:00 2001 From: Martina Date: Fri, 30 Jul 2021 15:00:06 -0700 Subject: [PATCH] api doc edits and adding google site verification file --- README.md | 2 +- common/logging.js | 4 ++-- components/api-docs/v1/get-slate.js | 4 ++-- components/api-docs/v1/get.js | 4 ++-- components/api-docs/v1/update-slate.js | 4 ++-- components/api-docs/v1/upload.js | 8 ++++---- components/api-docs/v2/get-slate.js | 4 ++-- components/api-docs/v2/get-user.js | 4 ++-- components/api-docs/v2/get.js | 4 ++-- components/api-docs/v2/update-file.js | 7 ++++--- components/api-docs/v2/update-slate.js | 7 ++++--- components/api-docs/v2/upload.js | 11 ++++++----- components/core/NewWebsitePrototypeHeader.js | 10 ++-------- google75364ba6a57d7b7d.html | 1 + pages/_/test.js | 4 ++-- pages/community.js | 2 +- 16 files changed, 39 insertions(+), 41 deletions(-) create mode 100644 google75364ba6a57d7b7d.html diff --git a/README.md b/README.md index d3593c24..a1cbca12 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ const response = await fetch("https://slate.host/api/v1/get", { method: "POST", headers: { "Content-Type": "application/json", - Authorization: "Basic XXX-YOUR-SLATE-KEY-XXX", + Authorization: "XXX-YOUR-SLATE-KEY-XXX", }, }); ``` diff --git a/common/logging.js b/common/logging.js index 1e384910..937fe0b6 100644 --- a/common/logging.js +++ b/common/logging.js @@ -9,9 +9,9 @@ const getTime = () => { const SLATE = "SLATE "; export const error = (...message) => { - console.log(`\x1b[1m[ \x1b[31m${SLATE}\x1b[0m\x1b[1m ]\x1b[0m ${getTime()} `, ...message); + console.error(`\x1b[1m[ \x1b[31m${SLATE}\x1b[0m\x1b[1m ]\x1b[0m ${getTime()} `, ...message); }; export const log = (...message) => { - console.log(`\x1b[1m[ \x1b[32m${SLATE}\x1b[0m\x1b[1m ]\x1b[0m ${getTime()} `, ...message); + console.info(`\x1b[1m[ \x1b[32m${SLATE}\x1b[0m\x1b[1m ]\x1b[0m ${getTime()} `, ...message); }; diff --git a/components/api-docs/v1/get-slate.js b/components/api-docs/v1/get-slate.js index abcfef9d..17ff7d0e 100644 --- a/components/api-docs/v1/get-slate.js +++ b/components/api-docs/v1/get-slate.js @@ -10,7 +10,7 @@ const EXAMPLE_CODE_JS = ( method: 'POST', headers: { 'Content-Type': 'application/json', - Authorization: 'Basic ${key}', + Authorization: '${key}', }, body: JSON.stringify({ data: { id: '${slateId}' // collection ID @@ -35,7 +35,7 @@ import json as JSON url = 'https://slate.host/api/v1/get-slate' headers = { 'content-type': 'application/json', - 'Authorization': 'Basic ${key}' + 'Authorization': '${key}' } json = { diff --git a/components/api-docs/v1/get.js b/components/api-docs/v1/get.js index 528c4e64..52a98778 100644 --- a/components/api-docs/v1/get.js +++ b/components/api-docs/v1/get.js @@ -7,7 +7,7 @@ const EXAMPLE_CODE_JS = (key) => `const response = await fetch('https://slate.ho method: 'GET', headers: { 'Content-Type': 'application/json', - Authorization: 'Basic ${key}', + Authorization: '${key}', }, body: JSON.stringify({ data: { private: false // set private = true to include private collections @@ -38,7 +38,7 @@ import json as JSON url = "https://slate.host/api/v1/get" headers = { "content-type": "application/json", - "Authorization": "Basic ${key}", + "Authorization": "${key}", } json = { diff --git a/components/api-docs/v1/update-slate.js b/components/api-docs/v1/update-slate.js index b260d46f..5820fb0b 100644 --- a/components/api-docs/v1/update-slate.js +++ b/components/api-docs/v1/update-slate.js @@ -15,7 +15,7 @@ const response = await fetch('https://slate.host/api/v1/update-slate', { method: 'POST', headers: { 'Content-Type': 'application/json', - Authorization: 'Basic ${key}', // API key + Authorization: '${key}', // API key }, body: JSON.stringify({ data: collection }) });`; @@ -26,7 +26,7 @@ const EXAMPLE_CODE_PY = (key, slateId) => headers = { "content-type": "application/json", - "Authorization": "Basic ${key}", # API key + "Authorization": "${key}", # API key } json = { "id": "${slateId}" } # slate ID diff --git a/components/api-docs/v1/upload.js b/components/api-docs/v1/upload.js index 1ab4c497..8789f60d 100644 --- a/components/api-docs/v1/upload.js +++ b/components/api-docs/v1/upload.js @@ -12,7 +12,7 @@ data.append("data", file); const response = await fetch(url, { method: 'POST', headers: { - Authorization: 'Basic ${key}', // API key + Authorization: '${key}', // API key }, body: data });`; @@ -24,7 +24,7 @@ files = { "file": open("example-file.txt", "rb") } headers = { - "Authorization": "Basic ${key}" # API key + "Authorization": "${key}" # API key } r = requests.post(url, headers=headers, files=files)`; @@ -41,7 +41,7 @@ data.append("data", file); const response = await fetch(url, { method: 'POST', headers: { - Authorization: 'Basic ${key}', // API key + Authorization: '${key}', // API key }, body: data });`; @@ -53,7 +53,7 @@ files = { "file": open("example-file.txt", "rb") } headers = { - "Authorization": "Basic ${key}" # API key + "Authorization": "${key}" # API key } r = requests.post(url, headers=headers, files=files)`; diff --git a/components/api-docs/v2/get-slate.js b/components/api-docs/v2/get-slate.js index 91df2c3c..8febc09f 100644 --- a/components/api-docs/v2/get-slate.js +++ b/components/api-docs/v2/get-slate.js @@ -10,7 +10,7 @@ const EXAMPLE_CODE_JS = ( method: 'POST', headers: { 'Content-Type': 'application/json', - Authorization: 'Basic ${key}', + Authorization: '${key}', }, body: JSON.stringify({ data: { id: '${slateId}' // collection ID @@ -35,7 +35,7 @@ import json as JSON url = 'https://slate.host/api/v2/get-collection' headers = { 'content-type': 'application/json', - 'Authorization': 'Basic ${key}' + 'Authorization': '${key}' } json = { diff --git a/components/api-docs/v2/get-user.js b/components/api-docs/v2/get-user.js index 418bd29a..e9b3283c 100644 --- a/components/api-docs/v2/get-user.js +++ b/components/api-docs/v2/get-user.js @@ -10,7 +10,7 @@ const EXAMPLE_CODE_JS = ( method: 'POST', headers: { 'Content-Type': 'application/json', - Authorization: 'Basic ${key}', + Authorization: '${key}', }, body: JSON.stringify({ data: { id: '${userId}' // user ID @@ -35,7 +35,7 @@ import json as JSON url = 'https://slate.host/api/v2/get-user' headers = { 'content-type': 'application/json', - 'Authorization': 'Basic ${key}' + 'Authorization': '${key}' } json = { diff --git a/components/api-docs/v2/get.js b/components/api-docs/v2/get.js index 7a9a6555..4b7ff7d2 100644 --- a/components/api-docs/v2/get.js +++ b/components/api-docs/v2/get.js @@ -7,7 +7,7 @@ const EXAMPLE_CODE_JS = (key) => `const response = await fetch('https://slate.ho method: 'GET', headers: { 'Content-Type': 'application/json', - Authorization: 'Basic ${key}', + Authorization: '${key}', } }); @@ -30,7 +30,7 @@ import json as JSON url = "https://slate.host/api/v2/get" headers = { "content-type": "application/json", - "Authorization": "Basic ${key}", + "Authorization": "${key}", } r = requests.get(url, headers=headers) diff --git a/components/api-docs/v2/update-file.js b/components/api-docs/v2/update-file.js index 3f66d2b9..16eae029 100644 --- a/components/api-docs/v2/update-file.js +++ b/components/api-docs/v2/update-file.js @@ -16,10 +16,11 @@ const response = await fetch('https://slate.host/api/v2/update-file', { method: 'POST', headers: { 'Content-Type': 'application/json', - Authorization: 'Basic ${key}', // API key + Authorization: '${key}', // API key }, body: JSON.stringify({ data: file }) -});`; +}); +const json = await response.json();`; }; const EXAMPLE_CODE_PY = (key, slateId) => @@ -27,7 +28,7 @@ const EXAMPLE_CODE_PY = (key, slateId) => headers = { "content-type": "application/json", - "Authorization": "Basic ${key}", # API key + "Authorization": "${key}", # API key } json = { "id": "${slateId}" } # collection ID diff --git a/components/api-docs/v2/update-slate.js b/components/api-docs/v2/update-slate.js index 74f68f39..7df9be79 100644 --- a/components/api-docs/v2/update-slate.js +++ b/components/api-docs/v2/update-slate.js @@ -15,10 +15,11 @@ const response = await fetch('https://slate.host/api/v2/update-collection', { method: 'POST', headers: { 'Content-Type': 'application/json', - Authorization: 'Basic ${key}', // API key + Authorization: '${key}', // API key }, body: JSON.stringify({ data: collection }) -});`; +}); +const json = await response.json();`; }; const EXAMPLE_CODE_PY = (key, slateId) => @@ -26,7 +27,7 @@ const EXAMPLE_CODE_PY = (key, slateId) => headers = { "content-type": "application/json", - "Authorization": "Basic ${key}", # API key + "Authorization": "${key}", # API key } json = { "id": "${slateId}" } # collection ID diff --git a/components/api-docs/v2/upload.js b/components/api-docs/v2/upload.js index 8dab60d1..c29a44af 100644 --- a/components/api-docs/v2/upload.js +++ b/components/api-docs/v2/upload.js @@ -12,7 +12,7 @@ data.append("data", file); const response = await fetch(url, { method: 'POST', headers: { - Authorization: 'Basic ${key}', // API key + Authorization: '${key}', // API key }, body: data });`; @@ -24,7 +24,7 @@ files = { "file": open("example-file.txt", "rb") } headers = { - "Authorization": "Basic ${key}" # API key + "Authorization": "${key}" # API key } r = requests.post(url, headers=headers, files=files)`; @@ -41,10 +41,11 @@ data.append("data", file); const response = await fetch(url, { method: 'POST', headers: { - Authorization: 'Basic ${key}', // API key + Authorization: '${key}', // API key }, body: data -});`; +}); +const json = await response.json();`; const SLATE_EXAMPLE_CODE_PY = (key, slateId) => `import requests @@ -53,7 +54,7 @@ files = { "file": open("example-file.txt", "rb") } headers = { - "Authorization": "Basic ${key}" # API key + "Authorization": "${key}" # API key } r = requests.post(url, headers=headers, files=files)`; diff --git a/components/core/NewWebsitePrototypeHeader.js b/components/core/NewWebsitePrototypeHeader.js index c52c817c..70d5b3c0 100644 --- a/components/core/NewWebsitePrototypeHeader.js +++ b/components/core/NewWebsitePrototypeHeader.js @@ -211,11 +211,8 @@ const NewWebsitePrototypeHeader = (props) => {
- - Get involved - - Sign in + Use Slate
@@ -224,11 +221,8 @@ const NewWebsitePrototypeHeader = (props) => {
- - Get involved - - Sign in + Use Slate
diff --git a/google75364ba6a57d7b7d.html b/google75364ba6a57d7b7d.html new file mode 100644 index 00000000..3c149257 --- /dev/null +++ b/google75364ba6a57d7b7d.html @@ -0,0 +1 @@ +google-site-verification: google75364ba6a57d7b7d.html \ No newline at end of file diff --git a/pages/_/test.js b/pages/_/test.js index c67583e4..27835e0d 100644 --- a/pages/_/test.js +++ b/pages/_/test.js @@ -18,7 +18,7 @@ export default class SlateReactSystemPage extends React.Component { const url = "/api/v1/get"; const response = await fetch(url, { headers: { - Authorization: "Basic SLA85621d2d-1bc1-4c35-9e3a-1e43689c155fTE", + Authorization: "SLA85621d2d-1bc1-4c35-9e3a-1e43689c155fTE", }, }); @@ -36,7 +36,7 @@ export default class SlateReactSystemPage extends React.Component { const response = await fetch(url, { method: "POST", headers: { - Authorization: "Basic --", + Authorization: "--", }, body: data, }); diff --git a/pages/community.js b/pages/community.js index 419082d1..b5b2f7b1 100644 --- a/pages/community.js +++ b/pages/community.js @@ -725,7 +725,7 @@ method: 'POST', headers: { 'Content-Type': 'application/json', // NOTE: your API key - Authorization: 'Basic SLATE-API-KEY-FROM-ACCOUNT-SETTINGS', + Authorization: 'SLATE-API-KEY-FROM-ACCOUNT-SETTINGS', }, body: JSON.stringify({ data: { // NOTE: optional, if you want your private collections too.