Answer the question
In order to leave comments, you need to log in
Am I able to properly organize API data processing using classes?
Greetings. Developed several classes for interacting with the Bitrix API. It was required to display statistics for each employee: the number of calls, transactions, and so on. Please rate and criticize my code. More details below
Link to github: https://github.com/afagorn/bitrix24-api
Class capabilities
For each "entity" of Bitrix (calls, bills, etc.), a separate class is created, where the necessary filter for Bitrix and "wrapper methods" are written , which set their own set of arguments and fill the array with user data. For example, the getInvoicesHistoryByEmployeesId() method, which accepts user IDs, date, and payment status. These wrappers are made
There is a base class Base, where common methods and variables are specified. An important variable is requestParameters (getRequestParameters getter), where data for a request to Bitrix is specified in the child classes. And it also contains values from the array of the requestData class. For example:
[
"FILTER" => array(
"STATUS_ID" => $this->requestData['statusId'],
">=PAY_VOUCHER_DATE" => $this->requestData['dateStart'],
"<=PAY_VOUCHER_DATE" => $this->requestData['dateEnd'],
'RESPONSIBLE_ID' => $this->requestData['employeesId'],
),
];
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question