feat(salesforce): add list objects data

This commit is contained in:
Ali BARIN
2022-11-05 02:40:46 +01:00
parent 243e50465f
commit 3d9249192c
3 changed files with 35 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
import listObjects from './list-objects';
export default [
listObjects,
];

View File

@@ -0,0 +1,28 @@
import { IGlobalVariable } from '@automatisch/types';
type TResponse = {
sobjects: TObject[];
}
type TObject = {
name: string;
label: string;
}
export default {
name: 'List objects',
key: 'listObjects',
async run($: IGlobalVariable) {
const response = await $.http.get<TResponse>('/services/data/v56.0/sobjects');
const objects = response.data.sobjects.map((object) => {
return {
value: object.name,
name: object.label,
};
});
return { data: objects };
},
};

View File

@@ -1,6 +1,7 @@
import defineApp from '../../helpers/define-app';
import addAuthHeader from './common/add-auth-header';
import auth from './auth';
import data from './data';
export default defineApp({
name: 'Salesforce',
@@ -13,4 +14,5 @@ export default defineApp({
primaryColor: '00A1E0',
beforeRequest: [addAuthHeader],
auth,
data,
});