Skip to content

Commit

Permalink
chore: add endpoint labelsx3
Browse files Browse the repository at this point in the history
  • Loading branch information
yashasvibajpai committed Dec 25, 2023
1 parent ca76297 commit b690406
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/v0/destinations/active_campaign/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const customTagProcessor = async (message, category, destination, contactId) =>
const resp = httpGET(endpoint, requestOptions, {
destType: 'active_campaign',
feature: 'transformation',
endpointPath: `/api/3/tags`,
});
promises.push(resp);
}
Expand Down Expand Up @@ -249,6 +250,7 @@ const customFieldProcessor = async (message, category, destination) => {
const resp = httpGET(endpoint, requestOpt, {
destType: 'active_campaign',
feature: 'transformation',
endpointPath: `/api/3/fields`,
});
promises.push(resp);
}
Expand Down Expand Up @@ -402,6 +404,7 @@ const screenRequestHandler = async (message, category, destination) => {
res = await httpGET(endpoint, requestOptions, {
destType: 'active_campaign',
feature: 'transformation',
endpointPath: `/api/3/eventTrackingEvents`,
});
if (res.success === false) {
errorHandler(res, 'Failed to retrieve events');
Expand Down Expand Up @@ -465,6 +468,7 @@ const trackRequestHandler = async (message, category, destination) => {
let res = await httpGET(endpoint, requestOptions, {
destType: 'active_campaign',
feature: 'transformation',
endpointPath: `/api/3/eventTrackingEvents`,
});

if (res.success === false) {
Expand Down
1 change: 1 addition & 0 deletions src/v0/destinations/canny/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const retrieveUserId = async (apiKey, message) => {
{
destType: 'canny',
feature: 'transformation',
endpointPath: `/v1/users/retrieve`,
},
);
logger.debug(response);
Expand Down
1 change: 1 addition & 0 deletions src/v0/destinations/custify/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const createUpdateCompany = async (companyPayload, Config) => {
{
destType: 'custify',
feature: 'transformation',
endpointPath: `/company`,
},
);
const processedCompanyResponse = processAxiosResponse(companyResponse);
Expand Down
7 changes: 7 additions & 0 deletions src/v0/destinations/freshmarketer/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const createUpdateAccount = async (payload, Config) => {
let accountResponse = await httpPOST(endPoint, payloadBody, requestOptions, {
destType: 'freshmarketer',
feature: 'transformation',
endpointPath: `/crm/sales/api/sales_accounts/upsert`,
});
accountResponse = processAxiosResponse(accountResponse);
if (accountResponse.status !== 200 && accountResponse.status !== 201) {
Expand Down Expand Up @@ -93,6 +94,7 @@ const getUserAccountDetails = async (payload, userEmail, Config) => {
let userSalesAccountResponse = await httpPOST(endPoint, userPayload, requestOptions, {
destType: 'freshmarketer',
feature: 'transformation',
endpointPath: `crm/sales/api/contacts/upsert?include=sales_accounts`,
});
userSalesAccountResponse = processAxiosResponse(userSalesAccountResponse);
if (userSalesAccountResponse.status !== 200 && userSalesAccountResponse.status !== 201) {
Expand Down Expand Up @@ -142,6 +144,7 @@ const createOrUpdateListDetails = async (listName, Config) => {
let listResponse = await httpGET(endPoint, requestOptions, {
destType: 'freshmarketer',
feature: 'transformation',
endpointPath: `/crm/sales/api/lists`,
});
listResponse = processAxiosResponse(listResponse);
if (listResponse.status !== 200) {
Expand All @@ -161,6 +164,7 @@ const createOrUpdateListDetails = async (listName, Config) => {
listResponse = await httpPOST(endPoint, { name: listName }, requestOptions, {
destType: 'freshmarketer',
feature: 'transformation',
endpointPath: `/crm/sales/api/lists`,
});
listResponse = processAxiosResponse(listResponse);
if (listResponse.status !== 200) {
Expand Down Expand Up @@ -235,6 +239,7 @@ const getContactsDetails = async (userEmail, Config) => {
let userResponse = await httpPOST(endPoint, userPayload, requestOptions, {
destType: 'freshmarketer',
feature: 'transformation',
endpointPath: `/crm/sales/api/contacts/upsert`,
});
userResponse = processAxiosResponse(userResponse);
if (userResponse.status !== 200 && userResponse.status !== 201) {
Expand Down Expand Up @@ -308,6 +313,7 @@ const UpdateContactWithLifeCycleStage = async (message, Config) => {
let lifeCycleStagesResponse = await httpGET(endPoint, requestOptions, {
destType: 'freshmarketer',
feature: 'transformation',
endpointPath: `/crm/sales/api/selector/lifecycle_stages`,
});
lifeCycleStagesResponse = processAxiosResponse(lifeCycleStagesResponse);
if (lifeCycleStagesResponse.status !== 200) {
Expand Down Expand Up @@ -393,6 +399,7 @@ const UpdateContactWithSalesActivity = async (payload, message, Config) => {
let salesActivityResponse = await httpGET(endPoint, requestOptions, {
destType: 'freshmarketer',
feature: 'transformation',
endpointPath: `/crm/sales/api/selector/sales_activity_types`,
});
salesActivityResponse = processAxiosResponse(salesActivityResponse);
if (salesActivityResponse.status !== 200) {
Expand Down
5 changes: 5 additions & 0 deletions src/v0/destinations/freshsales/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const createUpdateAccount = async (payload, Config) => {
let accountResponse = await httpPOST(endPoint, payloadBody, requestOptions, {
destType: 'freshsales',
feature: 'transformation',
endpointPath: `/crm/sales/api/sales_accounts/upsert`,
});
accountResponse = processAxiosResponse(accountResponse);
if (accountResponse.status !== 200 && accountResponse.status !== 201) {
Expand Down Expand Up @@ -90,6 +91,7 @@ const getUserAccountDetails = async (payload, userEmail, Config) => {
let userSalesAccountResponse = await httpPOST(endPoint, userPayload, requestOptions, {
destType: 'freshsales',
feature: 'transformation',
endpointPath: `/crm/sales/api/contacts/upsert?include=sales_accounts`,
});
userSalesAccountResponse = processAxiosResponse(userSalesAccountResponse);
if (userSalesAccountResponse.status !== 200 && userSalesAccountResponse.status !== 201) {
Expand Down Expand Up @@ -145,6 +147,7 @@ const getContactsDetails = async (userEmail, Config) => {
let userResponse = await httpPOST(endPoint, userPayload, requestOptions, {
destType: 'freshsales',
feature: 'transformation',
endpointPath: `/crm/sales/api/contacts/upsert`,
});
userResponse = processAxiosResponse(userResponse);
if (userResponse.status !== 200 && userResponse.status !== 201) {
Expand Down Expand Up @@ -235,6 +238,7 @@ const UpdateContactWithSalesActivity = async (payload, message, Config) => {
let salesActivityResponse = await httpGET(endPoint, requestOptions, {
destType: 'freshsales',
feature: 'transformation',
endpointPath: `/crm/sales/api/sales_activity_types`,
});
salesActivityResponse = processAxiosResponse(salesActivityResponse);
if (salesActivityResponse.status !== 200) {
Expand Down Expand Up @@ -314,6 +318,7 @@ const UpdateContactWithLifeCycleStage = async (message, Config) => {
let lifeCycleStagesResponse = await httpGET(endPoint, requestOptions, {
destType: 'freshsales',
feature: 'transformation',
endpointPath: `/crm/sales/api/lifecycle_stages`,
});
lifeCycleStagesResponse = processAxiosResponse(lifeCycleStagesResponse);
if (lifeCycleStagesResponse.status !== 200) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ const ProxyRequest = async (request) => {
const response = await httpSend(requestBody, {
feature: 'proxy',
destType: 'gogole_adwords_offline_conversions',
endpointPath: `/proxy`,
});
return response;
};
Expand Down
2 changes: 2 additions & 0 deletions src/v0/destinations/hs/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const getProperties = async (destination) => {
hubspotPropertyMapResponse = await httpGET(CONTACT_PROPERTY_MAP_ENDPOINT, requestOptions, {
destType: 'hs',
feature: 'transformation',
endpointPath: `/properties/v1/contacts/properties`,
});
hubspotPropertyMapResponse = processAxiosResponse(hubspotPropertyMapResponse);
} else {
Expand All @@ -111,6 +112,7 @@ const getProperties = async (destination) => {
{
destType: 'hs',
feature: 'transformation',
endpointPath: `/properties/v1/contacts/properties?hapikey`,
},
);
hubspotPropertyMapResponse = processAxiosResponse(hubspotPropertyMapResponse);
Expand Down
1 change: 1 addition & 0 deletions src/v0/destinations/marketo/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ const sendGetRequest = async (url, options) => {
const clientResponse = await httpGET(url, options, {
destType: 'marketo',
feature: 'transformation',
endpointPath: `/v1/leads`,
});
const processedResponse = processAxiosResponse(clientResponse);
return processedResponse;
Expand Down
7 changes: 7 additions & 0 deletions src/v0/destinations/user/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ const createCompany = async (message, destination) => {
const response = await httpPOST(endpoint, payload, requestOptions, {
destType: 'user',
feature: 'transformation',
endpointPath: `/companies/`,
});
const data = processAxiosResponse(response);
return data.response;
Expand Down Expand Up @@ -277,6 +278,7 @@ const updateCompany = async (message, destination, company) => {
const response = await httpPUT(endpoint, payload, requestOptions, {
destType: 'user',
feature: 'transformation',
endpointPath: `/companies/`,
});
const data = processAxiosResponse(response);
return data.response;
Expand All @@ -303,6 +305,7 @@ const getUserByUserKey = async (apiKey, userKey, appSubdomain) => {
const userResponse = await httpGET(endpoint, requestOptions, {
destType: 'user',
feature: 'transformation',
endpointPath: `/users/search`,
});
const processedUserResponse = processAxiosResponse(userResponse);
if (processedUserResponse.status === 200) {
Expand Down Expand Up @@ -336,6 +339,7 @@ const getUserByEmail = async (apiKey, email, appSubdomain) => {
const userResponse = await httpGET(endpoint, requestOptions, {
destType: 'user',
feature: 'transformation',
endpointPath: `/users/search/?email`,
});
const processedUserResponse = processAxiosResponse(userResponse);

Expand Down Expand Up @@ -374,6 +378,7 @@ const getUserByPhoneNumber = async (apiKey, phoneNumber, appSubdomain) => {
const userResponse = await httpGET(endpoint, requestOptions, {
destType: 'user',
feature: 'transformation',
endpointPath: `/users/search/?phone_number`,
});
const processedUserResponse = processAxiosResponse(userResponse);

Expand Down Expand Up @@ -418,6 +423,7 @@ const getUserByCustomId = async (message, destination) => {
const userResponse = await httpGET(endpoint, requestOptions, {
destType: 'user',
feature: 'transformation',
endpointPath: `/users-by-id/`,
});
const processedUserResponse = processAxiosResponse(userResponse);

Expand Down Expand Up @@ -453,6 +459,7 @@ const getCompanyByCustomId = async (message, destination) => {
const response = await httpGET(endpoint, requestOptions, {
destType: 'user',
feature: 'transformation',
endpointPath: `/companies-by-id/`,
});
const processedUserResponse = processAxiosResponse(response);
if (processedUserResponse.status === 200) {
Expand Down
2 changes: 2 additions & 0 deletions src/v0/destinations/wootric/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const getAccessToken = async (destination) => {
const wootricAuthResponse = await httpPOST(request.url, request.data, request.header, {
destType: 'wootric',
feature: 'transformation',
endpointPath: `/oauth/token`,
});
const processedAuthResponse = processAxiosResponse(wootricAuthResponse);
// If the request fails, throwing error.
Expand Down Expand Up @@ -98,6 +99,7 @@ const retrieveUserDetails = async (endUserId, externalId, accessToken) => {
const userResponse = await httpGET(endpoint, requestOptions, {
destType: 'wootric',
feature: 'transformation',
endpointPath: `/v1/end_users/`,
});
const processedUserResponse = processAxiosResponse(userResponse);

Expand Down

0 comments on commit b690406

Please sign in to comment.