ServiceInterface.php 1.5 KB

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