UNPKG

@rudderstack/integrations-lib

Version:
47 lines 2.84 kB
import { AuthObject, BusinessUnit, ContactAttributesResponse, CreateDataExtensionResponse, DataExtension, DataExtensionBody, DataFolder } from './type'; import { RestError, SoapError } from './utils'; export default class SFMC { authObject: AuthObject; constructor(authObject: any); private static validateAuthObject; /** * This function returns the access token. If the token is expired, it will generate a new token. * @returns {Promise<AuthObject>} It returns the access token or error */ getAccessToken(): Promise<AuthObject>; /** * This method fetches the fields of a data extension. It requires the data extension id. The method returns the fields of the data extension. If the data extension is not found, it returns a RestError. * @param dataExtensionId Id of the data extension whose fields are to be fetched * @returns */ getDestinationFields(dataExtensionId: string): Promise<DataExtensionBody | RestError>; /** * This method fetches the contact attributes. The method returns the contact attributes. If the contact attributes are not found, it returns a RestError. * @returns */ getContactAttributes(): Promise<ContactAttributesResponse | RestError>; /** * This method creates a data extension. It requires the data extension fields. The method returns the data extension created. If the data extension is not created, it returns a RestError. * @param body DataExtension fields * @returns */ createDataExtension(body: DataExtensionBody): Promise<CreateDataExtensionResponse | RestError>; /** * This method fetches the business units. The method returns the business units. If the business units are not found, it returns a SoapError. * @returns */ getBusinessUnits(): Promise<BusinessUnit[] | SoapError>; /** * This method fetches the data folders. It business unit id is provided all data folder under that business id would be retrieved otherwise all the data folder will be retrieved. The method returns the data folders. If the data folders are not found, it returns a SoapError. * @param businessUnitId this is the id of the business unit * @returns */ getDataFolders(businessUnitId?: string): Promise<DataFolder[] | SoapError>; /** * This function fetches the data extensions. It the data folder id is provided all the data extension under that data folder will be retrieved otherwise all the data extensions under the access token will be fetched. The method returns the data extensions. If the data extensions are not found, it returns a SoapError. * @param dataFolderId Id of the data folder * @returns */ getDataExtensions(dataFolderId?: string): Promise<DataExtension[] | SoapError>; } //# sourceMappingURL=index.d.ts.map