Snuze  0.8.1
snuze\RequestSender Class Reference
Inheritance diagram for snuze\RequestSender:

Public Member Functions

 __construct (\snuze\Request\Request $request, \snuze\AuthenticationState $auth)
 
 send ()
 
- Public Member Functions inherited from snuze\SnuzeObject
 __construct (array $args=null)
 
 _getSnuzeId ()
 
 _getSnuzeClass ()
 
 _ident ()
 

Private Attributes

 $request = null
 
 $auth = null
 

Additional Inherited Members

- Protected Member Functions inherited from snuze\SnuzeObject
 debug (string $message, bool $echo=false)
 
 info (string $message, bool $echo=false)
 
 warning (string $message, bool $echo=false)
 
 error (string $message, bool $echo=false)
 
- Protected Attributes inherited from snuze\SnuzeObject
 $_snuzeId = null
 
 $_snuzeClass = null
 

Detailed Description

A RequestSender is responsible for transmitting a request to Reddit's API server and returning the response.

If an error is encountered, an exception will be thrown. It's important that your application uses some error handling strategy to deal with these exceptions. Some of them, like transient connection issues or server HTTP 500 errors, happen fairly often.


This file is part of Snuze, a PHP client for the Reddit API. Copyright 2019 Shaun Cummiskey shaun.nosp@m.@sha.nosp@m.unc.c.nosp@m.om https://shaunc.com/ Repository: https://github.com/snuze/snuze/ Documentation: https://snuze.shaunc.com/

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Constructor & Destructor Documentation

◆ __construct()

snuze\RequestSender::__construct ( \snuze\Request\Request  $request,
\snuze\AuthenticationState  $auth 
)

Constructor.

Parameters
\snuze\Request\Request$requestA Request subtype object that's been populated and is ready to submit to the API server
\snuze\AuthenticationState$authAn AuthenticationState object containing the credentials needed to talk to the API server

Member Function Documentation

◆ send()

snuze\RequestSender::send ( )

Validate the request and send it to the Reddit API server.

Returns
string A JSON response from the Reddit API server
Exceptions

The documentation for this class was generated from the following file: