diff --git a/README.md b/README.md index 80b8801..d665f43 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Add this dependency to your project's POM: com.upstox.api upstox-java-sdk - 1.27 + 1.28 compile ``` @@ -40,7 +40,7 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "com.upstox.api:upstox-java-sdk:1.27" +compile "com.upstox.api:upstox-java-sdk:1.28" ``` ## Sandbox Mode diff --git a/examples/ipo/README.md b/examples/ipo/README.md index 58e151f..8e9e657 100644 --- a/examples/ipo/README.md +++ b/examples/ipo/README.md @@ -9,3 +9,10 @@ Links to all IPO-related examples in the `code/` folder. ## 2. IPO Details - 2.1 [Get IPO details](code/get-ipo-details.md#get-ipo-details) + +## 3. IPO Orders + +- 3.1 [Apply for IPO](code/apply-for-ipo.md#apply-for-ipo) +- 3.2 [Get IPO orders](code/get-ipo-orders.md#get-ipo-orders) +- 3.3 [Get IPO order details](code/get-ipo-order-details.md#get-ipo-order-details) +- 3.4 [Cancel IPO order](code/cancel-ipo-order.md#cancel-ipo-order) diff --git a/examples/ipo/code/apply-for-ipo.md b/examples/ipo/code/apply-for-ipo.md new file mode 100644 index 0000000..8bea719 --- /dev/null +++ b/examples/ipo/code/apply-for-ipo.md @@ -0,0 +1,43 @@ +## Apply for IPO + +```java +import com.upstox.ApiClient; +import com.upstox.ApiException; +import com.upstox.Configuration; +import com.upstox.api.IpoApplyRequest; +import com.upstox.api.IpoApplyResponse; +import com.upstox.api.IpoBidRequest; +import com.upstox.auth.OAuth; +import io.swagger.client.api.IpoApi; + +import java.util.Arrays; + +public class Main { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + OAuth OAUTH2 = (OAuth) defaultClient.getAuthentication("OAUTH2"); + OAUTH2.setAccessToken("{your_access_token}"); + + IpoApi apiInstance = new IpoApi(); + + IpoApplyRequest body = new IpoApplyRequest(); + body.setId("{ipo_slug_id}"); + body.setUpi("{your_upi_handle}"); + // category: IND (retail individual) or HNI + body.setCategory("IND"); + // Up to 3 bids are allowed + body.setBids(Arrays.asList( + new IpoBidRequest().quantity(1).price(100.0) + )); + + try { + IpoApplyResponse result = apiInstance.applyForIpo(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IpoApi#applyForIpo"); + e.printStackTrace(); + } + } +} +``` diff --git a/examples/ipo/code/cancel-ipo-order.md b/examples/ipo/code/cancel-ipo-order.md new file mode 100644 index 0000000..b1a4d18 --- /dev/null +++ b/examples/ipo/code/cancel-ipo-order.md @@ -0,0 +1,32 @@ +## Cancel IPO order + +```java +import com.upstox.ApiClient; +import com.upstox.ApiException; +import com.upstox.Configuration; +import com.upstox.api.IpoCancelResponse; +import com.upstox.auth.OAuth; +import io.swagger.client.api.IpoApi; + +public class Main { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + OAuth OAUTH2 = (OAuth) defaultClient.getAuthentication("OAUTH2"); + OAUTH2.setAccessToken("{your_access_token}"); + + IpoApi apiInstance = new IpoApi(); + + // order_id as returned by the apply and IPO orders APIs + String orderId = "{ipo_order_id}"; + + try { + IpoCancelResponse result = apiInstance.cancelIpoOrder(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IpoApi#cancelIpoOrder"); + e.printStackTrace(); + } + } +} +``` diff --git a/examples/ipo/code/get-ipo-order-details.md b/examples/ipo/code/get-ipo-order-details.md new file mode 100644 index 0000000..817dfe9 --- /dev/null +++ b/examples/ipo/code/get-ipo-order-details.md @@ -0,0 +1,32 @@ +## Get IPO order details + +```java +import com.upstox.ApiClient; +import com.upstox.ApiException; +import com.upstox.Configuration; +import com.upstox.api.IpoOrderDetailResponse; +import com.upstox.auth.OAuth; +import io.swagger.client.api.IpoApi; + +public class Main { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + OAuth OAUTH2 = (OAuth) defaultClient.getAuthentication("OAUTH2"); + OAUTH2.setAccessToken("{your_access_token}"); + + IpoApi apiInstance = new IpoApi(); + + // order_id as returned by the apply and IPO orders APIs + String orderId = "{ipo_order_id}"; + + try { + IpoOrderDetailResponse result = apiInstance.getIpoOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IpoApi#getIpoOrderById"); + e.printStackTrace(); + } + } +} +``` diff --git a/examples/ipo/code/get-ipo-orders.md b/examples/ipo/code/get-ipo-orders.md new file mode 100644 index 0000000..a5df696 --- /dev/null +++ b/examples/ipo/code/get-ipo-orders.md @@ -0,0 +1,30 @@ +## Get IPO orders + +```java +import com.upstox.ApiClient; +import com.upstox.ApiException; +import com.upstox.Configuration; +import com.upstox.api.IpoOrderResponse; +import com.upstox.auth.OAuth; +import io.swagger.client.api.IpoApi; + +public class Main { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + OAuth OAUTH2 = (OAuth) defaultClient.getAuthentication("OAUTH2"); + OAUTH2.setAccessToken("{your_access_token}"); + + IpoApi apiInstance = new IpoApi(); + + // pageNumber starts at 1; both params are optional (pass null to use defaults) + try { + IpoOrderResponse result = apiInstance.getIpoOrders(1, 20); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IpoApi#getIpoOrders"); + e.printStackTrace(); + } + } +} +``` diff --git a/pom.xml b/pom.xml index b92baeb..93d2e02 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ upstox-java-sdk jar upstox-java-sdk - 1.27 + 1.28 https://upstox.com/uplink/ The official Java client for communicating with the Upstox API diff --git a/src/main/java/com/upstox/ApiClient.java b/src/main/java/com/upstox/ApiClient.java index 3af420f..fee3eef 100644 --- a/src/main/java/com/upstox/ApiClient.java +++ b/src/main/java/com/upstox/ApiClient.java @@ -1014,7 +1014,7 @@ public Call buildCall(String path, String method, List queryParams, List

