Types
Because this package has been designed using Typescript, it natively supports it. 🖥
Axios
Here is the list of all axios
interfaces & types used in this package:
AxiosInstance
used for thestrapi.axios
propertyAxiosRequestConfig
used for the axiosOptions in theStrapi Constructor
and the custom requestMethod
(which is atype
) used for the parametermethod
in the custom request method.
Custom
Here is a list of all the custom types & interfaces present in this package.
You can easily use them by importing them.
Example with StrapiOptions
import Strapi, { StrapiOptions } from "strapi-sdk-js";
const options: StrapiOptions = {
url: "http://strapi-host/",
};
const strapi = new Strapi(options);
StrapiOptions
- Options in order to configure new Strapi SDK instance.
interface StrapiConfig {
url?: string;
store?: StoreConfig;
axiosOptions?: AxiosRequestConfig;
}
StoreConfig
- Used for store configuration in Strapi SDK instanciation.
interface StoreConfig {
key: string;
useLocalStorage?: boolean;
cookieOptions?: CookieAttributes;
}
StrapiAuthProvider
- Used for
provider
parameter in getProviderAuthenticationUrl & authenticateProvider methods.
type StrapiAuthProvider =
| "github"
| "facebook"
| "google"
| "cognito"
| "twitter"
| "discord"
| "twitch"
| "instagram"
| "vk"
| "linkedin"
| "reddit"
| "auth0";
StrapiAuthenticationResponse
- Return object type in register, login, resetPassword & authenticateProvider methods.
interface StrapiAuthenticationResponse {
user: Record<string, unknown>;
jwt: string;
}
StrapiAuthenticationData
- Used for
data
parameter in login method.
interface StrapiAuthenticationData {
identifier: string;
password: string;
}
StrapiRegistrationData
- Used for
data
parameter in register method.
interface StrapiRegistrationData {
username: string;
email: string;
password: string;
}
StrapiForgotPasswordData
- Used for
data
parameter in forgotPassword method.
interface StrapiForgotPasswordData {
email: string;
}
StrapiResetPasswordData
- Used for
data
parameter in resetPassword method.
interface StrapiResetPasswordData {
code: string;
password: string;
passwordConfirmation: string;
}
StrapiEmailConfirmationData
- Used for
data
parameter in sendEmailConfirmation method.
interface StrapiEmailConfirmationData {
email: string;
}