You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 01-diffbot.rst
+47-1Lines changed: 47 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -6,5 +6,51 @@
6
6
Diffbot Class
7
7
=============
8
8
9
-
The Diffbot class is the first instance a developer must create when using the client. It serves as container for global settings, and as a factory for the various API endpoint classes.
9
+
.. php:namespace:: Swader\Diffbot
10
10
11
+
.. php:class:: Diffbot
12
+
13
+
The Diffbot class is the first instance a developer must create when using the client. It serves as a container for global settings, and as a factory for the various API endpoint classes. The Diffbot class takes a single optional argument, the ``$token``, which can be obtained `here <https://diffbot.com/pricing>`_. Instantiate like so::
14
+
15
+
$diffbot = new Diffbot("my_token");
16
+
17
+
Alternatively, set the token globally, and instantiate without passing in the parameter::
18
+
19
+
Diffbot::setToken("my_token");
20
+
$diffbot = new Diffbot();
21
+
22
+
Note that if you instantiate without a global token set, and don't pass in a token while instantiating either, you'll get a \\DiffbotException.
23
+
24
+
25
+
:hidden:`setToken`
26
+
""""""""""""""""""
27
+
28
+
.. php:staticmethod:: setToken($token)
29
+
30
+
Useful for setting a default token for all future instances.
31
+
32
+
:param string $token: The token.
33
+
:returns: void, or throws an \\InvalidArgumentException if the token is invalid
34
+
35
+
Usage::
36
+
37
+
Diffbot::setToken("my_token");
38
+
39
+
40
+
:hidden:`getToken`
41
+
""""""""""""""""""
42
+
43
+
.. php:method:: getToken()
44
+
45
+
Returns either the instance token, or the globally defined one - or null if neither is defined
46
+
47
+
:returns: null or string
48
+
49
+
Usage::
50
+
51
+
echo $diffbot->getToken(); // "my_token"
52
+
53
+
54
+
The Diffbot class is the starting point of your API usage. Whenever you use the Diffbot PHP Client, you must start with the steps above.
<spanid="diffbot-class"></span><h1>Diffbot Class<aclass="headerlink" href="#namespace-Swader\Diffbot" title="Permalink to this headline">¶</a></h1>
126
+
<dlclass="class">
127
+
<dtid="Swader\Diffbot\Diffbot">
128
+
<emclass="property">class </em><codeclass="descclassname">Swader\Diffbot\</code><codeclass="descname">Diffbot</code><aclass="headerlink" href="#Swader\Diffbot\Diffbot" title="Permalink to this definition">¶</a></dt>
129
+
<dd><p>The Diffbot class is the first instance a developer must create when using the client. It serves as a container for global settings, and as a factory for the various API endpoint classes. The Diffbot class takes a single optional argument, the <codeclass="docutils literal"><spanclass="pre">$token</span></code>, which can be obtained <aclass="reference external" href="https://diffbot.com/pricing">here</a>. Instantiate like so:</p>
<p>Note that if you instantiate without a global token set, and don’t pass in a token while instantiating either, you’ll get a \DiffbotException.</p>
139
+
</dd></dl>
140
+
141
+
<divclass="section" id="settoken">
142
+
<h2><spanclass="hidden">setToken</span><aclass="headerlink" href="#settoken" title="Permalink to this headline">¶</a></h2>
143
+
<blockquote>
144
+
<div><dlclass="staticmethod">
145
+
<dtid="Swader\Diffbot\Diffbot::setToken">
146
+
<emclass="property">static </em><codeclass="descclassname">Swader\Diffbot\Diffbot::</code><codeclass="descname">setToken</code><spanclass="sig-paren">(</span><em>$token</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#Swader\Diffbot\Diffbot::setToken" title="Permalink to this definition">¶</a></dt>
147
+
<dd><p>Useful for setting a default token for all future instances.</p>
<li><strong>$token</strong> (<em>string</em>) – The token.</li>
154
+
</ul>
155
+
</td>
156
+
</tr>
157
+
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first last">void, or throws an \InvalidArgumentException if the token is invalid</p>
<h2><spanclass="hidden">getToken</span><aclass="headerlink" href="#gettoken" title="Permalink to this headline">¶</a></h2>
172
+
<blockquote>
173
+
<div><dlclass="method">
174
+
<dtid="Swader\Diffbot\Diffbot::getToken">
175
+
<codeclass="descclassname">Swader\Diffbot\Diffbot::</code><codeclass="descname">getToken</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink" href="#Swader\Diffbot\Diffbot::getToken" title="Permalink to this definition">¶</a></dt>
176
+
<dd><p>Returns either the instance token, or the globally defined one - or null if neither is defined</p>
Built with <ahref="http://sphinx-doc.org/">Sphinx</a> using a <ahref="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <ahref="https://readthedocs.org">Read the Docs</a>.
The Diffbot class is the first instance a developer must create when using the client. It serves as a container for global settings, and as a factory for the various API endpoint classes. The Diffbot class takes a single optional argument, the ``$token``, which can be obtained `here <https://diffbot.com/pricing>`_. Instantiate like so::
14
+
15
+
$diffbot = new Diffbot("my_token");
16
+
17
+
Alternatively, set the token globally, and instantiate without passing in the parameter::
18
+
19
+
Diffbot::setToken("my_token");
20
+
$diffbot = new Diffbot();
21
+
22
+
Note that if you instantiate without a global token set, and don't pass in a token while instantiating either, you'll get a \\DiffbotException.
23
+
24
+
25
+
:hidden:`setToken`
26
+
""""""""""""""""""
27
+
28
+
.. php:staticmethod:: setToken($token)
29
+
30
+
Useful for setting a default token for all future instances.
31
+
32
+
:param string $token: The token.
33
+
:returns: void, or throws an \\InvalidArgumentException if the token is invalid
34
+
35
+
Usage::
36
+
37
+
Diffbot::setToken("my_token");
38
+
39
+
40
+
:hidden:`getToken`
41
+
""""""""""""""""""
42
+
43
+
.. php:method:: getToken()
44
+
45
+
Returns either the instance token, or the globally defined one - or null if neither is defined
46
+
47
+
:returns: null or string
48
+
49
+
Usage::
50
+
51
+
echo $diffbot->getToken(); // "my_token"
52
+
53
+
54
+
The Diffbot class is the starting point of your API usage. Whenever you use the Diffbot PHP Client, you must start with the steps above.
0 commit comments