com.upstox.api.TokenRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of upstox-java-sdk Show documentation
Show all versions of upstox-java-sdk Show documentation
The official Java client for communicating with the Upstox API
/*
* Upstox Developer API
* Build your App on the Upstox platform ![Banner](https://api-v2.upstox.com/api-docs/images/banner.jpg \"banner\") # Introduction Upstox API is a set of rest APIs that provide data required to build a complete investment and trading platform. Execute orders in real time, manage user portfolio, stream live market data (using Websocket), and more, with the easy to understand API collection. All requests are over HTTPS and the requests are sent with the content-type ‘application/json’. Developers have the option of choosing the response type as JSON or CSV for a few API calls. To be able to use these APIs you need to create an App in the Developer Console and generate your **apiKey** and **apiSecret**. You can use a redirect URL which will be called after the login flow. If you are a **trader**, you can directly create apps from Upstox mobile app or the desktop platform itself from **Apps** sections inside the **Account** Tab. Head over to account.upstox.com/developer/apps. If you are a **business** looking to integrate Upstox APIs, reach out to us and we will get a custom app created for you in no time. It is highly recommended that you do not embed the **apiSecret** in your frontend app. Create a remote backend which does the handshake on behalf of the frontend app. Marking the apiSecret in the frontend app will make your app vulnerable to threats and potential issues.
*
* OpenAPI spec version: v2
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package com.upstox.api;
import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.v3.oas.annotations.media.Schema;
import java.io.IOException;
/**
* TokenRequest
*/
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2023-07-12T20:29:09.823661+05:30[Asia/Kolkata]")
public class TokenRequest {
@SerializedName("code")
private String code = null;
@SerializedName("client_id")
private String clientId = null;
@SerializedName("client_secret")
private String clientSecret = null;
@SerializedName("redirect_uri")
private String redirectUri = null;
@SerializedName("grant_type")
private String grantType = null;
public TokenRequest code(String code) {
this.code = code;
return this;
}
/**
* Get code
* @return code
**/
@Schema(required = true, description = "")
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public TokenRequest clientId(String clientId) {
this.clientId = clientId;
return this;
}
/**
* OAuth API key that is a public identifier for app
* @return clientId
**/
@Schema(required = true, description = "OAuth API key that is a public identifier for app")
public String getClientId() {
return clientId;
}
public void setClientId(String clientId) {
this.clientId = clientId;
}
public TokenRequest clientSecret(String clientSecret) {
this.clientSecret = clientSecret;
return this;
}
/**
* OAuth client secret that is a private secret known only to app and authorization server
* @return clientSecret
**/
@Schema(required = true, description = "OAuth client secret that is a private secret known only to app and authorization server")
public String getClientSecret() {
return clientSecret;
}
public void setClientSecret(String clientSecret) {
this.clientSecret = clientSecret;
}
public TokenRequest redirectUri(String redirectUri) {
this.redirectUri = redirectUri;
return this;
}
/**
* Authorization server will redirect the user back to the application via redirect url
* @return redirectUri
**/
@Schema(required = true, description = "Authorization server will redirect the user back to the application via redirect url")
public String getRedirectUri() {
return redirectUri;
}
public void setRedirectUri(String redirectUri) {
this.redirectUri = redirectUri;
}
public TokenRequest grantType(String grantType) {
this.grantType = grantType;
return this;
}
/**
* Type of grant used to get an access token
* @return grantType
**/
@Schema(required = true, description = "Type of grant used to get an access token")
public String getGrantType() {
return grantType;
}
public void setGrantType(String grantType) {
this.grantType = grantType;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
TokenRequest tokenRequest = (TokenRequest) o;
return Objects.equals(this.code, tokenRequest.code) &&
Objects.equals(this.clientId, tokenRequest.clientId) &&
Objects.equals(this.clientSecret, tokenRequest.clientSecret) &&
Objects.equals(this.redirectUri, tokenRequest.redirectUri) &&
Objects.equals(this.grantType, tokenRequest.grantType);
}
@Override
public int hashCode() {
return Objects.hash(code, clientId, clientSecret, redirectUri, grantType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class TokenRequest {\n");
sb.append(" code: ").append(toIndentedString(code)).append("\n");
sb.append(" clientId: ").append(toIndentedString(clientId)).append("\n");
sb.append(" clientSecret: ").append(toIndentedString(clientSecret)).append("\n");
sb.append(" redirectUri: ").append(toIndentedString(redirectUri)).append("\n");
sb.append(" grantType: ").append(toIndentedString(grantType)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}