Skip to content

Added support for specifing server url in constructor#4

Open
Utkarsh-vishnoi wants to merge 1 commit into
MacroYau:masterfrom
Utkarsh-vishnoi:master
Open

Added support for specifing server url in constructor#4
Utkarsh-vishnoi wants to merge 1 commit into
MacroYau:masterfrom
Utkarsh-vishnoi:master

Conversation

@Utkarsh-vishnoi

Copy link
Copy Markdown

I have created two more constructors which now can take an optional argument, one can set THINGSPEAK_API url by passing it as a string to the last argument.

Note:- The URL to be passed must be of data-type java.net.URL which is later passed into string.

* @param API The address of the custom thingspeak server API.
*/
public ThingSpeakChannel(long channelId, String readApiKey, @Nullable URL API) {
THINGSPEAK_API = API.toString();

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can simply check if the api parameter is null. If yes, set the Retrofit endpoint to the default one, otherwise use the custom parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants