forked from activepieces/activepieces
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(wedof): updating cfsurveys classes
- Loading branch information
1 parent
525852b
commit bb03413
Showing
10 changed files
with
485 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...nity/wedof/src/lib/actions/certification-folder-survey/get-certification-folder-survey.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { HttpMethod, httpClient } from '@activepieces/pieces-common'; | ||
import { wedofAuth } from '../../..'; | ||
import { | ||
createAction, | ||
Property, | ||
} from '@activepieces/pieces-framework'; | ||
import { wedofCommon } from '../../common/wedof'; | ||
|
||
export const getCertificationFolderSurvey = createAction({ | ||
auth: wedofAuth, | ||
name: 'getCertificationFolderSurvey', | ||
displayName: "Récupération d'une enquête", | ||
description: "Permet de récupérer une enquête associée à un dossier de certification", | ||
props: { | ||
certificationFolderExternalId: Property.ShortText({ | ||
displayName: 'N° de dossier de certification', | ||
description: "Sélectionner la propriété {externalId} du dossier de certification", | ||
required: true, | ||
}), | ||
}, | ||
|
||
async run(context) { | ||
return ( | ||
await httpClient.sendRequest({ | ||
method: HttpMethod.GET, | ||
url: wedofCommon.baseUrl + '/surveys/'+ context.propsValue.certificationFolderExternalId, | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'X-Api-Key': context.auth as string, | ||
}, | ||
}) | ||
).body; | ||
}, | ||
}); |
108 changes: 108 additions & 0 deletions
108
...ty/wedof/src/lib/actions/certification-folder-survey/list-certification-folder-surveys.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import { HttpMethod, QueryParams, httpClient } from '@activepieces/pieces-common'; | ||
import { wedofAuth } from '../../..'; | ||
import { | ||
createAction, | ||
Property, | ||
} from '@activepieces/pieces-framework'; | ||
import { wedofCommon } from '../../common/wedof'; | ||
|
||
export const listCertificationFolderSurveys = createAction({ | ||
auth: wedofAuth, | ||
name: 'listCertificationFolderSurveys', | ||
displayName: 'Liste les enquêtes selon des critères', | ||
description: "Récupérer l'ensemble des enquêtes de l'organisme de l'utilisateur connecté", | ||
props: { | ||
certifInfo: Property.ShortText({ | ||
displayName: 'N° certifInfo', | ||
description: "Permet de n'obtenir que les enquêtes liées à la certification considérée", | ||
required: false, | ||
}), | ||
limit: Property.ShortText({ | ||
displayName: "Nombre d'enquêtes", | ||
description: "Nombre d'éléments retourné par requête - par défaut 100", | ||
required: false, | ||
}), | ||
order: Property.StaticDropdown({ | ||
displayName: "Ordre", | ||
description: "Tri les résultats par ordre ascendant ou descendant", | ||
required: false, | ||
options: { | ||
options: [ | ||
{ | ||
value: 'asc', | ||
label: 'Ascendant', | ||
}, | ||
{ | ||
value: 'desc', | ||
label: 'Descendant', | ||
}, | ||
], | ||
disabled: false, | ||
}, | ||
}), | ||
page: Property.Number({ | ||
displayName: 'N° de page de la requête', | ||
description: 'Par défaut : 1', | ||
defaultValue: 1, | ||
required: false, | ||
}), | ||
state: Property.StaticDropdown({ | ||
displayName: "Etat", | ||
description: "Permet de n'obtenir que les enquêtes en fonction de l'état considéré", | ||
required: false, | ||
options: { | ||
options: [ | ||
{ | ||
value: 'all', | ||
label: 'Tous', | ||
}, | ||
{ | ||
value: 'created', | ||
label: 'Créé', | ||
}, | ||
{ | ||
value: 'beforeCertificationSuccess', | ||
label: 'Avant la réussite de la certification', | ||
}, | ||
{ | ||
value: 'afterSixMonthsCertificationSuccess', | ||
label: 'Six mois après la réussite de la certification', | ||
}, | ||
{ | ||
value: 'finished', | ||
label: 'Terminé', | ||
}, | ||
], | ||
disabled: false, | ||
}, | ||
}), | ||
}, | ||
|
||
async run(context) { | ||
const params = { | ||
certifInfo: context.propsValue.certifInfo ?? null, | ||
limit: context.propsValue.limit ?? null, | ||
page: context.propsValue.page ?? null, | ||
state: context.propsValue.state ?? null, | ||
order:context.propsValue.order ?? null, | ||
}; | ||
const queryParams: QueryParams = {}; | ||
Object.keys(params).forEach((value) => { | ||
const key = value as keyof typeof params; | ||
if (params[key] != null && params[key] != undefined) { | ||
queryParams[value] = params[key] as string; | ||
} | ||
}); | ||
return ( | ||
await httpClient.sendRequest({ | ||
method: HttpMethod.GET, | ||
queryParams: queryParams, | ||
url: wedofCommon.baseUrl + '/surveys', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'X-Api-Key': context.auth as string, | ||
}, | ||
}) | ||
).body; | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.