2.0 KiB
2.0 KiB
Client structure
The client is separated into several resource groups, all of which are accessible through the Client's public properties. Each resource group is responsible for the corresponding API section. It is much easier to understand how the Client works by learning its design principles.
Design principles
The general principles of the Client design are:
- The Client itself doesn't contain any API methods implementations.
- ResourceGroups implements all API methods.
- Every method can accept from zero to several arguments.
- URI path arguments (not the query string ones) are always passed as separate method arguments.
- Query parameters are always passed in the form of the Request model. The same principle applies to the POST form data.
- If the Request contains only one parameter - it'll probably accept it through the constructor. This doesn't apply to the filter requests, which don't have constructors at all.
- All DTO's you'll ever need can be found in the
RetailCrm\Api\Model
namespace. - Every method has an example of the usage in its DocBlock. Yes, all of them. You can learn how to use any of the methods just by looking at the DocBlock help tooltip provided by your IDE. If it's not provided by your IDE - you'll need to look up how to configure it. It'll ease your work with this (and any other) library a lot.
Resource groups
The resource groups list into which client is separated:
api
costs
customFields
customers
customersCorporate
delivery
features
files
integration
loyalty
notifications
orders
packs
payments
references
segments
settings
store
tasks
telephony
users
verification
statistics
webAnalytics
There is also a special customMethods
group that is used for custom API methods. Each group except this one implements corresponding API documentation block: