-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from shinusuresh/38-handling-timeouts-in-api
#38 - Default timeout settings
- Loading branch information
Showing
3 changed files
with
22 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 14 additions & 63 deletions
77
src/main/java/io/github/shinusuresh/productsup/client/config/ProductsUpProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,41 @@ | ||
package io.github.shinusuresh.productsup.client.config; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
/** | ||
* Products up related configurations. | ||
*/ | ||
@ConfigurationProperties("productsup") | ||
@Getter | ||
@Setter | ||
public class ProductsUpProperties { | ||
|
||
private String token; | ||
|
||
private String authorizationToken; | ||
|
||
private String platformEndpoint = "https://platform-api.productsup.io/platform/v2"; | ||
|
||
private String streamEndpoint = "https://stream-api.productsup.com/"; | ||
|
||
/** | ||
* Returns platform endpoint. | ||
* | ||
* @return platform endpoint url | ||
*/ | ||
public String getPlatformEndpoint() { | ||
return platformEndpoint; | ||
} | ||
|
||
/** | ||
* Sets platform endpoint. | ||
* | ||
* @param platformEndpoint - endpoint for platform calls. | ||
* Token for platform api calls | ||
*/ | ||
public void setPlatformEndpoint(String platformEndpoint) { | ||
this.platformEndpoint = platformEndpoint; | ||
} | ||
|
||
private String token; | ||
|
||
/** | ||
* Returns Products up token configured for a client. | ||
* | ||
* @return token | ||
* Timeout for API calls. | ||
*/ | ||
public String getToken() { | ||
return token; | ||
} | ||
private long timeout = 5L; | ||
|
||
/** | ||
* Sets token | ||
* @param token - token for the client. | ||
* Authorization token for Stream api calls. | ||
*/ | ||
public void setToken(String token) { | ||
this.token = token; | ||
} | ||
private String authorizationToken; | ||
|
||
/** | ||
* Returns stream endpoint. | ||
* | ||
* @return Stream api endpoint. | ||
*/ | ||
public String getStreamEndpoint() { | ||
return streamEndpoint; | ||
} | ||
|
||
/** | ||
* Sets stream endpoint. | ||
* | ||
* @param streamEndpoint - stream endpoint. | ||
* Platform endpoint. | ||
*/ | ||
public void setStreamEndpoint(String streamEndpoint) { | ||
this.streamEndpoint = streamEndpoint; | ||
} | ||
private String platformEndpoint = "https://platform-api.productsup.io/platform/v2"; | ||
|
||
/** | ||
* Returns authorization token for Stream api calls. | ||
* | ||
* @return authorization token | ||
* Stream api endpoint. | ||
*/ | ||
public String getAuthorizationToken() { | ||
return authorizationToken; | ||
} | ||
private String streamEndpoint = "https://stream-api.productsup.com/"; | ||
|
||
/** | ||
* Sets authorization token for stream api calls. | ||
* | ||
* @param authorizationToken - Authorization token. | ||
*/ | ||
public void setAuthorizationToken(String authorizationToken) { | ||
this.authorizationToken = authorizationToken; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
productsup: | ||
#Timeout in seconds | ||
timeout: 5 | ||
token: "client_id:client_secret" | ||
stream: | ||
enabled: false |