@experteam-mx/ngx-services
Version:
Angular common services for Experteam apps
974 lines • 144 kB
JavaScript
import { Inject, Injectable } from '@angular/core';
import { forkJoin, map, mergeMap } from 'rxjs';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common/http";
export class ApiCompaniesService {
environments;
http;
constructor(environments, http) {
this.environments = environments;
this.http = http;
}
/**
* Retrieves the URL for the companies API from the environment configurations.
*
* @return {string} The URL of the companies API.
*/
get url() {
return this.environments.apiCompaniesUrl ?? '';
}
/**
* Fetches the installations based on the provided query parameters.
*
* @param {QueryParams} params - The parameters used to filter the installations query.
* @return {Observable<InstallationsOut>} An observable that emits the installation's data.
*/
getInstallations(params) {
return this.http.get(`${this.url}/installations`, { params })
.pipe(map(({ data }) => data));
}
/**
* Retrieves the installation details based on the given installation ID.
*
* @param {number} id - The unique identifier of the installation to retrieve.
* @returns {Observable<InstallationOut>} An observable of the installation details.
*/
getInstallation(id) {
return this.http.get(`${this.url}/installations/${id}`)
.pipe(map(({ data }) => data));
}
/**
* Sends a post-installation request to the server and retrieves the installation details.
*
* @param {InstallationIn} body - The installation details to be sent in the request body.
* @return {Observable<InstallationOut>} An observable that emits the response containing installation output details.
*/
postInstallation(body) {
return this.http.post(`${this.url}/installations`, body)
.pipe(map(({ data }) => data));
}
/**
* Updates an existing installation record by its ID.
*
* @param id The unique identifier of the installation to update.
* @param body The data payload containing the updated installation information.
* @return An observable that emits the updated installation data upon a successful update.
*/
putInstallation(id, body) {
return this.http.put(`${this.url}/installations/${id}`, body)
.pipe(map(({ data }) => data));
}
/**
* Deletes an installation by its unique identifier.
*
* @param {number} id - The unique identifier of the installation to be deleted.
* @return {Observable<{}>} An observable that emits the response after the installation is deleted.
*/
deleteInstallation(id) {
return this.http.delete(`${this.url}/installations/${id}`)
.pipe(map(({ data }) => data));
}
/**
* Retrieves a list of locations based on the provided query parameters.
*
* @param {QueryParams} params - The parameters to use for querying locations.
* @return {Observable<LocationsOut>} An observable that emits the location's data.
*/
getLocations(params) {
return this.http.get(`${this.url}/locations`, { params })
.pipe(map(({ data }) => data));
}
/**
* Fetches the location details for a given location ID.
*
* @param {number} id - The unique identifier of the location.
* @return {Observable<LocationOut>} An Observable containing the location details.
*/
getLocation(id) {
return this.http.get(`${this.url}/locations/${id}`)
.pipe(map(({ data }) => data));
}
/**
* Sends a location object to the server and returns the created location data.
*
* @param {LocationIn} body - The location input object to be sent in the request body.
* @return {Observable<LocationOut>} An observable emitting the created location output object.
*/
postLocation(body) {
return this.http.post(`${this.url}/locations`, body)
.pipe(map(({ data }) => data));
}
/**
* Updates the location information for the specified ID.
*
* @param {number} id - The unique identifier of the location to be updated.
* @param {LocationIn} body - The updated location data to be sent in the request body.
* @return {Observable<LocationOut>} An observable containing the updated location information.
*/
putLocation(id, body) {
return this.http.put(`${this.url}/locations/${id}`, body)
.pipe(map(({ data }) => data));
}
/**
* Deletes a location by its unique identifier.
*
* @param {number} id - The unique identifier of the location to be deleted.
* @return {Observable<{}>} An observable that emits an empty object upon successful deletion.
*/
deleteLocation(id) {
return this.http.delete(`${this.url}/locations/${id}`)
.pipe(map(({ data }) => data));
}
/**
* Retrieves a list of active supply entities.
*
* @param {QueryParams} params - The query parameters to filter supply entities.
* @return {Observable<SupplyEntitiesOut>} Observable emitting supply entities data.
*/
getSupplyEntitiesActives(params) {
return this.http.get(`${this.url}/supply-entities/actives`, { params })
.pipe(map(({ data }) => data));
}
/**
* Retrieves supply entities based on the provided query parameters.
*
* @param {QueryParams} params - The query parameters used to filter and fetch the supply entities.
* @return {Observable<SupplyEntitiesOut>} An observable that emits the supply entities data.
*/
getSupplyEntities(params) {
return this.http.get(`${this.url}/supply-entities`, { params })
.pipe(map(({ data }) => data));
}
/**
* Sends supply entities information to the server and receives the processed supply entities data in response.
*
* @param {SupplyEntitiesIn} body - The supply entities data to be sent to the server.
* @return {Observable<SupplyEntitiesOut>} An observable containing the processed supply entities data.
*/
putSupplyEntities(body) {
return this.http.post(`${this.url}/accounts`, body)
.pipe(map(({ data }) => data));
}
/**
* Fetches a list of employees based on the specified query parameters.
*
* @param {QueryParams} params - The parameters to filter and sort the employees.
* @return {Observable<EmployeesOut>} An observable that emits the list of employees.
*/
getEmployees(params) {
return this.http.get(`${this.url}/employees`, {
params,
}).pipe(map(({ data }) => data));
}
/**
* Fetches an employee's details based on the provided employee ID.
*
* @param {number} id - The unique identifier of the employee.
* @return {Observable<EmployeeOut>} An observable that emits the employee's details.
*/
getEmployee(id) {
return this.http.get(`${this.url}/employees/${id}`)
.pipe(map(({ data }) => data));
}
/**
* Sends a POST request to create a new employee record.
*
* @param {EmployeeIn} body - The data of the employee to be created.
* @return {Observable<EmployeeOut>} An observable containing the created employee data.
*/
postEmployee(body) {
return this.http.post(`${this.url}/employees`, body)
.pipe(map(({ data }) => data));
}
/**
* Updates an existing employee record with the specified data.
*
* @param {number} id - The unique identifier of the employee to be updated.
* @param {EmployeeIn} body - The employee data to update the record with.
* @return {Observable<EmployeeOut>} An observable containing the updated employee data.
*/
putEmployee(id, body) {
return this.http.put(`${this.url}/employees/${id}`, body)
.pipe(map(({ data }) => data));
}
/**
* Deletes an employee based on the provided ID.
*
* @param {number} id - The unique identifier of the employee to delete.
* @return {Observable<{}>} An observable containing the response data after the employee is deleted.
*/
deleteEmployee(id) {
return this.http.delete(`${this.url}/employees/${id}`)
.pipe(map(({ data }) => data));
}
/**
* Retrieves the list of employees for a specified location based on provided query parameters.
*
* @param {QueryParams} params - The query parameters used to filter and retrieve the location employees.
* @returns {Observable<LocationEmployeesOut>} An observable that emits the list of employees for the specified location.
*/
getLocationEmployees(params) {
return this.http.get(`${this.url}/location-employees`, {
params,
}).pipe(map(({ data }) => data));
}
/**
* Fetches the location employee details for a given employee ID.
*
* @param {number} id - The unique identifier of the employee whose location details are to be retrieved.
* @return {Observable<LocationEmployeeOut>} An observable containing the location employee details.
*/
getLocationEmployee(id) {
return this.http.get(`${this.url}/location-employees/${id}`)
.pipe(map(({ data }) => data));
}
/**
* Deletes a specific location employee by their unique identifier.
*
* @param {number} id - The unique identifier of the employee to be deleted.
* @return {Observable<{}>} - An observable emitting the server's response after the deletion.
*/
deleteLocationEmployee(id) {
return this.http.delete(`${this.url}/location-employees/${id}`)
.pipe(map(({ data }) => data));
}
/**
* Sends a batch of location-employee associations to the server for processing.
*
* @param {LocationEmployeeBatchIn} body - The object containing a batch of location-employee data to be posted.
* @return {Observable<EmployeeOut>} An observable emitting the processed employee data from the server's response.
*/
postLocationEmployeeBatch(body) {
return this.http.post(`${this.url}/location-employees/batch`, body)
.pipe(map(({ data }) => data));
}
/**
* Retrieves a list of countries where the company operates.
*
* @param {QueryParams} params - The query parameters for the API request.
* @return {Observable<CompanyCountriesOut>} An observable containing the list of company countries.
*/
getCompanyCountries(params) {
return this.http.get(`${this.url}/company-countries`, { params })
.pipe(map(({ data }) => data));
}
/**
* Retrieves the country information for a specified company by its ID.
*
* @param {number} id - The unique identifier of the company.
* @return {Observable<CompanyCountryOut>} An observable containing the country information of the company.
*/
getCompanyCountry(id) {
return this.http.get(`${this.url}/company-countries/${id}`)
.pipe(map(({ data }) => data));
}
/**
* Sends a request to update or create a company country entry on the server.
*
* @param {CompanyCountryIn} body The data object representing the company country information to be sent to the server.
* @return {Observable<CompanyCountryOut>} An observable containing the server response with the updated or created company country data.
*/
postCompanyCountry(body) {
return this.http.put(`${this.url}/company-countries`, body)
.pipe(map(({ data }) => data));
}
/**
* Updates the country information for a specific company.
*
* @param {number} id - The unique identifier of the company whose country information needs to be updated.
* @param {CompanyCountryIn} body - The updated country information to be applied to the company.
* @return {Observable<CompanyCountryOut>} An observable that emits the updated company country information.
*/
putCompanyCountry(id, body) {
return this.http.put(`${this.url}/company-countries/${id}`, body)
.pipe(map(({ data }) => data));
}
/**
* Deletes a company-country association by its unique identifier.
*
* @param {number} id - The unique identifier of the company-country record to be deleted.
* @return {Observable<{}>} An observable emitting the result of the delete operation.
*/
deleteCompanyCountry(id) {
return this.http.delete(`${this.url}/company-countries/${id}`)
.pipe(map(({ data }) => data));
}
/**
* Fetches the reference currencies for a given country.
*
* @param {QueryParams} params - The query parameters to include in the request.
* @return {Observable<CountryReferenceCurrenciesOut>} The observable containing the country reference currencies data.
*/
getCountryReferenceCurrencies(params) {
return this.http.get(`${this.url}/country-reference-currencies`, { params })
.pipe(map(({ data }) => data));
}
/**
* Retrieves the reference currency details for a specific country using its ID.
*
* @param {number} id - The unique identifier of the country.
* @return {Observable<CountryReferenceCurrencyOut>} An observable emitting the country's reference currency details.
*/
getCountryReferenceCurrency(id) {
return this.http.get(`${this.url}/country-reference-currencies/${id}`)
.pipe(map(({ data }) => data));
}
/**
* Retrieves a list of currencies for different countries along with their current exchange rates.
*
* @param {QueryParams} params - The query parameters used to fetch the country reference currencies.
* @return {Observable<CountryCurrencyRate[]>} An observable that emits an array of country currency rates.
*/
getCountryCurrenciesWithRate(params) {
return this.getCountryReferenceCurrencies(params)
.pipe(mergeMap((currenciesData) => {
const $observables = currenciesData.country_reference_currencies
.map((item) => this.getCurrentExchanges({
currency_id: item.currency.id,
}).pipe(map((exchangesData) => ({
...item,
rate: exchangesData.exchanges[0]?.value,
}))));
return forkJoin($observables);
}));
}
/**
* Updates the reference currency for a specified country.
*
* @param {number} id - The unique identifier of the country.
* @param {CountryReferenceCurrencyIn} body - The data for updating the country's reference currency.
* @return {Observable<CountryReferenceCurrencyOut>} An Observable emitting the updated country reference currency data.
*/
putCountryReferenceCurrency(id, body) {
return this.http.put(`${this.url}/country-reference-currencies/${id}`, body)
.pipe(map(({ data }) => data));
}
/**
* Sends a POST request to create a country reference currency.
*
* @param {CountryReferenceCurrencyIn} body - The payload containing the country reference currency data.
* @return {Observable<CountryReferenceCurrencyOut>} An observable emitting the created country reference currency.
*/
postCountryReferenceCurrency(body) {
return this.http.post(`${this.url}/country-reference-currencies`, body)
.pipe(map(({ data }) => data));
}
/**
* Sends a POST request to create or update a country reference extra charge.
*
* @param {CountryReferenceExtraChargeIn} body - The request payload containing details about the country reference extra charge.
* @return {Observable<CountryReferenceExtraChargeOut>} An observable containing the response with the created or updated country reference extra charge.
*/
postCountryReferenceExtraCharge(body) {
return this.http.post(`${this.url}/country-reference-extra-charges`, body)
.pipe(map(({ data }) => data));
}
/**
* Updates a country reference extra charge by its ID.
*
* @param {number} id - The unique identifier of the country reference extra charge to be updated.
* @param {CountryReferenceExtraChargeIn} body - The data to update the country reference extra charge with.
* @return {Observable<CountryReferenceExtraChargeOut>} An observable that emits the updated country reference extra charge.
*/
putCountryReferenceExtraCharge(id, body) {
return this.http.put(`${this.url}/country-reference-extra-charges/${id}`, body)
.pipe(map(({ data }) => data));
}
/**
* Enables or disables a country reference extra charge based on the provided parameters.
*
* @param {CountryReferenceExtraCharge} extraCharge - The country reference extra charge object to be updated.
* @param {boolean} [isActive] - Optional parameter to explicitly set the active status of the extra charge.
* If not provided, the current active status will be toggled.
* @return {Observable<EmployeeCustomersOut>} An Observable that emits the updated employee customers output.
*/
patchCountryReferenceExtraCharge(extraCharge, isActive) {
return this.http.patch(`${this.url}/country-reference-extra-charges/${extraCharge.id}`, {
is_active: isActive ?? !extraCharge.is_active
}).pipe(map(({ data }) => data));
}
/**
* Fetches exchange data based on the provided query parameters.
*
* @param {QueryParams} params - The query parameters for retrieving exchange data.
* @return {Observable<ExchangesOut>} An observable containing the exchange data.
*/
getExchanges(params) {
return this.http.get(`${this.url}/exchanges`, { params })
.pipe(map(({ data }) => data));
}
/**
* Sends a POST request to create or update an exchange.
*
* @param {ExchangeIn} body - The request body containing the exchange data to be sent.
* @return {Observable<ExchangeOut>} An observable that emits the response containing the created or updated exchange data.
*/
postExchange(body) {
return this.http.put(`${this.url}/exchanges`, body)
.pipe(map(({ data }) => data));
}
/**
* Updates an existing exchange with new data.
*
* @param {number} id - The unique identifier of the exchange to update.
* @param {ExchangeIn} body - The data to update the exchange with.
* @return {Observable<ExchangeOut>} An observable that emits the updated exchange data.
*/
putExchange(id, body) {
return this.http.put(`${this.url}/exchanges/${id}`, body)
.pipe(map(({ data }) => data));
}
/**
* Retrieves the current exchanges based on the given query parameters.
*
* @param {QueryParams} params - The query parameters to filter the exchanges.
*
* @returns {Observable<ExchangesOut>} - An observable that emits the API response data containing the current exchanges.
*/
getCurrentExchanges(params) {
return this.http.get(`${this.url}/exchanges/current`, { params })
.pipe(map(({ data }) => data));
}
/**
* Fetches the country-specific tax information for a company.
*
* @param {QueryParams} params - The parameters used to filter and query the taxes.
* @return {Observable<CompanyCountryTaxesOut>} An observable that emits the tax information.
*/
getCompanyCountryTaxes(params) {
return this.http.get(`${this.url}/company-country-taxes`, { params })
.pipe(map(({ data }) => data));
}
/**
* Fetches account information based on the provided query parameters.
*
* @param {QueryParams} params - The query parameters for fetching account data.
* @return {Observable<AccountsOut>} An observable emitting the account data.
*/
getAccounts(params) {
return this.http.get(`${this.url}/accounts`)
.pipe(map(({ data }) => data));
}
/**
* Fetches the account information for the specified account ID.
*
* @param {number} id - The unique identifier of the account to retrieve.
* @return {Observable<AccountOut>} An observable that emits the account details.
*/
getAccount(id) {
return this.http.get(`${this.url}/accounts/${id}`)
.pipe(map(({ data }) => data));
}
/**
* Creates a new account by sending account details in the body.
*
* @param {AccountIn} body - The account information to be sent in the request body.
* @return {Observable<AccountOut>} Observable that emits the created account details upon success.
*/
postAccount(body) {
return this.http.post(`${this.url}/accounts`, body)
.pipe(map(({ data }) => data));
}
/**
* Updates an account with the specified ID using the provided data.
*
* @param {number} id - The unique identifier of the account to be updated.
* @param {AccountIn} body - The data to update the account with.
* @return {Observable<AccountOut>} An observable emitting the updated account details.
*/
putAccount(id, body) {
return this.http.post(`${this.url}/accounts/${id}`, body)
.pipe(map(({ data }) => data));
}
/**
* Fetches account entity data from the server based on the provided query parameters.
*
* @param {QueryParams} params - The query parameters to be sent with the HTTP request.
* @return {Observable<AccountEntitiesOut>} An observable that emits the account entities data.
*/
getAccountEntities(params) {
return this.http.get(`${this.url}/account-entities`, { params })
.pipe(map(({ data }) => data));
}
/**
* Updates an account entity using the provided details.
*
* @param {AccountEntitiesIn} body The account entity data to be updated.
* @return {Observable<AccountEntitiesOut>} An observable containing the updated account entity details.
*/
putAccountEntity(body) {
return this.http.put(`${this.url}/account-entities`, body)
.pipe(map(({ data }) => data));
}
/**
* Retrieves the list of active account entities based on the provided query parameters.
*
* @param {QueryParams} params - The parameters to filter and query active account entities.
* @return {Observable<AccountEntitiesOut>} An observable that emits the list of active account entities.
*/
getAccountEntitiesActives(params) {
return this.http.get(`${this.url}/account-entities/actives`, { params })
.pipe(map(({ data }) => data));
}
/**
* Fetches a list of account categories based on the provided query parameters.
*
* @param {QueryParams} params - The query parameters used to filter the account categories.
* @return {Observable<AccountCategoriesOut>} An observable that emits the fetched account categories data.
*/
getAccountCategories(params) {
return this.http.get(`${this.url}/account-categories`, { params, })
.pipe(map(({ data }) => data));
}
/**
* Retrieves a list of account types from the server.
*
* @param {QueryParams} params - The query parameters to filter or customize the request.
* @return {Observable<AccountTypesOut>} An observable emitting the account types data.
*/
getAccountTypes(params) {
return this.http.get(`${this.url}/account-types`, { params, })
.pipe(map(({ data }) => data));
}
/**
* Retrieves the account type for the given account ID.
*
* @param {number} id - The unique identifier of the account.
* @return {Observable<AccountTypeOut>} An observable that emits the account type data.
*/
getAccountType(id) {
return this.http.get(`${this.url}/account-types/${id}`)
.pipe(map(({ data }) => data));
}
/**
* Sends a POST request to create a new account type.
*
* @param {AccountTypeIn} body - The data for the account type to be created.
* @return {Observable<AccountTypeOut>} An observable that emits the created account type object.
*/
postAccountType(body) {
return this.http.post(`${this.url}/account-types`, body)
.pipe(map(({ data }) => data));
}
/**
* Updates an account type with the specified ID using the provided data.
*
* @param {number} id - The unique identifier of the account type to update.
* @param {AccountTypeIn} body - The data to update the account type with.
* @return {Observable<AccountTypeOut>} An observable containing the updated account type data.
*/
putAccountType(id, body) {
return this.http.put(`${this.url}/account-types/${id}`, body)
.pipe(map(({ data }) => data));
}
/**
* Retrieves parameters based on the provided query parameters.
*
* @param {QueryParams} params - The query parameters used to filter or fetch the desired parameters.
* @return {Observable<ParametersOut>} An observable that emits the fetched parameters.
*/
getParameters(params) {
return this.http.get(`${this.url}/parameters`, { params, })
.pipe(map(({ data }) => data));
}
/**
* Retrieves the parameter values based on the provided parameter names.
*
* @param {Object} params - An object containing the required parameters.
* @param {string[]} params.paramNames - An array of parameter names for which the values need to be fetched.
* @return {Observable<ParametersValuesOut>} An observable that emits the fetched parameter values.
*/
getParametersValues({ paramNames }) {
const parameters = paramNames.map((p) => ({ name: p }));
return this.http.post(`${this.url}/parameters-values`, { parameters })
.pipe(map(({ data }) => data));
}
/**
* Retrieves parameter values based on the provided level configuration.
*
* @param {ParametersByLevelIn} parameters - The input object containing the criteria or level details to retrieve the parameters.
* @return {Observable<ParametersValuesOut>} An observable that emits the parameter values fetched from the server.
*/
getParameterValueByModel(parameters) {
return this.http.post(`${this.url}/parameters-values`, { parameters })
.pipe(map(({ data }) => data));
}
/**
* Retrieves the value of a specified parameter.
*
* @param {Object} input - The input object containing the parameter details.
* @param {string} input.paramName - The name of the parameter whose value is to be retrieved.
* @return {Observable<ParameterValueOut>} An observable emitting the value of the specified parameter.
*/
getParameterValue({ paramName, }) {
return this.http.get(`${this.url}/parameters-values/${paramName}`)
.pipe(map(({ data }) => data));
}
/**
* Retrieves a list of country references based on the given query parameters.
*
* @param {QueryParams} params - The query parameters for retrieving country references.
* @return {Observable<CountryReferencesOut>} An observable containing the country reference data.
*/
getCountryReferences(params) {
return this.http.get(`${this.url}/country-references`, { params })
.pipe(map(({ data }) => data));
}
/**
* Fetches the country reference data for a given country ID.
*
* @param {number} id - The unique identifier of the country for which the reference data is to be retrieved.
* @return {Observable<CountryReferenceOut>} An observable containing the country reference data.
*/
getCountryReference(id) {
return this.http.get(`${this.url}/country-references/${id}`)
.pipe(map(({ data }) => data));
}
/**
* Updates a country reference resource with the specified ID and data.
*
* @param {number} id - The unique identifier of the country reference to be updated.
* @param {CountryReferenceIn} body - The data to update the country reference with.
* @return {Observable<CountryReferenceOut>} An observable that emits the updated country reference object.
*/
putCountryReference(id, body) {
return this.http.put(`${this.url}/country-references/${id}`, body)
.pipe(map(({ data }) => data));
}
/**
* Fetches the list of workflows based on the provided query parameters.
*
* @param {QueryParams} params - The query parameters used to filter workflows.
* @return {Observable<WorkflowsOut>} An observable containing the workflow data.
*/
getWorkflows(params) {
return this.http.get(`${this.url}/workflows`, { params })
.pipe(map(({ data }) => data));
}
/**
* Fetches the list of employee customer
*
* @param {QueryParams} params - The query parameters used to filter employee customers.
* @return {Observable<EmployeeCustomersOut>} An observable containing the employee customer data.
*/
getEmployeesCustomers(params) {
return this.http.get(`${this.url}/employee-customers`, { params })
.pipe(map(({ data }) => data));
}
/**
* Sends a POST request to create or update employee customer records and processes the server response.
*
* @param {EmployeeCustomersIn} body - The request payload containing employee customer data to be sent to the server.
* @return {Observable<EmployeeCustomersOut>} An observable that emits the updated employee customer data on successful response.
*/
postEmployeeCustomers(body) {
return this.http.post(`${this.url}/employee-customers`, body)
.pipe(map(({ data }) => data));
}
/**
* Updates the employee-customer association record identified by the given ID with the provided data.
*
* @param {number} id - The identifier of the employee-customer record to update.
* @param {EmployeeCustomersIn} body - The data to update the employee-customer record with.
* @return {Observable<EmployeeCustomersOut>} An observable that emits the updated employee-customer data.
*/
putEmployeeCustomers(id, body) {
return this.http.put(`${this.url}/employee-customers/${id}`, body)
.pipe(map(({ data }) => data));
}
/**
* Fetches the employee-customer details based on the provided employee customer ID.
*
* @param {number} id - The identifier of the employee-customer record to update.
* @return {Observable<EmployeeCustomersOut>} An observable that emits the updated employee-customer data.
*/
getEmployeeCustomer(id) {
return this.http.get(`${this.url}/employee-customers/${id}`)
.pipe(map(({ data }) => data));
}
/**
* Enables or disables an employee customer's active state.
*
* @param {EmployeeCustomerDhl} employee - The employee customer object to be updated.
* @param {boolean} [isActive] - Optional parameter to explicitly set the active state.
* If null or undefined, the active state will be toggled.
* @return {Observable<EmployeeCustomersOut>} An observable containing the updated employee customer output.
*/
patchEmployeeCustomers(employee, isActive) {
return this.http.patch(`${this.url}/employee-customers/${employee.id}`, {
is_active: isActive ?? !employee.is_active
}).pipe(map(({ data }) => data));
}
/**
* Submits a file containing employee customer data for a specific country to the server.
*
* @param {number} countryId - The identifier of the country for which the data is being uploaded.
* @param {File} file - The file contains employee customer data to be uploaded.
* @return {Observable<BoardingProcessIdIn>} Observable that emits the processed boarding process ID on success.
*/
postEmployeeCustomersLoad(countryId, file) {
const body = new FormData();
body.append('file', file);
body.append('country_id', countryId.toString());
return this.http.post(`${this.url}/employee-customers/load`, body)
.pipe(map(({ data }) => data));
}
/**
* Downloads a file containing customer data for a specific employee based on the provided country ID.
*
* @param {number} id - The ID of the country used as a filter for fetching the employee's customers.
* @return {Observable<Blob>} An observable that emits the file blob containing the customer data.
*/
getEmployeeCustomersDownload(id) {
return this.http.get(`${this.url}/employee-customers/download`, {
params: { country_id: id },
responseType: 'blob'
});
}
/**
* Retrieves the boarding process details for a given ID.
*
* @param {number} id - The unique identifier of the boarding process to retrieve.
* @return {Observable<BoardingProcessIn>} An observable containing the boarding process details.
*/
getBoardingProcess(id) {
return this.http.get(`${this.url}/boarding-process/${id}`)
.pipe(map(({ data }) => data));
}
/**
* Fetches a list of systems based on the provided query parameters.
*
* @param {QueryParams} params - The parameters used to filter the systems.
* @return {Observable<SystemsOut>} An observable that emits the retrieved systems data.
*/
getSystems(params) {
return this.http.get(`${this.url}/systems`, { params })
.pipe(map(({ data }) => data));
}
/**
* Retrieves the system by the specified ID.
*
* @param {number} id - The unique identifier of the system to be retrieved.
* @return {Observable<SystemOut>} An observable that emits the requested system information.
*/
getSystem(id) {
return this.http.get(`${this.url}/systems/${id}`)
.pipe(map(({ data }) => data));
}
/**
* Sends a POST request to create or update a system.
*
* @param {SystemIn} body - The data representing the system to be created or updated.
* @return {Observable<SystemOut>} An observable emitting the resulting system output after the API request succeeds.
*/
postSystem(body) {
return this.http.post(`${this.url}/systems`, body)
.pipe(map(({ data }) => data));
}
/**
* Updates the system identified by the given ID with the provided request body and returns the updated system details.
*
* @param {number} id - The unique identifier of the system to be updated.
* @param {SystemIn} body - The payload containing the updated system details.
* @return {Observable<SystemOut>} An observable emitting the updated system data.
*/
putSystem(id, body) {
return this.http.post(`${this.url}/systems/${id}`, body)
.pipe(map(({ data }) => data));
}
/**
* Retrieves a list of system entities based on the specified query parameters.
*
* @param {QueryParams} params - The query parameters used to filter or specify the system entities to retrieve.
* @return {Observable<SystemEntitiesOut>} An Observable that emits the retrieved system entities.
*/
getSystemEntities(params) {
return this.http.get(`${this.url}/system-entities`, { params })
.pipe(map(({ data }) => data));
}
/**
* Updates the system entities by sending the provided data to the server.
*
* @param {SystemEntitiesIn} body - The data object representing the system entities to be updated.
* @return {Observable<SystemEntitiesOut>} An observable containing the updated system entities data.
*/
putSystemEntities(body) {
return this.http.put(`${this.url}/system-entities`, body)
.pipe(map(({ data }) => data));
}
/**
* Retrieves workflow configurations based on the provided query parameters.
*
* @param {QueryParams} params - The query parameters to filter the workflow configurations.
* @return {Observable<WorkflowConfigsOut>} An observable emitting the workflow configurations.
*/
getWorkflowConfigs(params) {
return this.http.get(`${this.url}/workflow-configs`, { params })
.pipe(map(({ data }) => data));
}
/**
* Sends a batch of workflow configuration data to the server for processing.
*
* @param {WorkflowConfigsBatchIn} body - The input data containing a batch of workflow configurations to be sent.
* @return {Observable<WorkflowConfigsOut>} An observable that emits the processed batch of workflow configuration data as a response.
*/
postWorkflowConfigsBatch(body) {
return this.http.post(`${this.url}/workflow-configs/batch`, body)
.pipe(map(({ data }) => data));
}
/**
* Sends a POST request to create a new company and returns the created company's details.
*
* @param {CompanyIn} body - The payload containing the details of the company to be created.
* @return {Observable<CompanyOut>} An Observable emitting the response with the created company's details.
*/
postCompany(body) {
return this.http.post(`${this.url}/companies`, body)
.pipe(map(({ data }) => data));
}
/**
* Updates the details of an existing company using its ID.
*
* @param {number} id - The unique identifier of the company to update.
* @param {CompanyIn} body - The object containing the updated company data.
* @return {Observable<CompanyOut>} An observable that emits the updated company details.
*/
putCompany(id, body) {
return this.http.put(`${this.url}/companies/${id}`, body)
.pipe(map(({ data }) => data));
}
/**
* Deletes a company by its unique identifier.
*
* @param {number} id - The unique identifier of the company to be deleted.
* @return {Observable<{}>} An observable that emits an empty object upon successful deletion or an error if the operation fails.
*/
deleteCompany(id) {
return this.http.delete(`${this.url}/companies/${id}`)
.pipe(map(({ data }) => data));
}
/**
* Fetches product entities from the server based on the provided query parameters.
*
* @param {QueryParams} params The query parameters used to modify the request for product entities.
* @return {Observable<ProductEntitiesOut>} An observable that emits the product entities retrieved from the server.
*/
getProductEntities(params) {
return this.http.get(`${this.url}/product-entities`, { params })
.pipe(map(({ data }) => data));
}
/**
* Sends a PUT request to update product entities and returns the updated entity.
*
* @param {ProductEntitiesIn} body - The payload containing the data to update the product entity.
* @return {Observable<ProductEntitiesOut>} Observable that emits the updated product entity.
*/
putProductEntities(body) {
return this.http.put(`${this.url}/product-entities`, body)
.pipe(map(({ data }) => data));
}
/**
* Retrieves the country reference products based on the given query parameters.
*
* @param {QueryParams} params The query parameters used to filter and retrieve the country reference products.
* @return {Observable<CountryReferenceProductsOut>} An observable emitting the fetched country reference products data.
*/
getCountryReferenceProducts(params) {
return this.http.get(`${this.url}/country-reference-products`, { params })
.pipe(map(({ data }) => data));
}
/**
* Sends a request to update or create country reference products.
*
* @param {CountryReferenceProductIn} body - The payload containing the details of the country reference products to post.
* @return {Observable<CountryReferenceProductOut>} An observable that emits the updated or created country reference product data.
*/
postCountryReferenceProducts(body) {
return this.http.put(`${this.url}/country-reference-products`, body)
.pipe(map(({ data }) => data));
}
/**
* Updates a country reference product with the specified ID using the provided data.
*
* @param {number} id - The unique identifier of the country reference product to update.
* @param {CountryReferenceProductIn} body - The updated country reference product data to be sent in the request body.
* @return {Observable<CountryReferenceProductOut>} An observable emitting the updated country reference product.
*/
putCountryReferenceProducts(id, body) {
return this.http.put(`${this.url}/country-reference-products/${id}`, body)
.pipe(map(({ data }) => data));
}
/**
* Fetches the extra charge entities from the server based on the provided query parameters.
*
* @param {QueryParams} params - An object containing the query parameters to filter the extra charge entities.
* @return {Observable<ExtraChargeEntitiesOut>} An observable that emits the extra charge entities retrieved from the server.
*/
getExtraChargeEntities(params) {
return this.http.get(`${this.url}/extracharge-entities`, { params })
.pipe(map(({ data }) => data));
}
/**
* Updates extra charge entities by sending the provided data to the server.
*
* @param {ExtraChargeEntitiesIn} body - The data to update the extra charge entities.
* @return {Observable<ExtraChargeEntitiesOut>} An observable that emits the updated extra charge entities.
*/
putExtraChargeEntities(body) {
return this.http.put(`${this.url}/extracharge-entities`, body)
.pipe(map(({ data }) => data));
}
/**
* Retrieves the parameter configurations based on the provided query parameters.
*
* @param {QueryParams} params - The query parameters to filter the parameter configurations.
* @return {Observable<ParameterConfigsOut>} An observable that emits the parameter configurations data.
*/
getParameterConfigs(params) {
return this.http.get(`${this.url}/parameter-configs`, { params })
.pipe(map(({ data }) => data));
}
/**
* Submits a configuration for parameters to the server.
*
* @param {ParameterConfigIn} body - The input configuration object containing the parameters to be submitted.
* @return {Observable<ParameterConfigOut>} An observable emitting the server's response containing the updated parameter configuration.
*/
postParameterConfig(body) {
return this.http.delete(`${this.url}/parameter-configs`)
.pipe(map(({ data }) => data));
}
/**
* Updates the configuration of a parameter with the provided ID and input data.
*
* @param {number} id - The unique identifier of the parameter configuration to be updated.
* @param {ParameterConfigIn} body - The input data containing the updated configuration for the parameter.
* @return {Observable<ParameterConfigOut>} An observable that emits the updated parameter configuration.
*/
putParameterConfig(id, body) {
return this.http.delete(`${this.url}/parameter-configs/${id}`)
.pipe(map(({ data }) => data));
}
/**
* Deletes a parameter configuration specified by its ID.
*
* @param {number} id - The unique identifier of the parameter configuration to be deleted.
* @return {Observable<ParameterConfigOut>} An observable containing the deleted parameter configuration data.
*/
deleteParameterConfig(id) {
return this.http.delete(`${this.url}/parameter-configs/${id}`)
.pipe(map(({ data }) => data));
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiCompaniesService, deps: [{ token: 'env' }, { token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiCompaniesService, providedIn: 'root' });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiCompaniesService, decorators: [{
type: Injectable,
args: [{
providedIn: 'root'
}]
}], ctorParameters: () => [{ type: undefined, decorators: [{
type: Inject,
args: ['env']
}] }, { type: i1.HttpClient }] });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBpLWNvbXBhbmllcy5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvZXhwZXJ0ZWFtLW14L25neC1zZXJ2aWNlcy9zcmMvbGliL2FwaXMvYXBpLWNvbXBhbmllcy5zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxNQUFNLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFBO0FBMkVsRCxPQUFPLEVBQUUsUUFBUSxFQUFFLEdBQUcsRUFBRSxRQUFRLEVBQWMsTUFBTSxNQUFNLENBQUE7OztBQVUxRCxNQUFNLE9BQU8sbUJBQW1CO0lBRUw7SUFDZjtJQUZWLFlBQ3lCLFlBQXlCLEVBQ3hDLElBQWdCO1FBREQsaUJBQVksR0FBWixZQUFZLENBQWE7UUFDeEMsU0FBSSxHQUFKLElBQUksQ0FBWTtJQUN0QixDQUFDO0lBRUw7Ozs7T0FJRztJQUNILElBQUksR0FBRztRQUNMLE9BQU8sSUFBSSxDQUFDLFlBQVksQ0FBQyxlQUFlLElBQUksRUFBRSxDQUFBO0lBQ2hELENBQUM7SUFFRDs7Ozs7T0FLRztJQUNILGdCQUFnQixDQUFFLE1BQW1CO1FBQ25DLE9BQU8sSUFBSSx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