Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

24 changes: 0 additions & 24 deletions .eslintrc.json

This file was deleted.

63 changes: 52 additions & 11 deletions dist/shipthisapi-js/collections/generic.d.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,63 @@
import { AllQueryFieldsPayload } from '../interfaces/api.interface';
import { CollectionParams, SelectGoogleLocationParams } from '../interfaces/collection-params.interface';
import { ShipthisAPI } from '../main';
import { AllQueryFieldsPayload } from '../interfaces/api.interface.js';
import { CollectionParams, SelectGoogleLocationParams } from '../interfaces/collection-params.interface.js';
import { ShipthisAPI } from '../main.js';
/**
* GENERIC CRUD
* @param obj
* @param collectionName
* @param params
* @returns
*/
declare const getListGeneric: (obj: any, collectionName: string, params: CollectionParams) => Promise<any>;
declare const getListGenericCollection: (obj: ShipthisAPI, collectionName: any, params?: CollectionParams) => Promise<any>;
declare const getSearchListCollection: (obj: ShipthisAPI, collectionName: any, queryFilter: any, params?: CollectionParams) => Promise<any>;
declare const getFullSearchListCollection: (obj: ShipthisAPI, collectionName: any, queryParams: AllQueryFieldsPayload, params?: CollectionParams) => Promise<any>;
declare const getOneGenericCollectionItem: (obj: ShipthisAPI, collectionName: any, objectId: string) => Promise<any>;
declare const createGenericCollectionItem: (obj: any, collectionName: string, itemData: any, params?: CollectionParams) => Promise<any>;
declare const updateGenericCollectionItem: (obj: any, collectionName: string, objectId: string, updatedData: any) => Promise<any>;
declare const setJobStatus: (obj: any, collectionName: string, objectId: string, index: any) => Promise<any>;
declare const getJobStatus: (obj: any, collectionName: string, objectId: string) => Promise<any>;
declare const getWorkflowReport: (obj: any, objectId: string) => Promise<any>;
declare const setWorkflowReport: (obj: any, objectId: string) => Promise<any>;
declare const createGenericCollectionItem: (obj: {
internalRequest: (arg0: any, arg1: string, arg2: string, arg3: {
requestData: {
reqbody: any;
};
params: CollectionParams;
}) => any;
} | ShipthisAPI, collectionName: string, itemData: any, params?: CollectionParams) => Promise<any>;
declare const updateGenericCollectionItem: (obj: {
internalRequest: (arg0: any, arg1: string, arg2: string, arg3: {
requestData: any;
}) => any;
} | ShipthisAPI, collectionName: string, objectId: string, updatedData: any) => Promise<any>;
declare const setJobStatus: (obj: {
internalRequest: (arg0: any, arg1: string, arg2: string, arg3: {
action_index: any;
}) => any;
}, collectionName: string, objectId: string, index: any) => Promise<any>;
declare const getJobStatus: (obj: {
internalRequest: (arg0: any, arg1: string, arg2: string) => any;
}, collectionName: string, objectId: string) => Promise<any>;
declare const getWorkflowReport: (obj: {
internalRequest: (arg0: any, arg1: string, arg2: string) => any;
}, objectId: string) => Promise<any>;
declare const setWorkflowReport: (obj: {
internalRequest: (arg0: any, arg1: string, arg2: string) => any;
}, objectId: string) => Promise<any>;
declare const getExchangeRateForCurrency: (obj: ShipthisAPI, currency: string) => Promise<any>;
declare const getGenericAutoComplete: (obj: ShipthisAPI, referenceName: string, data: any) => Promise<any>;
declare const getLocation: (obj: ShipthisAPI, collectionName: string, params?: CollectionParams) => Promise<any>;
declare const selectGoogleLocation: (obj: ShipthisAPI, collectionName: string, params: SelectGoogleLocationParams) => Promise<any>;
declare const conversation: (obj: ShipthisAPI, collectionName: string, data: any, params?: CollectionParams) => Promise<any>;
declare const deleteGenericCollectionItem: (obj: any, collectionName: string, objectId: string) => Promise<any>;
declare const getReportView: (obj: any, report_name: string, start_date: string, end_date: string, location: any, output_type: string, skip_meta: string, post_data: any) => Promise<any>;
declare const deleteGenericCollectionItem: (obj: {
internalRequest: (arg0: any, arg1: string, arg2: string) => any;
}, collectionName: string, objectId: string) => Promise<any>;
declare const getReportView: (obj: {
internalRequest: (arg0: any, arg1: string, arg2: string, arg3: {
params: {
start_date: string;
end_date: string;
output_type: string;
skip_meta: string;
location: any;
};
requestData: any;
}) => any;
}, report_name: string, start_date: string, end_date: string, location: any, output_type: string | undefined, skip_meta: string | undefined, post_data: any) => Promise<any>;
export { getOneGenericCollectionItem, getListGenericCollection, getSearchListCollection, getFullSearchListCollection, createGenericCollectionItem, updateGenericCollectionItem, deleteGenericCollectionItem, getExchangeRateForCurrency, getGenericAutoComplete, getLocation, conversation, getReportView, selectGoogleLocation, getListGeneric, setJobStatus, getJobStatus, getWorkflowReport, setWorkflowReport, };
33 changes: 11 additions & 22 deletions dist/shipthisapi-js/collections/generic.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.setWorkflowReport = exports.getWorkflowReport = exports.getJobStatus = exports.setJobStatus = exports.getListGeneric = exports.selectGoogleLocation = exports.getReportView = exports.conversation = exports.getLocation = exports.getGenericAutoComplete = exports.getExchangeRateForCurrency = exports.deleteGenericCollectionItem = exports.updateGenericCollectionItem = exports.createGenericCollectionItem = exports.getFullSearchListCollection = exports.getSearchListCollection = exports.getListGenericCollection = exports.getOneGenericCollectionItem = void 0;
/**
* GENERIC CRUD
* @param obj
* @param collectionName
* @param params
* @returns
*/
const getListGeneric = async (obj, collectionName, params) => {
if (!params) {
params = {};
Expand All @@ -9,7 +13,6 @@ const getListGeneric = async (obj, collectionName, params) => {
params,
});
};
exports.getListGeneric = getListGeneric;
const getListGenericCollection = async (obj, collectionName, params) => {
if (!params) {
params = {};
Expand All @@ -18,7 +21,6 @@ const getListGenericCollection = async (obj, collectionName, params) => {
params,
});
};
exports.getListGenericCollection = getListGenericCollection;
const getSearchListCollection = async (obj, collectionName, queryFilter, params) => {
if (!params) {
params = {};
Expand All @@ -27,7 +29,6 @@ const getSearchListCollection = async (obj, collectionName, queryFilter, params)
params,
});
};
exports.getSearchListCollection = getSearchListCollection;
const getFullSearchListCollection = async (obj, collectionName, queryParams, params) => {
if (!params) {
params = {};
Expand All @@ -36,11 +37,9 @@ const getFullSearchListCollection = async (obj, collectionName, queryParams, par
params,
});
};
exports.getFullSearchListCollection = getFullSearchListCollection;
const getOneGenericCollectionItem = async (obj, collectionName, objectId) => {
return obj.internalRequest(obj, 'GET', `/incollection/${collectionName}/${objectId}`);
};
exports.getOneGenericCollectionItem = getOneGenericCollectionItem;
const createGenericCollectionItem = async (obj, collectionName, itemData, params) => {
if (!params) {
params = {};
Expand All @@ -50,35 +49,30 @@ const createGenericCollectionItem = async (obj, collectionName, itemData, params
params,
});
};
exports.createGenericCollectionItem = createGenericCollectionItem;
const updateGenericCollectionItem = async (obj, collectionName, objectId, updatedData) => {
return obj.internalRequest(obj, 'PUT', `/incollection/${collectionName}/${objectId}`, { requestData: updatedData });
};
exports.updateGenericCollectionItem = updateGenericCollectionItem;
const setJobStatus = async (obj, collectionName, objectId, index) => {
return obj.internalRequest(obj, 'POST', `/workflow/${collectionName}/job_status/${objectId}`, { action_index: index });
};
exports.setJobStatus = setJobStatus;
const getJobStatus = async (obj, collectionName, objectId) => {
return obj.internalRequest(obj, 'GET', `/workflow/${collectionName}/job_status/${objectId}`);
};
exports.getJobStatus = getJobStatus;
const getWorkflowReport = async (obj, objectId) => {
return obj.internalRequest(obj, 'GET', `/incollection/workflow/${objectId}`);
};
exports.getWorkflowReport = getWorkflowReport;
const setWorkflowReport = async (obj, objectId) => {
return obj.internalRequest(obj, 'PUT', `/incollection/workflow/${objectId}`);
};
exports.setWorkflowReport = setWorkflowReport;
// get the exchange rate for currencies in Invoice
// url : https://asia-south1.gcp.api.shipthis.co/api/v3/thirdparty/currency?source=EUR&target=USD&date=1662508800000
const getExchangeRateForCurrency = async (obj, currency) => {
return obj.internalRequest(obj, 'GET', `thirdparty/currency?source=${currency}&target=USD&date=${new Date().getTime()}`);
};
exports.getExchangeRateForCurrency = getExchangeRateForCurrency;
// get the port of landing and discharge for shipments
const getGenericAutoComplete = async (obj, referenceName, data) => {
return obj.internalRequest(obj, 'POST', `autocomplete-reference/${referenceName}?location=new_york`, { requestData: data });
};
exports.getGenericAutoComplete = getGenericAutoComplete;
const getLocation = async (obj, collectionName, params) => {
if (!params) {
params = {};
Expand All @@ -87,29 +81,24 @@ const getLocation = async (obj, collectionName, params) => {
params,
});
};
exports.getLocation = getLocation;
const selectGoogleLocation = async (obj, collectionName, params) => {
return obj.internalRequest(obj, 'GET', `thirdparty/${collectionName}?query=${params.placeId}&description=${params.description}`, {
params,
});
};
exports.selectGoogleLocation = selectGoogleLocation;
const conversation = async (obj, collectionName, data, params) => {
if (!params) {
params = {};
}
return obj.internalRequest(obj, 'POST', collectionName, data);
};
exports.conversation = conversation;
const deleteGenericCollectionItem = async (obj, collectionName, objectId) => {
return obj.internalRequest(obj, 'DELETE', `/incollection/${collectionName}/${objectId}`);
};
exports.deleteGenericCollectionItem = deleteGenericCollectionItem;
const getReportView = async (obj, report_name, start_date, end_date, location, output_type = 'json', skip_meta = 'true', post_data) => {
return obj.internalRequest(obj, 'POST', `/report-view/${report_name}`, {
params: { start_date, end_date, output_type, skip_meta, location },
requestData: post_data,
});
};
exports.getReportView = getReportView;
//# sourceMappingURL=generic.js.map
export { getOneGenericCollectionItem, getListGenericCollection, getSearchListCollection, getFullSearchListCollection, createGenericCollectionItem, updateGenericCollectionItem, deleteGenericCollectionItem, getExchangeRateForCurrency, getGenericAutoComplete, getLocation, conversation, getReportView, selectGoogleLocation, getListGeneric, setJobStatus, getJobStatus, getWorkflowReport, setWorkflowReport, };
2 changes: 1 addition & 1 deletion dist/shipthisapi-js/collections/invoice.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ShipthisAPI } from '../main';
import { ShipthisAPI } from '../main.js';
export declare class Invoice {
obj: ShipthisAPI;
constructor(obj: any);
Expand Down
15 changes: 7 additions & 8 deletions dist/shipthisapi-js/collections/invoice.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Invoice = void 0;
const request_body_1 = require("./request-body");
class Invoice {
import { invoiceRequestData } from './request-body.js';
export class Invoice {
obj;
constructor(obj) {
this.obj = obj;
}
Expand All @@ -14,16 +12,17 @@ class Invoice {
}
createInvoice(invoiceData) {
const exchangeRate = this.obj.getExchangeRateForCurrency(this.obj, invoiceData?.invoice_currency);
const updatedData = { ...request_body_1.invoiceRequestData, ...invoiceData };
// exchangeRate.data.rate
const updatedData = { ...invoiceRequestData, ...invoiceData };
updatedData.exchange_rate = exchangeRate;
return this.obj.getOneGenericCollectionItem(this.obj, 'invoice', updatedData);
}
// update invoice
updateInvoice(objectId, updatedData) {
return this.obj.updateGenericCollectionItem(this.obj, 'invoice', objectId, updatedData);
}
// delete invoice
deleteInvoice(objectId) {
return this.obj.deleteGenericCollectionItem(this.obj, 'invoice', objectId);
}
}
exports.Invoice = Invoice;
//# sourceMappingURL=invoice.js.map
1 change: 1 addition & 0 deletions dist/shipthisapi-js/collections/meta.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
3 changes: 1 addition & 2 deletions dist/shipthisapi-js/collections/meta.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
"use strict";
//# sourceMappingURL=meta.js.map
export {};
Loading
Loading