
com.starkinfra.IssuingWithdrawal Maven / Gradle / Ivy
Show all versions of sdk Show documentation
package com.starkinfra;
import com.starkinfra.utils.Rest;
import com.starkinfra.utils.Resource;
import com.starkinfra.utils.Generator;
import com.starkinfra.utils.SubResource;
import java.util.Map;
import java.util.List;
import java.util.HashMap;
import java.util.ArrayList;
public final class IssuingWithdrawal extends Resource {
/**
* IssuingWithdrawal object
*
* The IssuingWithdrawal objects created in your Workspace return cash from your Issuing balance to your
* Banking balance
*
* When you initialize a IssuingWithdrawal, the entity will not be automatically
* created in the Stark Infra API. The 'create' function sends the objects
* to the Stark Infra API and returns the created object.
*
* Parameters:
* amount [Long]: IssuingWithdrawal value in cents. Minimum = 0 (any value will be accepted). ex: 1234 (= R$ 12.34)
* externalId [string] IssuingWithdrawal external ID. ex: "12345"
* description [string]: IssuingWithdrawal description. ex: "sending money back"
* tags [list of strings, default []]: list of strings for tagging. ex: ["tony", "stark"]
* id [string]: unique id returned when IssuingWithdrawal is created. ex: "5656565656565656"
* transactionId [string]: Stark Infra ledger transaction ids linked to this IssuingWithdrawal
* issuingTransactionId [string]: issuing ledger transaction ids linked to this IssuingWithdrawal
* updated [string]: latest update datetime for the IssuingWithdrawal. ex: "2020-03-10 10:30:00.000000+00:00"
* created [string]: creation datetime for the IssuingWithdrawal. ex: "2020-03-10 10:30:00.000000+00:00"
*
*/
static ClassData data = new ClassData(IssuingWithdrawal.class, "IssuingWithdrawal");
public Long amount;
public String externalId;
public String description;
public String[] tags;
public String transactionId;
public String issuingTransactionId;
public String updated;
public String created;
/**
* IssuingWithdrawal object
*
* The IssuingWithdrawal objects created in your Workspace return cash from your Issuing balance to your
* Banking balance.
*
* When you initialize a IssuingWithdrawal, the entity will not be automatically
* created in the Stark Infra API. The 'create' function sends the objects
* to the Stark Infra API and returns the created object.
*
* Parameters:
* @param amount [Long]: IssuingWithdrawal value in cents. Minimum = 0 (any value will be accepted). ex: 1234 (= R$ 12.34)
* @param externalId [string] IssuingWithdrawal external ID. ex: "12345"
* @param description [string]: IssuingWithdrawal description. ex: "sending money back"
* @param tags [list of strings, default []]: list of strings for tagging. ex: ["tony", "stark"]
* @param id [string]: unique id returned when IssuingWithdrawal is created. ex: "5656565656565656"
* @param transactionId [string]: Stark Infra ledger transaction ids linked to this IssuingWithdrawal
* @param issuingTransactionId [string]: issuing ledger transaction ids linked to this IssuingWithdrawal
* @param updated [string]: latest update datetime for the IssuingWithdrawal. ex: "2020-03-10 10:30:00.000000+00:00"
* @param created [string]: creation datetime for the IssuingWithdrawal. ex: "2020-03-10 10:30:00.000000+00:00"
*/
IssuingWithdrawal(String id, Long amount, String description, String transactionId, String issuingTransactionId,
String externalId, String[] tags, String updated, String created
) {
super(id);
this.amount = amount;
this.externalId = externalId;
this.description = description;
this.tags = tags;
this.transactionId = transactionId;
this.issuingTransactionId = issuingTransactionId;
this.updated = updated;
this.created = created;
}
/**
* IssuingWithdrawal object
*
* The IssuingWithdrawal objects created in your Workspace return cash from your Issuing balance to your
* Banking balance.
*
* When you initialize a IssuingWithdrawal, the entity will not be automatically
* created in the Stark Infra API. The 'create' function sends the objects
* to the Stark Infra API and returns the created object.
*
* Parameters:
* @param data map of properties for the creation of the IssuingWithdrawal
* amount [Long]: IssuingWithdrawal value in cents. Minimum = 0 (any value will be accepted). ex: 1234 (= R$ 12.34)
* externalId [string] IssuingWithdrawal external ID. ex: "12345"
* description [string]: IssuingWithdrawal description. ex: "sending money back"
*
* Parameters (optional):
* tags [list of strings, default []]: list of strings for tagging. ex: ["tony", "stark"]
*
* Attributes (return-only):
* id [string]: unique id returned when IssuingWithdrawal is created. ex: "5656565656565656"
* transactionId [string]: Stark Infra ledger transaction ids linked to this IssuingWithdrawal
* issuingTransactionId [string]: issuing ledger transaction ids linked to this IssuingWithdrawal
* updated [string]: latest update datetime for the IssuingWithdrawal. ex: "2020-03-10 10:30:00.000000+00:00"
* created [string]: creation datetime for the IssuingWithdrawal. ex: "2020-03-10 10:30:00.000000+00:00"
* @throws Exception error in the request
*/
@SuppressWarnings("unchecked")
public IssuingWithdrawal(Map data) throws Exception {
super(null);
HashMap dataCopy = new HashMap<>(data);
this.amount = ((Number) dataCopy.remove("amount")).longValue();
this.externalId = (String) dataCopy.remove("externalId");
this.description = (String) dataCopy.remove("description");
this.tags = (String[]) dataCopy.remove("tags");
this.transactionId = null;
this.issuingTransactionId = null;
this.updated = null;
this.created = null;
if (!dataCopy.isEmpty()) {
throw new Exception("Unknown parameters used in constructor: [" + String.join(", ", dataCopy.keySet()) + "]");
}
}
/**
* Create an IssuingWithdrawal
*
* Send an IssuingWithdrawal object for creation in the Stark Infra API
*
* Parameters:
* @param withdrawal [IssuingWithdrawal object]: IssuingWithdrawal object to be created in the API
* @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkinfra.Settings.user was set before function call
*
* Return:
* @return IssuingWithdrawal object with updated attributes
* @throws Exception error in the request
*/
public static IssuingWithdrawal create(IssuingWithdrawal withdrawal, User user) throws Exception {
return Rest.postSingle(data, withdrawal, user);
}
/**
* Create an IssuingWithdrawal
*
* Send an IssuingWithdrawal object for creation in the Stark Infra API
*
* Parameters:
* @param withdrawal [IssuingWithdrawal object]: IssuingWithdrawal object to be created in the API
*
* Return:
* @return IssuingWithdrawal object with updated attributes
* @throws Exception error in the withdrawal
*/
public static IssuingWithdrawal create(IssuingWithdrawal withdrawal) throws Exception {
return IssuingWithdrawal.create(withdrawal, null);
}
/**
* Retrieve a specific IssuingWithdrawal
*
* Receive a single IssuingWithdrawal object previously created in the Stark Infra API by its id
*
* Parameters:
* @param id [string]: object unique id. ex: "5656565656565656"
* @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkinfra.Settings.user was set before function call
*
* Return:
* @return IssuingWithdrawal object with updated attributes
* @throws Exception error in the request
*/
public static IssuingWithdrawal get(String id, User user) throws Exception{
return Rest.getId(data, id, user);
}
/**
* Retrieve a specific IssuingWithdrawal
*
* Receive a single IssuingWithdrawal object previously created in the Stark Infra API by its id
*
* Parameters:
* @param id [string]: object unique id. ex: "5656565656565656"
*
* Return:
* @return IssuingWithdrawal object with updated attributes
* @throws Exception error in the request
*/
public static IssuingWithdrawal get(String id) throws Exception{
return Rest.getId(data, id, null);
}
/**
* Retrieve IssuingWithdrawals
*
* Receive a generator of IssuingWithdrawal objects previously created in the Stark Infra API
*
* Parameters:
* @param params map of parameters for the query
* limit [integer, default null]: maximum number of objects to be retrieved. Unlimited if null. ex: 35
* externalIds [list of strings, default []]: external IDs. ex: ["5656565656565656", "4545454545454545"]
* after [string, default null] date filter for objects created only after specified date. ex: "2022-03-22"
* before [string, default null]: date filter for objects created only before specified date. ex: "2022-03-22"
* tags [list of strings, default null]: tags to filter retrieved objects. ex: ["tony", "stark"]
* @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkinfra.Settings.user was set before function call
*
* Return:
* @return generator of IssuingWithdrawal objects with updated attributes
* @throws Exception error in the request
*/
public static Generator query(Map params, User user) throws Exception{
return Rest.getStream(data, params, user);
}
/**
* Retrieve IssuingWithdrawals
*
* Receive a generator of IssuingWithdrawal objects previously created in the Stark Infra API
*
* Parameters:
* @param params map of parameters for the query
* limit [integer, default null]: maximum number of objects to be retrieved. Unlimited if null. ex: 35
* externalIds [list of strings, default []]: external IDs. ex: ["5656565656565656", "4545454545454545"]
* after [string, default null] date filter for objects created only after specified date. ex: "2022-03-22"
* before [string, default null]: date filter for objects created only before specified date. ex: "2022-03-22"
* tags [list of strings, default null]: tags to filter retrieved objects. ex: ["tony", "stark"]
*
* Return:
* @return generator of IssuingWithdrawal objects with updated attributes
* @throws Exception error in the request
*/
public static Generator query(Map params) throws Exception{
return Rest.getStream(data, params, null);
}
/**
* Retrieve IssuingWithdrawals
*
* Receive a generator of IssuingWithdrawal objects previously created in the Stark Infra API
*
* Parameters:
* @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkinfra.Settings.user was set before function call
*
* Return:
* @return generator of IssuingWithdrawal objects with updated attributes
* @throws Exception error in the request
*/
public static Generator query(User user) throws Exception{
return Rest.getStream(data, new HashMap<>(), user);
}
/**
* Retrieve IssuingWithdrawals
*
* Receive a generator of IssuingWithdrawal objects previously created in the Stark Infra API
*
* Return:
* @return generator of IssuingWithdrawal objects with updated attributes
* @throws Exception error in the request
*/
public static Generator query() throws Exception{
return Rest.getStream(data, new HashMap<>(), null);
}
public final static class Page {
public List issuingWithdrawals;
public String cursor;
public Page(List issuingWithdrawals, String cursor) {
this.issuingWithdrawals = issuingWithdrawals;
this.cursor = cursor;
}
}
/**
* Retrieve paged IssuingWithdrawals
*
* Receive a list of up to 100 IssuingWithdrawal objects previously created in the Stark Infra API and the cursor to the next page.
* Use this function instead of query if you want to manually page purchases.
*
* Return:
* IssuingWithdrawal.Page.withdrawals: list of IssuingWithdrawal objects with updated attributes
* IssuingWithdrawal.Page.cursor: cursor to retrieve the next page of IssuingWithdrawal objects
* @throws Exception error in the request
*/
public static IssuingWithdrawal.Page page() throws Exception {
return page(new HashMap<>(), null);
}
/**
* Retrieve paged IssuingWithdrawals
*
* Receive a list of up to 100 IssuingWithdrawal objects previously created in the Stark Infra API and the cursor to the next page.
* Use this function instead of query if you want to manually page purchases.
*
* Parameters:
* @param params map of parameters
* limit [integer, default 100]: maximum number of objects to be retrieved. Unlimited if null. ex: 35
* externalIds [list of strings, default []]: external IDs. ex: ["5656565656565656", "4545454545454545"]
* after [string, default null] date filter for objects created only after specified date. ex: "2022-03-22"
* before [string, default null]: date filter for objects created only before specified date. ex: "2022-03-22"
* tags [list of strings, default null]: tags to filter retrieved objects. ex: ["tony", "stark"]
*
* Return:
* IssuingWithdrawal.Page.withdrawals: list of IssuingWithdrawal objects with updated attributes
* IssuingWithdrawal.Page.cursor: cursor to retrieve the next page of IssuingWithdrawal objects
* @throws Exception error in the request
*/
public static IssuingWithdrawal.Page page(Map params) throws Exception {
return page(params, null);
}
/**
* Retrieve paged IssuingWithdrawals
*
* Receive a list of up to 100 IssuingWithdrawal objects previously created in the Stark Infra API and the cursor to the next page.
* Use this function instead of query if you want to manually page purchases.
*
* Parameters:
* @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkinfra.Settings.user was set before function call
*
* Return:
* IssuingWithdrawal.Page.withdrawals: list of IssuingWithdrawal objects with updated attributes
* IssuingWithdrawal.Page.cursor: cursor to retrieve the next page of IssuingWithdrawal objects
* @throws Exception error in the request
*/
public static IssuingWithdrawal.Page page(User user) throws Exception {
return page(new HashMap<>(), user);
}
/**
* Retrieve paged IssuingWithdrawals
*
* Receive a list of up to 100 IssuingWithdrawal objects previously created in the Stark Infra API and the cursor to the next page.
* Use this function instead of query if you want to manually page purchases.
*
* Parameters:
* @param params map of parameters
* limit [integer, default 100]: maximum number of objects to be retrieved. It must be an integer between 1 and 100. ex: 35
* externalIds [list of strings, default []]: external IDs. ex: ["5656565656565656", "4545454545454545"]
* after [string, default null] date filter for objects created only after specified date. ex: "2022-03-22"
* before [string, default null]: date filter for objects created only before specified date. ex: "2022-03-22"
* tags [list of strings, default null]: tags to filter retrieved objects. ex: ["tony", "stark"]
* @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkinfra.Settings.user was set before function call
*
* Return:
* IssuingWithdrawal.Page.withdrawals: list of IssuingWithdrawal objects with updated attributes
* IssuingWithdrawal.Page.cursor: cursor to retrieve the next page of IssuingWithdrawal objects
* @throws Exception error in the request
*/
public static IssuingWithdrawal.Page page(Map params, User user) throws Exception {
com.starkinfra.utils.Page page = Rest.getPage(data, params, user);
List issuingWithdrawals = new ArrayList<>();
for (SubResource issuingWithdrawal: page.entities) {
issuingWithdrawals.add((IssuingWithdrawal) issuingWithdrawal);
}
return new Page(issuingWithdrawals, page.cursor);
}
}