mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-23 22:12:19 +03:00
fixing api docs issues
This commit is contained in:
parent
dcaa8f0cc3
commit
81b08a85a8
@ -19,6 +19,12 @@ const EXAMPLE_CODE_JS = (
|
|||||||
|
|
||||||
if (!response) {
|
if (!response) {
|
||||||
console.log("No response");
|
console.log("No response");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
console.log(response.error);
|
||||||
|
return response.error;
|
||||||
}
|
}
|
||||||
|
|
||||||
const json = await response.json();
|
const json = await response.json();
|
||||||
|
@ -4,7 +4,7 @@ import * as System from "~/components/system";
|
|||||||
import CodeBlock from "~/components/system/CodeBlock";
|
import CodeBlock from "~/components/system/CodeBlock";
|
||||||
|
|
||||||
const EXAMPLE_CODE_JS = (key) => `const response = await fetch('https://slate.host/api/v1/get', {
|
const EXAMPLE_CODE_JS = (key) => `const response = await fetch('https://slate.host/api/v1/get', {
|
||||||
method: 'POST',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
Authorization: 'Basic ${key}',
|
Authorization: 'Basic ${key}',
|
||||||
@ -16,6 +16,12 @@ const EXAMPLE_CODE_JS = (key) => `const response = await fetch('https://slate.ho
|
|||||||
|
|
||||||
if (!response) {
|
if (!response) {
|
||||||
console.log("No response");
|
console.log("No response");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
console.log(response.error);
|
||||||
|
return response.error;
|
||||||
}
|
}
|
||||||
|
|
||||||
const json = await response.json();
|
const json = await response.json();
|
||||||
@ -41,7 +47,7 @@ json = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
r = requests.post(url, headers=headers, json=json)
|
r = requests.get(url, headers=headers, json=json)
|
||||||
|
|
||||||
print(JSON.dumps(r.json(), indent=2))`;
|
print(JSON.dumps(r.json(), indent=2))`;
|
||||||
|
|
||||||
|
@ -19,6 +19,12 @@ const EXAMPLE_CODE_JS = (
|
|||||||
|
|
||||||
if (!response) {
|
if (!response) {
|
||||||
console.log("No response");
|
console.log("No response");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
console.log(response.error);
|
||||||
|
return response.error;
|
||||||
}
|
}
|
||||||
|
|
||||||
const json = await response.json();
|
const json = await response.json();
|
||||||
|
@ -19,6 +19,12 @@ const EXAMPLE_CODE_JS = (
|
|||||||
|
|
||||||
if (!response) {
|
if (!response) {
|
||||||
console.log("No response");
|
console.log("No response");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
console.log(response.error);
|
||||||
|
return response.error;
|
||||||
}
|
}
|
||||||
|
|
||||||
const json = await response.json();
|
const json = await response.json();
|
||||||
|
@ -4,7 +4,7 @@ import * as System from "~/components/system";
|
|||||||
import CodeBlock from "~/components/system/CodeBlock";
|
import CodeBlock from "~/components/system/CodeBlock";
|
||||||
|
|
||||||
const EXAMPLE_CODE_JS = (key) => `const response = await fetch('https://slate.host/api/v2/get', {
|
const EXAMPLE_CODE_JS = (key) => `const response = await fetch('https://slate.host/api/v2/get', {
|
||||||
method: 'POST',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
Authorization: 'Basic ${key}',
|
Authorization: 'Basic ${key}',
|
||||||
@ -13,6 +13,12 @@ const EXAMPLE_CODE_JS = (key) => `const response = await fetch('https://slate.ho
|
|||||||
|
|
||||||
if (!response) {
|
if (!response) {
|
||||||
console.log("No response");
|
console.log("No response");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
console.log(response.error);
|
||||||
|
return response.error;
|
||||||
}
|
}
|
||||||
|
|
||||||
const json = await response.json();
|
const json = await response.json();
|
||||||
@ -32,7 +38,7 @@ headers = {
|
|||||||
"Authorization": "Basic ${key}",
|
"Authorization": "Basic ${key}",
|
||||||
}
|
}
|
||||||
|
|
||||||
r = requests.post(url, headers=headers)
|
r = requests.get(url, headers=headers)
|
||||||
|
|
||||||
print(JSON.dumps(r.json(), indent=2))`;
|
print(JSON.dumps(r.json(), indent=2))`;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user