minimax-client
Version:
TypeScript client library for the Minimax accounting API (https://moj.minimax.rs/RS/API/)
219 lines (218 loc) • 4.09 kB
TypeScript
/**
* Customers module
*
* Module for interacting with customers in the Minimax API
*/
import { BaseResource } from './base-resource';
/**
* Customer resource
*/
export interface Customer {
/**
* Unique identifier
*/
Id: string;
/**
* Concurrency control token
*/
RowVersion: string;
/**
* Customer name
*/
Name: string;
/**
* Tax number
*/
TaxNumber?: string;
/**
* Registration number
*/
RegistrationNumber?: string;
/**
* Email
*/
Email?: string;
/**
* Phone
*/
Phone?: string;
/**
* Address
*/
Address?: {
Street?: string;
City?: string;
PostalCode?: string;
Country?: string;
};
/**
* Customer type
*/
Type?: 'Individual' | 'Company';
/**
* Whether the customer is active
*/
IsActive: boolean;
}
/**
* Customer creation parameters
*/
export interface CreateCustomerParams {
/**
* Customer name
*/
Name: string;
/**
* Tax number
*/
TaxNumber?: string;
/**
* Registration number
*/
RegistrationNumber?: string;
/**
* Email
*/
Email?: string;
/**
* Phone
*/
Phone?: string;
/**
* Address
*/
Address?: {
Street?: string;
City?: string;
PostalCode?: string;
Country?: string;
};
/**
* Customer type
*/
Type?: 'Individual' | 'Company';
/**
* Whether the customer is active
*/
IsActive?: boolean;
}
/**
* Customer update parameters
*/
export interface UpdateCustomerParams {
/**
* Customer name
*/
Name?: string;
/**
* Tax number
*/
TaxNumber?: string;
/**
* Registration number
*/
RegistrationNumber?: string;
/**
* Email
*/
Email?: string;
/**
* Phone
*/
Phone?: string;
/**
* Address
*/
Address?: {
Street?: string;
City?: string;
PostalCode?: string;
Country?: string;
};
/**
* Customer type
*/
Type?: 'Individual' | 'Company';
/**
* Whether the customer is active
*/
IsActive?: boolean;
}
/**
* Customer filter options
*/
export interface CustomerFilterOptions {
/**
* Filter by name (contains)
*/
name?: string;
/**
* Filter by tax number
*/
taxNumber?: string;
/**
* Filter by type
*/
type?: 'Individual' | 'Company';
/**
* Filter by active status
*/
isActive?: boolean;
/**
* Maximum number of results to return
*/
limit?: number;
/**
* Number of results to skip
*/
offset?: number;
/**
* Whether to include the total count
*/
count?: boolean;
}
/**
* Customers module
*/
export declare class CustomersModule extends BaseResource {
/**
* Base endpoint for customers
*/
protected readonly endpoint = "customers";
/**
* Get all customers
*
* @param options Filter options
* @returns Promise resolving to an array of customers
*/
getAll(options?: CustomerFilterOptions): Promise<Customer[]>;
/**
* Get a customer by ID
*
* @param id Customer ID
* @returns Promise resolving to the customer
*/
get(id: string): Promise<Customer>;
/**
* Create a new customer
*
* @param params Customer creation parameters
* @returns Promise resolving to the created customer
*/
create(params: CreateCustomerParams): Promise<Customer>;
/**
* Update a customer
*
* @param id Customer ID
* @param params Customer update parameters
* @returns Promise resolving to the updated customer
*/
update(id: string, params: UpdateCustomerParams): Promise<Customer>;
/**
* Delete a customer
*
* @param id Customer ID
* @returns Promise resolving when the customer is deleted
*/
delete(id: string): Promise<void>;
}