);
}
}
export default class SceneSettingsDeveloper extends React.Component {
_bucketCID;
state = {
loading: false,
language: "javascript",
docs: "GET",
copying: false,
tab: 0,
};
_handleCopy = async () => {
this._bucketCID.select();
document.execCommand("copy");
await this.setState({ copying: true });
await Window.delay(1000);
await this.setState({ copying: false });
};
_handleSave = async (e) => {
this.setState({ loading: true });
const response = await Actions.generateAPIKey();
Events.hasError(response);
this.setState({ loading: false });
};
_handleDelete = async (id) => {
this.setState({ loading: true });
if (
!window.confirm(
"Are you sure you want to revoke this API key? Any services using it will no longer be able to access your Slate account"
)
) {
this.setState({ loading: false });
return;
}
const response = await Actions.deleteAPIKey({ id });
Events.hasError(response);
this.setState({ loading: false });
};
_handleChangeLanguage = (newLanguage) => {
this.setState({ language: newLanguage });
};
render() {
let APIKey = "YOUR-API-KEY-HERE";
let lang = this.state.language;
if (this.props.viewer.keys) {
if (this.props.viewer.keys.length) {
APIKey = this.props.viewer.keys[0].key;
}
}
const userId = this.props.viewer.id;
let slateId = "YOUR-SLATE-ID-VALUE";
if (this.props.viewer.slates) {
if (this.props.viewer.slates.length) {
slateId = this.props.viewer.slates[0].id;
}
}
let userBucketCID = this.props.viewer?.userBucketCID;
if (userBucketCID) {
userBucketCID = userBucketCID.replace("/ipfs/", "");
}
return (
{/*
this._changeDocs("INTRO")}>
Introduction
api
this._changeDocs("GET")}
>
Get all slates
this._changeDocs("GET_SLATE")}
>
Get slate by ID
this._changeDocs("UPLOAD_TO_SLATE")}
>
Upload to slate by ID
this._changeDocs("UPDATE_SLATE")}
>
Update slate
guides
*/}
You can use your API keys to access your account information outside of Slate and upload
files to Slate. You can have a maximum of 10 keys at any given time.
{userBucketCID && (
{this.props.viewer.keys.length < 10 ? (
Generate
) : (
Generate
)}
{this.props.viewer.keys.length === 0 ? (
Generate an API key to have it appear in the code examples
) : null}
*/}
Slate is currently on v2.0 of the API. While prior versions are still supported, we
recommend using the most up to date version.
this.setState({ tab })}
/>
{this.state.tab === 0 ? (
<>
>
) : (
<>
>
)}
);
}
}