2024-09-25 02:30:18 -07:00
|
|
|
import type { ICredentialType } from "n8n-workflow";
|
|
|
|
import {
|
|
|
|
CredentialSchema,
|
|
|
|
type InferCredentialSchema,
|
|
|
|
} from "../utils/CredentialSchema";
|
2024-08-28 11:19:40 -07:00
|
|
|
|
|
|
|
export const strapiApiCredentialSchema = CredentialSchema.create({
|
2024-09-25 02:30:18 -07:00
|
|
|
notice: CredentialSchema.notice(
|
|
|
|
"Make sure you are using a user account not an admin account",
|
|
|
|
),
|
|
|
|
email: CredentialSchema.email({ placeholder: "name@email.com" }),
|
2024-08-28 11:19:40 -07:00
|
|
|
password: CredentialSchema.password(),
|
|
|
|
url: CredentialSchema.url({
|
2024-09-25 02:30:18 -07:00
|
|
|
placeholder: "https://api.example.com",
|
2024-08-28 11:19:40 -07:00
|
|
|
}),
|
|
|
|
apiVersion: CredentialSchema.options({
|
2024-09-25 02:30:18 -07:00
|
|
|
label: "API Version",
|
|
|
|
description: "The version of api to be used",
|
2024-08-28 11:19:40 -07:00
|
|
|
options: [
|
|
|
|
{
|
2024-09-25 02:30:18 -07:00
|
|
|
label: "Version 4",
|
|
|
|
value: "v4",
|
|
|
|
description: "API version supported by Strapi 4",
|
2024-08-28 11:19:40 -07:00
|
|
|
},
|
|
|
|
{
|
2024-09-25 02:30:18 -07:00
|
|
|
label: "Version 3",
|
|
|
|
value: "v3",
|
2024-08-28 11:19:40 -07:00
|
|
|
default: true,
|
2024-09-25 02:30:18 -07:00
|
|
|
description: "API version supported by Strapi 3",
|
2024-08-28 11:19:40 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
|
2024-09-25 02:30:18 -07:00
|
|
|
export type StrapiApiCredential = InferCredentialSchema<
|
|
|
|
typeof strapiApiCredentialSchema
|
|
|
|
>;
|
2020-11-11 00:44:53 -08:00
|
|
|
|
|
|
|
export class StrapiApi implements ICredentialType {
|
2024-09-25 02:30:18 -07:00
|
|
|
name = "strapiApi";
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2024-09-25 02:30:18 -07:00
|
|
|
displayName = "Strapi API";
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2024-09-25 02:30:18 -07:00
|
|
|
documentationUrl = "strapi";
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2024-08-28 11:19:40 -07:00
|
|
|
properties = strapiApiCredentialSchema.toNodeProperties();
|
2024-09-25 02:30:18 -07:00
|
|
|
|
|
|
|
schema = strapiApiCredentialSchema;
|
2020-11-11 00:44:53 -08:00
|
|
|
}
|