Skip to content

Commit f2c3aa9

Browse files
committed
Doc
1 parent 0dd3ce1 commit f2c3aa9

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

CONTRIBUTING.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
## Note on Patches/Pull Requests
2+
23
1. Fork the project.
34
2. Make your feature addition or bug fix.
45
3. Add tests for it. This is important so that we don't break your improvement in a future version unintentionally.
@@ -45,7 +46,8 @@ Class docblocks should contain:
4546
* A short description of the class
4647
* Any methods available that are called via magic method with what that method returns.
4748

48-
A good example is
49+
A good example is:
50+
4951
``` php
5052
/**
5153
* Client class, base level access
@@ -56,17 +58,17 @@ A good example is
5658
*/
5759
```
5860

59-
6061
#### Methods
6162

6263
Method docblocks should contain:
64+
6365
* A short description of what the method does.
6466
* The parameters passed with what type to expect.
6567
* Description of the parameters passed with examples(optional).
6668
* The type of the return.
6769
* All the possible exceptions the method may throw.
6870

69-
A good example of this is
71+
A good example of this is:
7072

7173
``` php
7274
/**
@@ -88,7 +90,7 @@ Class properties docblocs should contain:
8890
* A short description of the property (optional)
8991
* The var type
9092

91-
A good example of this
93+
A good example is:
9294

9395
``` php
9496
/**
@@ -99,6 +101,7 @@ A good example of this
99101
```
100102

101103
### Arrays
104+
102105
The short notations for declaring arrays (`[]`) is preferred over the longer `array()`.
103106

104107
Align `=>`s following the longest key to make the arrays easier to read.
@@ -127,7 +130,6 @@ $lastRequestBody = 'example';
127130
$lastResponseCode = 'something';
128131
$lastResponseHeaders = 'test';
129132
$lastResponseError = 'test2';
130-
131133
```
132134

133135
### Traits
@@ -146,6 +148,7 @@ $lastResponseError = 'test2';
146148
When adding a resource, use traits to define available API calls. Resource traits are namespaced under `Zendesk\API\Traits\Resource`.
147149

148150
**Single Resource**
151+
149152
* Create
150153
* Delete
151154
* Find
@@ -154,6 +157,7 @@ When adding a resource, use traits to define available API calls. Resource trait
154157
* Defaults - this adds **Find**, **FindAll**, **Create**, **Update**, and **Delete**
155158

156159
**Bulk traits**
160+
157161
* CreateMany
158162
* DeleteMany
159163
* FindMany

README.md

+13-9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Zendesk PHP API Client Library #
44

5-
[![Build Status](https://travis-ci.org/zendesk/zendesk_api_client_php.svg?branch=master)](https://travis-ci.org/zendesk/zendesk_api_client_php)
5+
![CI](https://github.com/zendesk/zendesk_api_client_php/actions/workflows/ci.yaml/badge.svg)
66
[![Latest Stable Version](https://poser.pugx.org/zendesk/zendesk_api_client_php/v/stable)](https://packagist.org/packages/zendesk/zendesk_api_client_php)
77
[![Total Downloads](https://poser.pugx.org/zendesk/zendesk_api_client_php/downloads)](https://packagist.org/packages/zendesk/zendesk_api_client_php)
88
[![Code Climate](https://codeclimate.com/github/zendesk/zendesk_api_client_php/badges/gpa.svg)](https://codeclimate.com/github/zendesk/zendesk_api_client_php)
@@ -29,6 +29,7 @@ The Zendesk PHP API client can be installed using [Composer](https://packagist.o
2929
To install run `composer require zendesk/zendesk_api_client_php`
3030

3131
### Upgrading from V1 to V2
32+
3233
If you are upgrading from [v1](https://github.com/zendesk/zendesk_api_client_php/tree/v1) of the client, we've written an [upgrade guide](https://github.com/zendesk/zendesk_api_client_php/wiki/Upgrading-from-v1-to-v2) to highlight some of the key differences.
3334

3435
## Configuration
@@ -121,28 +122,31 @@ $tickets = $client->tickets()->sideload(['users', 'groups'])->findAll();
121122
```
122123

123124
### Pagination
124-
The Zendesk API offers a way to get the next pages for the requests and is documented in [the Zendesk Developer Documentation](https://developer.zendesk.com/rest_api/docs/core/introduction#pagination).
125125

126-
The way to do this is to pass it as an option to your request.
126+
The Zendesk API offers a way to get the next pages for the requests and is documented in [the Zendesk Developer Documentation](https://developer.zendesk.com/api-reference/introduction/pagination).
127+
128+
There are two ways to do pagination, CBP (cursor based pagination) and OBP (offset based pagination). The recommended and less limited way is to use CBP. Until CBP becomes the default API response, you should use the `page[size]` parameter to ensure you use cursor based pagination.
127129

128130
``` php
129-
$tickets = $this->client->tickets()->findAll(['per_page' => 10, 'page' => 2]);
130-
```
131+
// CBP /endpoint?page[size]=100
132+
$tickets = $this->client->tickets()->findAll(['page' => ['size' => 100]]);
131133

132-
The allowed options are
133-
* per_page
134-
* page
135-
* sort_order
134+
// OBP /endpoint?per_page=100&page=2
135+
// Warning, this subject to stricter limits
136+
$tickets = $this->client->tickets()->findAll(['per_page' => 100, 'page' => 2]);
137+
```
136138

137139
### Retrying Requests
138140

139141
Add the `RetryHandler` middleware on the `HandlerStack` of your `GuzzleHttp\Client` instance. By default `Zendesk\Api\HttpClient`
140142
retries:
143+
141144
* timeout requests
142145
* those that throw `Psr\Http\Message\RequestInterface\ConnectException:class`
143146
* and those that throw `Psr\Http\Message\RequestInterface\RequestException:class` that are identified as ssl issue.
144147

145148
#### Available options
149+
146150
Options are passed on `RetryHandler` as an array of values.
147151

148152
* max = 2 _limit of retries_

0 commit comments

Comments
 (0)