64 lines
1.7 KiB
TypeScript
64 lines
1.7 KiB
TypeScript
// Generated from the OpenAPI specification. Do not edit by hand: regenerate.
|
|
import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
|
|
export class MozOutMzApi implements ICredentialType {
|
|
name = 'mozOutMzApi';
|
|
|
|
displayName = 'MozOut Mozambique API';
|
|
|
|
documentationUrl = 'https://docs.mozout.co.mz';
|
|
|
|
properties: INodeProperties[] = [
|
|
{
|
|
"displayName": "API Key",
|
|
"name": "apiKey",
|
|
"type": "string",
|
|
"typeOptions": {
|
|
"password": true
|
|
},
|
|
"required": true,
|
|
"default": "",
|
|
"description": "Create it in the API Center of Meu MozOut. Keys that start with sandbox_ simulate writes and never charge."
|
|
},
|
|
{
|
|
"displayName": "Base URL",
|
|
"name": "baseUrl",
|
|
"type": "string",
|
|
"default": "https://api.mozout.co.mz",
|
|
"description": "The MozOut Mozambique API. Change it only for tests."
|
|
},
|
|
{
|
|
"displayName": "Language of Error Messages",
|
|
"name": "language",
|
|
"type": "options",
|
|
"default": "en",
|
|
"options": [
|
|
{
|
|
"name": "English",
|
|
"value": "en"
|
|
},
|
|
{
|
|
"name": "Português",
|
|
"value": "pt"
|
|
}
|
|
]
|
|
}
|
|
];
|
|
|
|
authenticate: IAuthenticateGeneric = {
|
|
type: 'generic',
|
|
properties: {
|
|
headers: {
|
|
Authorization: '=Bearer {{$credentials.apiKey}}',
|
|
'Accept-Language': '={{$credentials.language || "en"}}',
|
|
},
|
|
},
|
|
};
|
|
|
|
test: ICredentialTestRequest = {
|
|
request: {
|
|
baseURL: '={{String($credentials.baseUrl || "https://api.mozout.co.mz").replace(new RegExp("/+$"), "")}}',
|
|
url: '/v1/token',
|
|
},
|
|
};
|
|
}
|