All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.starkinfra.IssuingCard Maven / Gradle / Ivy

Go to download

Welcome to the Stark Infra Java SDK! This tool is made for Java developers who want to easily integrate with our API. This SDK version is compatible with the Stark Infra API v2.

There is a newer version: 0.11.2
Show newest version
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 IssuingCard extends Resource {
    /**
     * IssuingCard object
     * 

* The IssuingCard object displays the information of the cards created in your Workspace. * Sensitive information will only be returned when the "expand" parameter is used, to avoid security concerns. *

* When you initialize a IssuingCard, 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: * holderName [string]: card holder name. ex: "Tony Stark" * holderTaxId [string]: card holder tax ID. ex: "012.345.678-90" * holderExternalId [string]: card holder unique id, generated by the user to avoid duplicated holders. ex: "my-entity/123" * displayName [string, default ""]: card displayed name. ex: "ANTHONY STARK" * rules [list of IssuingRule or HashMap, default []]: [EXPANDABLE] list of card spending rules. * productId [string, default ""]: card product ID to which the card is bound. ex: "53810200" * tags [list of strings, default []]: list of strings for tagging. ex: ["travel", "food"] * streetLine1 [string, default sub-issuer street line 1]: card holder main address. ex: "Av. Paulista, 200" * streetLine2 [string, default sub-issuer street line 2]: card holder address complement. ex: "Apto. 123" * district [string, default sub-issuer district]: card holder address district / neighbourhood. ex: "Bela Vista" * city [string, default sub-issuer city]: card holder address city. ex: "Rio de Janeiro" * stateCode [string, default sub-issuer state code]: card holder address state. ex: "GO" * zipCode [string, default sub-issuer zip code]: card holder address zip code. ex: "01311-200" * id [string]: unique id returned when IssuingCard is created. ex: "5656565656565656" * holderId [string]: card holder unique id. ex: "5656565656565656" * type [string]: card type. ex: "virtual" * status [string]: current IssuingCard status. ex: "canceled" or "active" * number [string]: [EXPANDABLE] masked card number. Expand to unmask the value. ex: "123". * securityCode [string]: [EXPANDABLE] masked card verification value (cvv). Expand to unmask the value. ex: "123". * expiration [string]: [EXPANDABLE] masked card expiration datetime. Expand to unmask the value. ex: "2020-03-10 10:30:00.000000+00:00" * updated [string]: latest update datetime for the IssuingCard. ex: "2020-03-10 10:30:00.000000+00:00" * created [string]: creation datetime for the IssuingCard. ex: "2020-03-10 10:30:00.000000+00:00" * */ static ClassData data = new ClassData(IssuingCard.class, "IssuingCard"); public String holderName; public String holderTaxId; public String holderExternalId; public String displayName; public List rules; public String productId; public String[] tags; public String streetLine1; public String streetLine2; public String district; public String city; public String stateCode; public String zipCode; public String holderId; public String type; public String status; public String number; public String securityCode; public String expiration; public String updated; public String created; /** * IssuingCard object *

* The IssuingCard object displays Card's information created in your Workspace. *

* When you initialize a IssuingCard, 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 holderName [string]: card holder name. ex: "Tony Stark" * @param holderTaxId [string]: card holder tax ID. ex: "012.345.678-90" * @param holderExternalId [string]: card holder unique id, generated by the user to avoid duplicated holders. ex: "my-entity/123" * @param displayName [string, default ""]: card displayed name. ex: "ANTHONY STARK" * @param rules [list of IssuingRule or HashMap, default []]: [EXPANDABLE] list of card spending rules. * @param productId [string, default ""]: card product ID to which the card is bound. ex: "53810200" * @param tags [list of strings, default []]: list of strings for tagging. ex: ["travel", "food"] * @param streetLine1 [string, default sub-issuer street line 1]: card holder main address. ex: "Av. Paulista, 200" * @param streetLine2 [string, default sub-issuer street line 2]: card holder address complement. ex: "Apto. 123" * @param district [string, default sub-issuer district]: card holder address district / neighbourhood. ex: "Bela Vista" * @param city [string, default sub-issuer city]: card holder address city. ex: "Rio de Janeiro" * @param stateCode [string, default sub-issuer state code]: card holder address state. ex: "GO" * @param zipCode [string, default sub-issuer zip code]: card holder address zip code. ex: "01311-200" * @param id [string]: unique id returned when IssuingCard is created. ex: "5656565656565656" * @param holderId [string]: card holder unique id. ex: "5656565656565656" * @param type [string]: card type. ex: "virtual" * @param status [string]: current IssuingCard status. ex: "canceled" or "active" * @param number [string]: [EXPANDABLE] masked card number. Expand to unmask the value. ex: "123". * @param securityCode [string]: [EXPANDABLE] masked card verification value (cvv). Expand to unmask the value. ex: "123". * @param expiration [string]: [EXPANDABLE] masked card expiration datetime. Expand to unmask the value. ex: "2020-03-10 10:30:00.000000+00:00" * @param updated [string]: latest update datetime for the IssuingCard. ex: "2020-03-10 10:30:00.000000+00:00" * @param created [string]: creation datetime for the IssuingCard. ex: "2020-03-10 10:30:00.000000+00:00" */ public IssuingCard(String holderName, String holderTaxId, String holderExternalId, String displayName, List rules, String productId, String[] tags, String streetLine1, String streetLine2, String district, String city, String stateCode, String zipCode, String id, String holderId, String type, String status, String number, String securityCode, String expiration, String updated, String created ) { super(id); this.holderName = holderName; this.holderTaxId = holderTaxId; this.holderExternalId = holderExternalId; this.displayName = displayName; this.rules = rules; this.productId = productId; this.tags = tags; this.streetLine1 = streetLine1; this.streetLine2 = streetLine2; this.district = district; this.city = city; this.stateCode = stateCode; this.zipCode = zipCode; this.holderId = holderId; this.type = type; this.status = status; this.number = number; this.securityCode = securityCode; this.expiration = expiration; this.updated = updated; this.created = created; } /** * IssuingCard object *

* The IssuingCard object displays Card's information created in your Workspace. *

* When you initialize a IssuingCard, 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 (required): * @param data map of properties for the creation of the IssuingCard * holderName [string]: card holder name. ex: "Tony Stark" * holderTaxId [string]: card holder tax ID. ex: "012.345.678-90" * holderExternalId [string]: card holder unique id, generated by the user to avoid duplicated holders. ex: "my-entity/123" *

* Parameters (optional): * displayName [string, default ""]: card displayed name. ex: "ANTHONY STARK" * rules [list of IssuingRule or HashMap, default []]: [EXPANDABLE] list of card spending rules. * productId [string, default ""]: product ID to which the card is bound. ex: "53810200" * tags [list of strings, default []]: list of strings for tagging. ex: ["travel", "food"] * streetLine1 [string, default sub-issuer street line 1]: card holder main address. ex: "Av. Paulista, 200" * streetLine2 [string, default sub-issuer street line 2]: card holder address complement. ex: "Apto. 123" * district [string, default sub-issuer district]: card holder address district / neighbourhood. ex: "Bela Vista" * city [string, default sub-issuer city]: card holder address city. ex: "Rio de Janeiro" * stateCode [string, default sub-issuer state code]: card holder address state. ex: "GO" * zipCode [string, default sub-issuer zip code]: card holder address zip code. ex: "01311-200" *

* Attributes (return-only): * id [string]: unique id returned when IssuingCard is created. ex: "5656565656565656" * holderId [string]: card holder unique id. ex: "5656565656565656" * type [string]: card type. ex: "virtual" * status [string]: current IssuingCard status. ex: "canceled" or "active" * number [string]: [EXPANDABLE] masked card number. Expand to unmask the value. ex: "123". * securityCode [string]: [EXPANDABLE] masked card verification value (cvv). Expand to unmask the value. ex: "123". * expiration [string]: [EXPANDABLE] masked card expiration datetime. Expand to unmask the value. ex: "2020-03-10 10:30:00.000000+00:00". * updated [string]: latest update datetime for the IssuingCard. ex: "2020-03-10 10:30:00.000000+00:00" * created [string]: creation datetime for the IssuingCard. ex: "2020-03-10 10:30:00.000000+00:00" * @throws Exception error in the request */ public IssuingCard(Map data) throws Exception { super(null); HashMap dataCopy = new HashMap<>(data); this.tags = (String[]) dataCopy.remove("tags"); this.holderExternalId = (String) dataCopy.remove("holderExternalId"); this.holderName = (String) dataCopy.remove("holderName"); this.holderTaxId = (String) dataCopy.remove("holderTaxId"); this.displayName = (String) dataCopy.remove("displayName"); this.rules = IssuingRule.parseRules((List) dataCopy.remove("rules")); this.productId = (String) dataCopy.remove("productId"); this.streetLine1 = (String) dataCopy.remove("streetLine1"); this.streetLine2 = (String) dataCopy.remove("streetLine2"); this.district = (String) dataCopy.remove("district"); this.city = (String) dataCopy.remove("city"); this.stateCode = (String) dataCopy.remove("stateCode"); this.zipCode = (String) dataCopy.remove("zipCode"); this.holderId = null; this.type = (String) dataCopy.remove("type"); this.status = null; this.number = null; this.securityCode = null; this.expiration = null; this.updated = null; this.created = null; if (!dataCopy.isEmpty()) { throw new Exception("Unknown parameters used in constructor: [" + String.join(", ", dataCopy.keySet()) + "]"); } } /** * Create IssuingCards *

* Send a list of IssuingCard objects for creation in the Stark Infra API *

* Parameters: * @param cards [list of IssuingCard objects]: list of IssuingCard objects to be created in the API * @param params map of parameters * expand [list of strings, default null]: fields to expand information. ex: ["rules", "securityCode", "number", "expiration"] * @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkinfra.Settings.user was set before function call *

* Return: * @return list of IssuingCard objects with updated attributes * @throws Exception error in the request */ public static List create(List cards, Map params, User user) throws Exception { List cardList = new ArrayList<>(); for (Object card : cards){ if (card instanceof Map){ cardList.add(new IssuingCard((Map) card)); continue; } if (card instanceof IssuingCard){ cardList.add((IssuingCard) card); continue; } throw new Exception("Unknown type \"" + card.getClass() + "\", use IssuingCard or HashMap"); } return Rest.post(data, cardList, params, user); } /** * Create IssuingCards *

* Send a list of IssuingCard objects for creation in the Stark Infra API *

* Parameters: * @param cards [list of IssuingCard objects]: list of IssuingCard objects 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 list of IssuingCard objects with updated attributes * @throws Exception error in the request */ public static List create(List cards, User user) throws Exception { return IssuingCard.create(cards, null, user); } /** * Create IssuingCards *

* Send a list of IssuingCard objects for creation in the Stark Infra API *

* Parameters: * @param cards [list of IssuingCard objects]: list of IssuingCard objects to be created in the API * @param params map of parameters * expand [list of strings, default null]: fields to expand information. ex: ["rules", "securityCode", "number", "expiration"] *

* Return: * @return list of IssuingCard objects with updated attributes * @throws Exception error in the request */ public static List create(List cards, Map params) throws Exception { return IssuingCard.create(cards, params, null); } /** * Create IssuingCards *

* Send a list of IssuingCard objects for creation in the Stark Infra API *

* Parameters: * @param cards [list of IssuingCard objects]: list of IssuingCard objects to be created in the API *

* Return: * @return list of IssuingCard objects with updated attributes * @throws Exception error in the request */ public static List create(List cards) throws Exception { return IssuingCard.create(cards, null, null); } /** * Retrieve IssuingCards *

* Receive a generator of IssuingCard objects registered to your workspace in the Stark Infra API. *

* Parameters: * @param params map of parameters for the query * status [string, default ""]: filter for status of retrieved objects. ex: "active", "blocked", "expired" or "canceled" * types [list of strings, default null]: card type. ex: ["virtual"] * holderIds [list of strings, default null]: card holder IDs. ex: ["5656565656565656", "4545454545454545"] * after [string, default null]: date filter for objects created only after specified date. ex: "2022-03-22" * before [date 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"] * ids [list of strings, default null]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"] * limit [integer, default null]: maximum number of objects to be retrieved. Unlimited if null. ex: 35 * expand [list of strings, default []]: fields to expand information. ex: ["rules", "securityCode", "number", "expiration"] * @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 IssuingCard 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 IssuingCards *

* Receive a generator of IssuingCard objects registered to your workspace in the Stark Infra API. *

* Parameters: * @param params map of parameters for the query * status [string, default ""]: filter for status of retrieved objects. ex: "active", "blocked", "expired" or "canceled" * types [list of strings, default null]: card type. ex: ["virtual"] * holderIds [list of strings, default null]: card holder IDs. ex: ["5656565656565656", "4545454545454545"] * after [string, default null]: date filter for objects created only after specified date. ex: "2022-03-22" * before [date 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"] * ids [list of strings, default null]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"] * limit [integer, default null]: maximum number of objects to be retrieved. Unlimited if null. ex: 35 * expand [list of strings, default []]: fields to expand information. ex: ["rules", "securityCode", "number", "expiration"] *

* Return: * @return generator of IssuingCard 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 IssuingCards *

* Receive a generator of IssuingCard objects registered to your workspace 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 IssuingCard 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 IssuingCards *

* Receive a generator of IssuingCard objects registered to your workspace in the Stark Infra API. *

* Return: * @return generator of IssuingCard 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 cards; public String cursor; public Page(List cards, String cursor) { this.cards = cards; this.cursor = cursor; } } /** * Retrieve paged IssuingCards *

* Receive a list of up to 100 IssuingCard objects registered to your workspace in the Stark Infra API. and the cursor to the next page. *

* Parameters: * @param params map of parameters * cursor [string, default null]: cursor returned on the previous page function call * status [string, default ""]: filter for status of retrieved objects. ex: "active", "blocked", "expired" or "canceled" * types [list of strings, default null]: card type. ex: ["virtual"] * holderIds [list of strings, default null]: card holder IDs. ex: ["5656565656565656", "4545454545454545"] * after [string, default null]: date filter for objects created only after specified date. ex: "2022-03-22" * before [date 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"] * ids [list of strings, default null]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"] * limit [integer, default 100]: maximum number of objects to be retrieved. It must be an integer between 1 and 100. ex: 35 * expand [list of strings, default []]: fields to expand information. ex: ["rules", "securityCode", "number", "expiration"] * @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkinfra.Settings.user was set before function call *

* Return: * @return IssuingCard.Page object: * IssuingCard.Page.cards: list of IssuingCard objects with updated attributes * IssuingCard.Page.cursor: cursor to retrieve the next page of IssuingCard objects * @throws Exception error in the request */ public static Page page(Map params, User user) throws Exception { com.starkinfra.utils.Page page = Rest.getPage(data, params, user); List cards = new ArrayList<>(); for (SubResource card: page.entities) { cards.add((IssuingCard) card); } return new Page(cards, page.cursor); } /** * Retrieve paged IssuingCards *

* Receive a list of up to 100 IssuingCard objects registered to your workspace in the Stark Infra API. and the cursor to the next page. *

* Parameters: * @param params map of parameters * cursor [string, default null]: cursor returned on the previous page function call * status [string, default ""]: filter for status of retrieved objects. ex: "active", "blocked", "expired" or "canceled" * types [list of strings, default null]: card type. ex: ["virtual"] * holderIds [list of strings, default null]: card holder IDs. ex: ["5656565656565656", "4545454545454545"] * after [string, default null]: date filter for objects created only after specified date. ex: "2022-03-22" * before [date 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"] * ids [list of strings, default null]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"] * limit [integer, default 100]: maximum number of objects to be retrieved. It must be an integer between 1 and 100. ex: 35 * expand [list of strings, default []]: fields to expand information. ex: ["rules", "securityCode", "number", "expiration"] *

* Return: * @return IssuingCard.Page object: * IssuingCard.Page.cards: list of IssuingCard objects with updated attributes * IssuingCard.Page.cursor: cursor to retrieve the next page of IssuingCard objects * @throws Exception error in the request */ public static Page page(Map params) throws Exception { return page(params, null); } /** * Retrieve paged IssuingCards *

* Receive a list of up to 100 IssuingCard objects registered to your workspace in the Stark Infra API. and the cursor to the next page. *

* 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 IssuingCard.Page object: * IssuingCard.Page.cards: list of IssuingCard objects with updated attributes * IssuingCard.Page.cursor: cursor to retrieve the next page of IssuingCard objects * @throws Exception error in the request */ public static Page page(User user) throws Exception { return page(new HashMap<>(), user); } /** * Retrieve paged IssuingCards *

* Receive a list of up to 100 IssuingCard objects registered to your workspace in the Stark Infra API. and the cursor to the next page. *

* Return: * @return IssuingCard.Page object: * IssuingCard.Page.cards: list of IssuingCard objects with updated attributes * IssuingCard.Page.cursor: cursor to retrieve the next page of IssuingCard objects * @throws Exception error in the request */ public static Page page() throws Exception { return page(new HashMap<>(), null); } /** * Retrieve a specific IssuingCard *

* Receive a single IssuingCard object previously created in the Stark Infra API by its id *

* Parameters: * @param id [string]: object unique id. ex: "5656565656565656" * @param params map of parameters * expand [list of strings, default null]: fields to expand information. ex: ["rules"] * @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkinfra.Settings.user was set before function call *

* Return: * @return IssuingCard object with updated attributes * @throws Exception error in the request */ public static IssuingCard get(String id, Map params, User user) throws Exception{ return Rest.getId(data, id, params, user); } /** * Retrieve a specific IssuingCard *

* Receive a single IssuingCard object previously created in the Stark Infra API by its id *

* Parameters: * @param id [string]: object unique id. ex: "5656565656565656" * @param params map of parameters * expand [list of strings, default null]: fields to expand information. ex: ["rules"] *

* Return: * @return IssuingCard object with updated attributes * @throws Exception error in the request */ public static IssuingCard get(String id, Map params) throws Exception{ return IssuingCard.get(id, params, null); } /** * Retrieve a specific IssuingCard *

* Receive a single IssuingCard 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 IssuingCard object with updated attributes * @throws Exception error in the request */ public static IssuingCard get(String id, User user) throws Exception{ return IssuingCard.get(id, null, user); } /** * Retrieve a specific IssuingCard *

* Receive a single IssuingCard object previously created in the Stark Infra API by its id *

* Parameters: * @param id [string]: object unique id. ex: "5656565656565656" *

* Return: * @return IssuingCard object with updated attributes * @throws Exception error in the request */ public static IssuingCard get(String id) throws Exception{ return IssuingCard.get(id, null, null); } /** * Update IssuingCard entity *

* Update an IssuingCard by passing id. *

* Parameters: * @param id [string]: IssuingCard id. ex: "5656565656565656" * @param patchData map of parameters * status [string]: You may block the IssuingCard by passing 'blocked' in the status * pin [string, default ""]: You may unlock your physical card by passing its PIN. This is also the PIN you use to authorize a purchase. * displayName [string, default ""]: card displayed name * rules [list of IssuingRule or HashMap, default null]: list of new IssuingRules. If the rule id isn't set, a new rule will be created. * tags [list of strings, default null]: list of strings for tagging * user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkinfra.Settings.user was set before function call *

* Return: * @return IssuingCard object with updated attributes * @throws Exception error in the request */ public static IssuingCard update(String id, Map patchData) throws Exception { return IssuingCard.update(id, patchData, null); } /** * Update IssuingCard entity *

* Update an IssuingCard by passing id. *

* Parameters: * @param id [string]: IssuingCard id. ex: "5656565656565656" * @param patchData map of parameters * status [string]: You may block the IssuingCard by passing 'blocked' in the status * pin [string, default ""]: You may unlock your physical card by passing its PIN. This is also the PIN you use to authorize a purchase. * displayName [string, default null]: card displayed name * rules [list of IssuingRule or HashMap, default null]: list of new IssuingRules. If the rule id isn't set, a new rule will be created. * tags [list of strings, default null]: list of strings for tagging * @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkinfra.Settings.user was set before function call *

* Return: * @return IssuingCard object with updated attributes * @throws Exception error in the request */ public static IssuingCard update(String id, Map patchData, User user) throws Exception { return Rest.patch(data, id, patchData, user); } /** * Cancel an IssuingCard entity *

* Cancel an IssuingCard entity previously created in the Stark Infra API *

* Parameters: * @param id [string]: IssuingCard unique id. ex: "5656565656565656" *

* Return: * @return canceled IssuingCard object * @throws Exception error in the request */ public static IssuingCard cancel(String id) throws Exception { return IssuingCard.cancel(id, null); } /** * Cancel an IssuingCard entity *

* Cancel an IssuingCard entity previously created in the Stark Infra API *

* Parameters: * @param id [string]: IssuingCard 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 canceled IssuingCard object * @throws Exception error in the request */ public static IssuingCard cancel(String id, User user) throws Exception { return Rest.delete(data, id, user); } public final static class Log extends Resource { static ClassData data = new ClassData(IssuingCard.Log.class, "IssuingCardLog"); public String created; public String type; public IssuingCard card; /** * IssuingCard Log object *

* Every time an IssuingCard entity is modified, a corresponding IssuingCard Log * is generated for the entity. This log is never generated by the user. *

* Attributes: * @param id [string]: unique id returned when the log is created. ex: "5656565656565656" * @param card [IssuingCard]: IssuingCard entity to which the log refers to. * @param type [string]: type of the IssuingCard event which triggered the log creation. ex: "processing" or "success" * @param created [string]: creation datetime for the log. ex: "2020-03-10 10:30:00.000000+00:00" */ public Log(String created, String type, IssuingCard card, String id) { super(id); this.card = card; this.type = type; this.created = created; } /** * Retrieve a specific IssuingCard Log *

* Receive a single IssuingCard Log object previously created by the Stark Infra API by passing its id *

* Parameters: * @param id [string]: object unique id. ex: "5656565656565656" *

* Return: * @return IssuingCard Log object with updated attributes * @throws Exception error in the card */ public static IssuingCard.Log get(String id) throws Exception { return IssuingCard.Log.get(id, null); } /** * Retrieve a specific IssuingCard Log *

* Receive a single IssuingCard Log object previously created by the Stark Infra API by passing 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 IssuingCard Log object with updated attributes * @throws Exception error in the card */ public static IssuingCard.Log get(String id, User user) throws Exception { return Rest.getId(data, id, user); } /** * Retrieve IssuingCard Logs *

* Receive a generator of IssuingCard.Log objects previously created in the Stark Infra API. * Use this function instead of page if you want to stream the objects without worrying about cursors and pagination. *

* 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 * after [string, default null]: date filter for objects created only after specified date. ex: "2020-03-10" * before [string, default null]: date filter for objects created only before specified date. ex: "2020-03-10" * types [list of strings, default null]: filter retrieved objects by types. ex: "success" or "failed" * cardIds [list of strings, default null]: list of IssuingCard ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"] * ids [list of strings, default null]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"] *

* Return: * @return generator of IssuingCard Log objects with updated attributes * @throws Exception error in the card */ public static Generator query(Map params) throws Exception { return IssuingCard.Log.query(params, null); } /** * Retrieve IssuingCard Logs *

* Receive a generator of IssuingCard.Log objects previously created in the Stark Infra API. * Use this function instead of page if you want to stream the objects without worrying about cursors and pagination. *

* 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 IssuingCard Log objects with updated attributes * @throws Exception error in the card */ public static Generator query(User user) throws Exception { return IssuingCard.Log.query(new HashMap<>(), user); } /** * Retrieve IssuingCard Logs *

* Receive a generator of IssuingCard.Log objects previously created in the Stark Infra API. * Use this function instead of page if you want to stream the objects without worrying about cursors and pagination. *

* Return: * @return generator of IssuingCard Log objects with updated attributes * @throws Exception error in the card */ public static Generator query() throws Exception { return IssuingCard.Log.query(new HashMap<>(), null); } /** * Retrieve IssuingCard Logs *

* Receive a generator of IssuingCard.Log objects previously created in the Stark Infra API. * Use this function instead of page if you want to stream the objects without worrying about cursors and pagination. *

* 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 * after [string, default null]: date filter for objects created only after specified date. ex: "2020-03-10" * before [string, default null]: date filter for objects created only before specified date. ex: "2020-03-10" * types [list of strings, default null]: filter retrieved objects by types. ex: "success" or "failed" * cardIds [list of strings, default null]: list of IssuingCard ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"] * ids [list of strings, default null]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"] * @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 IssuingCard Log objects with updated attributes * @throws Exception error in the card */ public static Generator query(Map params, User user) throws Exception { return Rest.getStream(data, params, user); } public final static class Page { public List logs; public String cursor; public Page(List logs, String cursor) { this.logs = logs; this.cursor = cursor; } } /** * Retrieve paged IssuingCard.Logs *

* Receive a list of up to 100 IssuingCard.Log 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 your cards. *

* Parameters: * @param params map of parameters for the query * cursor [string, default null]: cursor returned on the previous page function call * limit [integer, default 100]: maximum number of objects to be retrieved. It must be an integer between 1 and 100. ex: 50 * after [string, default null]: date filter for objects created only after specified date. ex: "2020-03-10" * before [string, default null]: date filter for objects created only before specified date. ex: "2020-03-10" * types [list of strings, default null]: filter retrieved objects by types. ex: "success" or "failed" * cardIds [list of strings, default null]: list of IssuingCard ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"] * ids [list of strings, default null]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"] *

* Return: * @return IssuingCard.Log.Page object: * IssuingCard.Log.Page.logs: list of IssuingCard.Log objects with updated attributes * IssuingCard.Log.Page.cursor: cursor to retrieve the next page of IssuingCard.Log objects * @throws Exception error in the card */ public static IssuingCard.Log.Page page(Map params) throws Exception { return IssuingCard.Log.page(params, null); } /** * Retrieve paged IssuingCard.Logs *

* Receive a list of up to 100 IssuingCard.Log 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 your cards. *

* 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 IssuingCard.Log.Page object: * IssuingCard.Log.Page.logs: list of IssuingCard.Log objects with updated attributes * IssuingCard.Log.Page.cursor: cursor to retrieve the next page of IssuingCard.Log objects * @throws Exception error in the card */ public static IssuingCard.Log.Page page(User user) throws Exception { return IssuingCard.Log.page(new HashMap<>(), user); } /** * Retrieve paged IssuingCard.Logs *

* Receive a list of up to 100 IssuingCard.Log 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 your cards. *

* Return: * @return IssuingCard.Log.Page object: * IssuingCard.Log.Page.logs: list of IssuingCard.Log objects with updated attributes * IssuingCard.Log.Page.cursor: cursor to retrieve the next page of IssuingCard.Log objects * @throws Exception error in the card */ public static IssuingCard.Log.Page page() throws Exception { return IssuingCard.Log.page(new HashMap<>(), null); } /** * Retrieve paged IssuingCard.Logs *

* Receive a list of up to 100 IssuingCard.Log 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 your cards. *

* Parameters: * @param params map of parameters for the query * cursor [string, default null]: cursor returned on the previous page function call * limit [integer, default 100]: maximum number of objects to be retrieved. It must be an integer between 1 and 100. ex: 50 * after [string, default null]: date filter for objects created only after specified date. ex: "2020-03-10" * before [string, default null]: date filter for objects created only before specified date. ex: "2020-03-10" * types [list of strings, default null]: filter retrieved objects by types. ex: "success" or "failed" * cardIds [list of strings, default null]: list of IssuingCard ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"] * ids [list of strings, default null]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"] * @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkinfra.Settings.user was set before function call *

* Return: * @return IssuingCard.Log.Page object: * IssuingCard.Log.Page.logs: list of IssuingCard.Log objects with updated attributes * IssuingCard.Log.Page.cursor: cursor to retrieve the next page of IssuingCard.Log objects * @throws Exception error in the card */ public static IssuingCard.Log.Page page(Map params, User user) throws Exception { com.starkinfra.utils.Page page = Rest.getPage(data, params, user); List logs = new ArrayList<>(); for (SubResource log: page.entities) { logs.add((IssuingCard.Log) log); } return new Page(logs, page.cursor); } } }