com.starkinfra.PixInfraction 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 com.starkinfra.error.ErrorElement;
import java.util.Map;
import java.util.List;
import java.util.HashMap;
import java.util.ArrayList;
public final class PixInfraction extends Resource {
/**
* PixInfraction object
*
* Pix Infractions are used to report transactions that are suspected of
* fraud, to request a refund or to reverse a refund.
*
* When you initialize a PixInfraction, 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:
* referenceId [string]: endToEndId or returnId of the transaction being reported. ex: "E20018183202201201450u34sDGd19lz"
* type [string]: type of Pix Infraction. Options: "fraud", "reversal", "reversalChargeback"
* description [string, default null]: description for any details that can help with the infraction investigation.
* tags [list of strings]: list of strings for tagging. ex: ["travel", "food"]
* creditedBankCode [string]: bankCode of the credited Pix participant in the reported transaction. ex: "20018183"
* analysis [string]: analysis that led to the result.
* debitedBankCode [string]: bankCode of the debited Pix participant in the reported transaction. ex: "20018183"
* flow [string]: direction of the PixInfraction flow. Options: "out" if you created the PixInfraction, "in" if you received the PixInfraction.
* id [string]: unique id returned when the PixInfraction is created. ex: "5656565656565656"
* reportedBy [string]: agent that reported the PixInfraction. Options: "debited", "credited".
* result [string]: result after the analysis of the PixInfraction by the receiving party. Options: "agreed", "disagreed"
* status [string]: current PixInfraction status. Options: "created", "failed", "delivered", "closed", "canceled".
* created [string]: creation datetime for the PixInfraction. ex: "2020-03-10 10:30:00.000000+00:00"
* updated [string]: latest update datetime for the PixInfraction. ex: "2020-03-10 10:30:00.000000+00:00"
*
*/
static ClassData data = new ClassData(PixInfraction.class, "PixInfraction");
public String referenceId;
public String type;
public String description;
public String[] tags;
public String creditedBankCode;
public String analysis;
public String debitedBankCode;
public String flow;
public String reportedBy;
public String result;
public String status;
public String created;
public String updated;
/**
* PixInfraction object
*
* When you initialize a PixInfraction, 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 list of created objects.
*
* Parameters:
* @param referenceId [string]: endToEndId or returnId of the transaction being reported. ex: "E20018183202201201450u34sDGd19lz"
* @param type [string]: type of Pix Infraction. Options: "fraud", "reversal", "reversalChargeback"
* @param description [string, default null]: description for any details that can help with the infraction investigation.
* @param tags [list of strings]: list of strings for tagging. ex: ["travel", "food"]
* @param creditedBankCode [string]: bankCode of the credited Pix participant in the reported transaction. ex: "20018183"
* @param analysis [string]: analysis that led to the result.
* @param debitedBankCode [string]: bankCode of the debited Pix participant in the reported transaction. ex: "20018183"
* @param flow [string]: direction of the PixInfraction flow. Options: "out" if you created the PixInfraction, "in" if you received the PixInfraction.
* @param id [string]: unique id returned when the PixInfraction is created. ex: "5656565656565656"
* @param reportedBy [string]: agent that reported the PixInfraction. Options: "debited", "credited".
* @param result [string]: result after the analysis of the PixInfraction by the receiving party. Options: "agreed", "disagreed"
* @param status [string]: current PixInfraction status. Options: "created", "failed", "delivered", "closed", "canceled".
* @param created [string]: creation datetime for the PixInfraction. ex: "2020-03-10 10:30:00.000000+00:00"
* @param updated [string]: latest update datetime for the PixInfraction. ex: "2020-03-10 10:30:00.000000+00:00"
*/
public PixInfraction(String referenceId, String type, String description, String[] tags, String creditedBankCode,
String analysis,String debitedBankCode, String flow, String id, String reportedBy,
String result, String status, String created, String updated
) {
super(id);
this.referenceId = referenceId;
this.type = type;
this.description = description;
this.tags = tags;
this.creditedBankCode = creditedBankCode;
this.analysis = analysis;
this.debitedBankCode = debitedBankCode;
this.flow = flow;
this.reportedBy = reportedBy;
this.result = result;
this.status = status;
this.created = created;
this.updated = updated;
}
/**
* PixInfraction object
*
* When you initialize a PixInfraction, 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 list of created objects.
*
* Parameters (required):
* @param data map of properties for the creation of the PixInfraction
* referenceId [string]: endToEndId or returnId of the transaction being reported. ex: "E20018183202201201450u34sDGd19lz"
* type [string]: type of Pix Infraction. Options: "fraud", "reversal", "reversalChargeback"
*
* Parameters (optional):
* description [string, default null]: description for any details that can help with the infraction investigation.
* tags [list of strings]: list of strings for tagging. ex: ["travel", "food"]
*
* Attributes (return-only):
* id [string]: unique id returned when the PixInfraction is created. ex: "5656565656565656"
* analysis [string]: analysis that led to the result.
* debitedBankCode [string]: bankCode of the debited Pix participant in the reported transaction. ex: "20018183"
* flow [string]: direction of the PixInfraction flow. Options: "out" if you created the PixInfraction, "in" if you received the PixInfraction.
* creditedBankCode [string]: bankCode of the credited Pix participant in the reported transaction. ex: "20018183"
* reportedBy [string]: agent that reported the PixInfraction. Options: "debited", "credited".
* result [string]: result after the analysis of the PixInfraction by the receiving party. Options: "agreed", "disagreed"
* status [string]: current PixInfraction status. Options: "created", "failed", "delivered", "closed", "canceled".
* created [string]: creation datetime for the PixInfraction. ex: "2020-03-10 10:30:00.000000+00:00"
* updated [string]: latest update datetime for the PixInfraction. ex: "2020-03-10 10:30:00.000000+00:00"
* @throws Exception error in the request
*/
public PixInfraction(Map data) throws Exception {
super(null);
HashMap dataCopy = new HashMap<>(data);
this.referenceId = (String) dataCopy.remove("referenceId");
this.type = (String) dataCopy.remove("type");
this.description = (String) dataCopy.remove("description");
this.tags = (String[]) dataCopy.remove("tags");
this.creditedBankCode = (String) dataCopy.remove("creditedBankCode");
this.analysis = null;
this.debitedBankCode = null;
this.flow = null;
this.reportedBy = null;
this.result = null;
this.status = null;
this.created = null;
this.updated = null;
if (!dataCopy.isEmpty()) {
throw new Exception("Unknown parameters used in constructor: [" + String.join(", ", dataCopy.keySet()) + "]");
}
}
/**
* Retrieve a specific PixInfraction
*
* Receive a single PixInfraction object previously created in the Stark Infra API by passing its id
*
* Parameters:
* @param id [string]: object unique id. ex: "5656565656565656"
*
* Return:
* @return PixInfraction object with updated attributes
* @throws Exception error in the request
*/
public static PixInfraction get(String id) throws Exception {
return PixInfraction.get(id, null);
}
/**
* Retrieve a specific PixInfraction
*
* Receive a single PixInfraction object previously created in 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 PixInfraction object with updated attributes
* @throws Exception error in the request
*/
public static PixInfraction get(String id, User user) throws Exception {
return Rest.getId(data, id, user);
}
/**
* Retrieve PixInfractions
*
* Receive a generator of PixInfraction 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 parameters for the query
* limit [integer, default null]: maximum number of objects to be retrieved. Max = 100. ex: 35
* after [string, default null]: date filter for objects created after a specified date. ex: "2020-03-29"
* before [string, default null]: date filter for objects created before a specified date. ex: "2020-03-30"
* status [list of strings, default null]: filter for status of retrieved objects. Options: "created", "failed", "delivered", "closed", "canceled".
* ids [list of strings, default null]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
* type [strings, default null]: filter for the type of retrieved PixInfractions. Options: "fraud", "reversal", "reversalChargeback".
* flow [string]: direction of the Pix Claim. Options: "in" if you received the PixClaim or "out" if you created the PixClaim.
* tags [list of strings]: list of strings for tagging. ex: ["travel", "food"]
*
* Return:
* @return generator of PixInfraction objects with updated attributes
* @throws Exception error in the request
*/
public static Generator query(Map params) throws Exception {
return PixInfraction.query(params, null);
}
/**
* Retrieve PixInfractions
*
* Receive a generator of PixInfraction 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 PixInfraction objects with updated attributes
* @throws Exception error in the request
*/
public static Generator query(User user) throws Exception {
return PixInfraction.query(new HashMap<>(), user);
}
/**
* Retrieve PixInfractions
*
* Receive a generator of PixInfraction 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 PixInfraction objects with updated attributes
* @throws Exception error in the request
*/
public static Generator query() throws Exception {
return PixInfraction.query(new HashMap<>(), null);
}
/**
* Retrieve PixInfractions
*
* Receive a generator of PixInfraction 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. Max = 100. ex: 35
* after [string, default null]: date filter for objects created after a specified date. ex: "2020-03-29"
* before [string, default null]: date filter for objects created before a specified date. ex: "2020-03-30"
* status [list of strings, default null]: filter for status of retrieved objects. Options: "created", "failed", "delivered", "closed", "canceled".
* ids [list of strings, default null]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
* type [strings, default null]: filter for the type of retrieved PixInfractions. Options: "fraud", "reversal", "reversalChargeback".
* flow [string]: direction of the Pix Claim. Options: "in" if you received the PixClaim or "out" if you created the PixClaim.
* tags [list of strings]: list of strings for tagging. ex: ["travel", "food"]
* @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 PixInfraction 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);
}
public final static class Page {
public List infractions;
public String cursor;
public Page(List infractions, String cursor) {
this.infractions = infractions;
this.cursor = cursor;
}
}
/**
* Retrieve paged PixInfractions
*
* Receive a list of up to 100 PixInfraction 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 infractions.
*
* 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: 35
* after [string, default null]: date filter for objects created after a specified date. ex: "2020-03-29"
* before [string, default null]: date filter for objects created before a specified date. ex: "2020-03-30"
* status [list of strings, default null]: filter for status of retrieved objects. Options: "created", "failed", "delivered", "closed", "canceled".
* ids [list of strings, default null]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
* type [strings, default null]: filter for the type of retrieved PixInfractions. Options: "fraud", "reversal", "reversalChargeback".
* flow [string]: direction of the Pix Claim. Options: "in" if you received the PixClaim or "out" if you created the PixClaim.
* tags [list of strings]: list of strings for tagging. ex: ["travel", "food"]
*
* Return:
* @return PixInfraction.Page object:
* PixInfraction.Page.infractions: list of PixInfraction objects with updated attributes
* PixInfraction.Page.cursor: cursor to retrieve the next page of PixInfraction objects
* @throws Exception error in the request
*/
public static Page page(Map params) throws Exception {
return page(params, null);
}
/**
* Retrieve paged PixInfractions
*
* Receive a list of up to 100 PixInfraction 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 infractions.
*
* 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 PixInfraction.Page object:
* PixInfraction.Page.infractions: list of PixInfraction objects with updated attributes
* PixInfraction.Page.cursor: cursor to retrieve the next page of PixInfraction objects
* @throws Exception error in the request
*/
public static Page page(User user) throws Exception {
return page(new HashMap<>(), user);
}
/**
* Retrieve paged PixInfractions
*
* Receive a list of up to 100 PixInfraction 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 infractions.
*
* Return:
* @return PixInfraction.Page object:
* PixInfraction.Page.infractions: list of PixInfraction objects with updated attributes
* PixInfraction.Page.cursor: cursor to retrieve the next page of PixInfraction objects
* @throws Exception error in the request
*/
public static Page page() throws Exception {
return page(new HashMap<>(), null);
}
/**
* Retrieve paged PixInfractions
*
* Receive a list of up to 100 PixInfraction 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 infractions.
*
* 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: 35
* after [string, default null]: date filter for objects created after a specified date. ex: "2020-03-29"
* before [string, default null]: date filter for objects created before a specified date. ex: "2020-03-30"
* status [list of strings, default null]: filter for status of retrieved objects. Options: "created", "failed", "delivered", "closed", "canceled".
* ids [list of strings, default null]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
* type [strings, default null]: filter for the type of retrieved PixInfractions. Options: "fraud", "reversal", "reversalChargeback".
* flow [string]: direction of the Pix Claim. Options: "in" if you received the PixClaim or "out" if you created the PixClaim.
* tags [list of strings]: list of strings for tagging. ex: ["travel", "food"]
* @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkinfra.Settings.user was set before function call
*
* Return:
* @return PixInfraction.Page object:
* PixInfraction.Page.infractions: list of PixInfraction objects with updated attributes
* PixInfraction.Page.cursor: cursor to retrieve the next page of PixInfraction 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 infractions = new ArrayList<>();
for (SubResource infraction: page.entities) {
infractions.add((PixInfraction) infraction);
}
return new Page(infractions, page.cursor);
}
/**
* Create a PixInfraction
*
* Send a PixInfraction object for creation in the Stark Infra API
*
* Parameters:
* @param infractions [list of PixInfraction objects or HashMaps]: list of PixInfraction objects to be created in the API
*
* Return:
* @return PixInfraction object with updated attributes
* @throws Exception error in the request
*/
public static List create(List> infractions) throws Exception {
return PixInfraction.create(infractions, null);
}
/**
* Create a PixInfraction
*
* Send a PixInfraction object for creation in the Stark Infra API
*
* Parameters:
* @param infractions [list of PixInfraction objects or HashMaps]: list of PixInfraction 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 PixInfraction object with updated attributes
* @throws Exception error in the request
*/
public static List create(List> infractions, User user) throws Exception {
List infractionList = new ArrayList<>();
for (Object infraction : infractions){
if (infraction instanceof Map){
infractionList.add(new PixInfraction((Map) infraction));
continue;
}
if (infraction instanceof PixInfraction){
infractionList.add((PixInfraction) infraction);
continue;
}
throw new Exception("Unknown type \"" + infraction.getClass() + "\", use PixInfraction or HashMap");
}
return Rest.post(data, infractionList, user);
}
/**
* Cancel an PixInfraction
*
* Cancel a PixInfraction entity previously created in the Stark Infra API
*
* Parameters:
* @param id [string]: PixInfraction unique id. ex: "5656565656565656"
*
* Return:
* @return canceled PixInfraction object
* @throws Exception error in the request
*/
public static PixInfraction cancel(String id) throws Exception {
return PixInfraction.cancel(id, null);
}
/**
* Cancel a PixInfraction entity
*
* Cancel a PixInfraction entity previously created in the Stark Infra API
*
* Parameters:
* @param id [string]: PixInfraction 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 PixInfraction object
* @throws Exception error in the request
*/
public static PixInfraction cancel(String id, User user) throws Exception {
return Rest.delete(data, id, user);
}
/**
* Update PixInfraction entity
*
* Update the PixInfraction by passing id.
*
* Parameters:
* @param id [string]: PixInfraction id. ex: "5656565656565656"
* @param result [string]: result after the analysis of the PixInfraction. Options: "agreed", "disagreed"
*
* Return:
* @return PixInfraction object with updated attributes
* @throws Exception error in the request
*/
public static PixInfraction update(String id, String result) throws Exception {
return PixInfraction.update(id, result, new HashMap<>(), null);
}
/**
* Update PixInfraction entity
*
* Update the PixInfraction by passing id.
*
* Parameters:
* @param id [string]: PixInfraction id. ex: "5656565656565656"
* @param result [string]: result after the analysis of the PixInfraction. Options: "agreed", "disagreed"
* @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkinfra.Settings.user was set before function call
*
* Return:
* @return PixInfraction object with updated attributes
* @throws Exception error in the request
*/
public static PixInfraction update(String id, String result, User user) throws Exception {
return PixInfraction.update(id, result, new HashMap<>(), user);
}
/**
* Update PixInfraction entity
*
* Update the PixInfraction by passing id.
*
* Parameters:
* @param id [string]: PixInfraction id. ex: "5656565656565656"
* @param result [string]: result after the analysis of the PixInfraction. Options: "agreed", "disagreed"
* @param patchData map of patch parameters
* analysis [string, default null]: analysis that led to the result.
*
* Return:
* @return PixInfraction object with updated attributes
* @throws Exception error in the request
*/
public static PixInfraction update(String id, String result, Map patchData) throws Exception {
return PixInfraction.update(id, result, patchData, null);
}
/**
* Update PixInfraction entity
*
* Update PixInfraction by passing id.
*
* Parameters:
* @param id [string]: PixInfraction id. ex: "5656565656565656"
* @param result [string]: result after the analysis of the PixInfraction. Options: "agreed", "disagreed"
* @param patchData map of patch parameters:
* analysis [string, default null]: analysis that led to the result.
* @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkinfra.Settings.user was set before function call
*
* Return:
* @return PixInfraction object with updated attributes
* @throws Exception error in the request
*/
public static PixInfraction update(String id, String result, Map patchData, User user) throws Exception {
patchData.put("result", result);
return Rest.patch(data, id, patchData, user);
}
public final static class Log extends Resource {
static ClassData data = new ClassData(Log.class, "PixInfractionLog");
public String created;
public String type;
public List errors;
public PixInfraction infraction;
/**
* PixInfraction.Log object
*
* Every time a PixInfraction entity is modified, a corresponding PixInfraction.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 created [string]: creation datetime for the log. ex: "2020-03-29"
* @param type [string]: type of the PixInfraction event which triggered the log creation. ex: "created"
* @param errors [list of strings]: list of errors linked to this PixInfraction event
* @param infraction [PixInfraction]: PixInfraction entity to which the log refers to.
*/
public Log(String created, String type, List errors, PixInfraction infraction, String id) {
super(id);
this.created = created;
this.type = type;
this.errors = errors;
this.infraction = infraction;
}
/**
* Retrieve a specific PixInfraction.Log
*
* Receive a single PixInfraction.Log object previously created by the Stark Infra API by passing its id
*
* Parameters:
* @param id [string]: object unique id. ex: "5656565656565656"
*
* Return:
* @return PixInfraction.Log object with updated attributes
* @throws Exception error in the request
*/
public static Log get(String id) throws Exception {
return Log.get(id, null);
}
/**
* Retrieve a specific PixInfraction.Log
*
* Receive a single PixInfraction.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 PixInfraction.Log object with updated attributes
* @throws Exception error in the request
*/
public static Log get(String id, User user) throws Exception {
return Rest.getId(data, id, user);
}
/**
* Retrieve PixInfraction.Logs
*
* Receive a generator of PixInfraction.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
* ids [list of strings, default null]: Log ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
* limit [integer, default null]: maximum number of objects to be retrieved. Max = 100. ex: 35
* after [string, default null]: date filter for objects created after a specified date. ex: "2020-03-29"
* before [string, default null]: date filter for objects created before a specified date. ex: "2020-03-30"
* types [strings, default null]: filter retrieved objects by types. ex: "success" or "failed"
* infractionIds [string, default null]: list of PixInfraction IDs to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
*
* Return:
* @return generator of PixInfraction.Log objects with updated attributes
* @throws Exception error in the request
*/
public static Generator query(Map params) throws Exception {
return Log.query(params, null);
}
/**
* Retrieve PixInfraction.Logs
*
* Receive a generator of PixInfraction.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 PixInfraction.Log objects with updated attributes
* @throws Exception error in the request
*/
public static Generator query(User user) throws Exception {
return Log.query(new HashMap<>(), user);
}
/**
* Retrieve PixInfraction.Logs
*
* Receive a generator of PixInfraction.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 PixInfraction.Log objects with updated attributes
* @throws Exception error in the request
*/
public static Generator query() throws Exception {
return Log.query(new HashMap<>(), null);
}
/**
* Retrieve PixInfraction.Logs
*
* Receive a generator of PixInfraction.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
* ids [list of strings, default null]: Log ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
* limit [integer, default null]: maximum number of objects to be retrieved. Max = 100. ex: 35
* after [string, default null]: date filter for objects created after a specified date. ex: "2020-03-29"
* before [string, default null]: date filter for objects created before a specified date. ex: "2020-03-30"
* types [strings, default null]: filter retrieved objects by types. ex: "success" or "failed"
* infractionIds [string, default null]: list of PixInfraction IDs to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
*
* Return:
* @return generator of PixInfraction.Log 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);
}
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 PixInfraction.Logs
*
* Receive a list of up to 100 PixInfraction.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 infractions.
*
* Parameters:
* @param params map of parameters for the query
* cursor [string, default null]: cursor returned on the previous page function call
* ids [list of strings, default null]: Log 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
* after [string, default null]: date filter for objects created after a specified date. ex: "2020-03-29"
* before [string, default null]: date filter for objects created before a specified date. ex: "2020-03-30"
* types [strings, default null]: filter retrieved objects by types. ex: "success" or "failed"
* infractionIds [string, default null]: list of PixInfraction IDs to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
*
* Return:
* @return PixInfraction.Log.Page object:
* PixInfraction.Log.Page.logs: list of PixInfraction.Log objects with updated attributes
* PixInfraction.Log.Page.cursor: cursor to retrieve the next page of PixInfraction.Log objects
* @throws Exception error in the request
*/
public static Page page(Map params) throws Exception {
return Log.page(params, null);
}
/**
* Retrieve paged PixInfraction.Logs
*
* Receive a list of up to 100 PixInfraction.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 infractions.
*
* 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 PixInfraction.Log.Page object:
* PixInfraction.Log.Page.logs: list of PixInfraction.Log objects with updated attributes
* PixInfraction.Log.Page.cursor: cursor to retrieve the next page of PixInfraction.Log objects
* @throws Exception error in the request
*/
public static Page page(User user) throws Exception {
return Log.page(new HashMap<>(), user);
}
/**
* Retrieve paged PixInfraction.Logs
*
* Receive a list of up to 100 PixInfraction.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 infractions.
*
* Return:
* @return PixInfraction.Log.Page object:
* PixInfraction.Log.Page.logs: list of PixInfraction.Log objects with updated attributes
* PixInfraction.Log.Page.cursor: cursor to retrieve the next page of PixInfraction.Log objects
* @throws Exception error in the request
*/
public static Page page() throws Exception {
return Log.page(new HashMap<>(), null);
}
/**
* Retrieve paged PixInfraction.Logs
*
* Receive a list of up to 100 PixInfraction.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 infractions.
*
* Parameters:
* @param params map of parameters for the query
* cursor [string, default null]: cursor returned on the previous page function call
* ids [list of strings, default null]: Log 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
* after [string, default null]: date filter for objects created after a specified date. ex: "2020-03-29"
* before [string, default null]: date filter for objects created before a specified date. ex: "2020-03-30"
* types [strings, default null]: filter retrieved objects by types. ex: "success" or "failed"
* infractionIds [string, default null]: list of PixInfraction 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 PixInfraction.Log.Page object:
* PixInfraction.Log.Page.logs: list of PixInfraction.Log objects with updated attributes
* PixInfraction.Log.Page.cursor: cursor to retrieve the next page of PixInfraction.Log 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 logs = new ArrayList<>();
for (SubResource log: page.entities) {
logs.add((Log) log);
}
return new Page(logs, page.cursor);
}
}
}