Getting started
๐ฆ Installationโ
Install the @opencord/client
package in your project:
## npm
npm install @opencord/client
## yarn
yarn add @opencord/client
โ๏ธ Initializationโ
Import and initialize the Opencord client in your project.
import { getClient } from "@opencord/client";
const oc = getClient();
// Check if the platform is not unknown, indicating that the plugin is currently
// running in the Opencord runtime and has initialized successfully.
if (oc.platform !== "unknown") {
console.log("โ
Opencord client initialized.");
} else {
console.log("โ Opencord client initialization failed.");
}
๐ก Usageโ
The OpencordClient
provides a set of methods for accessing the SDK's features.
For example, you can use the getCode()
method to retrieve the authorization code.
const { code, message, data } = await oc.getCode();
if (code === 200) {
console.log("โ
Get authorization code successed", data);
} else {
console.log("โ Get authorization code failed.", code, message);
}
๐ Next Stepsโ
Once you have successfully integrated the Opencord SDK into your project, it is recommended that you explore the Client Methods documentation to fully discover the capabilities of the SDK.
You can also visit Create your plugin to learn more about creating, developing, testing, and publishing your first Opencord plugin.
Furthermore, welcome to join our Opencord server to obtain additional technical support, and to preview the plugin's capabilities firsthand in the # ๐ฎ๏ฝPlayground
channel.