1<?php
2
3namespace OAuth\Common\Service;
4
5use OAuth\Common\Http\Uri\UriInterface;
6
7/**
8 * Defines methods common among all OAuth services.
9 */
10interface ServiceInterface
11{
12    /**
13     * Sends an authenticated API request to the path provided.
14     * If the path provided is not an absolute URI, the base API Uri (service-specific) will be used.
15     *
16     * @param string|UriInterface $path
17     * @param string              $method       HTTP method
18     * @param array               $body         Request body if applicable (an associative array will
19     *                                          automatically be converted into a urlencoded body)
20     * @param array               $extraHeaders Extra headers if applicable. These will override service-specific
21     *                                          any defaults.
22     *
23     * @return string
24     */
25    public function request($path, $method = 'GET', $body = null, array $extraHeaders = array());
26
27    /**
28     * Returns the url to redirect to for authorization purposes.
29     *
30     * @param array $additionalParameters
31     *
32     * @return UriInterface
33     */
34    public function getAuthorizationUri(array $additionalParameters = array());
35
36    /**
37     * Returns the authorization API endpoint.
38     *
39     * @return UriInterface
40     */
41    public function getAuthorizationEndpoint();
42
43    /**
44     * Returns the access token API endpoint.
45     *
46     * @return UriInterface
47     */
48    public function getAccessTokenEndpoint();
49}
50