-
Notifications
You must be signed in to change notification settings - Fork 1
DuckSharpClient Documentation
TheMulti0 edited this page Nov 12, 2018
·
3 revisions
In this page we are going to go through the public methods of DuckSharpClient.
The constructor of the client has 3 optional parameters:
-
string applicationName: 'DuckSharp'
- The application name that will refer to the API (it is set to'DuckSharp'
by default).
-
bool allowHtml: true
- The boolean that indicates whether the response will include HTML in text, for example; bold and italics (it is set totrue
by default).
-
bool allowDisambiguation: true
- The boolean that indicates whether the response will include disambiguation answer results. It is set totrue
by default. -
HttpClient
client: null
- Used for using a custom HttpClient. -
bool disposeClient: true
- The boolean that indicates whether disposing the DuckSharpClient will dispose the HttpClient (true
by default).
Returns: void
The client implements the interface IDisposable
, meaning it can be disposed (and used in using
statements).
Returns: Task<InstantAnswer>
The method GetInstantAnswerAsync
requires a parameter:
-
string query
- This is the string value that will be searched andInstantAnswer
will be found with. However it does have another optional parameter: -
CancellationToken
token: default
- The optional cancellation token that can be used to cancel the task (async operation) while it runs (It is set to an emptyCancellationToken
by default).
Returns: Task<string>
The method GetInstantAnswerAsync
requires a parameter:
-
string query
- This is the source the link will redirect to and the query it will give the source. However it does have another optional parameter: -
CancellationToken
token: default
- The optional cancellation token that can be used to cancel the task (async operation) while it runs (It is set to an emptyCancellationToken
by default).