queryParams, List collectionQueryParams, Object body, Map headerParams, Map formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { updateParamsForAuth(authNames, queryParams, headerParams); headerParams.put("X-Upstox-SDK-Language","java"); - headerParams.put("X-Upstox-SDK-Version","1.27"); + headerParams.put("X-Upstox-SDK-Version","1.28"); final String url = buildUrl(path, queryParams, collectionQueryParams); final Request.Builder reqBuilder = new Request.Builder().url(url); processHeaderParams(headerParams, reqBuilder); diff --git a/src/main/java/com/upstox/api/IpoApplyData.java b/src/main/java/com/upstox/api/IpoApplyData.java new file mode 100644 index 0000000..e300f5c --- /dev/null +++ b/src/main/java/com/upstox/api/IpoApplyData.java @@ -0,0 +1,92 @@ +/* + * OpenAPI definition + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: v0 + * + * + * 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; +/** + * IpoApplyData + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2026-08-17T18:30:36.248588+05:30[Asia/Kolkata]") + +public class IpoApplyData { + @SerializedName("order_id") + private Object orderId = null; + + public IpoApplyData orderId(Object orderId) { + this.orderId = orderId; + return this; + } + + /** + * Application id created for this IPO application. Pass this as order_id to the get-order and cancel-order APIs + * @return orderId + **/ + @Schema(example = "UPCHK500000020", description = "Application id created for this IPO application. Pass this as order_id to the get-order and cancel-order APIs") + public Object getOrderId() { + return orderId; + } + + public void setOrderId(Object orderId) { + this.orderId = orderId; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IpoApplyData ipoApplyData = (IpoApplyData) o; + return Objects.equals(this.orderId, ipoApplyData.orderId); + } + + @Override + public int hashCode() { + return Objects.hash(orderId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IpoApplyData {\n"); + + sb.append(" orderId: ").append(toIndentedString(orderId)).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 "); + } + +} diff --git a/src/main/java/com/upstox/api/IpoApplyRequest.java b/src/main/java/com/upstox/api/IpoApplyRequest.java new file mode 100644 index 0000000..b3909d8 --- /dev/null +++ b/src/main/java/com/upstox/api/IpoApplyRequest.java @@ -0,0 +1,161 @@ +/* + * OpenAPI definition + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: v0 + * + * + * 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; +/** + * IpoApplyRequest + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2026-08-17T18:30:36.248588+05:30[Asia/Kolkata]") + +public class IpoApplyRequest { + @SerializedName("id") + private Object id = null; + + @SerializedName("upi") + private Object upi = null; + + @SerializedName("category") + private Object category = null; + + @SerializedName("bids") + private Object bids = null; + + public IpoApplyRequest id(Object id) { + this.id = id; + return this; + } + + /** + * IPO id (slug) to apply for, as returned in `id` by the IPO listing and details APIs + * @return id + **/ + @Schema(example = "mandb-engineering-limited-ipo", required = true, description = "IPO id (slug) to apply for, as returned in `id` by the IPO listing and details APIs") + public Object getId() { + return id; + } + + public void setId(Object id) { + this.id = id; + } + + public IpoApplyRequest upi(Object upi) { + this.upi = upi; + return this; + } + + /** + * UPI id used to block the application amount + * @return upi + **/ + @Schema(example = "test@upi", required = true, description = "UPI id used to block the application amount") + public Object getUpi() { + return upi; + } + + public void setUpi(Object upi) { + this.upi = upi; + } + + public IpoApplyRequest category(Object category) { + this.category = category; + return this; + } + + /** + * Investor category to apply under. Must be one the issue accepts — see `investors[].category` in the IPO details API + * @return category + **/ + @Schema(example = "IND", required = true, description = "Investor category to apply under. Must be one the issue accepts — see `investors[].category` in the IPO details API") + public Object getCategory() { + return category; + } + + public void setCategory(Object category) { + this.category = category; + } + + public IpoApplyRequest bids(Object bids) { + this.bids = bids; + return this; + } + + /** + * List of bids for the application (1 to 3 bids) + * @return bids + **/ + @Schema(required = true, description = "List of bids for the application (1 to 3 bids)") + public Object getBids() { + return bids; + } + + public void setBids(Object bids) { + this.bids = bids; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IpoApplyRequest ipoApplyRequest = (IpoApplyRequest) o; + return Objects.equals(this.id, ipoApplyRequest.id) && + Objects.equals(this.upi, ipoApplyRequest.upi) && + Objects.equals(this.category, ipoApplyRequest.category) && + Objects.equals(this.bids, ipoApplyRequest.bids); + } + + @Override + public int hashCode() { + return Objects.hash(id, upi, category, bids); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IpoApplyRequest {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" upi: ").append(toIndentedString(upi)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" bids: ").append(toIndentedString(bids)).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 "); + } + +} diff --git a/src/main/java/com/upstox/api/IpoApplyResponse.java b/src/main/java/com/upstox/api/IpoApplyResponse.java new file mode 100644 index 0000000..88ff315 --- /dev/null +++ b/src/main/java/com/upstox/api/IpoApplyResponse.java @@ -0,0 +1,116 @@ +/* + * OpenAPI definition + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: v0 + * + * + * 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 com.upstox.api.IpoApplyData; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; +/** + * IpoApplyResponse + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2026-08-17T18:30:36.248588+05:30[Asia/Kolkata]") + +public class IpoApplyResponse { + @SerializedName("status") + private Object status = null; + + @SerializedName("data") + private IpoApplyData data = null; + + public IpoApplyResponse status(Object status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @Schema(description = "") + public Object getStatus() { + return status; + } + + public void setStatus(Object status) { + this.status = status; + } + + public IpoApplyResponse data(IpoApplyData data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @Schema(description = "") + public IpoApplyData getData() { + return data; + } + + public void setData(IpoApplyData data) { + this.data = data; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IpoApplyResponse ipoApplyResponse = (IpoApplyResponse) o; + return Objects.equals(this.status, ipoApplyResponse.status) && + Objects.equals(this.data, ipoApplyResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(status, data); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IpoApplyResponse {\n"); + + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).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 "); + } + +} diff --git a/src/main/java/com/upstox/api/IpoBidRequest.java b/src/main/java/com/upstox/api/IpoBidRequest.java new file mode 100644 index 0000000..f6bd298 --- /dev/null +++ b/src/main/java/com/upstox/api/IpoBidRequest.java @@ -0,0 +1,115 @@ +/* + * OpenAPI definition + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: v0 + * + * + * 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; +/** + * IpoBidRequest + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2026-08-17T18:30:36.248588+05:30[Asia/Kolkata]") + +public class IpoBidRequest { + @SerializedName("quantity") + private Object quantity = null; + + @SerializedName("price") + private Object price = null; + + public IpoBidRequest quantity(Object quantity) { + this.quantity = quantity; + return this; + } + + /** + * Number of shares bid for. Must be a multiple of the IPO's `lot_size` and at least its `minimum_quantity` + * @return quantity + **/ + @Schema(example = "20", required = true, description = "Number of shares bid for. Must be a multiple of the IPO's `lot_size` and at least its `minimum_quantity`") + public Object getQuantity() { + return quantity; + } + + public void setQuantity(Object quantity) { + this.quantity = quantity; + } + + public IpoBidRequest price(Object price) { + this.price = price; + return this; + } + + /** + * Bid price per share, in whole rupees — decimals are not accepted. Must sit within the IPO's price band, or equal its `cut_off_price` + * @return price + **/ + @Schema(example = "850", required = true, description = "Bid price per share, in whole rupees — decimals are not accepted. Must sit within the IPO's price band, or equal its `cut_off_price`") + public Object getPrice() { + return price; + } + + public void setPrice(Object price) { + this.price = price; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IpoBidRequest ipoBidRequest = (IpoBidRequest) o; + return Objects.equals(this.quantity, ipoBidRequest.quantity) && + Objects.equals(this.price, ipoBidRequest.price); + } + + @Override + public int hashCode() { + return Objects.hash(quantity, price); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IpoBidRequest {\n"); + + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).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 "); + } + +} diff --git a/src/main/java/com/upstox/api/IpoCancelData.java b/src/main/java/com/upstox/api/IpoCancelData.java new file mode 100644 index 0000000..59f1707 --- /dev/null +++ b/src/main/java/com/upstox/api/IpoCancelData.java @@ -0,0 +1,115 @@ +/* + * OpenAPI definition + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: v0 + * + * + * 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; +/** + * IpoCancelData + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2026-08-17T18:30:36.248588+05:30[Asia/Kolkata]") + +public class IpoCancelData { + @SerializedName("order_id") + private Object orderId = null; + + @SerializedName("status") + private Object status = null; + + public IpoCancelData orderId(Object orderId) { + this.orderId = orderId; + return this; + } + + /** + * Application id that was cancelled + * @return orderId + **/ + @Schema(example = "6715c003289265c3", description = "Application id that was cancelled") + public Object getOrderId() { + return orderId; + } + + public void setOrderId(Object orderId) { + this.orderId = orderId; + } + + public IpoCancelData status(Object status) { + this.status = status; + return this; + } + + /** + * Free-text message returned by the IPO service for the cancellation request + * @return status + **/ + @Schema(description = "Free-text message returned by the IPO service for the cancellation request") + public Object getStatus() { + return status; + } + + public void setStatus(Object status) { + this.status = status; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IpoCancelData ipoCancelData = (IpoCancelData) o; + return Objects.equals(this.orderId, ipoCancelData.orderId) && + Objects.equals(this.status, ipoCancelData.status); + } + + @Override + public int hashCode() { + return Objects.hash(orderId, status); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IpoCancelData {\n"); + + sb.append(" orderId: ").append(toIndentedString(orderId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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 "); + } + +} diff --git a/src/main/java/com/upstox/api/IpoCancelResponse.java b/src/main/java/com/upstox/api/IpoCancelResponse.java new file mode 100644 index 0000000..c1c2f36 --- /dev/null +++ b/src/main/java/com/upstox/api/IpoCancelResponse.java @@ -0,0 +1,116 @@ +/* + * OpenAPI definition + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: v0 + * + * + * 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 com.upstox.api.IpoCancelData; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; +/** + * IpoCancelResponse + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2026-08-17T18:30:36.248588+05:30[Asia/Kolkata]") + +public class IpoCancelResponse { + @SerializedName("status") + private Object status = null; + + @SerializedName("data") + private IpoCancelData data = null; + + public IpoCancelResponse status(Object status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @Schema(description = "") + public Object getStatus() { + return status; + } + + public void setStatus(Object status) { + this.status = status; + } + + public IpoCancelResponse data(IpoCancelData data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @Schema(description = "") + public IpoCancelData getData() { + return data; + } + + public void setData(IpoCancelData data) { + this.data = data; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IpoCancelResponse ipoCancelResponse = (IpoCancelResponse) o; + return Objects.equals(this.status, ipoCancelResponse.status) && + Objects.equals(this.data, ipoCancelResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(status, data); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IpoCancelResponse {\n"); + + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).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 "); + } + +} diff --git a/src/main/java/com/upstox/api/IpoDetailsData.java b/src/main/java/com/upstox/api/IpoDetailsData.java index 621d623..abd289d 100644 --- a/src/main/java/com/upstox/api/IpoDetailsData.java +++ b/src/main/java/com/upstox/api/IpoDetailsData.java @@ -19,10 +19,12 @@ import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; +import com.upstox.api.IpoInvestorType; import com.upstox.api.IpoRegistrarInfo; import com.upstox.api.IpoTimeline; import io.swagger.v3.oas.annotations.media.Schema; import java.io.IOException; +import java.util.List; /** * IpoDetailsData */ @@ -108,6 +110,9 @@ public class IpoDetailsData { @SerializedName("total_subscription") private Object totalSubscription = null; + @SerializedName("investors") + private List investors = null; + public IpoDetailsData id(Object id) { this.id = id; return this; @@ -576,6 +581,24 @@ public void setTotalSubscription(Object totalSubscription) { this.totalSubscription = totalSubscription; } + public IpoDetailsData investors(List investors) { + this.investors = investors; + return this; + } + + /** + * Get investors + * @return investors + **/ + @Schema(description = "") + public List getInvestors() { + return investors; + } + + public void setInvestors(List investors) { + this.investors = investors; + } + @Override public boolean equals(java.lang.Object o) { @@ -611,12 +634,13 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.drhpUrl, ipoDetailsData.drhpUrl) && Objects.equals(this.timeline, ipoDetailsData.timeline) && Objects.equals(this.registrarInfo, ipoDetailsData.registrarInfo) && - Objects.equals(this.totalSubscription, ipoDetailsData.totalSubscription); + Objects.equals(this.totalSubscription, ipoDetailsData.totalSubscription) && + Objects.equals(this.investors, ipoDetailsData.investors); } @Override public int hashCode() { - return Objects.hash(id, symbol, name, status, isin, issueType, issueSize, industry, minimumPrice, maximumPrice, biddingStartDate, biddingEndDate, dailyStartTime, dailyEndTime, faceValue, tickSize, lotSize, minimumQuantity, cutOffPrice, listingPrice, listingExchange, rhpUrl, drhpUrl, timeline, registrarInfo, totalSubscription); + return Objects.hash(id, symbol, name, status, isin, issueType, issueSize, industry, minimumPrice, maximumPrice, biddingStartDate, biddingEndDate, dailyStartTime, dailyEndTime, faceValue, tickSize, lotSize, minimumQuantity, cutOffPrice, listingPrice, listingExchange, rhpUrl, drhpUrl, timeline, registrarInfo, totalSubscription, investors); } @@ -651,6 +675,7 @@ public String toString() { sb.append(" timeline: ").append(toIndentedString(timeline)).append("\n"); sb.append(" registrarInfo: ").append(toIndentedString(registrarInfo)).append("\n"); sb.append(" totalSubscription: ").append(toIndentedString(totalSubscription)).append("\n"); + sb.append(" investors: ").append(toIndentedString(investors)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/com/upstox/api/IpoInvestorType.java b/src/main/java/com/upstox/api/IpoInvestorType.java new file mode 100644 index 0000000..a61b8ac --- /dev/null +++ b/src/main/java/com/upstox/api/IpoInvestorType.java @@ -0,0 +1,115 @@ +/* + * OpenAPI definition + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: v0 + * + * + * 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; +/** + * IpoInvestorType + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2026-08-17T18:30:36.248588+05:30[Asia/Kolkata]") + +public class IpoInvestorType { + @SerializedName("category") + private Object category = null; + + @SerializedName("description") + private Object description = null; + + public IpoInvestorType category(Object category) { + this.category = category; + return this; + } + + /** + * Investor category the issue accepts. Pass this value as category when applying + * @return category + **/ + @Schema(example = "IND", description = "Investor category the issue accepts. Pass this value as category when applying") + public Object getCategory() { + return category; + } + + public void setCategory(Object category) { + this.category = category; + } + + public IpoInvestorType description(Object description) { + this.description = description; + return this; + } + + /** + * Human-readable name of the category; null when the IPO service does not provide one + * @return description + **/ + @Schema(example = "Individual Investor", description = "Human-readable name of the category; null when the IPO service does not provide one") + public Object getDescription() { + return description; + } + + public void setDescription(Object description) { + this.description = description; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IpoInvestorType ipoInvestorType = (IpoInvestorType) o; + return Objects.equals(this.category, ipoInvestorType.category) && + Objects.equals(this.description, ipoInvestorType.description); + } + + @Override + public int hashCode() { + return Objects.hash(category, description); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IpoInvestorType {\n"); + + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).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 "); + } + +} diff --git a/src/main/java/com/upstox/api/IpoListingData.java b/src/main/java/com/upstox/api/IpoListingData.java index e84203f..e09153f 100644 --- a/src/main/java/com/upstox/api/IpoListingData.java +++ b/src/main/java/com/upstox/api/IpoListingData.java @@ -19,8 +19,10 @@ import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; +import com.upstox.api.IpoInvestorType; import io.swagger.v3.oas.annotations.media.Schema; import java.io.IOException; +import java.util.List; /** * IpoListingData */ @@ -67,6 +69,9 @@ public class IpoListingData { @SerializedName("total_subscription") private Object totalSubscription = null; + @SerializedName("investors") + private List investors = null; + public IpoListingData id(Object id) { this.id = id; return this; @@ -301,6 +306,24 @@ public void setTotalSubscription(Object totalSubscription) { this.totalSubscription = totalSubscription; } + public IpoListingData investors(List investors) { + this.investors = investors; + return this; + } + + /** + * Get investors + * @return investors + **/ + @Schema(description = "") + public List getInvestors() { + return investors; + } + + public void setInvestors(List investors) { + this.investors = investors; + } + @Override public boolean equals(java.lang.Object o) { @@ -323,12 +346,13 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.maximumPrice, ipoListingData.maximumPrice) && Objects.equals(this.biddingStartDate, ipoListingData.biddingStartDate) && Objects.equals(this.biddingEndDate, ipoListingData.biddingEndDate) && - Objects.equals(this.totalSubscription, ipoListingData.totalSubscription); + Objects.equals(this.totalSubscription, ipoListingData.totalSubscription) && + Objects.equals(this.investors, ipoListingData.investors); } @Override public int hashCode() { - return Objects.hash(id, symbol, name, status, isin, issueType, issueSize, industry, minimumPrice, maximumPrice, biddingStartDate, biddingEndDate, totalSubscription); + return Objects.hash(id, symbol, name, status, isin, issueType, issueSize, industry, minimumPrice, maximumPrice, biddingStartDate, biddingEndDate, totalSubscription, investors); } @@ -350,6 +374,7 @@ public String toString() { sb.append(" biddingStartDate: ").append(toIndentedString(biddingStartDate)).append("\n"); sb.append(" biddingEndDate: ").append(toIndentedString(biddingEndDate)).append("\n"); sb.append(" totalSubscription: ").append(toIndentedString(totalSubscription)).append("\n"); + sb.append(" investors: ").append(toIndentedString(investors)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/com/upstox/api/IpoOrderBid.java b/src/main/java/com/upstox/api/IpoOrderBid.java new file mode 100644 index 0000000..a49bf5a --- /dev/null +++ b/src/main/java/com/upstox/api/IpoOrderBid.java @@ -0,0 +1,161 @@ +/* + * OpenAPI definition + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: v0 + * + * + * 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; +/** + * IpoOrderBid + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2026-08-17T18:30:36.248588+05:30[Asia/Kolkata]") + +public class IpoOrderBid { + @SerializedName("quantity") + private Object quantity = null; + + @SerializedName("price") + private Object price = null; + + @SerializedName("amount") + private Object amount = null; + + @SerializedName("message") + private Object message = null; + + public IpoOrderBid quantity(Object quantity) { + this.quantity = quantity; + return this; + } + + /** + * Number of shares bid for + * @return quantity + **/ + @Schema(example = "30", description = "Number of shares bid for") + public Object getQuantity() { + return quantity; + } + + public void setQuantity(Object quantity) { + this.quantity = quantity; + } + + public IpoOrderBid price(Object price) { + this.price = price; + return this; + } + + /** + * Bid price per share + * @return price + **/ + @Schema(example = "150.3", description = "Bid price per share") + public Object getPrice() { + return price; + } + + public void setPrice(Object price) { + this.price = price; + } + + public IpoOrderBid amount(Object amount) { + this.amount = amount; + return this; + } + + /** + * Value of the bid, quantity x price + * @return amount + **/ + @Schema(example = "4509.0", description = "Value of the bid, quantity x price") + public Object getAmount() { + return amount; + } + + public void setAmount(Object amount) { + this.amount = amount; + } + + public IpoOrderBid message(Object message) { + this.message = message; + return this; + } + + /** + * Message from the exchange for this bid, when one was returned + * @return message + **/ + @Schema(example = "Bid accepted", description = "Message from the exchange for this bid, when one was returned") + public Object getMessage() { + return message; + } + + public void setMessage(Object message) { + this.message = message; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IpoOrderBid ipoOrderBid = (IpoOrderBid) o; + return Objects.equals(this.quantity, ipoOrderBid.quantity) && + Objects.equals(this.price, ipoOrderBid.price) && + Objects.equals(this.amount, ipoOrderBid.amount) && + Objects.equals(this.message, ipoOrderBid.message); + } + + @Override + public int hashCode() { + return Objects.hash(quantity, price, amount, message); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IpoOrderBid {\n"); + + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).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 "); + } + +} diff --git a/src/main/java/com/upstox/api/IpoOrderData.java b/src/main/java/com/upstox/api/IpoOrderData.java new file mode 100644 index 0000000..5b4f28c --- /dev/null +++ b/src/main/java/com/upstox/api/IpoOrderData.java @@ -0,0 +1,621 @@ +/* + * OpenAPI definition + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: v0 + * + * + * 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; +/** + * IpoOrderData + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2026-08-17T18:30:36.248588+05:30[Asia/Kolkata]") + +public class IpoOrderData { + @SerializedName("id") + private Object id = null; + + @SerializedName("symbol") + private Object symbol = null; + + @SerializedName("exchange") + private Object exchange = null; + + @SerializedName("request_id") + private Object requestId = null; + + @SerializedName("order_id") + private Object orderId = null; + + @SerializedName("status") + private Object status = null; + + @SerializedName("order_status") + private Object orderStatus = null; + + @SerializedName("payment_status") + private Object paymentStatus = null; + + @SerializedName("category") + private Object category = null; + + @SerializedName("issue_type") + private Object issueType = null; + + @SerializedName("reason") + private Object reason = null; + + @SerializedName("upi") + private Object upi = null; + + @SerializedName("upi_amount_blocked") + private Object upiAmountBlocked = null; + + @SerializedName("nse_submitted_date") + private Object nseSubmittedDate = null; + + @SerializedName("bse_submitted_date") + private Object bseSubmittedDate = null; + + @SerializedName("mandate_approved_date") + private Object mandateApprovedDate = null; + + @SerializedName("rejection_date") + private Object rejectionDate = null; + + @SerializedName("mandate_rejection_date") + private Object mandateRejectionDate = null; + + @SerializedName("cancel_requested_date") + private Object cancelRequestedDate = null; + + @SerializedName("cancel_accepted_date") + private Object cancelAcceptedDate = null; + + @SerializedName("units_allotted") + private Object unitsAllotted = null; + + @SerializedName("bids") + private Object bids = null; + + @SerializedName("created_at") + private Object createdAt = null; + + @SerializedName("last_updated_at") + private Object lastUpdatedAt = null; + + public IpoOrderData id(Object id) { + this.id = id; + return this; + } + + /** + * Reference id of the IPO the application was placed against + * @return id + **/ + @Schema(example = "deepak-3188545e-93d5", description = "Reference id of the IPO the application was placed against") + public Object getId() { + return id; + } + + public void setId(Object id) { + this.id = id; + } + + public IpoOrderData symbol(Object symbol) { + this.symbol = symbol; + return this; + } + + /** + * Trading symbol of the issuer + * @return symbol + **/ + @Schema(example = "DBEIL", description = "Trading symbol of the issuer") + public Object getSymbol() { + return symbol; + } + + public void setSymbol(Object symbol) { + this.symbol = symbol; + } + + public IpoOrderData exchange(Object exchange) { + this.exchange = exchange; + return this; + } + + /** + * Exchange the application was submitted to. Casing follows the exchange feed and may vary + * @return exchange + **/ + @Schema(example = "nse", description = "Exchange the application was submitted to. Casing follows the exchange feed and may vary") + public Object getExchange() { + return exchange; + } + + public void setExchange(Object exchange) { + this.exchange = exchange; + } + + public IpoOrderData requestId(Object requestId) { + this.requestId = requestId; + return this; + } + + /** + * Id of the request that created the application + * @return requestId + **/ + @Schema(example = "LEGACY-1d7f24d7-aaee-4351-b726-b4f41fd0a0e9", description = "Id of the request that created the application") + public Object getRequestId() { + return requestId; + } + + public void setRequestId(Object requestId) { + this.requestId = requestId; + } + + public IpoOrderData orderId(Object orderId) { + this.orderId = orderId; + return this; + } + + /** + * Application id. Pass this as order_id to the get-order and cancel-order APIs + * @return orderId + **/ + @Schema(example = "6715c003289265c3", description = "Application id. Pass this as order_id to the get-order and cancel-order APIs") + public Object getOrderId() { + return orderId; + } + + public void setOrderId(Object orderId) { + this.orderId = orderId; + } + + public IpoOrderData status(Object status) { + this.status = status; + return this; + } + + /** + * Lifecycle stage of the application. Known values: awaiting_mandate, ipo_allotted, ipo_not_allotted, application_deleted + * @return status + **/ + @Schema(example = "ipo_allotted", description = "Lifecycle stage of the application. Known values: awaiting_mandate, ipo_allotted, ipo_not_allotted, application_deleted") + public Object getStatus() { + return status; + } + + public void setStatus(Object status) { + this.status = status; + } + + public IpoOrderData orderStatus(Object orderStatus) { + this.orderStatus = orderStatus; + return this; + } + + /** + * Outcome of the application. Known values: success, allotted, not_allotted + * @return orderStatus + **/ + @Schema(example = "allotted", description = "Outcome of the application. Known values: success, allotted, not_allotted") + public Object getOrderStatus() { + return orderStatus; + } + + public void setOrderStatus(Object orderStatus) { + this.orderStatus = orderStatus; + } + + public IpoOrderData paymentStatus(Object paymentStatus) { + this.paymentStatus = paymentStatus; + return this; + } + + /** + * State of the UPI mandate backing the application. Known values: pending, mandate_accepted + * @return paymentStatus + **/ + @Schema(example = "mandate_accepted", description = "State of the UPI mandate backing the application. Known values: pending, mandate_accepted") + public Object getPaymentStatus() { + return paymentStatus; + } + + public void setPaymentStatus(Object paymentStatus) { + this.paymentStatus = paymentStatus; + } + + public IpoOrderData category(Object category) { + this.category = category; + return this; + } + + /** + * Investor category the application was placed under. IND (individual) and HNI can be applied for; EMP appears on employee-quota applications + * @return category + **/ + @Schema(example = "IND", description = "Investor category the application was placed under. IND (individual) and HNI can be applied for; EMP appears on employee-quota applications") + public Object getCategory() { + return category; + } + + public void setCategory(Object category) { + this.category = category; + } + + public IpoOrderData issueType(Object issueType) { + this.issueType = issueType; + return this; + } + + /** + * Issue type of the IPO. `regular` is a mainboard issue + * @return issueType + **/ + @Schema(example = "regular", description = "Issue type of the IPO. `regular` is a mainboard issue") + public Object getIssueType() { + return issueType; + } + + public void setIssueType(Object issueType) { + this.issueType = issueType; + } + + public IpoOrderData reason(Object reason) { + this.reason = reason; + return this; + } + + /** + * Free-text reason from the exchange or registrar explaining the current status + * @return reason + **/ + @Schema(example = "alloted", description = "Free-text reason from the exchange or registrar explaining the current status") + public Object getReason() { + return reason; + } + + public void setReason(Object reason) { + this.reason = reason; + } + + public IpoOrderData upi(Object upi) { + this.upi = upi; + return this; + } + + /** + * UPI id the mandate was raised against + * @return upi + **/ + @Schema(example = "9136776254@ybl", description = "UPI id the mandate was raised against") + public Object getUpi() { + return upi; + } + + public void setUpi(Object upi) { + this.upi = upi; + } + + public IpoOrderData upiAmountBlocked(Object upiAmountBlocked) { + this.upiAmountBlocked = upiAmountBlocked; + return this; + } + + /** + * Amount blocked in the applicant's bank account for this application, as a decimal string. Absent until the mandate is accepted + * @return upiAmountBlocked + **/ + @Schema(example = "14819.0", description = "Amount blocked in the applicant's bank account for this application, as a decimal string. Absent until the mandate is accepted") + public Object getUpiAmountBlocked() { + return upiAmountBlocked; + } + + public void setUpiAmountBlocked(Object upiAmountBlocked) { + this.upiAmountBlocked = upiAmountBlocked; + } + + public IpoOrderData nseSubmittedDate(Object nseSubmittedDate) { + this.nseSubmittedDate = nseSubmittedDate; + return this; + } + + /** + * When the application was submitted to NSE, in yyyy-MM-dd'T'HH:mm:ss; null if not submitted there + * @return nseSubmittedDate + **/ + @Schema(example = "2024-10-21T08:14:20", description = "When the application was submitted to NSE, in yyyy-MM-dd'T'HH:mm:ss; null if not submitted there") + public Object getNseSubmittedDate() { + return nseSubmittedDate; + } + + public void setNseSubmittedDate(Object nseSubmittedDate) { + this.nseSubmittedDate = nseSubmittedDate; + } + + public IpoOrderData bseSubmittedDate(Object bseSubmittedDate) { + this.bseSubmittedDate = bseSubmittedDate; + return this; + } + + /** + * When the application was submitted to BSE, in yyyy-MM-dd'T'HH:mm:ss; null if not submitted there + * @return bseSubmittedDate + **/ + @Schema(example = "2024-10-21T08:14:20", description = "When the application was submitted to BSE, in yyyy-MM-dd'T'HH:mm:ss; null if not submitted there") + public Object getBseSubmittedDate() { + return bseSubmittedDate; + } + + public void setBseSubmittedDate(Object bseSubmittedDate) { + this.bseSubmittedDate = bseSubmittedDate; + } + + public IpoOrderData mandateApprovedDate(Object mandateApprovedDate) { + this.mandateApprovedDate = mandateApprovedDate; + return this; + } + + /** + * When the UPI mandate was approved; null until approved + * @return mandateApprovedDate + **/ + @Schema(example = "2024-10-21T09:02:11", description = "When the UPI mandate was approved; null until approved") + public Object getMandateApprovedDate() { + return mandateApprovedDate; + } + + public void setMandateApprovedDate(Object mandateApprovedDate) { + this.mandateApprovedDate = mandateApprovedDate; + } + + public IpoOrderData rejectionDate(Object rejectionDate) { + this.rejectionDate = rejectionDate; + return this; + } + + /** + * When the application was rejected; null unless rejected + * @return rejectionDate + **/ + @Schema(example = "2024-10-22T11:30:00", description = "When the application was rejected; null unless rejected") + public Object getRejectionDate() { + return rejectionDate; + } + + public void setRejectionDate(Object rejectionDate) { + this.rejectionDate = rejectionDate; + } + + public IpoOrderData mandateRejectionDate(Object mandateRejectionDate) { + this.mandateRejectionDate = mandateRejectionDate; + return this; + } + + /** + * When the UPI mandate was rejected; null unless rejected + * @return mandateRejectionDate + **/ + @Schema(example = "2024-10-22T11:30:00", description = "When the UPI mandate was rejected; null unless rejected") + public Object getMandateRejectionDate() { + return mandateRejectionDate; + } + + public void setMandateRejectionDate(Object mandateRejectionDate) { + this.mandateRejectionDate = mandateRejectionDate; + } + + public IpoOrderData cancelRequestedDate(Object cancelRequestedDate) { + this.cancelRequestedDate = cancelRequestedDate; + return this; + } + + /** + * When cancellation was requested; null unless a cancellation was raised + * @return cancelRequestedDate + **/ + @Schema(example = "2024-10-23T10:15:00", description = "When cancellation was requested; null unless a cancellation was raised") + public Object getCancelRequestedDate() { + return cancelRequestedDate; + } + + public void setCancelRequestedDate(Object cancelRequestedDate) { + this.cancelRequestedDate = cancelRequestedDate; + } + + public IpoOrderData cancelAcceptedDate(Object cancelAcceptedDate) { + this.cancelAcceptedDate = cancelAcceptedDate; + return this; + } + + /** + * When cancellation was accepted; null unless the cancellation completed + * @return cancelAcceptedDate + **/ + @Schema(example = "2024-10-23T10:45:00", description = "When cancellation was accepted; null unless the cancellation completed") + public Object getCancelAcceptedDate() { + return cancelAcceptedDate; + } + + public void setCancelAcceptedDate(Object cancelAcceptedDate) { + this.cancelAcceptedDate = cancelAcceptedDate; + } + + public IpoOrderData unitsAllotted(Object unitsAllotted) { + this.unitsAllotted = unitsAllotted; + return this; + } + + /** + * Shares allotted. 0 until allotment completes, and on applications that were not allotted + * @return unitsAllotted + **/ + @Schema(example = "73", description = "Shares allotted. 0 until allotment completes, and on applications that were not allotted") + public Object getUnitsAllotted() { + return unitsAllotted; + } + + public void setUnitsAllotted(Object unitsAllotted) { + this.unitsAllotted = unitsAllotted; + } + + public IpoOrderData bids(Object bids) { + this.bids = bids; + return this; + } + + /** + * Bids placed in this application + * @return bids + **/ + @Schema(description = "Bids placed in this application") + public Object getBids() { + return bids; + } + + public void setBids(Object bids) { + this.bids = bids; + } + + public IpoOrderData createdAt(Object createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * When the application was created, in yyyy-MM-dd'T'HH:mm:ss + * @return createdAt + **/ + @Schema(example = "2024-11-07T17:33:10", description = "When the application was created, in yyyy-MM-dd'T'HH:mm:ss") + public Object getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Object createdAt) { + this.createdAt = createdAt; + } + + public IpoOrderData lastUpdatedAt(Object lastUpdatedAt) { + this.lastUpdatedAt = lastUpdatedAt; + return this; + } + + /** + * When the application was last updated, in yyyy-MM-dd'T'HH:mm:ss + * @return lastUpdatedAt + **/ + @Schema(example = "2026-06-30T17:36:36", description = "When the application was last updated, in yyyy-MM-dd'T'HH:mm:ss") + public Object getLastUpdatedAt() { + return lastUpdatedAt; + } + + public void setLastUpdatedAt(Object lastUpdatedAt) { + this.lastUpdatedAt = lastUpdatedAt; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IpoOrderData ipoOrderData = (IpoOrderData) o; + return Objects.equals(this.id, ipoOrderData.id) && + Objects.equals(this.symbol, ipoOrderData.symbol) && + Objects.equals(this.exchange, ipoOrderData.exchange) && + Objects.equals(this.requestId, ipoOrderData.requestId) && + Objects.equals(this.orderId, ipoOrderData.orderId) && + Objects.equals(this.status, ipoOrderData.status) && + Objects.equals(this.orderStatus, ipoOrderData.orderStatus) && + Objects.equals(this.paymentStatus, ipoOrderData.paymentStatus) && + Objects.equals(this.category, ipoOrderData.category) && + Objects.equals(this.issueType, ipoOrderData.issueType) && + Objects.equals(this.reason, ipoOrderData.reason) && + Objects.equals(this.upi, ipoOrderData.upi) && + Objects.equals(this.upiAmountBlocked, ipoOrderData.upiAmountBlocked) && + Objects.equals(this.nseSubmittedDate, ipoOrderData.nseSubmittedDate) && + Objects.equals(this.bseSubmittedDate, ipoOrderData.bseSubmittedDate) && + Objects.equals(this.mandateApprovedDate, ipoOrderData.mandateApprovedDate) && + Objects.equals(this.rejectionDate, ipoOrderData.rejectionDate) && + Objects.equals(this.mandateRejectionDate, ipoOrderData.mandateRejectionDate) && + Objects.equals(this.cancelRequestedDate, ipoOrderData.cancelRequestedDate) && + Objects.equals(this.cancelAcceptedDate, ipoOrderData.cancelAcceptedDate) && + Objects.equals(this.unitsAllotted, ipoOrderData.unitsAllotted) && + Objects.equals(this.bids, ipoOrderData.bids) && + Objects.equals(this.createdAt, ipoOrderData.createdAt) && + Objects.equals(this.lastUpdatedAt, ipoOrderData.lastUpdatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, symbol, exchange, requestId, orderId, status, orderStatus, paymentStatus, category, issueType, reason, upi, upiAmountBlocked, nseSubmittedDate, bseSubmittedDate, mandateApprovedDate, rejectionDate, mandateRejectionDate, cancelRequestedDate, cancelAcceptedDate, unitsAllotted, bids, createdAt, lastUpdatedAt); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IpoOrderData {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" exchange: ").append(toIndentedString(exchange)).append("\n"); + sb.append(" requestId: ").append(toIndentedString(requestId)).append("\n"); + sb.append(" orderId: ").append(toIndentedString(orderId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" orderStatus: ").append(toIndentedString(orderStatus)).append("\n"); + sb.append(" paymentStatus: ").append(toIndentedString(paymentStatus)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" issueType: ").append(toIndentedString(issueType)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" upi: ").append(toIndentedString(upi)).append("\n"); + sb.append(" upiAmountBlocked: ").append(toIndentedString(upiAmountBlocked)).append("\n"); + sb.append(" nseSubmittedDate: ").append(toIndentedString(nseSubmittedDate)).append("\n"); + sb.append(" bseSubmittedDate: ").append(toIndentedString(bseSubmittedDate)).append("\n"); + sb.append(" mandateApprovedDate: ").append(toIndentedString(mandateApprovedDate)).append("\n"); + sb.append(" rejectionDate: ").append(toIndentedString(rejectionDate)).append("\n"); + sb.append(" mandateRejectionDate: ").append(toIndentedString(mandateRejectionDate)).append("\n"); + sb.append(" cancelRequestedDate: ").append(toIndentedString(cancelRequestedDate)).append("\n"); + sb.append(" cancelAcceptedDate: ").append(toIndentedString(cancelAcceptedDate)).append("\n"); + sb.append(" unitsAllotted: ").append(toIndentedString(unitsAllotted)).append("\n"); + sb.append(" bids: ").append(toIndentedString(bids)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" lastUpdatedAt: ").append(toIndentedString(lastUpdatedAt)).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 "); + } + +} diff --git a/src/main/java/com/upstox/api/IpoOrderDetailResponse.java b/src/main/java/com/upstox/api/IpoOrderDetailResponse.java new file mode 100644 index 0000000..18eea10 --- /dev/null +++ b/src/main/java/com/upstox/api/IpoOrderDetailResponse.java @@ -0,0 +1,116 @@ +/* + * OpenAPI definition + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: v0 + * + * + * 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 com.upstox.api.IpoOrderData; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; +/** + * IpoOrderDetailResponse + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2026-08-17T18:30:36.248588+05:30[Asia/Kolkata]") + +public class IpoOrderDetailResponse { + @SerializedName("status") + private Object status = null; + + @SerializedName("data") + private IpoOrderData data = null; + + public IpoOrderDetailResponse status(Object status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @Schema(description = "") + public Object getStatus() { + return status; + } + + public void setStatus(Object status) { + this.status = status; + } + + public IpoOrderDetailResponse data(IpoOrderData data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @Schema(description = "") + public IpoOrderData getData() { + return data; + } + + public void setData(IpoOrderData data) { + this.data = data; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IpoOrderDetailResponse ipoOrderDetailResponse = (IpoOrderDetailResponse) o; + return Objects.equals(this.status, ipoOrderDetailResponse.status) && + Objects.equals(this.data, ipoOrderDetailResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(status, data); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IpoOrderDetailResponse {\n"); + + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).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 "); + } + +} diff --git a/src/main/java/com/upstox/api/IpoOrderResponse.java b/src/main/java/com/upstox/api/IpoOrderResponse.java new file mode 100644 index 0000000..f48c746 --- /dev/null +++ b/src/main/java/com/upstox/api/IpoOrderResponse.java @@ -0,0 +1,139 @@ +/* + * OpenAPI definition + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: v0 + * + * + * 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 com.upstox.api.IpoMetaData; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; +/** + * IpoOrderResponse + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2026-08-17T18:30:36.248588+05:30[Asia/Kolkata]") + +public class IpoOrderResponse { + @SerializedName("status") + private Object status = null; + + @SerializedName("data") + private Object data = null; + + @SerializedName("meta_data") + private IpoMetaData metaData = null; + + public IpoOrderResponse status(Object status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @Schema(description = "") + public Object getStatus() { + return status; + } + + public void setStatus(Object status) { + this.status = status; + } + + public IpoOrderResponse data(Object data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @Schema(description = "") + public Object getData() { + return data; + } + + public void setData(Object data) { + this.data = data; + } + + public IpoOrderResponse metaData(IpoMetaData metaData) { + this.metaData = metaData; + return this; + } + + /** + * Get metaData + * @return metaData + **/ + @Schema(description = "") + public IpoMetaData getMetaData() { + return metaData; + } + + public void setMetaData(IpoMetaData metaData) { + this.metaData = metaData; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IpoOrderResponse ipoOrderResponse = (IpoOrderResponse) o; + return Objects.equals(this.status, ipoOrderResponse.status) && + Objects.equals(this.data, ipoOrderResponse.data) && + Objects.equals(this.metaData, ipoOrderResponse.metaData); + } + + @Override + public int hashCode() { + return Objects.hash(status, data, metaData); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IpoOrderResponse {\n"); + + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" metaData: ").append(toIndentedString(metaData)).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 "); + } + +} diff --git a/src/main/java/io/swagger/client/api/IpoApi.java b/src/main/java/io/swagger/client/api/IpoApi.java index b3ef72b..91ffb4b 100644 --- a/src/main/java/io/swagger/client/api/IpoApi.java +++ b/src/main/java/io/swagger/client/api/IpoApi.java @@ -27,8 +27,13 @@ import com.upstox.api.ApiGatewayErrorResponse; +import com.upstox.api.IpoApplyRequest; +import com.upstox.api.IpoApplyResponse; +import com.upstox.api.IpoCancelResponse; import com.upstox.api.IpoDetailsResponse; import com.upstox.api.IpoListingResponse; +import com.upstox.api.IpoOrderDetailResponse; +import com.upstox.api.IpoOrderResponse; import java.lang.reflect.Type; import java.util.ArrayList; @@ -60,6 +65,261 @@ public void setHeadersOverrides(Map headers) { this.headers = headers; } + /** + * Build call for applyForIpo + * @param body (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public com.squareup.okhttp.Call applyForIpoCall(IpoApplyRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/v2/ipos/orders"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "OAUTH2" }; + if (headers != null) { + localVarHeaderParams.putAll(headers); + } + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call applyForIpoValidateBeforeCall(IpoApplyRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling applyForIpo(Async)"); + } + + com.squareup.okhttp.Call call = applyForIpoCall(body, progressListener, progressRequestListener); + return call; + + + + + + } + + /** + * Apply for IPO + * Places an IPO application for the authenticated user. + * @param body (required) + * @return IpoApplyResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public IpoApplyResponse applyForIpo(IpoApplyRequest body) throws ApiException { + ApiResponse resp = applyForIpoWithHttpInfo(body); + return resp.getData(); + } + + /** + * Apply for IPO + * Places an IPO application for the authenticated user. + * @param body (required) + * @return ApiResponse<IpoApplyResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse applyForIpoWithHttpInfo(IpoApplyRequest body) throws ApiException { + com.squareup.okhttp.Call call = applyForIpoValidateBeforeCall(body, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Apply for IPO (asynchronously) + * Places an IPO application for the authenticated user. + * @param body (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public com.squareup.okhttp.Call applyForIpoAsync(IpoApplyRequest body, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + com.squareup.okhttp.Call call = applyForIpoValidateBeforeCall(body, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /** + * Build call for cancelIpoOrder + * @param orderId IPO application id, as returned in `order_id` by the apply and orders APIs (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public com.squareup.okhttp.Call cancelIpoOrderCall(Object orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v2/ipos/orders/{order_id}" + .replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "OAUTH2" }; + if (headers != null) { + localVarHeaderParams.putAll(headers); + } + return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call cancelIpoOrderValidateBeforeCall(Object orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling cancelIpoOrder(Async)"); + } + + com.squareup.okhttp.Call call = cancelIpoOrderCall(orderId, progressListener, progressRequestListener); + return call; + + + + + + } + + /** + * Cancel IPO Order + * Cancels/deletes an IPO order of the authenticated user by order id. + * @param orderId IPO application id, as returned in `order_id` by the apply and orders APIs (required) + * @return IpoCancelResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public IpoCancelResponse cancelIpoOrder(Object orderId) throws ApiException { + ApiResponse resp = cancelIpoOrderWithHttpInfo(orderId); + return resp.getData(); + } + + /** + * Cancel IPO Order + * Cancels/deletes an IPO order of the authenticated user by order id. + * @param orderId IPO application id, as returned in `order_id` by the apply and orders APIs (required) + * @return ApiResponse<IpoCancelResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse cancelIpoOrderWithHttpInfo(Object orderId) throws ApiException { + com.squareup.okhttp.Call call = cancelIpoOrderValidateBeforeCall(orderId, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Cancel IPO Order (asynchronously) + * Cancels/deletes an IPO order of the authenticated user by order id. + * @param orderId IPO application id, as returned in `order_id` by the apply and orders APIs (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public com.squareup.okhttp.Call cancelIpoOrderAsync(Object orderId, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + com.squareup.okhttp.Call call = cancelIpoOrderValidateBeforeCall(orderId, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } /** * Build call for getIpoDetails * @param id IPO slug ID (required) @@ -331,4 +591,263 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don apiClient.executeAsync(call, localVarReturnType, callback); return call; } + /** + * Build call for getIpoOrderById + * @param orderId IPO application id, as returned in `order_id` by the apply and orders APIs (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public com.squareup.okhttp.Call getIpoOrderByIdCall(Object orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v2/ipos/orders/{order_id}" + .replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "OAUTH2" }; + if (headers != null) { + localVarHeaderParams.putAll(headers); + } + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call getIpoOrderByIdValidateBeforeCall(Object orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling getIpoOrderById(Async)"); + } + + com.squareup.okhttp.Call call = getIpoOrderByIdCall(orderId, progressListener, progressRequestListener); + return call; + + + + + + } + + /** + * Get IPO Order + * Fetches a single IPO order of the authenticated user by order id. + * @param orderId IPO application id, as returned in `order_id` by the apply and orders APIs (required) + * @return IpoOrderDetailResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public IpoOrderDetailResponse getIpoOrderById(Object orderId) throws ApiException { + ApiResponse resp = getIpoOrderByIdWithHttpInfo(orderId); + return resp.getData(); + } + + /** + * Get IPO Order + * Fetches a single IPO order of the authenticated user by order id. + * @param orderId IPO application id, as returned in `order_id` by the apply and orders APIs (required) + * @return ApiResponse<IpoOrderDetailResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse getIpoOrderByIdWithHttpInfo(Object orderId) throws ApiException { + com.squareup.okhttp.Call call = getIpoOrderByIdValidateBeforeCall(orderId, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get IPO Order (asynchronously) + * Fetches a single IPO order of the authenticated user by order id. + * @param orderId IPO application id, as returned in `order_id` by the apply and orders APIs (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public com.squareup.okhttp.Call getIpoOrderByIdAsync(Object orderId, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + com.squareup.okhttp.Call call = getIpoOrderByIdValidateBeforeCall(orderId, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /** + * Build call for getIpoOrders + * @param pageNumber Page number, starting at 1 (optional) + * @param records Number of records per page (optional) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public com.squareup.okhttp.Call getIpoOrdersCall(Object pageNumber, Object records, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v2/ipos/orders"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + if (pageNumber != null) + localVarQueryParams.addAll(apiClient.parameterToPair("page_number", pageNumber)); + if (records != null) + localVarQueryParams.addAll(apiClient.parameterToPair("records", records)); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "OAUTH2" }; + if (headers != null) { + localVarHeaderParams.putAll(headers); + } + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call getIpoOrdersValidateBeforeCall(Object pageNumber, Object records, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + com.squareup.okhttp.Call call = getIpoOrdersCall(pageNumber, records, progressListener, progressRequestListener); + return call; + + + + + + } + + /** + * Get IPO Orders + * Fetches the authenticated user's IPO orders/applications. + * @param pageNumber Page number, starting at 1 (optional) + * @param records Number of records per page (optional) + * @return IpoOrderResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public IpoOrderResponse getIpoOrders(Object pageNumber, Object records) throws ApiException { + ApiResponse resp = getIpoOrdersWithHttpInfo(pageNumber, records); + return resp.getData(); + } + + /** + * Get IPO Orders + * Fetches the authenticated user's IPO orders/applications. + * @param pageNumber Page number, starting at 1 (optional) + * @param records Number of records per page (optional) + * @return ApiResponse<IpoOrderResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse getIpoOrdersWithHttpInfo(Object pageNumber, Object records) throws ApiException { + com.squareup.okhttp.Call call = getIpoOrdersValidateBeforeCall(pageNumber, records, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get IPO Orders (asynchronously) + * Fetches the authenticated user's IPO orders/applications. + * @param pageNumber Page number, starting at 1 (optional) + * @param records Number of records per page (optional) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public com.squareup.okhttp.Call getIpoOrdersAsync(Object pageNumber, Object records, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + com.squareup.okhttp.Call call = getIpoOrdersValidateBeforeCall(pageNumber, records, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } } diff --git a/src/test/java/com/upstox/sanity/IpoApiTest.java b/src/test/java/com/upstox/sanity/IpoApiTest.java index 83ecf71..f6000c7 100644 --- a/src/test/java/com/upstox/sanity/IpoApiTest.java +++ b/src/test/java/com/upstox/sanity/IpoApiTest.java @@ -3,11 +3,17 @@ import com.upstox.ApiClient; import com.upstox.ApiException; import com.upstox.Configuration; +import com.upstox.api.IpoApplyRequest; +import com.upstox.api.IpoBidRequest; import com.upstox.api.IpoDetailsResponse; import com.upstox.api.IpoListingResponse; +import com.upstox.api.IpoOrderDetailResponse; +import com.upstox.api.IpoOrderResponse; import com.upstox.auth.OAuth; import io.swagger.client.api.IpoApi; +import java.util.Arrays; + public class IpoApiTest { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); @@ -40,5 +46,59 @@ public static void main(String[] args) { System.err.println("Exception when calling IpoApi#getIpoDetails"); System.out.println(e.getResponseBody()); } + + try { + IpoOrderResponse result = apiInstance.getIpoOrders(1, 20); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IpoApi#getIpoOrders"); + System.out.println(e.getResponseBody()); + } + + try { + IpoOrderResponse result = apiInstance.getIpoOrders(null, null); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IpoApi#getIpoOrders (no params)"); + System.out.println(e.getResponseBody()); + } + + try { + IpoOrderDetailResponse result = apiInstance.getIpoOrderById("sample-ipo-order-id"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IpoApi#getIpoOrderById"); + System.out.println(e.getResponseBody()); + } + + // NOTE: applyForIpo and cancelIpoOrder are state-changing on a live account — + // applyForIpo blocks funds via a UPI mandate and cancelIpoOrder withdraws a real + // application. The sanity suite has no dry-run/guard mechanism for write paths, so + // these two calls are left commented out. Uncomment them only when running against + // an account where a live IPO application (and its cancellation) is acceptable, and + // replace the placeholder id / UPI handle / order id with real values. + IpoApplyRequest applyBody = new IpoApplyRequest(); + applyBody.setId("sample-ipo-slug"); + applyBody.setUpi("sampleuser@upi"); + applyBody.setCategory("IND"); + applyBody.setBids(Arrays.asList( + new IpoBidRequest().quantity(1).price(100.0) + )); + System.out.println("Prepared (not sent) IPO apply request: " + applyBody); + // try { + // IpoApplyResponse result = apiInstance.applyForIpo(applyBody); + // System.out.println(result); + // } catch (ApiException e) { + // System.err.println("Exception when calling IpoApi#applyForIpo"); + // System.out.println(e.getResponseBody()); + // } + + // try { + // IpoCancelResponse result = apiInstance.cancelIpoOrder("sample-ipo-order-id"); + // System.out.println(result); + // } catch (ApiException e) { + // System.err.println("Exception when calling IpoApi#cancelIpoOrder"); + // System.out.println(e.getResponseBody()); + // } } }