UNPKG

@experteam-mx/ngx-services

Version:

Angular common services for Experteam apps

168 lines (167 loc) 9.24 kB
import { HttpClient } from '@angular/common/http'; import { Environment } from '../ngx-services.models'; import { Observable } from 'rxjs'; import { QueryParams } from './models/api.models'; import { CustomerRestrictionIn, CustomerRestrictionInV2, CustomerRestrictionOut, CustomerRestrictionsOut, DiscountIn, DiscountOut, DiscountsOut, LoyaltyPeriodIn, LoyaltyPeriodOut, LoyaltyPeriodsOut, LoyaltyRuleIn, LoyaltyRuleOut, LoyaltyRulesOut, OperationsLoadTopCustomerV2In, TopCustomersOut } from './models/api-discounts.types'; import * as i0 from "@angular/core"; export declare class ApiDiscountsService { private environments; private http; constructor(environments: Environment, http: HttpClient); /** * Gets the API endpoint URL for discounts from the environments configuration. * * @return {string} The URL for the discounts API. Returns an empty string if not defined. */ get url(): string; /** * Fetches available discounts based on the provided query parameters. * * @param {QueryParams} params - The query parameters used to filter and retrieve discounts. * @return {Observable<DiscountsOut>} An Observable that emits the retrieved discounts data. */ getDiscounts(params: QueryParams): Observable<DiscountsOut>; /** * Sends a request to create or update discounts on the server. * * @param {DiscountIn} body - The discount information to be submitted. * @return {Observable<DiscountOut>} An Observable emitting the server's response containing the created or updated discount details. */ postDiscounts(body: DiscountIn): Observable<DiscountOut>; /** * Updates the discount information for a specific item. * * @param {number} id - The unique identifier of the item whose discount is to be updated. * @param {DiscountIn} body - The payload containing the updated discount details. * @return {Observable<DiscountOut>} An observable emitting the updated discount details. */ putDiscounts(id: number, body: DiscountIn): Observable<DiscountOut>; /** * Retrieves the top customers based on the provided query parameters. * * @param {QueryParams} params - The query parameters to filter and sort the top customers. * @return {Observable<TopCustomersOut>} An observable emitting the list of top customers. */ getTopCustomers(params: QueryParams): Observable<TopCustomersOut>; /** * Sends a POST request to load the top customer data in the system, using the provided input. * Transforms the API response to extract the data field containing the discount information. * * @param {OperationsLoadTopCustomerV2In} body - The input payload containing the company country ID and the file. * @param {number} body.company_country_id - The ID of the company's country. * @param {File} body.file - The file containing data to be processed. * @return {Observable<DiscountOut>} An observable containing the discount output information. */ postOperationsLoadTopCustomerV2(body: OperationsLoadTopCustomerV2In): Observable<{}>; /** * Fetches the loyalty periods based on the provided query parameters. * * @param {QueryParams} params - An object containing query parameters to filter the periods. * @return {Observable<LoyaltyPeriodsOut>} An observable that emits the fetched loyalty periods. */ getLoyaltyPeriods(params: QueryParams): Observable<LoyaltyPeriodsOut>; /** * Retrieves the loyalty period details for the given ID. * * @param {number} id - The unique identifier of the loyalty period to retrieve. * @return {Observable<LoyaltyPeriodOut>} An observable emitting the loyalty period details. */ getLoyaltyPeriod(id: number): Observable<LoyaltyPeriodOut>; /** * Sends a PUT request to update the loyalty period with the provided data. * * @param {LoyaltyPeriodIn} body - The data for the loyalty period to be updated. * @return {Observable<LoyaltyPeriodOut>} An observable that emits the updated loyalty period data. */ postLoyaltyPeriod(body: LoyaltyPeriodIn): Observable<LoyaltyPeriodOut>; /** * Updates the loyalty period for a specified ID with the provided data. * * @param {number} id - The unique identifier of the loyalty period to update. * @param {LoyaltyPeriodIn} body - An object containing the updated details of the loyalty period. * @return {Observable<LoyaltyPeriodOut>} An observable that emits the updated loyalty period details. */ putLoyaltyPeriod(id: number, body: LoyaltyPeriodIn): Observable<LoyaltyPeriodOut>; /** * Retrieves the loyalty rules based on the provided query parameters. * * @param {QueryParams} params - The query parameters to filter the loyalty rules. * @return {Observable<LoyaltyRulesOut>} An observable containing the loyalty rules output. */ getLoyaltyRules(params: QueryParams): Observable<LoyaltyRulesOut>; /** * Retrieves a specific loyalty rule based on the provided ID. * * @param {number} id - The unique identifier of the loyalty rule to retrieve. * @return {Observable<LoyaltyRuleOut>} An observable that emits the details of the specified loyalty rule. */ getLoyaltyRule(id: number): Observable<LoyaltyRuleOut>; /** * Sends a request to add or update a loyalty rule. * * @param {LoyaltyRuleIn} body - The loyalty rule data to be sent to the server. * @return {Observable<LoyaltyRuleOut>} An observable that emits the updated loyalty rule details. */ postLoyaltyRule(body: LoyaltyRuleIn): Observable<LoyaltyRuleOut>; /** * Updates an existing loyalty rule with the provided data. * * @param {number} id - The unique identifier of the loyalty rule to update. * @param {LoyaltyRuleIn} body - The data to update the loyalty rule with. * @return {Observable<LoyaltyRuleOut>} An observable that emits the updated loyalty rule. */ putLoyaltyRule(id: number, body: LoyaltyRuleIn): Observable<LoyaltyRuleOut>; /** * Fetches customer restrictions based on the provided query parameters. * * @param {QueryParams} params - The query parameters to filter customer restrictions. * @return {Observable<CustomerRestrictionsOut>} An observable that emits the customer restrictions data. */ getCustomerRestrictions(params: QueryParams): Observable<CustomerRestrictionsOut>; /** * Retrieves customer restriction details for a given customer ID. * * @param {number} id - The unique identifier of the customer. * @return {Observable<CustomerRestrictionOut>} An observable containing the customer restriction details. */ getCustomerRestriction(id: number): Observable<CustomerRestrictionOut>; /** * Sends a request to apply a restriction to a customer. * * @param {CustomerRestrictionIn} body - The restriction details to be applied to the customer. * @return {Observable<CustomerRestrictionOut>} An observable containing the response with the applied customer restriction. */ postCustomerRestriction(body: CustomerRestrictionIn): Observable<CustomerRestrictionOut>; /** * Updates customer restrictions using the provided ID and data. * * @param {number} id - The unique identifier of the customer restriction to be updated. * @param {LoyaltyRuleIn} body - The data object containing the customer restriction details to be updated. * @return {Observable<CustomerRestrictionOut>} An observable emitting the updated customer restriction details. */ putCustomerRestriction(id: number, body: CustomerRestrictionIn): Observable<CustomerRestrictionOut>; /** * Deletes a customer restriction by its ID. * * @param {number} id - The unique identifier of the customer restriction to delete. * @return {Observable<{}>} An Observable that emits the result of the deletion operation. */ deleteCustomerRestriction(id: number): Observable<{}>; /** * Sends a request to apply a restriction to a customer (Version 2). * * @param {CustomerRestrictionInV2} body - The restriction details to be applied to the customer. * @return {Observable<CustomerRestrictionOut>} An observable containing the response with the applied customer restriction. */ postCustomerRestrictionV2(body: CustomerRestrictionInV2): Observable<CustomerRestrictionOut>; /** * Updates customer restrictions using the provided ID and data (Version 2). * * @param {number} id - The unique identifier of the customer restriction to be updated. * @param {CustomerRestrictionInV2} body - The data object containing the customer restriction details to be updated. * @return {Observable<CustomerRestrictionOut>} An observable emitting the updated customer restriction details. */ putCustomerRestrictionV2(id: number, body: CustomerRestrictionInV2): Observable<CustomerRestrictionOut>; static ɵfac: i0.ɵɵFactoryDeclaration<ApiDiscountsService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<ApiDiscountsService>; }