Skip to content

Commit b8226bd

Browse files
authored
Merge pull request #23 from chadicus/fea/client-interface
Adds ClientInterface
2 parents 1e4325b + 6c4a607 commit b8226bd

2 files changed

Lines changed: 111 additions & 1 deletion

File tree

src/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/**
99
* Client for apis
1010
*/
11-
final class Client
11+
final class Client implements ClientInterface
1212
{
1313
/**
1414
* Flag to cache no requests

src/ClientInterface.php

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<?php
2+
namespace DominionEnterprises\Api;
3+
4+
/**
5+
* Client for apis
6+
*/
7+
interface ClientInterface
8+
{
9+
/**
10+
* Get access token and refresh token
11+
*
12+
* @return array two string values, access token and refresh token
13+
*/
14+
function getTokens();
15+
16+
/**
17+
* Search the API resource using the specified $filters
18+
*
19+
* @param string $resource
20+
* @param array $filters
21+
*
22+
* @return mixed opaque handle to be given to endIndex()
23+
*/
24+
function startIndex($resource, array $filters = []);
25+
26+
/**
27+
* @see startIndex()
28+
*/
29+
function index($resource, array $filters = []);
30+
31+
/**
32+
* Get the details of an API resource based on $id
33+
*
34+
* @param string $resource
35+
* @param string $id
36+
*
37+
* @return mixed opaque handle to be given to endGet()
38+
*/
39+
function startGet($resource, $id);
40+
41+
/**
42+
* @see startGet()
43+
*/
44+
function get($resource, $id);
45+
46+
/**
47+
* Create a new instance of an API resource using the provided $data
48+
*
49+
* @param string $resource
50+
* @param array $data
51+
*
52+
* @return mixed opaque handle to be given to endPost()
53+
*/
54+
function startPost($resource, array $data);
55+
56+
/**
57+
* @see startPost()
58+
*/
59+
function post($resource, array $data);
60+
61+
/**
62+
* Update an existing instance of an API resource specified by $id with the provided $data
63+
*
64+
* @param string $resource
65+
* @param string $id
66+
* @param array $data
67+
*
68+
* @return mixed opaque handle to be given to endPut()
69+
*/
70+
function startPut($resource, $id, array $data);
71+
72+
/**
73+
* @see startPut()
74+
*/
75+
function put($resource, $id, array $data);
76+
77+
/**
78+
* Delete an existing instance of an API resource specified by $id
79+
*
80+
* @param string $resource
81+
* @param string $id
82+
* @param array $data
83+
*
84+
* @return mixed opaque handle to be given to endDelete()
85+
*/
86+
function startDelete($resource, $id, array $data = null);
87+
88+
/**
89+
* @see startDelete()
90+
*/
91+
function delete($resource, $id, array $data = null);
92+
93+
/**
94+
* Get response of start*() method
95+
*
96+
* @param mixed $handle opaque handle from start*()
97+
*
98+
* @return Response
99+
*/
100+
function end($handle);
101+
102+
/**
103+
* Set the default headers
104+
*
105+
* @param array The default headers
106+
*
107+
* @return void
108+
*/
109+
function setDefaultHeaders($defaultHeaders);
110+
}

0 commit comments

Comments
 (0)