Skip to content

Latest commit

 

History

History
48 lines (41 loc) · 2.03 KB

structure.md

File metadata and controls

48 lines (41 loc) · 2.03 KB

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:

  1. The Client itself doesn't contain any API methods implementations.
  2. ResourceGroups implements all API methods.
  3. Every method can accept from zero to several arguments.
  4. URI path arguments (not the query string ones) are always passed as separate method arguments.
  5. Query parameters are always passed in the form of the Request model. The same principle applies to the POST form data.
  6. 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.
  7. All DTO's you'll ever need can be found in the RetailCrm\Api\Model namespace.
  8. 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: