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 the strapi.axios property
  • AxiosRequestConfig used for the axiosOptions in the Strapi Constructor and the custom request
  • Method (which is a type) used for the parameter method 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

interface StrapiConfig {
  url?: string;
  store?: StoreConfig;
  axiosOptions?: AxiosRequestConfig;
}

StoreConfig

interface StoreConfig {
  key: string;
  useLocalStorage?: boolean;
  cookieOptions?: CookieAttributes;
}

StrapiAuthProvider

type StrapiAuthProvider =
  | "github"
  | "facebook"
  | "google"
  | "cognito"
  | "twitter"
  | "discord"
  | "twitch"
  | "instagram"
  | "vk"
  | "linkedin"
  | "reddit"
  | "auth0";

StrapiAuthenticationResponse

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

interface StrapiForgotPasswordData {
  email: string;
}

StrapiResetPasswordData

interface StrapiResetPasswordData {
  code: string;
  password: string;
  passwordConfirmation: string;
}

StrapiEmailConfirmationData

interface StrapiEmailConfirmationData {
  email: string;
}