index int64 0 0 | repo_id stringlengths 9 205 | file_path stringlengths 31 246 | content stringlengths 1 12.2M | __index_level_0__ int64 0 10k |
|---|---|---|---|---|
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/V1RetrieveTimecardRequest.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import io.swagger.annotations.ApiModel;
/**
*
*/
@ApiModel(description = "")
public class V1RetrieveTimecardRequest {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return true;
}
@Override
public int hashCode() {
return Objects.hash();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class V1RetrieveTimecardRequest {\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 ");
}
}
| 5,100 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/ListBreakTypesResponse.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.squareup.connect.models.BreakType;
import com.squareup.connect.models.Error;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
* The response to a request for a set of `BreakTypes`. Contains the requested `BreakType` objects. May contain a set of `Error` objects if the request resulted in errors.
*/
@ApiModel(description = "The response to a request for a set of `BreakTypes`. Contains the requested `BreakType` objects. May contain a set of `Error` objects if the request resulted in errors.")
public class ListBreakTypesResponse {
@JsonProperty("break_types")
private List<BreakType> breakTypes = new ArrayList<BreakType>();
@JsonProperty("cursor")
private String cursor = null;
@JsonProperty("errors")
private List<Error> errors = new ArrayList<Error>();
public ListBreakTypesResponse breakTypes(List<BreakType> breakTypes) {
this.breakTypes = breakTypes;
return this;
}
public ListBreakTypesResponse addBreakTypesItem(BreakType breakTypesItem) {
this.breakTypes.add(breakTypesItem);
return this;
}
/**
* A page of `BreakType` results.
* @return breakTypes
**/
@ApiModelProperty(value = " A page of `BreakType` results.")
public List<BreakType> getBreakTypes() {
return breakTypes;
}
public void setBreakTypes(List<BreakType> breakTypes) {
this.breakTypes = breakTypes;
}
public ListBreakTypesResponse cursor(String cursor) {
this.cursor = cursor;
return this;
}
/**
* Value supplied in the subsequent request to fetch the next next page of Break Type results.
* @return cursor
**/
@ApiModelProperty(value = "Value supplied in the subsequent request to fetch the next next page of Break Type results.")
public String getCursor() {
return cursor;
}
public void setCursor(String cursor) {
this.cursor = cursor;
}
public ListBreakTypesResponse errors(List<Error> errors) {
this.errors = errors;
return this;
}
public ListBreakTypesResponse addErrorsItem(Error errorsItem) {
this.errors.add(errorsItem);
return this;
}
/**
* Any errors that occurred during the request.
* @return errors
**/
@ApiModelProperty(value = "Any errors that occurred during the request.")
public List<Error> getErrors() {
return errors;
}
public void setErrors(List<Error> errors) {
this.errors = errors;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ListBreakTypesResponse listBreakTypesResponse = (ListBreakTypesResponse) o;
return Objects.equals(this.breakTypes, listBreakTypesResponse.breakTypes) &&
Objects.equals(this.cursor, listBreakTypesResponse.cursor) &&
Objects.equals(this.errors, listBreakTypesResponse.errors);
}
@Override
public int hashCode() {
return Objects.hash(breakTypes, cursor, errors);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ListBreakTypesResponse {\n");
sb.append(" breakTypes: ").append(toIndentedString(breakTypes)).append("\n");
sb.append(" cursor: ").append(toIndentedString(cursor)).append("\n");
sb.append(" errors: ").append(toIndentedString(errors)).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 ");
}
}
| 5,101 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/Tender.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.squareup.connect.models.AdditionalRecipient;
import com.squareup.connect.models.Money;
import com.squareup.connect.models.TenderCardDetails;
import com.squareup.connect.models.TenderCashDetails;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
* Represents a tender (i.e., a method of payment) used in a Square transaction.
*/
@ApiModel(description = "Represents a tender (i.e., a method of payment) used in a Square transaction.")
public class Tender {
@JsonProperty("id")
private String id = null;
@JsonProperty("location_id")
private String locationId = null;
@JsonProperty("transaction_id")
private String transactionId = null;
@JsonProperty("created_at")
private String createdAt = null;
@JsonProperty("note")
private String note = null;
@JsonProperty("amount_money")
private Money amountMoney = null;
@JsonProperty("tip_money")
private Money tipMoney = null;
@JsonProperty("processing_fee_money")
private Money processingFeeMoney = null;
@JsonProperty("customer_id")
private String customerId = null;
@JsonProperty("type")
private String type = null;
@JsonProperty("card_details")
private TenderCardDetails cardDetails = null;
@JsonProperty("cash_details")
private TenderCashDetails cashDetails = null;
@JsonProperty("additional_recipients")
private List<AdditionalRecipient> additionalRecipients = new ArrayList<AdditionalRecipient>();
@JsonProperty("payment_id")
private String paymentId = null;
public Tender id(String id) {
this.id = id;
return this;
}
/**
* The tender's unique ID.
* @return id
**/
@ApiModelProperty(value = "The tender's unique ID.")
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Tender locationId(String locationId) {
this.locationId = locationId;
return this;
}
/**
* The ID of the transaction's associated location.
* @return locationId
**/
@ApiModelProperty(value = "The ID of the transaction's associated location.")
public String getLocationId() {
return locationId;
}
public void setLocationId(String locationId) {
this.locationId = locationId;
}
public Tender transactionId(String transactionId) {
this.transactionId = transactionId;
return this;
}
/**
* The ID of the tender's associated transaction.
* @return transactionId
**/
@ApiModelProperty(value = "The ID of the tender's associated transaction.")
public String getTransactionId() {
return transactionId;
}
public void setTransactionId(String transactionId) {
this.transactionId = transactionId;
}
public Tender createdAt(String createdAt) {
this.createdAt = createdAt;
return this;
}
/**
* The time when the tender was created, in RFC 3339 format.
* @return createdAt
**/
@ApiModelProperty(value = "The time when the tender was created, in RFC 3339 format.")
public String getCreatedAt() {
return createdAt;
}
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
public Tender note(String note) {
this.note = note;
return this;
}
/**
* An optional note associated with the tender at the time of payment.
* @return note
**/
@ApiModelProperty(value = "An optional note associated with the tender at the time of payment.")
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public Tender amountMoney(Money amountMoney) {
this.amountMoney = amountMoney;
return this;
}
/**
* The total amount of the tender, including `tip_money`. If the tender has a `payment_id`, the `total_money` of the corresponding `Payment` will be equal to the `amount_money` of the tender.
* @return amountMoney
**/
@ApiModelProperty(value = "The total amount of the tender, including `tip_money`. If the tender has a `payment_id`, the `total_money` of the corresponding `Payment` will be equal to the `amount_money` of the tender.")
public Money getAmountMoney() {
return amountMoney;
}
public void setAmountMoney(Money amountMoney) {
this.amountMoney = amountMoney;
}
public Tender tipMoney(Money tipMoney) {
this.tipMoney = tipMoney;
return this;
}
/**
* The tip's amount of the tender.
* @return tipMoney
**/
@ApiModelProperty(value = "The tip's amount of the tender.")
public Money getTipMoney() {
return tipMoney;
}
public void setTipMoney(Money tipMoney) {
this.tipMoney = tipMoney;
}
public Tender processingFeeMoney(Money processingFeeMoney) {
this.processingFeeMoney = processingFeeMoney;
return this;
}
/**
* The amount of any Square processing fees applied to the tender. This field is not immediately populated when a new transaction is created. It is usually available after about ten seconds.
* @return processingFeeMoney
**/
@ApiModelProperty(value = "The amount of any Square processing fees applied to the tender. This field is not immediately populated when a new transaction is created. It is usually available after about ten seconds.")
public Money getProcessingFeeMoney() {
return processingFeeMoney;
}
public void setProcessingFeeMoney(Money processingFeeMoney) {
this.processingFeeMoney = processingFeeMoney;
}
public Tender customerId(String customerId) {
this.customerId = customerId;
return this;
}
/**
* If the tender is associated with a customer or represents a customer's card on file, this is the ID of the associated customer.
* @return customerId
**/
@ApiModelProperty(value = "If the tender is associated with a customer or represents a customer's card on file, this is the ID of the associated customer.")
public String getCustomerId() {
return customerId;
}
public void setCustomerId(String customerId) {
this.customerId = customerId;
}
public Tender type(String type) {
this.type = type;
return this;
}
/**
* The type of tender, such as `CARD` or `CASH`. See [TenderType](#type-tendertype) for possible values
* @return type
**/
@ApiModelProperty(required = true, value = "The type of tender, such as `CARD` or `CASH`. See [TenderType](#type-tendertype) for possible values")
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Tender cardDetails(TenderCardDetails cardDetails) {
this.cardDetails = cardDetails;
return this;
}
/**
* The details of the card tender. This value is present only if the value of `type` is `CARD`.
* @return cardDetails
**/
@ApiModelProperty(value = "The details of the card tender. This value is present only if the value of `type` is `CARD`.")
public TenderCardDetails getCardDetails() {
return cardDetails;
}
public void setCardDetails(TenderCardDetails cardDetails) {
this.cardDetails = cardDetails;
}
public Tender cashDetails(TenderCashDetails cashDetails) {
this.cashDetails = cashDetails;
return this;
}
/**
* The details of the cash tender. This value is present only if the value of `type` is `CASH`.
* @return cashDetails
**/
@ApiModelProperty(value = "The details of the cash tender. This value is present only if the value of `type` is `CASH`.")
public TenderCashDetails getCashDetails() {
return cashDetails;
}
public void setCashDetails(TenderCashDetails cashDetails) {
this.cashDetails = cashDetails;
}
public Tender additionalRecipients(List<AdditionalRecipient> additionalRecipients) {
this.additionalRecipients = additionalRecipients;
return this;
}
public Tender addAdditionalRecipientsItem(AdditionalRecipient additionalRecipientsItem) {
this.additionalRecipients.add(additionalRecipientsItem);
return this;
}
/**
* Additional recipients (other than the merchant) receiving a portion of this tender. For example, fees assessed on the purchase by a third party integration.
* @return additionalRecipients
**/
@ApiModelProperty(value = "Additional recipients (other than the merchant) receiving a portion of this tender. For example, fees assessed on the purchase by a third party integration.")
public List<AdditionalRecipient> getAdditionalRecipients() {
return additionalRecipients;
}
public void setAdditionalRecipients(List<AdditionalRecipient> additionalRecipients) {
this.additionalRecipients = additionalRecipients;
}
public Tender paymentId(String paymentId) {
this.paymentId = paymentId;
return this;
}
/**
* The ID of the `Payment` that corresponds to this tender. This value is only present for payments created with the v2 Payments API.
* @return paymentId
**/
@ApiModelProperty(value = "The ID of the `Payment` that corresponds to this tender. This value is only present for payments created with the v2 Payments API.")
public String getPaymentId() {
return paymentId;
}
public void setPaymentId(String paymentId) {
this.paymentId = paymentId;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Tender tender = (Tender) o;
return Objects.equals(this.id, tender.id) &&
Objects.equals(this.locationId, tender.locationId) &&
Objects.equals(this.transactionId, tender.transactionId) &&
Objects.equals(this.createdAt, tender.createdAt) &&
Objects.equals(this.note, tender.note) &&
Objects.equals(this.amountMoney, tender.amountMoney) &&
Objects.equals(this.tipMoney, tender.tipMoney) &&
Objects.equals(this.processingFeeMoney, tender.processingFeeMoney) &&
Objects.equals(this.customerId, tender.customerId) &&
Objects.equals(this.type, tender.type) &&
Objects.equals(this.cardDetails, tender.cardDetails) &&
Objects.equals(this.cashDetails, tender.cashDetails) &&
Objects.equals(this.additionalRecipients, tender.additionalRecipients) &&
Objects.equals(this.paymentId, tender.paymentId);
}
@Override
public int hashCode() {
return Objects.hash(id, locationId, transactionId, createdAt, note, amountMoney, tipMoney, processingFeeMoney, customerId, type, cardDetails, cashDetails, additionalRecipients, paymentId);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Tender {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" locationId: ").append(toIndentedString(locationId)).append("\n");
sb.append(" transactionId: ").append(toIndentedString(transactionId)).append("\n");
sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n");
sb.append(" note: ").append(toIndentedString(note)).append("\n");
sb.append(" amountMoney: ").append(toIndentedString(amountMoney)).append("\n");
sb.append(" tipMoney: ").append(toIndentedString(tipMoney)).append("\n");
sb.append(" processingFeeMoney: ").append(toIndentedString(processingFeeMoney)).append("\n");
sb.append(" customerId: ").append(toIndentedString(customerId)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" cardDetails: ").append(toIndentedString(cardDetails)).append("\n");
sb.append(" cashDetails: ").append(toIndentedString(cashDetails)).append("\n");
sb.append(" additionalRecipients: ").append(toIndentedString(additionalRecipients)).append("\n");
sb.append(" paymentId: ").append(toIndentedString(paymentId)).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 ");
}
}
| 5,102 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/UpdateShiftResponse.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.squareup.connect.models.Error;
import com.squareup.connect.models.Shift;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
* The response to a request to update a `Shift`. Contains the updated `Shift` object. May contain a set of `Error` objects if the request resulted in errors.
*/
@ApiModel(description = "The response to a request to update a `Shift`. Contains the updated `Shift` object. May contain a set of `Error` objects if the request resulted in errors.")
public class UpdateShiftResponse {
@JsonProperty("shift")
private Shift shift = null;
@JsonProperty("errors")
private List<Error> errors = new ArrayList<Error>();
public UpdateShiftResponse shift(Shift shift) {
this.shift = shift;
return this;
}
/**
* The updated `Shift`.
* @return shift
**/
@ApiModelProperty(value = "The updated `Shift`.")
public Shift getShift() {
return shift;
}
public void setShift(Shift shift) {
this.shift = shift;
}
public UpdateShiftResponse errors(List<Error> errors) {
this.errors = errors;
return this;
}
public UpdateShiftResponse addErrorsItem(Error errorsItem) {
this.errors.add(errorsItem);
return this;
}
/**
* Any errors that occurred during the request.
* @return errors
**/
@ApiModelProperty(value = "Any errors that occurred during the request.")
public List<Error> getErrors() {
return errors;
}
public void setErrors(List<Error> errors) {
this.errors = errors;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
UpdateShiftResponse updateShiftResponse = (UpdateShiftResponse) o;
return Objects.equals(this.shift, updateShiftResponse.shift) &&
Objects.equals(this.errors, updateShiftResponse.errors);
}
@Override
public int hashCode() {
return Objects.hash(shift, errors);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class UpdateShiftResponse {\n");
sb.append(" shift: ").append(toIndentedString(shift)).append("\n");
sb.append(" errors: ").append(toIndentedString(errors)).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 ");
}
}
| 5,103 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/V1Discount.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.squareup.connect.models.V1Money;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* V1Discount
*/
@ApiModel(description = "V1Discount")
public class V1Discount {
@JsonProperty("id")
private String id = null;
@JsonProperty("name")
private String name = null;
@JsonProperty("rate")
private String rate = null;
@JsonProperty("amount_money")
private V1Money amountMoney = null;
@JsonProperty("discount_type")
private String discountType = null;
@JsonProperty("pin_required")
private Boolean pinRequired = null;
@JsonProperty("color")
private String color = null;
@JsonProperty("v2_id")
private String v2Id = null;
public V1Discount id(String id) {
this.id = id;
return this;
}
/**
* The discount's unique ID.
* @return id
**/
@ApiModelProperty(value = "The discount's unique ID.")
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public V1Discount name(String name) {
this.name = name;
return this;
}
/**
* The discount's name.
* @return name
**/
@ApiModelProperty(value = "The discount's name.")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public V1Discount rate(String rate) {
this.rate = rate;
return this;
}
/**
* The rate of the discount, as a string representation of a decimal number. A value of 0.07 corresponds to a rate of 7%. This rate is 0 if discount_type is VARIABLE_PERCENTAGE.
* @return rate
**/
@ApiModelProperty(value = "The rate of the discount, as a string representation of a decimal number. A value of 0.07 corresponds to a rate of 7%. This rate is 0 if discount_type is VARIABLE_PERCENTAGE.")
public String getRate() {
return rate;
}
public void setRate(String rate) {
this.rate = rate;
}
public V1Discount amountMoney(V1Money amountMoney) {
this.amountMoney = amountMoney;
return this;
}
/**
* The amount of the discount. This amount is 0 if discount_type is VARIABLE_AMOUNT. This field is not included for rate-based discounts.
* @return amountMoney
**/
@ApiModelProperty(value = "The amount of the discount. This amount is 0 if discount_type is VARIABLE_AMOUNT. This field is not included for rate-based discounts.")
public V1Money getAmountMoney() {
return amountMoney;
}
public void setAmountMoney(V1Money amountMoney) {
this.amountMoney = amountMoney;
}
public V1Discount discountType(String discountType) {
this.discountType = discountType;
return this;
}
/**
* Indicates whether the discount is a FIXED value or entered at the time of sale. See [V1DiscountDiscountType](#type-v1discountdiscounttype) for possible values
* @return discountType
**/
@ApiModelProperty(value = "Indicates whether the discount is a FIXED value or entered at the time of sale. See [V1DiscountDiscountType](#type-v1discountdiscounttype) for possible values")
public String getDiscountType() {
return discountType;
}
public void setDiscountType(String discountType) {
this.discountType = discountType;
}
public V1Discount pinRequired(Boolean pinRequired) {
this.pinRequired = pinRequired;
return this;
}
/**
* Indicates whether a mobile staff member needs to enter their PIN to apply the discount to a payment.
* @return pinRequired
**/
@ApiModelProperty(value = "Indicates whether a mobile staff member needs to enter their PIN to apply the discount to a payment.")
public Boolean getPinRequired() {
return pinRequired;
}
public void setPinRequired(Boolean pinRequired) {
this.pinRequired = pinRequired;
}
public V1Discount color(String color) {
this.color = color;
return this;
}
/**
* The color of the discount's display label in Square Point of Sale, if not the default color. The default color is 9da2a6. See [V1DiscountColor](#type-v1discountcolor) for possible values
* @return color
**/
@ApiModelProperty(value = "The color of the discount's display label in Square Point of Sale, if not the default color. The default color is 9da2a6. See [V1DiscountColor](#type-v1discountcolor) for possible values")
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public V1Discount v2Id(String v2Id) {
this.v2Id = v2Id;
return this;
}
/**
* The ID of the CatalogObject in the Connect v2 API. Objects that are shared across multiple locations share the same v2 ID.
* @return v2Id
**/
@ApiModelProperty(value = "The ID of the CatalogObject in the Connect v2 API. Objects that are shared across multiple locations share the same v2 ID.")
public String getV2Id() {
return v2Id;
}
public void setV2Id(String v2Id) {
this.v2Id = v2Id;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
V1Discount v1Discount = (V1Discount) o;
return Objects.equals(this.id, v1Discount.id) &&
Objects.equals(this.name, v1Discount.name) &&
Objects.equals(this.rate, v1Discount.rate) &&
Objects.equals(this.amountMoney, v1Discount.amountMoney) &&
Objects.equals(this.discountType, v1Discount.discountType) &&
Objects.equals(this.pinRequired, v1Discount.pinRequired) &&
Objects.equals(this.color, v1Discount.color) &&
Objects.equals(this.v2Id, v1Discount.v2Id);
}
@Override
public int hashCode() {
return Objects.hash(id, name, rate, amountMoney, discountType, pinRequired, color, v2Id);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class V1Discount {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" rate: ").append(toIndentedString(rate)).append("\n");
sb.append(" amountMoney: ").append(toIndentedString(amountMoney)).append("\n");
sb.append(" discountType: ").append(toIndentedString(discountType)).append("\n");
sb.append(" pinRequired: ").append(toIndentedString(pinRequired)).append("\n");
sb.append(" color: ").append(toIndentedString(color)).append("\n");
sb.append(" v2Id: ").append(toIndentedString(v2Id)).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 ");
}
}
| 5,104 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/CancelPaymentResponse.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.squareup.connect.models.Error;
import com.squareup.connect.models.Payment;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
* Return value from the [CancelPayment](#endpoint-payments-cancelpayment) endpoint.
*/
@ApiModel(description = "Return value from the [CancelPayment](#endpoint-payments-cancelpayment) endpoint.")
public class CancelPaymentResponse {
@JsonProperty("errors")
private List<Error> errors = new ArrayList<Error>();
@JsonProperty("payment")
private Payment payment = null;
public CancelPaymentResponse errors(List<Error> errors) {
this.errors = errors;
return this;
}
public CancelPaymentResponse addErrorsItem(Error errorsItem) {
this.errors.add(errorsItem);
return this;
}
/**
* Information on errors encountered during the request.
* @return errors
**/
@ApiModelProperty(value = "Information on errors encountered during the request.")
public List<Error> getErrors() {
return errors;
}
public void setErrors(List<Error> errors) {
this.errors = errors;
}
public CancelPaymentResponse payment(Payment payment) {
this.payment = payment;
return this;
}
/**
* The successfully canceled `Payment` object.
* @return payment
**/
@ApiModelProperty(value = "The successfully canceled `Payment` object.")
public Payment getPayment() {
return payment;
}
public void setPayment(Payment payment) {
this.payment = payment;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CancelPaymentResponse cancelPaymentResponse = (CancelPaymentResponse) o;
return Objects.equals(this.errors, cancelPaymentResponse.errors) &&
Objects.equals(this.payment, cancelPaymentResponse.payment);
}
@Override
public int hashCode() {
return Objects.hash(errors, payment);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CancelPaymentResponse {\n");
sb.append(" errors: ").append(toIndentedString(errors)).append("\n");
sb.append(" payment: ").append(toIndentedString(payment)).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 ");
}
}
| 5,105 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/UpdateWorkweekConfigResponse.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.squareup.connect.models.Error;
import com.squareup.connect.models.WorkweekConfig;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
* The response to a request to update a `WorkweekConfig` object. Contains the updated `WorkweekConfig` object. May contain a set of `Error` objects if the request resulted in errors.
*/
@ApiModel(description = "The response to a request to update a `WorkweekConfig` object. Contains the updated `WorkweekConfig` object. May contain a set of `Error` objects if the request resulted in errors.")
public class UpdateWorkweekConfigResponse {
@JsonProperty("workweek_config")
private WorkweekConfig workweekConfig = null;
@JsonProperty("errors")
private List<Error> errors = new ArrayList<Error>();
public UpdateWorkweekConfigResponse workweekConfig(WorkweekConfig workweekConfig) {
this.workweekConfig = workweekConfig;
return this;
}
/**
* The response object.
* @return workweekConfig
**/
@ApiModelProperty(value = "The response object.")
public WorkweekConfig getWorkweekConfig() {
return workweekConfig;
}
public void setWorkweekConfig(WorkweekConfig workweekConfig) {
this.workweekConfig = workweekConfig;
}
public UpdateWorkweekConfigResponse errors(List<Error> errors) {
this.errors = errors;
return this;
}
public UpdateWorkweekConfigResponse addErrorsItem(Error errorsItem) {
this.errors.add(errorsItem);
return this;
}
/**
* Any errors that occurred during the request.
* @return errors
**/
@ApiModelProperty(value = "Any errors that occurred during the request.")
public List<Error> getErrors() {
return errors;
}
public void setErrors(List<Error> errors) {
this.errors = errors;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
UpdateWorkweekConfigResponse updateWorkweekConfigResponse = (UpdateWorkweekConfigResponse) o;
return Objects.equals(this.workweekConfig, updateWorkweekConfigResponse.workweekConfig) &&
Objects.equals(this.errors, updateWorkweekConfigResponse.errors);
}
@Override
public int hashCode() {
return Objects.hash(workweekConfig, errors);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class UpdateWorkweekConfigResponse {\n");
sb.append(" workweekConfig: ").append(toIndentedString(workweekConfig)).append("\n");
sb.append(" errors: ").append(toIndentedString(errors)).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 ");
}
}
| 5,106 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/ListEmployeeWagesRequest.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* A request for a set of `EmployeeWage` objects
*/
@ApiModel(description = "A request for a set of `EmployeeWage` objects")
public class ListEmployeeWagesRequest {
@JsonProperty("employee_id")
private String employeeId = null;
@JsonProperty("limit")
private Integer limit = null;
@JsonProperty("cursor")
private String cursor = null;
public ListEmployeeWagesRequest employeeId(String employeeId) {
this.employeeId = employeeId;
return this;
}
/**
* Filter wages returned to only those that are associated with the specified employee.
* @return employeeId
**/
@ApiModelProperty(value = "Filter wages returned to only those that are associated with the specified employee.")
public String getEmployeeId() {
return employeeId;
}
public void setEmployeeId(String employeeId) {
this.employeeId = employeeId;
}
public ListEmployeeWagesRequest limit(Integer limit) {
this.limit = limit;
return this;
}
/**
* Maximum number of Employee Wages to return per page. Can range between 1 and 200. The default is the maximum at 200.
* minimum: 1
* maximum: 200
* @return limit
**/
@ApiModelProperty(value = "Maximum number of Employee Wages to return per page. Can range between 1 and 200. The default is the maximum at 200.")
public Integer getLimit() {
return limit;
}
public void setLimit(Integer limit) {
this.limit = limit;
}
public ListEmployeeWagesRequest cursor(String cursor) {
this.cursor = cursor;
return this;
}
/**
* Pointer to the next page of Employee Wage results to fetch.
* @return cursor
**/
@ApiModelProperty(value = "Pointer to the next page of Employee Wage results to fetch.")
public String getCursor() {
return cursor;
}
public void setCursor(String cursor) {
this.cursor = cursor;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ListEmployeeWagesRequest listEmployeeWagesRequest = (ListEmployeeWagesRequest) o;
return Objects.equals(this.employeeId, listEmployeeWagesRequest.employeeId) &&
Objects.equals(this.limit, listEmployeeWagesRequest.limit) &&
Objects.equals(this.cursor, listEmployeeWagesRequest.cursor);
}
@Override
public int hashCode() {
return Objects.hash(employeeId, limit, cursor);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ListEmployeeWagesRequest {\n");
sb.append(" employeeId: ").append(toIndentedString(employeeId)).append("\n");
sb.append(" limit: ").append(toIndentedString(limit)).append("\n");
sb.append(" cursor: ").append(toIndentedString(cursor)).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 ");
}
}
| 5,107 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/RetrieveCatalogObjectRequest.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
*
*/
@ApiModel(description = "")
public class RetrieveCatalogObjectRequest {
@JsonProperty("include_related_objects")
private Boolean includeRelatedObjects = null;
public RetrieveCatalogObjectRequest includeRelatedObjects(Boolean includeRelatedObjects) {
this.includeRelatedObjects = includeRelatedObjects;
return this;
}
/**
* If `true`, the response will include additional objects that are related to the requested object, as follows: If the `object` field of the response contains a CatalogItem, its associated CatalogCategory, CatalogTax objects, CatalogImages and CatalogModifierLists will be returned in the `related_objects` field of the response. If the `object` field of the response contains a CatalogItemVariation, its parent CatalogItem will be returned in the `related_objects` field of the response. Default value: `false`
* @return includeRelatedObjects
**/
@ApiModelProperty(value = "If `true`, the response will include additional objects that are related to the requested object, as follows: If the `object` field of the response contains a CatalogItem, its associated CatalogCategory, CatalogTax objects, CatalogImages and CatalogModifierLists will be returned in the `related_objects` field of the response. If the `object` field of the response contains a CatalogItemVariation, its parent CatalogItem will be returned in the `related_objects` field of the response. Default value: `false`")
public Boolean getIncludeRelatedObjects() {
return includeRelatedObjects;
}
public void setIncludeRelatedObjects(Boolean includeRelatedObjects) {
this.includeRelatedObjects = includeRelatedObjects;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
RetrieveCatalogObjectRequest retrieveCatalogObjectRequest = (RetrieveCatalogObjectRequest) o;
return Objects.equals(this.includeRelatedObjects, retrieveCatalogObjectRequest.includeRelatedObjects);
}
@Override
public int hashCode() {
return Objects.hash(includeRelatedObjects);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class RetrieveCatalogObjectRequest {\n");
sb.append(" includeRelatedObjects: ").append(toIndentedString(includeRelatedObjects)).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 ");
}
}
| 5,108 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/BusinessHours.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.squareup.connect.models.BusinessHoursPeriod;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
* Represents the hours of operation for a business location.
*/
@ApiModel(description = "Represents the hours of operation for a business location.")
public class BusinessHours {
@JsonProperty("periods")
private List<BusinessHoursPeriod> periods = new ArrayList<BusinessHoursPeriod>();
public BusinessHours periods(List<BusinessHoursPeriod> periods) {
this.periods = periods;
return this;
}
public BusinessHours addPeriodsItem(BusinessHoursPeriod periodsItem) {
this.periods.add(periodsItem);
return this;
}
/**
* The list of time periods during which the business is open. There may be at most 10 periods per day.
* @return periods
**/
@ApiModelProperty(value = "The list of time periods during which the business is open. There may be at most 10 periods per day.")
public List<BusinessHoursPeriod> getPeriods() {
return periods;
}
public void setPeriods(List<BusinessHoursPeriod> periods) {
this.periods = periods;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
BusinessHours businessHours = (BusinessHours) o;
return Objects.equals(this.periods, businessHours.periods);
}
@Override
public int hashCode() {
return Objects.hash(periods);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class BusinessHours {\n");
sb.append(" periods: ").append(toIndentedString(periods)).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 ");
}
}
| 5,109 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/OrderLineItemTax.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.squareup.connect.models.Money;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Represents a tax that applies to one or more line item in the order. Fixed-amount, order-scoped taxes are distributed across all non-zero line item totals. The amount distributed to each line item is relative to the amount the item contributes to the order subtotal.
*/
@ApiModel(description = "Represents a tax that applies to one or more line item in the order. Fixed-amount, order-scoped taxes are distributed across all non-zero line item totals. The amount distributed to each line item is relative to the amount the item contributes to the order subtotal.")
public class OrderLineItemTax {
@JsonProperty("uid")
private String uid = null;
@JsonProperty("catalog_object_id")
private String catalogObjectId = null;
@JsonProperty("name")
private String name = null;
@JsonProperty("type")
private String type = null;
@JsonProperty("percentage")
private String percentage = null;
@JsonProperty("metadata")
private Map<String, String> metadata = new HashMap<String, String>();
@JsonProperty("applied_money")
private Money appliedMoney = null;
@JsonProperty("scope")
private String scope = null;
public OrderLineItemTax uid(String uid) {
this.uid = uid;
return this;
}
/**
* Unique ID that identifies the tax only within this order.
* Note: This model is in beta.
* @return uid
**/
@ApiModelProperty(value = "Unique ID that identifies the tax only within this order.")
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public OrderLineItemTax catalogObjectId(String catalogObjectId) {
this.catalogObjectId = catalogObjectId;
return this;
}
/**
* The catalog object id referencing `CatalogTax`.
* @return catalogObjectId
**/
@ApiModelProperty(value = "The catalog object id referencing `CatalogTax`.")
public String getCatalogObjectId() {
return catalogObjectId;
}
public void setCatalogObjectId(String catalogObjectId) {
this.catalogObjectId = catalogObjectId;
}
public OrderLineItemTax name(String name) {
this.name = name;
return this;
}
/**
* The tax's name.
* @return name
**/
@ApiModelProperty(value = "The tax's name.")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public OrderLineItemTax type(String type) {
this.type = type;
return this;
}
/**
* Indicates the calculation method used to apply the tax. See [OrderLineItemTaxType](#type-orderlineitemtaxtype) for possible values
* @return type
**/
@ApiModelProperty(value = "Indicates the calculation method used to apply the tax. See [OrderLineItemTaxType](#type-orderlineitemtaxtype) for possible values")
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public OrderLineItemTax percentage(String percentage) {
this.percentage = percentage;
return this;
}
/**
* The percentage of the tax, as a string representation of a decimal number. For example, a value of `\"7.25\"` corresponds to a percentage of 7.25%.
* @return percentage
**/
@ApiModelProperty(value = "The percentage of the tax, as a string representation of a decimal number. For example, a value of `\"7.25\"` corresponds to a percentage of 7.25%.")
public String getPercentage() {
return percentage;
}
public void setPercentage(String percentage) {
this.percentage = percentage;
}
public OrderLineItemTax metadata(Map<String, String> metadata) {
this.metadata = metadata;
return this;
}
public OrderLineItemTax putMetadataItem(String key, String metadataItem) {
this.metadata.put(key, metadataItem);
return this;
}
/**
* Application-defined data attached to this tax. Metadata fields are intended to store descriptive references or associations with an entity in another system or store brief information about the object. Square does not process this field; it only stores and returns it in relevant API calls. Do not use metadata to store any sensitive information (personally identifiable information, card details, etc.). Keys written by applications must be 60 characters or less and must be in the character set `[a-zA-Z0-9_-]`. Entries may also include metadata generated by Square. These keys are prefixed with a namespace, separated from the key with a ':' character. Values have a max length of 255 characters. An application may have up to 10 entries per metadata field. Entries written by applications are private and can only be read or modified by the same application. See [Metadata](https://developer.squareup.com/docs/build-basics/metadata) for more information.
* Note: This model is in beta.
* @return metadata
**/
@ApiModelProperty(value = "Application-defined data attached to this tax. Metadata fields are intended to store descriptive references or associations with an entity in another system or store brief information about the object. Square does not process this field; it only stores and returns it in relevant API calls. Do not use metadata to store any sensitive information (personally identifiable information, card details, etc.). Keys written by applications must be 60 characters or less and must be in the character set `[a-zA-Z0-9_-]`. Entries may also include metadata generated by Square. These keys are prefixed with a namespace, separated from the key with a ':' character. Values have a max length of 255 characters. An application may have up to 10 entries per metadata field. Entries written by applications are private and can only be read or modified by the same application. See [Metadata](https://developer.squareup.com/docs/build-basics/metadata) for more information.")
public Map<String, String> getMetadata() {
return metadata;
}
public void setMetadata(Map<String, String> metadata) {
this.metadata = metadata;
}
public OrderLineItemTax appliedMoney(Money appliedMoney) {
this.appliedMoney = appliedMoney;
return this;
}
/**
* The amount of the money applied by the tax in the order.
* @return appliedMoney
**/
@ApiModelProperty(value = "The amount of the money applied by the tax in the order.")
public Money getAppliedMoney() {
return appliedMoney;
}
public void setAppliedMoney(Money appliedMoney) {
this.appliedMoney = appliedMoney;
}
public OrderLineItemTax scope(String scope) {
this.scope = scope;
return this;
}
/**
* Indicates the level at which the tax applies. For `ORDER` scoped taxes, Square generates references in `applied_taxes` on all order line items that do not have them. For `LINE_ITEM` scoped taxes, the tax will only apply to line items with references in their `applied_taxes` field. This field is immutable. To change the scope, you must delete the tax and re-add it as a new tax. See [OrderLineItemTaxScope](#type-orderlineitemtaxscope) for possible values
* @return scope
**/
@ApiModelProperty(value = "Indicates the level at which the tax applies. For `ORDER` scoped taxes, Square generates references in `applied_taxes` on all order line items that do not have them. For `LINE_ITEM` scoped taxes, the tax will only apply to line items with references in their `applied_taxes` field. This field is immutable. To change the scope, you must delete the tax and re-add it as a new tax. See [OrderLineItemTaxScope](#type-orderlineitemtaxscope) for possible values")
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
OrderLineItemTax orderLineItemTax = (OrderLineItemTax) o;
return Objects.equals(this.uid, orderLineItemTax.uid) &&
Objects.equals(this.catalogObjectId, orderLineItemTax.catalogObjectId) &&
Objects.equals(this.name, orderLineItemTax.name) &&
Objects.equals(this.type, orderLineItemTax.type) &&
Objects.equals(this.percentage, orderLineItemTax.percentage) &&
Objects.equals(this.metadata, orderLineItemTax.metadata) &&
Objects.equals(this.appliedMoney, orderLineItemTax.appliedMoney) &&
Objects.equals(this.scope, orderLineItemTax.scope);
}
@Override
public int hashCode() {
return Objects.hash(uid, catalogObjectId, name, type, percentage, metadata, appliedMoney, scope);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class OrderLineItemTax {\n");
sb.append(" uid: ").append(toIndentedString(uid)).append("\n");
sb.append(" catalogObjectId: ").append(toIndentedString(catalogObjectId)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" percentage: ").append(toIndentedString(percentage)).append("\n");
sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n");
sb.append(" appliedMoney: ").append(toIndentedString(appliedMoney)).append("\n");
sb.append(" scope: ").append(toIndentedString(scope)).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 ");
}
}
| 5,110 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/OrderReturnServiceCharge.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.squareup.connect.models.Money;
import com.squareup.connect.models.OrderLineItemAppliedTax;
import com.squareup.connect.models.OrderReturnTax;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
* Represents the service charge applied to the original order.
*/
@ApiModel(description = "Represents the service charge applied to the original order.")
public class OrderReturnServiceCharge {
@JsonProperty("uid")
private String uid = null;
@JsonProperty("source_service_charge_uid")
private String sourceServiceChargeUid = null;
@JsonProperty("name")
private String name = null;
@JsonProperty("catalog_object_id")
private String catalogObjectId = null;
@JsonProperty("percentage")
private String percentage = null;
@JsonProperty("amount_money")
private Money amountMoney = null;
@JsonProperty("applied_money")
private Money appliedMoney = null;
@JsonProperty("total_money")
private Money totalMoney = null;
@JsonProperty("total_tax_money")
private Money totalTaxMoney = null;
@JsonProperty("calculation_phase")
private String calculationPhase = null;
@JsonProperty("taxable")
private Boolean taxable = null;
@JsonProperty("return_taxes")
private List<OrderReturnTax> returnTaxes = new ArrayList<OrderReturnTax>();
@JsonProperty("applied_taxes")
private List<OrderLineItemAppliedTax> appliedTaxes = new ArrayList<OrderLineItemAppliedTax>();
public OrderReturnServiceCharge uid(String uid) {
this.uid = uid;
return this;
}
/**
* Unique ID that identifies the return service charge only within this order.
* Note: This model is in beta.
* @return uid
**/
@ApiModelProperty(value = "Unique ID that identifies the return service charge only within this order.")
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public OrderReturnServiceCharge sourceServiceChargeUid(String sourceServiceChargeUid) {
this.sourceServiceChargeUid = sourceServiceChargeUid;
return this;
}
/**
* `uid` of the Service Charge from the Order containing the original charge of the service charge. `source_service_charge_uid` is `null` for unlinked returns.
* @return sourceServiceChargeUid
**/
@ApiModelProperty(value = "`uid` of the Service Charge from the Order containing the original charge of the service charge. `source_service_charge_uid` is `null` for unlinked returns.")
public String getSourceServiceChargeUid() {
return sourceServiceChargeUid;
}
public void setSourceServiceChargeUid(String sourceServiceChargeUid) {
this.sourceServiceChargeUid = sourceServiceChargeUid;
}
public OrderReturnServiceCharge name(String name) {
this.name = name;
return this;
}
/**
* The name of the service charge.
* @return name
**/
@ApiModelProperty(value = "The name of the service charge.")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public OrderReturnServiceCharge catalogObjectId(String catalogObjectId) {
this.catalogObjectId = catalogObjectId;
return this;
}
/**
* The catalog object ID of the associated `CatalogServiceCharge`.
* @return catalogObjectId
**/
@ApiModelProperty(value = "The catalog object ID of the associated `CatalogServiceCharge`.")
public String getCatalogObjectId() {
return catalogObjectId;
}
public void setCatalogObjectId(String catalogObjectId) {
this.catalogObjectId = catalogObjectId;
}
public OrderReturnServiceCharge percentage(String percentage) {
this.percentage = percentage;
return this;
}
/**
* The percentage of the service charge, as a string representation of a decimal number. For example, a value of `\"7.25\"` corresponds to a percentage of 7.25%. Exactly one of `percentage` or `amount_money` should be set.
* @return percentage
**/
@ApiModelProperty(value = "The percentage of the service charge, as a string representation of a decimal number. For example, a value of `\"7.25\"` corresponds to a percentage of 7.25%. Exactly one of `percentage` or `amount_money` should be set.")
public String getPercentage() {
return percentage;
}
public void setPercentage(String percentage) {
this.percentage = percentage;
}
public OrderReturnServiceCharge amountMoney(Money amountMoney) {
this.amountMoney = amountMoney;
return this;
}
/**
* The amount of a non-percentage based service charge. Exactly one of `percentage` or `amount_money` should be set.
* @return amountMoney
**/
@ApiModelProperty(value = "The amount of a non-percentage based service charge. Exactly one of `percentage` or `amount_money` should be set.")
public Money getAmountMoney() {
return amountMoney;
}
public void setAmountMoney(Money amountMoney) {
this.amountMoney = amountMoney;
}
public OrderReturnServiceCharge appliedMoney(Money appliedMoney) {
this.appliedMoney = appliedMoney;
return this;
}
/**
* The amount of money applied to the order by the service charge, including any inclusive tax amounts, as calculated by Square. - For fixed-amount service charges, `applied_money` is equal to `amount_money`. - For percentage-based service charges, `applied_money` is the money calculated using the percentage.
* @return appliedMoney
**/
@ApiModelProperty(value = "The amount of money applied to the order by the service charge, including any inclusive tax amounts, as calculated by Square. - For fixed-amount service charges, `applied_money` is equal to `amount_money`. - For percentage-based service charges, `applied_money` is the money calculated using the percentage.")
public Money getAppliedMoney() {
return appliedMoney;
}
public void setAppliedMoney(Money appliedMoney) {
this.appliedMoney = appliedMoney;
}
public OrderReturnServiceCharge totalMoney(Money totalMoney) {
this.totalMoney = totalMoney;
return this;
}
/**
* The total amount of money to collect for the service charge. __NOTE__: if an inclusive tax is applied to the service charge, `total_money` does not equal `applied_money` plus `total_tax_money` since the inclusive tax amount will already be included in both `applied_money` and `total_tax_money`.
* @return totalMoney
**/
@ApiModelProperty(value = "The total amount of money to collect for the service charge. __NOTE__: if an inclusive tax is applied to the service charge, `total_money` does not equal `applied_money` plus `total_tax_money` since the inclusive tax amount will already be included in both `applied_money` and `total_tax_money`.")
public Money getTotalMoney() {
return totalMoney;
}
public void setTotalMoney(Money totalMoney) {
this.totalMoney = totalMoney;
}
public OrderReturnServiceCharge totalTaxMoney(Money totalTaxMoney) {
this.totalTaxMoney = totalTaxMoney;
return this;
}
/**
* The total amount of tax money to collect for the service charge.
* @return totalTaxMoney
**/
@ApiModelProperty(value = "The total amount of tax money to collect for the service charge.")
public Money getTotalTaxMoney() {
return totalTaxMoney;
}
public void setTotalTaxMoney(Money totalTaxMoney) {
this.totalTaxMoney = totalTaxMoney;
}
public OrderReturnServiceCharge calculationPhase(String calculationPhase) {
this.calculationPhase = calculationPhase;
return this;
}
/**
* The calculation phase after which to apply the service charge. See [OrderServiceChargeCalculationPhase](#type-orderservicechargecalculationphase) for possible values
* @return calculationPhase
**/
@ApiModelProperty(value = "The calculation phase after which to apply the service charge. See [OrderServiceChargeCalculationPhase](#type-orderservicechargecalculationphase) for possible values")
public String getCalculationPhase() {
return calculationPhase;
}
public void setCalculationPhase(String calculationPhase) {
this.calculationPhase = calculationPhase;
}
public OrderReturnServiceCharge taxable(Boolean taxable) {
this.taxable = taxable;
return this;
}
/**
* Indicates whether the surcharge can be taxed. Service charges calculated in the `TOTAL_PHASE` cannot be marked as taxable.
* @return taxable
**/
@ApiModelProperty(value = "Indicates whether the surcharge can be taxed. Service charges calculated in the `TOTAL_PHASE` cannot be marked as taxable.")
public Boolean getTaxable() {
return taxable;
}
public void setTaxable(Boolean taxable) {
this.taxable = taxable;
}
public OrderReturnServiceCharge returnTaxes(List<OrderReturnTax> returnTaxes) {
this.returnTaxes = returnTaxes;
return this;
}
public OrderReturnServiceCharge addReturnTaxesItem(OrderReturnTax returnTaxesItem) {
this.returnTaxes.add(returnTaxesItem);
return this;
}
/**
* Taxes applied to the `OrderReturnServiceCharge`. By default, return-level taxes apply to `OrderReturnServiceCharge`s calculated in the `SUBTOTAL_PHASE` if `taxable` is set to `true`. On read or retrieve, this list includes both item-level taxes and any return-level taxes apportioned to this item. This field has been deprecated in favour of `applied_taxes`.
* @return returnTaxes
**/
@ApiModelProperty(value = "Taxes applied to the `OrderReturnServiceCharge`. By default, return-level taxes apply to `OrderReturnServiceCharge`s calculated in the `SUBTOTAL_PHASE` if `taxable` is set to `true`. On read or retrieve, this list includes both item-level taxes and any return-level taxes apportioned to this item. This field has been deprecated in favour of `applied_taxes`.")
@Deprecated
public List<OrderReturnTax> getReturnTaxes() {
return returnTaxes;
}
public void setReturnTaxes(List<OrderReturnTax> returnTaxes) {
this.returnTaxes = returnTaxes;
}
public OrderReturnServiceCharge appliedTaxes(List<OrderLineItemAppliedTax> appliedTaxes) {
this.appliedTaxes = appliedTaxes;
return this;
}
public OrderReturnServiceCharge addAppliedTaxesItem(OrderLineItemAppliedTax appliedTaxesItem) {
this.appliedTaxes.add(appliedTaxesItem);
return this;
}
/**
* The list of references to `OrderReturnTax` entities applied to the `OrderReturnServiceCharge`. Each `OrderLineItemAppliedTax` has a `tax_uid` that references the `uid` of a top-level `OrderReturnTax` that is being applied to the `OrderReturnServiceCharge`. On reads, the amount applied is populated.
* Note: This model is in beta.
* @return appliedTaxes
**/
@ApiModelProperty(value = "The list of references to `OrderReturnTax` entities applied to the `OrderReturnServiceCharge`. Each `OrderLineItemAppliedTax` has a `tax_uid` that references the `uid` of a top-level `OrderReturnTax` that is being applied to the `OrderReturnServiceCharge`. On reads, the amount applied is populated.")
public List<OrderLineItemAppliedTax> getAppliedTaxes() {
return appliedTaxes;
}
public void setAppliedTaxes(List<OrderLineItemAppliedTax> appliedTaxes) {
this.appliedTaxes = appliedTaxes;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
OrderReturnServiceCharge orderReturnServiceCharge = (OrderReturnServiceCharge) o;
return Objects.equals(this.uid, orderReturnServiceCharge.uid) &&
Objects.equals(this.sourceServiceChargeUid, orderReturnServiceCharge.sourceServiceChargeUid) &&
Objects.equals(this.name, orderReturnServiceCharge.name) &&
Objects.equals(this.catalogObjectId, orderReturnServiceCharge.catalogObjectId) &&
Objects.equals(this.percentage, orderReturnServiceCharge.percentage) &&
Objects.equals(this.amountMoney, orderReturnServiceCharge.amountMoney) &&
Objects.equals(this.appliedMoney, orderReturnServiceCharge.appliedMoney) &&
Objects.equals(this.totalMoney, orderReturnServiceCharge.totalMoney) &&
Objects.equals(this.totalTaxMoney, orderReturnServiceCharge.totalTaxMoney) &&
Objects.equals(this.calculationPhase, orderReturnServiceCharge.calculationPhase) &&
Objects.equals(this.taxable, orderReturnServiceCharge.taxable) &&
Objects.equals(this.returnTaxes, orderReturnServiceCharge.returnTaxes) &&
Objects.equals(this.appliedTaxes, orderReturnServiceCharge.appliedTaxes);
}
@Override
public int hashCode() {
return Objects.hash(uid, sourceServiceChargeUid, name, catalogObjectId, percentage, amountMoney, appliedMoney, totalMoney, totalTaxMoney, calculationPhase, taxable, returnTaxes, appliedTaxes);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class OrderReturnServiceCharge {\n");
sb.append(" uid: ").append(toIndentedString(uid)).append("\n");
sb.append(" sourceServiceChargeUid: ").append(toIndentedString(sourceServiceChargeUid)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" catalogObjectId: ").append(toIndentedString(catalogObjectId)).append("\n");
sb.append(" percentage: ").append(toIndentedString(percentage)).append("\n");
sb.append(" amountMoney: ").append(toIndentedString(amountMoney)).append("\n");
sb.append(" appliedMoney: ").append(toIndentedString(appliedMoney)).append("\n");
sb.append(" totalMoney: ").append(toIndentedString(totalMoney)).append("\n");
sb.append(" totalTaxMoney: ").append(toIndentedString(totalTaxMoney)).append("\n");
sb.append(" calculationPhase: ").append(toIndentedString(calculationPhase)).append("\n");
sb.append(" taxable: ").append(toIndentedString(taxable)).append("\n");
sb.append(" returnTaxes: ").append(toIndentedString(returnTaxes)).append("\n");
sb.append(" appliedTaxes: ").append(toIndentedString(appliedTaxes)).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 ");
}
}
| 5,111 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/V1CreateDiscountRequest.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.squareup.connect.models.V1Discount;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
*
*/
@ApiModel(description = "")
public class V1CreateDiscountRequest {
@JsonProperty("body")
private V1Discount body = null;
public V1CreateDiscountRequest body(V1Discount body) {
this.body = body;
return this;
}
/**
* An object containing the fields to POST for the request. See the corresponding object definition for field details.
* @return body
**/
@ApiModelProperty(value = "An object containing the fields to POST for the request. See the corresponding object definition for field details.")
public V1Discount getBody() {
return body;
}
public void setBody(V1Discount body) {
this.body = body;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
V1CreateDiscountRequest v1CreateDiscountRequest = (V1CreateDiscountRequest) o;
return Objects.equals(this.body, v1CreateDiscountRequest.body);
}
@Override
public int hashCode() {
return Objects.hash(body);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class V1CreateDiscountRequest {\n");
sb.append(" body: ").append(toIndentedString(body)).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 ");
}
}
| 5,112 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/V1ListLocationsRequest.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import io.swagger.annotations.ApiModel;
/**
*
*/
@ApiModel(description = "")
public class V1ListLocationsRequest {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return true;
}
@Override
public int hashCode() {
return Objects.hash();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class V1ListLocationsRequest {\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 ");
}
}
| 5,113 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/CatalogItem.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.squareup.connect.models.CatalogItemModifierListInfo;
import com.squareup.connect.models.CatalogItemOptionForItem;
import com.squareup.connect.models.CatalogObject;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
* An item (i.e., product family) in the Catalog object model.
*/
@ApiModel(description = "An item (i.e., product family) in the Catalog object model.")
public class CatalogItem {
@JsonProperty("name")
private String name = null;
@JsonProperty("description")
private String description = null;
@JsonProperty("abbreviation")
private String abbreviation = null;
@JsonProperty("label_color")
private String labelColor = null;
@JsonProperty("available_online")
private Boolean availableOnline = null;
@JsonProperty("available_for_pickup")
private Boolean availableForPickup = null;
@JsonProperty("available_electronically")
private Boolean availableElectronically = null;
@JsonProperty("category_id")
private String categoryId = null;
@JsonProperty("tax_ids")
private List<String> taxIds = new ArrayList<String>();
@JsonProperty("modifier_list_info")
private List<CatalogItemModifierListInfo> modifierListInfo = new ArrayList<CatalogItemModifierListInfo>();
@JsonProperty("variations")
private List<CatalogObject> variations = new ArrayList<CatalogObject>();
@JsonProperty("product_type")
private String productType = null;
@JsonProperty("skip_modifier_screen")
private Boolean skipModifierScreen = null;
@JsonProperty("item_options")
private List<CatalogItemOptionForItem> itemOptions = new ArrayList<CatalogItemOptionForItem>();
public CatalogItem name(String name) {
this.name = name;
return this;
}
/**
* The item's name. Searchable. This field must not be empty. This field has max length of 512 Unicode code points.
* @return name
**/
@ApiModelProperty(value = "The item's name. Searchable. This field must not be empty. This field has max length of 512 Unicode code points.")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public CatalogItem description(String description) {
this.description = description;
return this;
}
/**
* The item's description. Searchable. This field has max length of 4096 Unicode code points.
* @return description
**/
@ApiModelProperty(value = "The item's description. Searchable. This field has max length of 4096 Unicode code points.")
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public CatalogItem abbreviation(String abbreviation) {
this.abbreviation = abbreviation;
return this;
}
/**
* The text of the item's display label in the Square Point of Sale app. Only up to the first five characters of the string are used. Searchable. This field has max length of 24 Unicode code points.
* @return abbreviation
**/
@ApiModelProperty(value = "The text of the item's display label in the Square Point of Sale app. Only up to the first five characters of the string are used. Searchable. This field has max length of 24 Unicode code points.")
public String getAbbreviation() {
return abbreviation;
}
public void setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation;
}
public CatalogItem labelColor(String labelColor) {
this.labelColor = labelColor;
return this;
}
/**
* The color of the item's display label in the Square Point of Sale app. This must be a valid hex color code.
* @return labelColor
**/
@ApiModelProperty(value = "The color of the item's display label in the Square Point of Sale app. This must be a valid hex color code.")
public String getLabelColor() {
return labelColor;
}
public void setLabelColor(String labelColor) {
this.labelColor = labelColor;
}
public CatalogItem availableOnline(Boolean availableOnline) {
this.availableOnline = availableOnline;
return this;
}
/**
* If `true`, the item can be added to shipping orders from the merchant's online store.
* @return availableOnline
**/
@ApiModelProperty(value = "If `true`, the item can be added to shipping orders from the merchant's online store.")
public Boolean getAvailableOnline() {
return availableOnline;
}
public void setAvailableOnline(Boolean availableOnline) {
this.availableOnline = availableOnline;
}
public CatalogItem availableForPickup(Boolean availableForPickup) {
this.availableForPickup = availableForPickup;
return this;
}
/**
* If `true`, the item can be added to pickup orders from the merchant's online store.
* @return availableForPickup
**/
@ApiModelProperty(value = "If `true`, the item can be added to pickup orders from the merchant's online store.")
public Boolean getAvailableForPickup() {
return availableForPickup;
}
public void setAvailableForPickup(Boolean availableForPickup) {
this.availableForPickup = availableForPickup;
}
public CatalogItem availableElectronically(Boolean availableElectronically) {
this.availableElectronically = availableElectronically;
return this;
}
/**
* If `true`, the item can be added to electronically fulfilled orders from the merchant's online store.
* @return availableElectronically
**/
@ApiModelProperty(value = "If `true`, the item can be added to electronically fulfilled orders from the merchant's online store.")
public Boolean getAvailableElectronically() {
return availableElectronically;
}
public void setAvailableElectronically(Boolean availableElectronically) {
this.availableElectronically = availableElectronically;
}
public CatalogItem categoryId(String categoryId) {
this.categoryId = categoryId;
return this;
}
/**
* The ID of the item's category, if any.
* @return categoryId
**/
@ApiModelProperty(value = "The ID of the item's category, if any.")
public String getCategoryId() {
return categoryId;
}
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}
public CatalogItem taxIds(List<String> taxIds) {
this.taxIds = taxIds;
return this;
}
public CatalogItem addTaxIdsItem(String taxIdsItem) {
this.taxIds.add(taxIdsItem);
return this;
}
/**
* A set of IDs indicating the taxes enabled for this item. When updating an item, any taxes listed here will be added to the item. Taxes may also be added to or deleted from an item using `UpdateItemTaxes`.
* @return taxIds
**/
@ApiModelProperty(value = "A set of IDs indicating the taxes enabled for this item. When updating an item, any taxes listed here will be added to the item. Taxes may also be added to or deleted from an item using `UpdateItemTaxes`.")
public List<String> getTaxIds() {
return taxIds;
}
public void setTaxIds(List<String> taxIds) {
this.taxIds = taxIds;
}
public CatalogItem modifierListInfo(List<CatalogItemModifierListInfo> modifierListInfo) {
this.modifierListInfo = modifierListInfo;
return this;
}
public CatalogItem addModifierListInfoItem(CatalogItemModifierListInfo modifierListInfoItem) {
this.modifierListInfo.add(modifierListInfoItem);
return this;
}
/**
* A set of `CatalogItemModifierListInfo` objects representing the modifier lists that apply to this item, along with the overrides and min and max limits that are specific to this item. Modifier lists may also be added to or deleted from an item using `UpdateItemModifierLists`.
* @return modifierListInfo
**/
@ApiModelProperty(value = "A set of `CatalogItemModifierListInfo` objects representing the modifier lists that apply to this item, along with the overrides and min and max limits that are specific to this item. Modifier lists may also be added to or deleted from an item using `UpdateItemModifierLists`.")
public List<CatalogItemModifierListInfo> getModifierListInfo() {
return modifierListInfo;
}
public void setModifierListInfo(List<CatalogItemModifierListInfo> modifierListInfo) {
this.modifierListInfo = modifierListInfo;
}
public CatalogItem variations(List<CatalogObject> variations) {
this.variations = variations;
return this;
}
public CatalogItem addVariationsItem(CatalogObject variationsItem) {
this.variations.add(variationsItem);
return this;
}
/**
* A list of CatalogObjects containing the `CatalogItemVariation`s for this item.
* @return variations
**/
@ApiModelProperty(value = "A list of CatalogObjects containing the `CatalogItemVariation`s for this item.")
public List<CatalogObject> getVariations() {
return variations;
}
public void setVariations(List<CatalogObject> variations) {
this.variations = variations;
}
public CatalogItem productType(String productType) {
this.productType = productType;
return this;
}
/**
* The product type of the item. May not be changed once an item has been created. Only items of product type `REGULAR` or `APPOINTMENTS_SERVICE` may be created by this API; items with other product types are read-only. See [CatalogItemProductType](#type-catalogitemproducttype) for possible values
* @return productType
**/
@ApiModelProperty(value = "The product type of the item. May not be changed once an item has been created. Only items of product type `REGULAR` or `APPOINTMENTS_SERVICE` may be created by this API; items with other product types are read-only. See [CatalogItemProductType](#type-catalogitemproducttype) for possible values")
public String getProductType() {
return productType;
}
public void setProductType(String productType) {
this.productType = productType;
}
public CatalogItem skipModifierScreen(Boolean skipModifierScreen) {
this.skipModifierScreen = skipModifierScreen;
return this;
}
/**
* If `false`, the Square Point of Sale app will present the `CatalogItem`'s details screen immediately, allowing the merchant to choose `CatalogModifier`s before adding the item to the cart. This is the default behavior. If `true`, the Square Point of Sale app will immediately add the item to the cart with the pre-selected modifiers, and merchants can edit modifiers by drilling down onto the item's details. Third-party clients are encouraged to implement similar behaviors.
* @return skipModifierScreen
**/
@ApiModelProperty(value = "If `false`, the Square Point of Sale app will present the `CatalogItem`'s details screen immediately, allowing the merchant to choose `CatalogModifier`s before adding the item to the cart. This is the default behavior. If `true`, the Square Point of Sale app will immediately add the item to the cart with the pre-selected modifiers, and merchants can edit modifiers by drilling down onto the item's details. Third-party clients are encouraged to implement similar behaviors.")
public Boolean getSkipModifierScreen() {
return skipModifierScreen;
}
public void setSkipModifierScreen(Boolean skipModifierScreen) {
this.skipModifierScreen = skipModifierScreen;
}
public CatalogItem itemOptions(List<CatalogItemOptionForItem> itemOptions) {
this.itemOptions = itemOptions;
return this;
}
public CatalogItem addItemOptionsItem(CatalogItemOptionForItem itemOptionsItem) {
this.itemOptions.add(itemOptionsItem);
return this;
}
/**
* List of item options IDs for this item. Used to manage and group item variations in a specified order. Maximum: 6 item options.
* Note: This model is in beta.
* @return itemOptions
**/
@ApiModelProperty(value = "List of item options IDs for this item. Used to manage and group item variations in a specified order. Maximum: 6 item options.")
public List<CatalogItemOptionForItem> getItemOptions() {
return itemOptions;
}
public void setItemOptions(List<CatalogItemOptionForItem> itemOptions) {
this.itemOptions = itemOptions;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CatalogItem catalogItem = (CatalogItem) o;
return Objects.equals(this.name, catalogItem.name) &&
Objects.equals(this.description, catalogItem.description) &&
Objects.equals(this.abbreviation, catalogItem.abbreviation) &&
Objects.equals(this.labelColor, catalogItem.labelColor) &&
Objects.equals(this.availableOnline, catalogItem.availableOnline) &&
Objects.equals(this.availableForPickup, catalogItem.availableForPickup) &&
Objects.equals(this.availableElectronically, catalogItem.availableElectronically) &&
Objects.equals(this.categoryId, catalogItem.categoryId) &&
Objects.equals(this.taxIds, catalogItem.taxIds) &&
Objects.equals(this.modifierListInfo, catalogItem.modifierListInfo) &&
Objects.equals(this.variations, catalogItem.variations) &&
Objects.equals(this.productType, catalogItem.productType) &&
Objects.equals(this.skipModifierScreen, catalogItem.skipModifierScreen) &&
Objects.equals(this.itemOptions, catalogItem.itemOptions);
}
@Override
public int hashCode() {
return Objects.hash(name, description, abbreviation, labelColor, availableOnline, availableForPickup, availableElectronically, categoryId, taxIds, modifierListInfo, variations, productType, skipModifierScreen, itemOptions);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CatalogItem {\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" abbreviation: ").append(toIndentedString(abbreviation)).append("\n");
sb.append(" labelColor: ").append(toIndentedString(labelColor)).append("\n");
sb.append(" availableOnline: ").append(toIndentedString(availableOnline)).append("\n");
sb.append(" availableForPickup: ").append(toIndentedString(availableForPickup)).append("\n");
sb.append(" availableElectronically: ").append(toIndentedString(availableElectronically)).append("\n");
sb.append(" categoryId: ").append(toIndentedString(categoryId)).append("\n");
sb.append(" taxIds: ").append(toIndentedString(taxIds)).append("\n");
sb.append(" modifierListInfo: ").append(toIndentedString(modifierListInfo)).append("\n");
sb.append(" variations: ").append(toIndentedString(variations)).append("\n");
sb.append(" productType: ").append(toIndentedString(productType)).append("\n");
sb.append(" skipModifierScreen: ").append(toIndentedString(skipModifierScreen)).append("\n");
sb.append(" itemOptions: ").append(toIndentedString(itemOptions)).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 ");
}
}
| 5,114 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/BreakType.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* A defined break template that sets an expectation for possible `Break` instances on a `Shift`.
*/
@ApiModel(description = "A defined break template that sets an expectation for possible `Break` instances on a `Shift`.")
public class BreakType {
@JsonProperty("id")
private String id = null;
@JsonProperty("location_id")
private String locationId = null;
@JsonProperty("break_name")
private String breakName = null;
@JsonProperty("expected_duration")
private String expectedDuration = null;
@JsonProperty("is_paid")
private Boolean isPaid = null;
@JsonProperty("version")
private Integer version = null;
@JsonProperty("created_at")
private String createdAt = null;
@JsonProperty("updated_at")
private String updatedAt = null;
public BreakType id(String id) {
this.id = id;
return this;
}
/**
* UUID for this object.
* @return id
**/
@ApiModelProperty(value = "UUID for this object.")
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public BreakType locationId(String locationId) {
this.locationId = locationId;
return this;
}
/**
* The ID of the business location this type of break applies to.
* @return locationId
**/
@ApiModelProperty(required = true, value = "The ID of the business location this type of break applies to.")
public String getLocationId() {
return locationId;
}
public void setLocationId(String locationId) {
this.locationId = locationId;
}
public BreakType breakName(String breakName) {
this.breakName = breakName;
return this;
}
/**
* A human-readable name for this type of break. Will be displayed to employees in Square products.
* @return breakName
**/
@ApiModelProperty(required = true, value = "A human-readable name for this type of break. Will be displayed to employees in Square products.")
public String getBreakName() {
return breakName;
}
public void setBreakName(String breakName) {
this.breakName = breakName;
}
public BreakType expectedDuration(String expectedDuration) {
this.expectedDuration = expectedDuration;
return this;
}
/**
* Format: RFC-3339 P[n]Y[n]M[n]DT[n]H[n]M[n]S. The expected length of this break. Precision below minutes is truncated.
* @return expectedDuration
**/
@ApiModelProperty(required = true, value = "Format: RFC-3339 P[n]Y[n]M[n]DT[n]H[n]M[n]S. The expected length of this break. Precision below minutes is truncated.")
public String getExpectedDuration() {
return expectedDuration;
}
public void setExpectedDuration(String expectedDuration) {
this.expectedDuration = expectedDuration;
}
public BreakType isPaid(Boolean isPaid) {
this.isPaid = isPaid;
return this;
}
/**
* Whether this break counts towards time worked for compensation purposes.
* @return isPaid
**/
@ApiModelProperty(required = true, value = "Whether this break counts towards time worked for compensation purposes.")
public Boolean getIsPaid() {
return isPaid;
}
public void setIsPaid(Boolean isPaid) {
this.isPaid = isPaid;
}
public BreakType version(Integer version) {
this.version = version;
return this;
}
/**
* Used for resolving concurrency issues; request will fail if version provided does not match server version at time of request. If a value is not provided, Square's servers execute a \"blind\" write; potentially overwriting another writer's data.
* @return version
**/
@ApiModelProperty(value = "Used for resolving concurrency issues; request will fail if version provided does not match server version at time of request. If a value is not provided, Square's servers execute a \"blind\" write; potentially overwriting another writer's data.")
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
public BreakType createdAt(String createdAt) {
this.createdAt = createdAt;
return this;
}
/**
* A read-only timestamp in RFC 3339 format.
* @return createdAt
**/
@ApiModelProperty(value = "A read-only timestamp in RFC 3339 format.")
public String getCreatedAt() {
return createdAt;
}
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
public BreakType updatedAt(String updatedAt) {
this.updatedAt = updatedAt;
return this;
}
/**
* A read-only timestamp in RFC 3339 format.
* @return updatedAt
**/
@ApiModelProperty(value = "A read-only timestamp in RFC 3339 format.")
public String getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
BreakType breakType = (BreakType) o;
return Objects.equals(this.id, breakType.id) &&
Objects.equals(this.locationId, breakType.locationId) &&
Objects.equals(this.breakName, breakType.breakName) &&
Objects.equals(this.expectedDuration, breakType.expectedDuration) &&
Objects.equals(this.isPaid, breakType.isPaid) &&
Objects.equals(this.version, breakType.version) &&
Objects.equals(this.createdAt, breakType.createdAt) &&
Objects.equals(this.updatedAt, breakType.updatedAt);
}
@Override
public int hashCode() {
return Objects.hash(id, locationId, breakName, expectedDuration, isPaid, version, createdAt, updatedAt);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class BreakType {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" locationId: ").append(toIndentedString(locationId)).append("\n");
sb.append(" breakName: ").append(toIndentedString(breakName)).append("\n");
sb.append(" expectedDuration: ").append(toIndentedString(expectedDuration)).append("\n");
sb.append(" isPaid: ").append(toIndentedString(isPaid)).append("\n");
sb.append(" version: ").append(toIndentedString(version)).append("\n");
sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n");
sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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 ");
}
}
| 5,115 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/CatalogInfoRequest.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import io.swagger.annotations.ApiModel;
/**
*
*/
@ApiModel(description = "")
public class CatalogInfoRequest {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return true;
}
@Override
public int hashCode() {
return Objects.hash();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CatalogInfoRequest {\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 ");
}
}
| 5,116 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/ListLocationsResponse.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.squareup.connect.models.Error;
import com.squareup.connect.models.Location;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
* Defines the fields that are included in the response body of a request to the __ListLocations__ endpoint. One of `errors` or `locations` is present in a given response (never both).
*/
@ApiModel(description = "Defines the fields that are included in the response body of a request to the __ListLocations__ endpoint. One of `errors` or `locations` is present in a given response (never both).")
public class ListLocationsResponse {
@JsonProperty("errors")
private List<Error> errors = new ArrayList<Error>();
@JsonProperty("locations")
private List<Location> locations = new ArrayList<Location>();
public ListLocationsResponse errors(List<Error> errors) {
this.errors = errors;
return this;
}
public ListLocationsResponse addErrorsItem(Error errorsItem) {
this.errors.add(errorsItem);
return this;
}
/**
* Any errors that occurred during the request.
* @return errors
**/
@ApiModelProperty(value = "Any errors that occurred during the request.")
public List<Error> getErrors() {
return errors;
}
public void setErrors(List<Error> errors) {
this.errors = errors;
}
public ListLocationsResponse locations(List<Location> locations) {
this.locations = locations;
return this;
}
public ListLocationsResponse addLocationsItem(Location locationsItem) {
this.locations.add(locationsItem);
return this;
}
/**
* The business locations.
* @return locations
**/
@ApiModelProperty(value = "The business locations.")
public List<Location> getLocations() {
return locations;
}
public void setLocations(List<Location> locations) {
this.locations = locations;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ListLocationsResponse listLocationsResponse = (ListLocationsResponse) o;
return Objects.equals(this.errors, listLocationsResponse.errors) &&
Objects.equals(this.locations, listLocationsResponse.locations);
}
@Override
public int hashCode() {
return Objects.hash(errors, locations);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ListLocationsResponse {\n");
sb.append(" errors: ").append(toIndentedString(errors)).append("\n");
sb.append(" locations: ").append(toIndentedString(locations)).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 ");
}
}
| 5,117 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/CatalogTax.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* A tax in the Catalog object model.
*/
@ApiModel(description = "A tax in the Catalog object model.")
public class CatalogTax {
@JsonProperty("name")
private String name = null;
@JsonProperty("calculation_phase")
private String calculationPhase = null;
@JsonProperty("inclusion_type")
private String inclusionType = null;
@JsonProperty("percentage")
private String percentage = null;
@JsonProperty("applies_to_custom_amounts")
private Boolean appliesToCustomAmounts = null;
@JsonProperty("enabled")
private Boolean enabled = null;
public CatalogTax name(String name) {
this.name = name;
return this;
}
/**
* The tax's name. Searchable. This field has max length of 255 Unicode code points.
* @return name
**/
@ApiModelProperty(value = "The tax's name. Searchable. This field has max length of 255 Unicode code points.")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public CatalogTax calculationPhase(String calculationPhase) {
this.calculationPhase = calculationPhase;
return this;
}
/**
* Whether the tax is calculated based on a payment's subtotal or total. See [TaxCalculationPhase](#type-taxcalculationphase) for possible values
* @return calculationPhase
**/
@ApiModelProperty(value = "Whether the tax is calculated based on a payment's subtotal or total. See [TaxCalculationPhase](#type-taxcalculationphase) for possible values")
public String getCalculationPhase() {
return calculationPhase;
}
public void setCalculationPhase(String calculationPhase) {
this.calculationPhase = calculationPhase;
}
public CatalogTax inclusionType(String inclusionType) {
this.inclusionType = inclusionType;
return this;
}
/**
* Whether the tax is `ADDITIVE` or `INCLUSIVE`. See [TaxInclusionType](#type-taxinclusiontype) for possible values
* @return inclusionType
**/
@ApiModelProperty(value = "Whether the tax is `ADDITIVE` or `INCLUSIVE`. See [TaxInclusionType](#type-taxinclusiontype) for possible values")
public String getInclusionType() {
return inclusionType;
}
public void setInclusionType(String inclusionType) {
this.inclusionType = inclusionType;
}
public CatalogTax percentage(String percentage) {
this.percentage = percentage;
return this;
}
/**
* The percentage of the tax in decimal form, using a `'.'` as the decimal separator and without a `'%'` sign. A value of `7.5` corresponds to 7.5%.
* @return percentage
**/
@ApiModelProperty(value = "The percentage of the tax in decimal form, using a `'.'` as the decimal separator and without a `'%'` sign. A value of `7.5` corresponds to 7.5%.")
public String getPercentage() {
return percentage;
}
public void setPercentage(String percentage) {
this.percentage = percentage;
}
public CatalogTax appliesToCustomAmounts(Boolean appliesToCustomAmounts) {
this.appliesToCustomAmounts = appliesToCustomAmounts;
return this;
}
/**
* If `true`, the fee applies to custom amounts entered into the Square Point of Sale app that are not associated with a particular `CatalogItem`.
* @return appliesToCustomAmounts
**/
@ApiModelProperty(value = "If `true`, the fee applies to custom amounts entered into the Square Point of Sale app that are not associated with a particular `CatalogItem`.")
public Boolean getAppliesToCustomAmounts() {
return appliesToCustomAmounts;
}
public void setAppliesToCustomAmounts(Boolean appliesToCustomAmounts) {
this.appliesToCustomAmounts = appliesToCustomAmounts;
}
public CatalogTax enabled(Boolean enabled) {
this.enabled = enabled;
return this;
}
/**
* If `true`, the tax will be shown as enabled in the Square Point of Sale app.
* @return enabled
**/
@ApiModelProperty(value = "If `true`, the tax will be shown as enabled in the Square Point of Sale app.")
public Boolean getEnabled() {
return enabled;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CatalogTax catalogTax = (CatalogTax) o;
return Objects.equals(this.name, catalogTax.name) &&
Objects.equals(this.calculationPhase, catalogTax.calculationPhase) &&
Objects.equals(this.inclusionType, catalogTax.inclusionType) &&
Objects.equals(this.percentage, catalogTax.percentage) &&
Objects.equals(this.appliesToCustomAmounts, catalogTax.appliesToCustomAmounts) &&
Objects.equals(this.enabled, catalogTax.enabled);
}
@Override
public int hashCode() {
return Objects.hash(name, calculationPhase, inclusionType, percentage, appliesToCustomAmounts, enabled);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CatalogTax {\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" calculationPhase: ").append(toIndentedString(calculationPhase)).append("\n");
sb.append(" inclusionType: ").append(toIndentedString(inclusionType)).append("\n");
sb.append(" percentage: ").append(toIndentedString(percentage)).append("\n");
sb.append(" appliesToCustomAmounts: ").append(toIndentedString(appliesToCustomAmounts)).append("\n");
sb.append(" enabled: ").append(toIndentedString(enabled)).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 ");
}
}
| 5,118 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/ObtainTokenResponse.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
*
*/
@ApiModel(description = "")
public class ObtainTokenResponse {
@JsonProperty("access_token")
private String accessToken = null;
@JsonProperty("token_type")
private String tokenType = null;
@JsonProperty("expires_at")
private String expiresAt = null;
@JsonProperty("merchant_id")
private String merchantId = null;
@JsonProperty("subscription_id")
private String subscriptionId = null;
@JsonProperty("plan_id")
private String planId = null;
@JsonProperty("id_token")
private String idToken = null;
@JsonProperty("refresh_token")
private String refreshToken = null;
public ObtainTokenResponse accessToken(String accessToken) {
this.accessToken = accessToken;
return this;
}
/**
* A valid OAuth access token. OAuth access tokens are 64 bytes long. Provide the access token in a header with every request to Connect API endpoints. See the [Build with OAuth](https://developer.squareup.com/docs/authz/oauth/build-with-the-api) guide for more information.
* @return accessToken
**/
@ApiModelProperty(value = "A valid OAuth access token. OAuth access tokens are 64 bytes long. Provide the access token in a header with every request to Connect API endpoints. See the [Build with OAuth](https://developer.squareup.com/docs/authz/oauth/build-with-the-api) guide for more information.")
public String getAccessToken() {
return accessToken;
}
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
public ObtainTokenResponse tokenType(String tokenType) {
this.tokenType = tokenType;
return this;
}
/**
* This value is always _bearer_.
* @return tokenType
**/
@ApiModelProperty(value = "This value is always _bearer_.")
public String getTokenType() {
return tokenType;
}
public void setTokenType(String tokenType) {
this.tokenType = tokenType;
}
public ObtainTokenResponse expiresAt(String expiresAt) {
this.expiresAt = expiresAt;
return this;
}
/**
* The date when access_token expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format.
* @return expiresAt
**/
@ApiModelProperty(value = "The date when access_token expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format.")
public String getExpiresAt() {
return expiresAt;
}
public void setExpiresAt(String expiresAt) {
this.expiresAt = expiresAt;
}
public ObtainTokenResponse merchantId(String merchantId) {
this.merchantId = merchantId;
return this;
}
/**
* The ID of the authorizing merchant's business.
* @return merchantId
**/
@ApiModelProperty(value = "The ID of the authorizing merchant's business.")
public String getMerchantId() {
return merchantId;
}
public void setMerchantId(String merchantId) {
this.merchantId = merchantId;
}
public ObtainTokenResponse subscriptionId(String subscriptionId) {
this.subscriptionId = subscriptionId;
return this;
}
/**
* __LEGACY FIELD__. The ID of a subscription plan the merchant signed up for. Only present if the merchant signed up for a subscription during authorization.
* @return subscriptionId
**/
@ApiModelProperty(value = "__LEGACY FIELD__. The ID of a subscription plan the merchant signed up for. Only present if the merchant signed up for a subscription during authorization.")
public String getSubscriptionId() {
return subscriptionId;
}
public void setSubscriptionId(String subscriptionId) {
this.subscriptionId = subscriptionId;
}
public ObtainTokenResponse planId(String planId) {
this.planId = planId;
return this;
}
/**
* T__LEGACY FIELD__. The ID of the subscription plan the merchant signed up for. Only present if the merchant signed up for a subscription during authorization.
* @return planId
**/
@ApiModelProperty(value = "T__LEGACY FIELD__. The ID of the subscription plan the merchant signed up for. Only present if the merchant signed up for a subscription during authorization.")
public String getPlanId() {
return planId;
}
public void setPlanId(String planId) {
this.planId = planId;
}
public ObtainTokenResponse idToken(String idToken) {
this.idToken = idToken;
return this;
}
/**
* Then OpenID token belonging to this this person. Only present if the OPENID scope is included in the authorize request.
* @return idToken
**/
@ApiModelProperty(value = "Then OpenID token belonging to this this person. Only present if the OPENID scope is included in the authorize request.")
public String getIdToken() {
return idToken;
}
public void setIdToken(String idToken) {
this.idToken = idToken;
}
public ObtainTokenResponse refreshToken(String refreshToken) {
this.refreshToken = refreshToken;
return this;
}
/**
* A refresh token. For more information, see [OAuth access token management](https://developer.squareup.com/docs/authz/oauth/how-it-works#oauth-access-token-management).
* @return refreshToken
**/
@ApiModelProperty(value = "A refresh token. For more information, see [OAuth access token management](https://developer.squareup.com/docs/authz/oauth/how-it-works#oauth-access-token-management).")
public String getRefreshToken() {
return refreshToken;
}
public void setRefreshToken(String refreshToken) {
this.refreshToken = refreshToken;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ObtainTokenResponse obtainTokenResponse = (ObtainTokenResponse) o;
return Objects.equals(this.accessToken, obtainTokenResponse.accessToken) &&
Objects.equals(this.tokenType, obtainTokenResponse.tokenType) &&
Objects.equals(this.expiresAt, obtainTokenResponse.expiresAt) &&
Objects.equals(this.merchantId, obtainTokenResponse.merchantId) &&
Objects.equals(this.subscriptionId, obtainTokenResponse.subscriptionId) &&
Objects.equals(this.planId, obtainTokenResponse.planId) &&
Objects.equals(this.idToken, obtainTokenResponse.idToken) &&
Objects.equals(this.refreshToken, obtainTokenResponse.refreshToken);
}
@Override
public int hashCode() {
return Objects.hash(accessToken, tokenType, expiresAt, merchantId, subscriptionId, planId, idToken, refreshToken);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ObtainTokenResponse {\n");
sb.append(" accessToken: ").append(toIndentedString(accessToken)).append("\n");
sb.append(" tokenType: ").append(toIndentedString(tokenType)).append("\n");
sb.append(" expiresAt: ").append(toIndentedString(expiresAt)).append("\n");
sb.append(" merchantId: ").append(toIndentedString(merchantId)).append("\n");
sb.append(" subscriptionId: ").append(toIndentedString(subscriptionId)).append("\n");
sb.append(" planId: ").append(toIndentedString(planId)).append("\n");
sb.append(" idToken: ").append(toIndentedString(idToken)).append("\n");
sb.append(" refreshToken: ").append(toIndentedString(refreshToken)).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 ");
}
}
| 5,119 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/CreateOrderRequestDiscount.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.squareup.connect.models.Money;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* __Deprecated__: Please use the [OrderLineItemDiscount](#type-orderlineitemdiscount) type in the order field of [CreateOrderRequest](#type-createorderrequest) instead. Represents a discount that can apply to either a single line item or an entire order.
*/
@ApiModel(description = "__Deprecated__: Please use the [OrderLineItemDiscount](#type-orderlineitemdiscount) type in the order field of [CreateOrderRequest](#type-createorderrequest) instead. Represents a discount that can apply to either a single line item or an entire order.")
public class CreateOrderRequestDiscount {
@JsonProperty("catalog_object_id")
private String catalogObjectId = null;
@JsonProperty("name")
private String name = null;
@JsonProperty("percentage")
private String percentage = null;
@JsonProperty("amount_money")
private Money amountMoney = null;
public CreateOrderRequestDiscount catalogObjectId(String catalogObjectId) {
this.catalogObjectId = catalogObjectId;
return this;
}
/**
* Only used for catalog discounts. The catalog object ID for an existing `CatalogDiscount`. Do not provide a value for this field if you provide values in other fields for an ad hoc discount.
* @return catalogObjectId
**/
@ApiModelProperty(value = "Only used for catalog discounts. The catalog object ID for an existing `CatalogDiscount`. Do not provide a value for this field if you provide values in other fields for an ad hoc discount.")
public String getCatalogObjectId() {
return catalogObjectId;
}
public void setCatalogObjectId(String catalogObjectId) {
this.catalogObjectId = catalogObjectId;
}
public CreateOrderRequestDiscount name(String name) {
this.name = name;
return this;
}
/**
* Only used for ad hoc discounts. The discount's name.
* @return name
**/
@ApiModelProperty(value = "Only used for ad hoc discounts. The discount's name.")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public CreateOrderRequestDiscount percentage(String percentage) {
this.percentage = percentage;
return this;
}
/**
* Only used for ad hoc discounts. The percentage of the discount, as a string representation of a decimal number. A value of `7.25` corresponds to a percentage of 7.25%. This value range between 0.0 up to 100.0
* @return percentage
**/
@ApiModelProperty(value = "Only used for ad hoc discounts. The percentage of the discount, as a string representation of a decimal number. A value of `7.25` corresponds to a percentage of 7.25%. This value range between 0.0 up to 100.0")
public String getPercentage() {
return percentage;
}
public void setPercentage(String percentage) {
this.percentage = percentage;
}
public CreateOrderRequestDiscount amountMoney(Money amountMoney) {
this.amountMoney = amountMoney;
return this;
}
/**
* Only used for ad hoc discounts. The monetary amount of the discount.
* @return amountMoney
**/
@ApiModelProperty(value = "Only used for ad hoc discounts. The monetary amount of the discount.")
public Money getAmountMoney() {
return amountMoney;
}
public void setAmountMoney(Money amountMoney) {
this.amountMoney = amountMoney;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CreateOrderRequestDiscount createOrderRequestDiscount = (CreateOrderRequestDiscount) o;
return Objects.equals(this.catalogObjectId, createOrderRequestDiscount.catalogObjectId) &&
Objects.equals(this.name, createOrderRequestDiscount.name) &&
Objects.equals(this.percentage, createOrderRequestDiscount.percentage) &&
Objects.equals(this.amountMoney, createOrderRequestDiscount.amountMoney);
}
@Override
public int hashCode() {
return Objects.hash(catalogObjectId, name, percentage, amountMoney);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CreateOrderRequestDiscount {\n");
sb.append(" catalogObjectId: ").append(toIndentedString(catalogObjectId)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" percentage: ").append(toIndentedString(percentage)).append("\n");
sb.append(" amountMoney: ").append(toIndentedString(amountMoney)).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 ");
}
}
| 5,120 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/ListAdditionalRecipientReceivableRefundsRequest.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Defines the query parameters that can be included in a request to the [ListAdditionalRecipientReceivableRefunds](#endpoint-listadditionalrecipientreceivablerefunds) endpoint.
*/
@ApiModel(description = "Defines the query parameters that can be included in a request to the [ListAdditionalRecipientReceivableRefunds](#endpoint-listadditionalrecipientreceivablerefunds) endpoint.")
public class ListAdditionalRecipientReceivableRefundsRequest {
@JsonProperty("begin_time")
private String beginTime = null;
@JsonProperty("end_time")
private String endTime = null;
@JsonProperty("sort_order")
private String sortOrder = null;
@JsonProperty("cursor")
private String cursor = null;
public ListAdditionalRecipientReceivableRefundsRequest beginTime(String beginTime) {
this.beginTime = beginTime;
return this;
}
/**
* The beginning of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time minus one year.
* @return beginTime
**/
@ApiModelProperty(value = "The beginning of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time minus one year.")
public String getBeginTime() {
return beginTime;
}
public void setBeginTime(String beginTime) {
this.beginTime = beginTime;
}
public ListAdditionalRecipientReceivableRefundsRequest endTime(String endTime) {
this.endTime = endTime;
return this;
}
/**
* The end of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time.
* @return endTime
**/
@ApiModelProperty(value = "The end of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time.")
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public ListAdditionalRecipientReceivableRefundsRequest sortOrder(String sortOrder) {
this.sortOrder = sortOrder;
return this;
}
/**
* The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC` See [SortOrder](#type-sortorder) for possible values
* @return sortOrder
**/
@ApiModelProperty(value = "The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC` See [SortOrder](#type-sortorder) for possible values")
public String getSortOrder() {
return sortOrder;
}
public void setSortOrder(String sortOrder) {
this.sortOrder = sortOrder;
}
public ListAdditionalRecipientReceivableRefundsRequest cursor(String cursor) {
this.cursor = cursor;
return this;
}
/**
* A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. See [Paginating results](#paginatingresults) for more information.
* @return cursor
**/
@ApiModelProperty(value = "A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. See [Paginating results](#paginatingresults) for more information.")
public String getCursor() {
return cursor;
}
public void setCursor(String cursor) {
this.cursor = cursor;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ListAdditionalRecipientReceivableRefundsRequest listAdditionalRecipientReceivableRefundsRequest = (ListAdditionalRecipientReceivableRefundsRequest) o;
return Objects.equals(this.beginTime, listAdditionalRecipientReceivableRefundsRequest.beginTime) &&
Objects.equals(this.endTime, listAdditionalRecipientReceivableRefundsRequest.endTime) &&
Objects.equals(this.sortOrder, listAdditionalRecipientReceivableRefundsRequest.sortOrder) &&
Objects.equals(this.cursor, listAdditionalRecipientReceivableRefundsRequest.cursor);
}
@Override
public int hashCode() {
return Objects.hash(beginTime, endTime, sortOrder, cursor);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ListAdditionalRecipientReceivableRefundsRequest {\n");
sb.append(" beginTime: ").append(toIndentedString(beginTime)).append("\n");
sb.append(" endTime: ").append(toIndentedString(endTime)).append("\n");
sb.append(" sortOrder: ").append(toIndentedString(sortOrder)).append("\n");
sb.append(" cursor: ").append(toIndentedString(cursor)).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 ");
}
}
| 5,121 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/V1SettlementEntry.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.squareup.connect.models.V1Money;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* V1SettlementEntry
*/
@ApiModel(description = "V1SettlementEntry")
public class V1SettlementEntry {
@JsonProperty("payment_id")
private String paymentId = null;
@JsonProperty("type")
private String type = null;
@JsonProperty("amount_money")
private V1Money amountMoney = null;
@JsonProperty("fee_money")
private V1Money feeMoney = null;
public V1SettlementEntry paymentId(String paymentId) {
this.paymentId = paymentId;
return this;
}
/**
* The settlement's unique identifier.
* @return paymentId
**/
@ApiModelProperty(value = "The settlement's unique identifier.")
public String getPaymentId() {
return paymentId;
}
public void setPaymentId(String paymentId) {
this.paymentId = paymentId;
}
public V1SettlementEntry type(String type) {
this.type = type;
return this;
}
/**
* The settlement's current status. See [V1SettlementEntryType](#type-v1settlemententrytype) for possible values
* @return type
**/
@ApiModelProperty(value = "The settlement's current status. See [V1SettlementEntryType](#type-v1settlemententrytype) for possible values")
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public V1SettlementEntry amountMoney(V1Money amountMoney) {
this.amountMoney = amountMoney;
return this;
}
/**
* The total amount of money this entry contributes to the total settlement amount.
* @return amountMoney
**/
@ApiModelProperty(value = "The total amount of money this entry contributes to the total settlement amount.")
public V1Money getAmountMoney() {
return amountMoney;
}
public void setAmountMoney(V1Money amountMoney) {
this.amountMoney = amountMoney;
}
public V1SettlementEntry feeMoney(V1Money feeMoney) {
this.feeMoney = feeMoney;
return this;
}
/**
* The amount of all Square fees associated with this settlement entry. This value is always negative or zero.
* @return feeMoney
**/
@ApiModelProperty(value = "The amount of all Square fees associated with this settlement entry. This value is always negative or zero.")
public V1Money getFeeMoney() {
return feeMoney;
}
public void setFeeMoney(V1Money feeMoney) {
this.feeMoney = feeMoney;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
V1SettlementEntry v1SettlementEntry = (V1SettlementEntry) o;
return Objects.equals(this.paymentId, v1SettlementEntry.paymentId) &&
Objects.equals(this.type, v1SettlementEntry.type) &&
Objects.equals(this.amountMoney, v1SettlementEntry.amountMoney) &&
Objects.equals(this.feeMoney, v1SettlementEntry.feeMoney);
}
@Override
public int hashCode() {
return Objects.hash(paymentId, type, amountMoney, feeMoney);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class V1SettlementEntry {\n");
sb.append(" paymentId: ").append(toIndentedString(paymentId)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" amountMoney: ").append(toIndentedString(amountMoney)).append("\n");
sb.append(" feeMoney: ").append(toIndentedString(feeMoney)).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 ");
}
}
| 5,122 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/ChargeRequestAdditionalRecipient.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.squareup.connect.models.Money;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Represents an additional recipient (other than the merchant) entitled to a portion of the tender. Support is currently limited to USD, CAD and GBP currencies
*/
@ApiModel(description = "Represents an additional recipient (other than the merchant) entitled to a portion of the tender. Support is currently limited to USD, CAD and GBP currencies")
public class ChargeRequestAdditionalRecipient {
@JsonProperty("location_id")
private String locationId = null;
@JsonProperty("description")
private String description = null;
@JsonProperty("amount_money")
private Money amountMoney = null;
public ChargeRequestAdditionalRecipient locationId(String locationId) {
this.locationId = locationId;
return this;
}
/**
* The location ID for a recipient (other than the merchant) receiving a portion of the tender.
* @return locationId
**/
@ApiModelProperty(required = true, value = "The location ID for a recipient (other than the merchant) receiving a portion of the tender.")
public String getLocationId() {
return locationId;
}
public void setLocationId(String locationId) {
this.locationId = locationId;
}
public ChargeRequestAdditionalRecipient description(String description) {
this.description = description;
return this;
}
/**
* The description of the additional recipient.
* @return description
**/
@ApiModelProperty(required = true, value = "The description of the additional recipient.")
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public ChargeRequestAdditionalRecipient amountMoney(Money amountMoney) {
this.amountMoney = amountMoney;
return this;
}
/**
* The amount of money distributed to the recipient.
* @return amountMoney
**/
@ApiModelProperty(required = true, value = "The amount of money distributed to the recipient.")
public Money getAmountMoney() {
return amountMoney;
}
public void setAmountMoney(Money amountMoney) {
this.amountMoney = amountMoney;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ChargeRequestAdditionalRecipient chargeRequestAdditionalRecipient = (ChargeRequestAdditionalRecipient) o;
return Objects.equals(this.locationId, chargeRequestAdditionalRecipient.locationId) &&
Objects.equals(this.description, chargeRequestAdditionalRecipient.description) &&
Objects.equals(this.amountMoney, chargeRequestAdditionalRecipient.amountMoney);
}
@Override
public int hashCode() {
return Objects.hash(locationId, description, amountMoney);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ChargeRequestAdditionalRecipient {\n");
sb.append(" locationId: ").append(toIndentedString(locationId)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" amountMoney: ").append(toIndentedString(amountMoney)).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 ");
}
}
| 5,123 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/V1DeleteCategoryRequest.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import io.swagger.annotations.ApiModel;
/**
*
*/
@ApiModel(description = "")
public class V1DeleteCategoryRequest {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return true;
}
@Override
public int hashCode() {
return Objects.hash();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class V1DeleteCategoryRequest {\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 ");
}
}
| 5,124 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/CatalogItemVariation.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.squareup.connect.models.CatalogItemOptionValueForItemVariation;
import com.squareup.connect.models.ItemVariationLocationOverrides;
import com.squareup.connect.models.Money;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
* An item variation (i.e., product) in the Catalog object model. Each item may have a maximum of 250 item variations.
*/
@ApiModel(description = "An item variation (i.e., product) in the Catalog object model. Each item may have a maximum of 250 item variations.")
public class CatalogItemVariation {
@JsonProperty("item_id")
private String itemId = null;
@JsonProperty("name")
private String name = null;
@JsonProperty("sku")
private String sku = null;
@JsonProperty("upc")
private String upc = null;
@JsonProperty("ordinal")
private Integer ordinal = null;
@JsonProperty("pricing_type")
private String pricingType = null;
@JsonProperty("price_money")
private Money priceMoney = null;
@JsonProperty("location_overrides")
private List<ItemVariationLocationOverrides> locationOverrides = new ArrayList<ItemVariationLocationOverrides>();
@JsonProperty("track_inventory")
private Boolean trackInventory = null;
@JsonProperty("inventory_alert_type")
private String inventoryAlertType = null;
@JsonProperty("inventory_alert_threshold")
private Long inventoryAlertThreshold = null;
@JsonProperty("user_data")
private String userData = null;
@JsonProperty("service_duration")
private Long serviceDuration = null;
@JsonProperty("item_option_values")
private List<CatalogItemOptionValueForItemVariation> itemOptionValues = new ArrayList<CatalogItemOptionValueForItemVariation>();
@JsonProperty("measurement_unit_id")
private String measurementUnitId = null;
public CatalogItemVariation itemId(String itemId) {
this.itemId = itemId;
return this;
}
/**
* The ID of the `CatalogItem` associated with this item variation. Searchable.
* @return itemId
**/
@ApiModelProperty(value = "The ID of the `CatalogItem` associated with this item variation. Searchable.")
public String getItemId() {
return itemId;
}
public void setItemId(String itemId) {
this.itemId = itemId;
}
public CatalogItemVariation name(String name) {
this.name = name;
return this;
}
/**
* The item variation's name. Searchable. This field has max length of 255 Unicode code points.
* @return name
**/
@ApiModelProperty(value = "The item variation's name. Searchable. This field has max length of 255 Unicode code points.")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public CatalogItemVariation sku(String sku) {
this.sku = sku;
return this;
}
/**
* The item variation's SKU, if any. Searchable.
* @return sku
**/
@ApiModelProperty(value = "The item variation's SKU, if any. Searchable.")
public String getSku() {
return sku;
}
public void setSku(String sku) {
this.sku = sku;
}
public CatalogItemVariation upc(String upc) {
this.upc = upc;
return this;
}
/**
* The item variation's UPC, if any. Searchable in the Connect API. This field is only exposed in the Connect API. It is not exposed in Square's Dashboard, Square Point of Sale app or Retail Point of Sale app.
* @return upc
**/
@ApiModelProperty(value = "The item variation's UPC, if any. Searchable in the Connect API. This field is only exposed in the Connect API. It is not exposed in Square's Dashboard, Square Point of Sale app or Retail Point of Sale app.")
public String getUpc() {
return upc;
}
public void setUpc(String upc) {
this.upc = upc;
}
public CatalogItemVariation ordinal(Integer ordinal) {
this.ordinal = ordinal;
return this;
}
/**
* The order in which this item variation should be displayed. This value is read-only. On writes, the ordinal for each item variation within a parent `CatalogItem` is set according to the item variations's position. On reads, the value is not guaranteed to be sequential or unique.
* @return ordinal
**/
@ApiModelProperty(value = "The order in which this item variation should be displayed. This value is read-only. On writes, the ordinal for each item variation within a parent `CatalogItem` is set according to the item variations's position. On reads, the value is not guaranteed to be sequential or unique.")
public Integer getOrdinal() {
return ordinal;
}
public void setOrdinal(Integer ordinal) {
this.ordinal = ordinal;
}
public CatalogItemVariation pricingType(String pricingType) {
this.pricingType = pricingType;
return this;
}
/**
* Indicates whether the item variation's price is fixed or determined at the time of sale. See [CatalogPricingType](#type-catalogpricingtype) for possible values
* @return pricingType
**/
@ApiModelProperty(value = "Indicates whether the item variation's price is fixed or determined at the time of sale. See [CatalogPricingType](#type-catalogpricingtype) for possible values")
public String getPricingType() {
return pricingType;
}
public void setPricingType(String pricingType) {
this.pricingType = pricingType;
}
public CatalogItemVariation priceMoney(Money priceMoney) {
this.priceMoney = priceMoney;
return this;
}
/**
* The item variation's price, if fixed pricing is used.
* @return priceMoney
**/
@ApiModelProperty(value = "The item variation's price, if fixed pricing is used.")
public Money getPriceMoney() {
return priceMoney;
}
public void setPriceMoney(Money priceMoney) {
this.priceMoney = priceMoney;
}
public CatalogItemVariation locationOverrides(List<ItemVariationLocationOverrides> locationOverrides) {
this.locationOverrides = locationOverrides;
return this;
}
public CatalogItemVariation addLocationOverridesItem(ItemVariationLocationOverrides locationOverridesItem) {
this.locationOverrides.add(locationOverridesItem);
return this;
}
/**
* Per-location price and inventory overrides.
* @return locationOverrides
**/
@ApiModelProperty(value = "Per-location price and inventory overrides.")
public List<ItemVariationLocationOverrides> getLocationOverrides() {
return locationOverrides;
}
public void setLocationOverrides(List<ItemVariationLocationOverrides> locationOverrides) {
this.locationOverrides = locationOverrides;
}
public CatalogItemVariation trackInventory(Boolean trackInventory) {
this.trackInventory = trackInventory;
return this;
}
/**
* If `true`, inventory tracking is active for the variation.
* @return trackInventory
**/
@ApiModelProperty(value = "If `true`, inventory tracking is active for the variation.")
public Boolean getTrackInventory() {
return trackInventory;
}
public void setTrackInventory(Boolean trackInventory) {
this.trackInventory = trackInventory;
}
public CatalogItemVariation inventoryAlertType(String inventoryAlertType) {
this.inventoryAlertType = inventoryAlertType;
return this;
}
/**
* Indicates whether the item variation displays an alert when its inventory quantity is less than or equal to its `inventory_alert_threshold`. See [InventoryAlertType](#type-inventoryalerttype) for possible values
* @return inventoryAlertType
**/
@ApiModelProperty(value = "Indicates whether the item variation displays an alert when its inventory quantity is less than or equal to its `inventory_alert_threshold`. See [InventoryAlertType](#type-inventoryalerttype) for possible values")
public String getInventoryAlertType() {
return inventoryAlertType;
}
public void setInventoryAlertType(String inventoryAlertType) {
this.inventoryAlertType = inventoryAlertType;
}
public CatalogItemVariation inventoryAlertThreshold(Long inventoryAlertThreshold) {
this.inventoryAlertThreshold = inventoryAlertThreshold;
return this;
}
/**
* If the inventory quantity for the variation is less than or equal to this value and `inventory_alert_type` is `LOW_QUANTITY`, the variation displays an alert in the merchant dashboard. This value is always an integer.
* @return inventoryAlertThreshold
**/
@ApiModelProperty(value = "If the inventory quantity for the variation is less than or equal to this value and `inventory_alert_type` is `LOW_QUANTITY`, the variation displays an alert in the merchant dashboard. This value is always an integer.")
public Long getInventoryAlertThreshold() {
return inventoryAlertThreshold;
}
public void setInventoryAlertThreshold(Long inventoryAlertThreshold) {
this.inventoryAlertThreshold = inventoryAlertThreshold;
}
public CatalogItemVariation userData(String userData) {
this.userData = userData;
return this;
}
/**
* Arbitrary user metadata to associate with the item variation. Searchable. This field has max length of 255 Unicode code points.
* @return userData
**/
@ApiModelProperty(value = "Arbitrary user metadata to associate with the item variation. Searchable. This field has max length of 255 Unicode code points.")
public String getUserData() {
return userData;
}
public void setUserData(String userData) {
this.userData = userData;
}
public CatalogItemVariation serviceDuration(Long serviceDuration) {
this.serviceDuration = serviceDuration;
return this;
}
/**
* If the `CatalogItem` that owns this item variation is of type `APPOINTMENTS_SERVICE`, then this is the duration of the service in milliseconds. For example, a 30 minute appointment would have the value `1800000`, which is equal to 30 (minutes) * 60 (seconds per minute) * 1000 (milliseconds per second).
* @return serviceDuration
**/
@ApiModelProperty(value = "If the `CatalogItem` that owns this item variation is of type `APPOINTMENTS_SERVICE`, then this is the duration of the service in milliseconds. For example, a 30 minute appointment would have the value `1800000`, which is equal to 30 (minutes) * 60 (seconds per minute) * 1000 (milliseconds per second).")
public Long getServiceDuration() {
return serviceDuration;
}
public void setServiceDuration(Long serviceDuration) {
this.serviceDuration = serviceDuration;
}
public CatalogItemVariation itemOptionValues(List<CatalogItemOptionValueForItemVariation> itemOptionValues) {
this.itemOptionValues = itemOptionValues;
return this;
}
public CatalogItemVariation addItemOptionValuesItem(CatalogItemOptionValueForItemVariation itemOptionValuesItem) {
this.itemOptionValues.add(itemOptionValuesItem);
return this;
}
/**
* List of item option values associated with this item variation. Listed in the same order as the item options of the parent item.
* Note: This model is in beta.
* @return itemOptionValues
**/
@ApiModelProperty(value = "List of item option values associated with this item variation. Listed in the same order as the item options of the parent item.")
public List<CatalogItemOptionValueForItemVariation> getItemOptionValues() {
return itemOptionValues;
}
public void setItemOptionValues(List<CatalogItemOptionValueForItemVariation> itemOptionValues) {
this.itemOptionValues = itemOptionValues;
}
public CatalogItemVariation measurementUnitId(String measurementUnitId) {
this.measurementUnitId = measurementUnitId;
return this;
}
/**
* ID of the ‘CatalogMeasurementUnit’ that is used to measure the quantity sold of this item variation. If left unset, the item will be sold in whole quantities.
* Note: This model is in beta.
* @return measurementUnitId
**/
@ApiModelProperty(value = "ID of the ‘CatalogMeasurementUnit’ that is used to measure the quantity sold of this item variation. If left unset, the item will be sold in whole quantities.")
public String getMeasurementUnitId() {
return measurementUnitId;
}
public void setMeasurementUnitId(String measurementUnitId) {
this.measurementUnitId = measurementUnitId;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CatalogItemVariation catalogItemVariation = (CatalogItemVariation) o;
return Objects.equals(this.itemId, catalogItemVariation.itemId) &&
Objects.equals(this.name, catalogItemVariation.name) &&
Objects.equals(this.sku, catalogItemVariation.sku) &&
Objects.equals(this.upc, catalogItemVariation.upc) &&
Objects.equals(this.ordinal, catalogItemVariation.ordinal) &&
Objects.equals(this.pricingType, catalogItemVariation.pricingType) &&
Objects.equals(this.priceMoney, catalogItemVariation.priceMoney) &&
Objects.equals(this.locationOverrides, catalogItemVariation.locationOverrides) &&
Objects.equals(this.trackInventory, catalogItemVariation.trackInventory) &&
Objects.equals(this.inventoryAlertType, catalogItemVariation.inventoryAlertType) &&
Objects.equals(this.inventoryAlertThreshold, catalogItemVariation.inventoryAlertThreshold) &&
Objects.equals(this.userData, catalogItemVariation.userData) &&
Objects.equals(this.serviceDuration, catalogItemVariation.serviceDuration) &&
Objects.equals(this.itemOptionValues, catalogItemVariation.itemOptionValues) &&
Objects.equals(this.measurementUnitId, catalogItemVariation.measurementUnitId);
}
@Override
public int hashCode() {
return Objects.hash(itemId, name, sku, upc, ordinal, pricingType, priceMoney, locationOverrides, trackInventory, inventoryAlertType, inventoryAlertThreshold, userData, serviceDuration, itemOptionValues, measurementUnitId);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CatalogItemVariation {\n");
sb.append(" itemId: ").append(toIndentedString(itemId)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" sku: ").append(toIndentedString(sku)).append("\n");
sb.append(" upc: ").append(toIndentedString(upc)).append("\n");
sb.append(" ordinal: ").append(toIndentedString(ordinal)).append("\n");
sb.append(" pricingType: ").append(toIndentedString(pricingType)).append("\n");
sb.append(" priceMoney: ").append(toIndentedString(priceMoney)).append("\n");
sb.append(" locationOverrides: ").append(toIndentedString(locationOverrides)).append("\n");
sb.append(" trackInventory: ").append(toIndentedString(trackInventory)).append("\n");
sb.append(" inventoryAlertType: ").append(toIndentedString(inventoryAlertType)).append("\n");
sb.append(" inventoryAlertThreshold: ").append(toIndentedString(inventoryAlertThreshold)).append("\n");
sb.append(" userData: ").append(toIndentedString(userData)).append("\n");
sb.append(" serviceDuration: ").append(toIndentedString(serviceDuration)).append("\n");
sb.append(" itemOptionValues: ").append(toIndentedString(itemOptionValues)).append("\n");
sb.append(" measurementUnitId: ").append(toIndentedString(measurementUnitId)).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 ");
}
}
| 5,125 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/V1RetrieveSettlementRequest.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import io.swagger.annotations.ApiModel;
/**
*
*/
@ApiModel(description = "")
public class V1RetrieveSettlementRequest {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return true;
}
@Override
public int hashCode() {
return Objects.hash();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class V1RetrieveSettlementRequest {\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 ");
}
}
| 5,126 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/CreateCheckoutRequest.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.squareup.connect.models.Address;
import com.squareup.connect.models.ChargeRequestAdditionalRecipient;
import com.squareup.connect.models.CreateOrderRequest;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
* Defines the parameters that can be included in the body of a request to the [CreateCheckout](#endpoint-createcheckout) endpoint.
*/
@ApiModel(description = "Defines the parameters that can be included in the body of a request to the [CreateCheckout](#endpoint-createcheckout) endpoint.")
public class CreateCheckoutRequest {
@JsonProperty("idempotency_key")
private String idempotencyKey = null;
@JsonProperty("order")
private CreateOrderRequest order = null;
@JsonProperty("ask_for_shipping_address")
private Boolean askForShippingAddress = null;
@JsonProperty("merchant_support_email")
private String merchantSupportEmail = null;
@JsonProperty("pre_populate_buyer_email")
private String prePopulateBuyerEmail = null;
@JsonProperty("pre_populate_shipping_address")
private Address prePopulateShippingAddress = null;
@JsonProperty("redirect_url")
private String redirectUrl = null;
@JsonProperty("additional_recipients")
private List<ChargeRequestAdditionalRecipient> additionalRecipients = new ArrayList<ChargeRequestAdditionalRecipient>();
@JsonProperty("note")
private String note = null;
public CreateCheckoutRequest idempotencyKey(String idempotencyKey) {
this.idempotencyKey = idempotencyKey;
return this;
}
/**
* A unique string that identifies this checkout among others you've created. It can be any valid string but must be unique for every order sent to Square Checkout for a given location ID. The idempotency key is used to avoid processing the same order more than once. If you're unsure whether a particular checkout was created successfully, you can reattempt it with the same idempotency key and all the same other parameters without worrying about creating duplicates. We recommend using a random number/string generator native to the language you are working in to generate strings for your idempotency keys. See [Idempotency keys](#idempotencykeys) for more information.
* @return idempotencyKey
**/
@ApiModelProperty(required = true, value = "A unique string that identifies this checkout among others you've created. It can be any valid string but must be unique for every order sent to Square Checkout for a given location ID. The idempotency key is used to avoid processing the same order more than once. If you're unsure whether a particular checkout was created successfully, you can reattempt it with the same idempotency key and all the same other parameters without worrying about creating duplicates. We recommend using a random number/string generator native to the language you are working in to generate strings for your idempotency keys. See [Idempotency keys](#idempotencykeys) for more information.")
public String getIdempotencyKey() {
return idempotencyKey;
}
public void setIdempotencyKey(String idempotencyKey) {
this.idempotencyKey = idempotencyKey;
}
public CreateCheckoutRequest order(CreateOrderRequest order) {
this.order = order;
return this;
}
/**
* The order including line items to be checked out.
* @return order
**/
@ApiModelProperty(required = true, value = "The order including line items to be checked out.")
public CreateOrderRequest getOrder() {
return order;
}
public void setOrder(CreateOrderRequest order) {
this.order = order;
}
public CreateCheckoutRequest askForShippingAddress(Boolean askForShippingAddress) {
this.askForShippingAddress = askForShippingAddress;
return this;
}
/**
* If `true`, Square Checkout will collect shipping information on your behalf and store that information with the transaction information in your Square Dashboard. Default: `false`.
* @return askForShippingAddress
**/
@ApiModelProperty(value = "If `true`, Square Checkout will collect shipping information on your behalf and store that information with the transaction information in your Square Dashboard. Default: `false`.")
public Boolean getAskForShippingAddress() {
return askForShippingAddress;
}
public void setAskForShippingAddress(Boolean askForShippingAddress) {
this.askForShippingAddress = askForShippingAddress;
}
public CreateCheckoutRequest merchantSupportEmail(String merchantSupportEmail) {
this.merchantSupportEmail = merchantSupportEmail;
return this;
}
/**
* The email address to display on the Square Checkout confirmation page and confirmation email that the buyer can use to contact the merchant. If this value is not set, the confirmation page and email will display the primary email address associated with the merchant's Square account. Default: none; only exists if explicitly set.
* @return merchantSupportEmail
**/
@ApiModelProperty(value = "The email address to display on the Square Checkout confirmation page and confirmation email that the buyer can use to contact the merchant. If this value is not set, the confirmation page and email will display the primary email address associated with the merchant's Square account. Default: none; only exists if explicitly set.")
public String getMerchantSupportEmail() {
return merchantSupportEmail;
}
public void setMerchantSupportEmail(String merchantSupportEmail) {
this.merchantSupportEmail = merchantSupportEmail;
}
public CreateCheckoutRequest prePopulateBuyerEmail(String prePopulateBuyerEmail) {
this.prePopulateBuyerEmail = prePopulateBuyerEmail;
return this;
}
/**
* If provided, the buyer's email is pre-populated on the checkout page as an editable text field. Default: none; only exists if explicitly set.
* @return prePopulateBuyerEmail
**/
@ApiModelProperty(value = "If provided, the buyer's email is pre-populated on the checkout page as an editable text field. Default: none; only exists if explicitly set.")
public String getPrePopulateBuyerEmail() {
return prePopulateBuyerEmail;
}
public void setPrePopulateBuyerEmail(String prePopulateBuyerEmail) {
this.prePopulateBuyerEmail = prePopulateBuyerEmail;
}
public CreateCheckoutRequest prePopulateShippingAddress(Address prePopulateShippingAddress) {
this.prePopulateShippingAddress = prePopulateShippingAddress;
return this;
}
/**
* If provided, the buyer's shipping info is pre-populated on the checkout page as editable text fields. Default: none; only exists if explicitly set.
* @return prePopulateShippingAddress
**/
@ApiModelProperty(value = "If provided, the buyer's shipping info is pre-populated on the checkout page as editable text fields. Default: none; only exists if explicitly set.")
public Address getPrePopulateShippingAddress() {
return prePopulateShippingAddress;
}
public void setPrePopulateShippingAddress(Address prePopulateShippingAddress) {
this.prePopulateShippingAddress = prePopulateShippingAddress;
}
public CreateCheckoutRequest redirectUrl(String redirectUrl) {
this.redirectUrl = redirectUrl;
return this;
}
/**
* The URL to redirect to after checkout is completed with `checkoutId`, Square's `orderId`, `transactionId`, and `referenceId` appended as URL parameters. For example, if the provided redirect_url is `http://www.example.com/order-complete`, a successful transaction redirects the customer to: `http://www.example.com/order-complete?checkoutId=xxxxxx&orderId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx` If you do not provide a redirect URL, Square Checkout will display an order confirmation page on your behalf; however Square strongly recommends that you provide a redirect URL so you can verify the transaction results and finalize the order through your existing/normal confirmation workflow. Default: none; only exists if explicitly set.
* @return redirectUrl
**/
@ApiModelProperty(value = "The URL to redirect to after checkout is completed with `checkoutId`, Square's `orderId`, `transactionId`, and `referenceId` appended as URL parameters. For example, if the provided redirect_url is `http://www.example.com/order-complete`, a successful transaction redirects the customer to: `http://www.example.com/order-complete?checkoutId=xxxxxx&orderId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx` If you do not provide a redirect URL, Square Checkout will display an order confirmation page on your behalf; however Square strongly recommends that you provide a redirect URL so you can verify the transaction results and finalize the order through your existing/normal confirmation workflow. Default: none; only exists if explicitly set.")
public String getRedirectUrl() {
return redirectUrl;
}
public void setRedirectUrl(String redirectUrl) {
this.redirectUrl = redirectUrl;
}
public CreateCheckoutRequest additionalRecipients(List<ChargeRequestAdditionalRecipient> additionalRecipients) {
this.additionalRecipients = additionalRecipients;
return this;
}
public CreateCheckoutRequest addAdditionalRecipientsItem(ChargeRequestAdditionalRecipient additionalRecipientsItem) {
this.additionalRecipients.add(additionalRecipientsItem);
return this;
}
/**
* The basic primitive of multi-party transaction. The value is optional. The transaction facilitated by you can be split from here. If you provide this value, the `amount_money` value in your additional_recipients must not be more than 90% of the `total_money` calculated by Square for your order. The `location_id` must be the valid location of the app owner merchant. This field requires `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission. This field is currently not supported in sandbox.
* @return additionalRecipients
**/
@ApiModelProperty(value = "The basic primitive of multi-party transaction. The value is optional. The transaction facilitated by you can be split from here. If you provide this value, the `amount_money` value in your additional_recipients must not be more than 90% of the `total_money` calculated by Square for your order. The `location_id` must be the valid location of the app owner merchant. This field requires `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission. This field is currently not supported in sandbox.")
public List<ChargeRequestAdditionalRecipient> getAdditionalRecipients() {
return additionalRecipients;
}
public void setAdditionalRecipients(List<ChargeRequestAdditionalRecipient> additionalRecipients) {
this.additionalRecipients = additionalRecipients;
}
public CreateCheckoutRequest note(String note) {
this.note = note;
return this;
}
/**
* An optional note to associate with the checkout object. This value cannot exceed 60 characters.
* @return note
**/
@ApiModelProperty(value = "An optional note to associate with the checkout object. This value cannot exceed 60 characters.")
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CreateCheckoutRequest createCheckoutRequest = (CreateCheckoutRequest) o;
return Objects.equals(this.idempotencyKey, createCheckoutRequest.idempotencyKey) &&
Objects.equals(this.order, createCheckoutRequest.order) &&
Objects.equals(this.askForShippingAddress, createCheckoutRequest.askForShippingAddress) &&
Objects.equals(this.merchantSupportEmail, createCheckoutRequest.merchantSupportEmail) &&
Objects.equals(this.prePopulateBuyerEmail, createCheckoutRequest.prePopulateBuyerEmail) &&
Objects.equals(this.prePopulateShippingAddress, createCheckoutRequest.prePopulateShippingAddress) &&
Objects.equals(this.redirectUrl, createCheckoutRequest.redirectUrl) &&
Objects.equals(this.additionalRecipients, createCheckoutRequest.additionalRecipients) &&
Objects.equals(this.note, createCheckoutRequest.note);
}
@Override
public int hashCode() {
return Objects.hash(idempotencyKey, order, askForShippingAddress, merchantSupportEmail, prePopulateBuyerEmail, prePopulateShippingAddress, redirectUrl, additionalRecipients, note);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CreateCheckoutRequest {\n");
sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n");
sb.append(" order: ").append(toIndentedString(order)).append("\n");
sb.append(" askForShippingAddress: ").append(toIndentedString(askForShippingAddress)).append("\n");
sb.append(" merchantSupportEmail: ").append(toIndentedString(merchantSupportEmail)).append("\n");
sb.append(" prePopulateBuyerEmail: ").append(toIndentedString(prePopulateBuyerEmail)).append("\n");
sb.append(" prePopulateShippingAddress: ").append(toIndentedString(prePopulateShippingAddress)).append("\n");
sb.append(" redirectUrl: ").append(toIndentedString(redirectUrl)).append("\n");
sb.append(" additionalRecipients: ").append(toIndentedString(additionalRecipients)).append("\n");
sb.append(" note: ").append(toIndentedString(note)).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 ");
}
}
| 5,127 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/Employee.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
* An employee object that is used by the external API.
*/
@ApiModel(description = "An employee object that is used by the external API.")
public class Employee {
@JsonProperty("id")
private String id = null;
@JsonProperty("first_name")
private String firstName = null;
@JsonProperty("last_name")
private String lastName = null;
@JsonProperty("email")
private String email = null;
@JsonProperty("phone_number")
private String phoneNumber = null;
@JsonProperty("location_ids")
private List<String> locationIds = new ArrayList<String>();
@JsonProperty("status")
private String status = null;
@JsonProperty("created_at")
private String createdAt = null;
@JsonProperty("updated_at")
private String updatedAt = null;
public Employee id(String id) {
this.id = id;
return this;
}
/**
* UUID for this object.
* @return id
**/
@ApiModelProperty(value = "UUID for this object.")
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Employee firstName(String firstName) {
this.firstName = firstName;
return this;
}
/**
* The employee's first name.
* @return firstName
**/
@ApiModelProperty(value = "The employee's first name.")
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public Employee lastName(String lastName) {
this.lastName = lastName;
return this;
}
/**
* The employee's last name.
* @return lastName
**/
@ApiModelProperty(value = "The employee's last name.")
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public Employee email(String email) {
this.email = email;
return this;
}
/**
* The employee's email address
* @return email
**/
@ApiModelProperty(value = "The employee's email address")
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Employee phoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
return this;
}
/**
* The employee's phone number in E.164 format, i.e. \"+12125554250\"
* @return phoneNumber
**/
@ApiModelProperty(value = "The employee's phone number in E.164 format, i.e. \"+12125554250\"")
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public Employee locationIds(List<String> locationIds) {
this.locationIds = locationIds;
return this;
}
public Employee addLocationIdsItem(String locationIdsItem) {
this.locationIds.add(locationIdsItem);
return this;
}
/**
* A list of location IDs where this employee has access to.
* @return locationIds
**/
@ApiModelProperty(value = "A list of location IDs where this employee has access to.")
public List<String> getLocationIds() {
return locationIds;
}
public void setLocationIds(List<String> locationIds) {
this.locationIds = locationIds;
}
public Employee status(String status) {
this.status = status;
return this;
}
/**
* Specifies the status of the employees being fetched. See [EmployeeStatus](#type-employeestatus) for possible values
* @return status
**/
@ApiModelProperty(value = "Specifies the status of the employees being fetched. See [EmployeeStatus](#type-employeestatus) for possible values")
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Employee createdAt(String createdAt) {
this.createdAt = createdAt;
return this;
}
/**
* A read-only timestamp in RFC 3339 format.
* @return createdAt
**/
@ApiModelProperty(value = "A read-only timestamp in RFC 3339 format.")
public String getCreatedAt() {
return createdAt;
}
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
public Employee updatedAt(String updatedAt) {
this.updatedAt = updatedAt;
return this;
}
/**
* A read-only timestamp in RFC 3339 format.
* @return updatedAt
**/
@ApiModelProperty(value = "A read-only timestamp in RFC 3339 format.")
public String getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Employee employee = (Employee) o;
return Objects.equals(this.id, employee.id) &&
Objects.equals(this.firstName, employee.firstName) &&
Objects.equals(this.lastName, employee.lastName) &&
Objects.equals(this.email, employee.email) &&
Objects.equals(this.phoneNumber, employee.phoneNumber) &&
Objects.equals(this.locationIds, employee.locationIds) &&
Objects.equals(this.status, employee.status) &&
Objects.equals(this.createdAt, employee.createdAt) &&
Objects.equals(this.updatedAt, employee.updatedAt);
}
@Override
public int hashCode() {
return Objects.hash(id, firstName, lastName, email, phoneNumber, locationIds, status, createdAt, updatedAt);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Employee {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n");
sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n");
sb.append(" email: ").append(toIndentedString(email)).append("\n");
sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n");
sb.append(" locationIds: ").append(toIndentedString(locationIds)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n");
sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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 ");
}
}
| 5,128 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/BatchRetrieveCatalogObjectsRequest.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
*
*/
@ApiModel(description = "")
public class BatchRetrieveCatalogObjectsRequest {
@JsonProperty("object_ids")
private List<String> objectIds = new ArrayList<String>();
@JsonProperty("include_related_objects")
private Boolean includeRelatedObjects = null;
public BatchRetrieveCatalogObjectsRequest objectIds(List<String> objectIds) {
this.objectIds = objectIds;
return this;
}
public BatchRetrieveCatalogObjectsRequest addObjectIdsItem(String objectIdsItem) {
this.objectIds.add(objectIdsItem);
return this;
}
/**
* The IDs of the CatalogObjects to be retrieved.
* @return objectIds
**/
@ApiModelProperty(required = true, value = "The IDs of the CatalogObjects to be retrieved.")
public List<String> getObjectIds() {
return objectIds;
}
public void setObjectIds(List<String> objectIds) {
this.objectIds = objectIds;
}
public BatchRetrieveCatalogObjectsRequest includeRelatedObjects(Boolean includeRelatedObjects) {
this.includeRelatedObjects = includeRelatedObjects;
return this;
}
/**
* If `true`, the response will include additional objects that are related to the requested objects, as follows: If the `objects` field of the response contains a CatalogItem, its associated CatalogCategory objects, CatalogTax objects, CatalogImage objects and CatalogModifierLists will be returned in the `related_objects` field of the response. If the `objects` field of the response contains a CatalogItemVariation, its parent CatalogItem will be returned in the `related_objects` field of the response.
* @return includeRelatedObjects
**/
@ApiModelProperty(value = "If `true`, the response will include additional objects that are related to the requested objects, as follows: If the `objects` field of the response contains a CatalogItem, its associated CatalogCategory objects, CatalogTax objects, CatalogImage objects and CatalogModifierLists will be returned in the `related_objects` field of the response. If the `objects` field of the response contains a CatalogItemVariation, its parent CatalogItem will be returned in the `related_objects` field of the response.")
public Boolean getIncludeRelatedObjects() {
return includeRelatedObjects;
}
public void setIncludeRelatedObjects(Boolean includeRelatedObjects) {
this.includeRelatedObjects = includeRelatedObjects;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
BatchRetrieveCatalogObjectsRequest batchRetrieveCatalogObjectsRequest = (BatchRetrieveCatalogObjectsRequest) o;
return Objects.equals(this.objectIds, batchRetrieveCatalogObjectsRequest.objectIds) &&
Objects.equals(this.includeRelatedObjects, batchRetrieveCatalogObjectsRequest.includeRelatedObjects);
}
@Override
public int hashCode() {
return Objects.hash(objectIds, includeRelatedObjects);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class BatchRetrieveCatalogObjectsRequest {\n");
sb.append(" objectIds: ").append(toIndentedString(objectIds)).append("\n");
sb.append(" includeRelatedObjects: ").append(toIndentedString(includeRelatedObjects)).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 ");
}
}
| 5,129 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/CreateOrderRequest.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.squareup.connect.models.CreateOrderRequestDiscount;
import com.squareup.connect.models.CreateOrderRequestLineItem;
import com.squareup.connect.models.CreateOrderRequestTax;
import com.squareup.connect.models.Order;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
*
*/
@ApiModel(description = "")
public class CreateOrderRequest {
@JsonProperty("order")
private Order order = null;
@JsonProperty("idempotency_key")
private String idempotencyKey = null;
@JsonProperty("reference_id")
private String referenceId = null;
@JsonProperty("line_items")
private List<CreateOrderRequestLineItem> lineItems = new ArrayList<CreateOrderRequestLineItem>();
@JsonProperty("taxes")
private List<CreateOrderRequestTax> taxes = new ArrayList<CreateOrderRequestTax>();
@JsonProperty("discounts")
private List<CreateOrderRequestDiscount> discounts = new ArrayList<CreateOrderRequestDiscount>();
public CreateOrderRequest order(Order order) {
this.order = order;
return this;
}
/**
* The order to create. If this field is set, then the only other top-level field that can be set is the idempotency_key.
* @return order
**/
@ApiModelProperty(value = "The order to create. If this field is set, then the only other top-level field that can be set is the idempotency_key.")
public Order getOrder() {
return order;
}
public void setOrder(Order order) {
this.order = order;
}
public CreateOrderRequest idempotencyKey(String idempotencyKey) {
this.idempotencyKey = idempotencyKey;
return this;
}
/**
* A value you specify that uniquely identifies this order among orders you've created. If you're unsure whether a particular order was created successfully, you can reattempt it with the same idempotency key without worrying about creating duplicate orders. See [Idempotency](https://developer.squareup.com/docs/basics/api101/idempotency) for more information.
* @return idempotencyKey
**/
@ApiModelProperty(value = "A value you specify that uniquely identifies this order among orders you've created. If you're unsure whether a particular order was created successfully, you can reattempt it with the same idempotency key without worrying about creating duplicate orders. See [Idempotency](https://developer.squareup.com/docs/basics/api101/idempotency) for more information.")
public String getIdempotencyKey() {
return idempotencyKey;
}
public void setIdempotencyKey(String idempotencyKey) {
this.idempotencyKey = idempotencyKey;
}
public CreateOrderRequest referenceId(String referenceId) {
this.referenceId = referenceId;
return this;
}
/**
* __Deprecated__: Please set the reference_id on the nested `order` field instead. An optional ID you can associate with the order for your own purposes (such as to associate the order with an entity ID in your own database). This value cannot exceed 40 characters.
* @return referenceId
**/
@ApiModelProperty(value = "__Deprecated__: Please set the reference_id on the nested `order` field instead. An optional ID you can associate with the order for your own purposes (such as to associate the order with an entity ID in your own database). This value cannot exceed 40 characters.")
@Deprecated
public String getReferenceId() {
return referenceId;
}
public void setReferenceId(String referenceId) {
this.referenceId = referenceId;
}
public CreateOrderRequest lineItems(List<CreateOrderRequestLineItem> lineItems) {
this.lineItems = lineItems;
return this;
}
public CreateOrderRequest addLineItemsItem(CreateOrderRequestLineItem lineItemsItem) {
this.lineItems.add(lineItemsItem);
return this;
}
/**
* __Deprecated__: Please set the line_items on the nested `order` field instead. The line items to associate with this order. Each line item represents a different product to include in a purchase.
* @return lineItems
**/
@ApiModelProperty(value = "__Deprecated__: Please set the line_items on the nested `order` field instead. The line items to associate with this order. Each line item represents a different product to include in a purchase.")
@Deprecated
public List<CreateOrderRequestLineItem> getLineItems() {
return lineItems;
}
public void setLineItems(List<CreateOrderRequestLineItem> lineItems) {
this.lineItems = lineItems;
}
public CreateOrderRequest taxes(List<CreateOrderRequestTax> taxes) {
this.taxes = taxes;
return this;
}
public CreateOrderRequest addTaxesItem(CreateOrderRequestTax taxesItem) {
this.taxes.add(taxesItem);
return this;
}
/**
* __Deprecated__: Please set the taxes on the nested `order` field instead. The taxes to include on the order.
* @return taxes
**/
@ApiModelProperty(value = "__Deprecated__: Please set the taxes on the nested `order` field instead. The taxes to include on the order.")
@Deprecated
public List<CreateOrderRequestTax> getTaxes() {
return taxes;
}
public void setTaxes(List<CreateOrderRequestTax> taxes) {
this.taxes = taxes;
}
public CreateOrderRequest discounts(List<CreateOrderRequestDiscount> discounts) {
this.discounts = discounts;
return this;
}
public CreateOrderRequest addDiscountsItem(CreateOrderRequestDiscount discountsItem) {
this.discounts.add(discountsItem);
return this;
}
/**
* __Deprecated__: Please set the discounts on the nested `order` field instead. The discounts to include on the order.
* @return discounts
**/
@ApiModelProperty(value = "__Deprecated__: Please set the discounts on the nested `order` field instead. The discounts to include on the order.")
@Deprecated
public List<CreateOrderRequestDiscount> getDiscounts() {
return discounts;
}
public void setDiscounts(List<CreateOrderRequestDiscount> discounts) {
this.discounts = discounts;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CreateOrderRequest createOrderRequest = (CreateOrderRequest) o;
return Objects.equals(this.order, createOrderRequest.order) &&
Objects.equals(this.idempotencyKey, createOrderRequest.idempotencyKey) &&
Objects.equals(this.referenceId, createOrderRequest.referenceId) &&
Objects.equals(this.lineItems, createOrderRequest.lineItems) &&
Objects.equals(this.taxes, createOrderRequest.taxes) &&
Objects.equals(this.discounts, createOrderRequest.discounts);
}
@Override
public int hashCode() {
return Objects.hash(order, idempotencyKey, referenceId, lineItems, taxes, discounts);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CreateOrderRequest {\n");
sb.append(" order: ").append(toIndentedString(order)).append("\n");
sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n");
sb.append(" referenceId: ").append(toIndentedString(referenceId)).append("\n");
sb.append(" lineItems: ").append(toIndentedString(lineItems)).append("\n");
sb.append(" taxes: ").append(toIndentedString(taxes)).append("\n");
sb.append(" discounts: ").append(toIndentedString(discounts)).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 ");
}
}
| 5,130 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/Transaction.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.squareup.connect.models.Address;
import com.squareup.connect.models.Refund;
import com.squareup.connect.models.Tender;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
* Represents a transaction processed with Square, either with the Connect API or with Square Point of Sale. The `tenders` field of this object lists all methods of payment used to pay in the transaction.
*/
@ApiModel(description = "Represents a transaction processed with Square, either with the Connect API or with Square Point of Sale. The `tenders` field of this object lists all methods of payment used to pay in the transaction.")
public class Transaction {
@JsonProperty("id")
private String id = null;
@JsonProperty("location_id")
private String locationId = null;
@JsonProperty("created_at")
private String createdAt = null;
@JsonProperty("tenders")
private List<Tender> tenders = new ArrayList<Tender>();
@JsonProperty("refunds")
private List<Refund> refunds = new ArrayList<Refund>();
@JsonProperty("reference_id")
private String referenceId = null;
@JsonProperty("product")
private String product = null;
@JsonProperty("client_id")
private String clientId = null;
@JsonProperty("shipping_address")
private Address shippingAddress = null;
@JsonProperty("order_id")
private String orderId = null;
public Transaction id(String id) {
this.id = id;
return this;
}
/**
* The transaction's unique ID, issued by Square payments servers.
* @return id
**/
@ApiModelProperty(value = "The transaction's unique ID, issued by Square payments servers.")
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Transaction locationId(String locationId) {
this.locationId = locationId;
return this;
}
/**
* The ID of the transaction's associated location.
* @return locationId
**/
@ApiModelProperty(value = "The ID of the transaction's associated location.")
public String getLocationId() {
return locationId;
}
public void setLocationId(String locationId) {
this.locationId = locationId;
}
public Transaction createdAt(String createdAt) {
this.createdAt = createdAt;
return this;
}
/**
* The time when the transaction was created, in RFC 3339 format.
* @return createdAt
**/
@ApiModelProperty(value = "The time when the transaction was created, in RFC 3339 format.")
public String getCreatedAt() {
return createdAt;
}
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
public Transaction tenders(List<Tender> tenders) {
this.tenders = tenders;
return this;
}
public Transaction addTendersItem(Tender tendersItem) {
this.tenders.add(tendersItem);
return this;
}
/**
* The tenders used to pay in the transaction.
* @return tenders
**/
@ApiModelProperty(value = "The tenders used to pay in the transaction.")
public List<Tender> getTenders() {
return tenders;
}
public void setTenders(List<Tender> tenders) {
this.tenders = tenders;
}
public Transaction refunds(List<Refund> refunds) {
this.refunds = refunds;
return this;
}
public Transaction addRefundsItem(Refund refundsItem) {
this.refunds.add(refundsItem);
return this;
}
/**
* Refunds that have been applied to any tender in the transaction.
* @return refunds
**/
@ApiModelProperty(value = "Refunds that have been applied to any tender in the transaction.")
public List<Refund> getRefunds() {
return refunds;
}
public void setRefunds(List<Refund> refunds) {
this.refunds = refunds;
}
public Transaction referenceId(String referenceId) {
this.referenceId = referenceId;
return this;
}
/**
* If the transaction was created with the `Charge` endpoint, this value is the same as the value provided for the `reference_id` parameter in the request to that endpoint. Otherwise, it is not set.
* @return referenceId
**/
@ApiModelProperty(value = "If the transaction was created with the `Charge` endpoint, this value is the same as the value provided for the `reference_id` parameter in the request to that endpoint. Otherwise, it is not set.")
public String getReferenceId() {
return referenceId;
}
public void setReferenceId(String referenceId) {
this.referenceId = referenceId;
}
public Transaction product(String product) {
this.product = product;
return this;
}
/**
* The Square product that processed the transaction. See [TransactionProduct](#type-transactionproduct) for possible values
* @return product
**/
@ApiModelProperty(value = "The Square product that processed the transaction. See [TransactionProduct](#type-transactionproduct) for possible values")
public String getProduct() {
return product;
}
public void setProduct(String product) {
this.product = product;
}
public Transaction clientId(String clientId) {
this.clientId = clientId;
return this;
}
/**
* If the transaction was created in the Square Point of Sale app, this value is the ID generated for the transaction by Square Point of Sale. This ID has no relationship to the transaction's canonical `id`, which is generated by Square's backend servers. This value is generated for bookkeeping purposes, in case the transaction cannot immediately be completed (for example, if the transaction is processed in offline mode). It is not currently possible with the Connect API to perform a transaction lookup by this value.
* @return clientId
**/
@ApiModelProperty(value = "If the transaction was created in the Square Point of Sale app, this value is the ID generated for the transaction by Square Point of Sale. This ID has no relationship to the transaction's canonical `id`, which is generated by Square's backend servers. This value is generated for bookkeeping purposes, in case the transaction cannot immediately be completed (for example, if the transaction is processed in offline mode). It is not currently possible with the Connect API to perform a transaction lookup by this value.")
public String getClientId() {
return clientId;
}
public void setClientId(String clientId) {
this.clientId = clientId;
}
public Transaction shippingAddress(Address shippingAddress) {
this.shippingAddress = shippingAddress;
return this;
}
/**
* The shipping address provided in the request, if any.
* @return shippingAddress
**/
@ApiModelProperty(value = "The shipping address provided in the request, if any.")
public Address getShippingAddress() {
return shippingAddress;
}
public void setShippingAddress(Address shippingAddress) {
this.shippingAddress = shippingAddress;
}
public Transaction orderId(String orderId) {
this.orderId = orderId;
return this;
}
/**
* The order_id is an identifier for the order associated with this transaction, if any.
* @return orderId
**/
@ApiModelProperty(value = "The order_id is an identifier for the order associated with this transaction, if any.")
public String getOrderId() {
return orderId;
}
public void setOrderId(String 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;
}
Transaction transaction = (Transaction) o;
return Objects.equals(this.id, transaction.id) &&
Objects.equals(this.locationId, transaction.locationId) &&
Objects.equals(this.createdAt, transaction.createdAt) &&
Objects.equals(this.tenders, transaction.tenders) &&
Objects.equals(this.refunds, transaction.refunds) &&
Objects.equals(this.referenceId, transaction.referenceId) &&
Objects.equals(this.product, transaction.product) &&
Objects.equals(this.clientId, transaction.clientId) &&
Objects.equals(this.shippingAddress, transaction.shippingAddress) &&
Objects.equals(this.orderId, transaction.orderId);
}
@Override
public int hashCode() {
return Objects.hash(id, locationId, createdAt, tenders, refunds, referenceId, product, clientId, shippingAddress, orderId);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Transaction {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" locationId: ").append(toIndentedString(locationId)).append("\n");
sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n");
sb.append(" tenders: ").append(toIndentedString(tenders)).append("\n");
sb.append(" refunds: ").append(toIndentedString(refunds)).append("\n");
sb.append(" referenceId: ").append(toIndentedString(referenceId)).append("\n");
sb.append(" product: ").append(toIndentedString(product)).append("\n");
sb.append(" clientId: ").append(toIndentedString(clientId)).append("\n");
sb.append(" shippingAddress: ").append(toIndentedString(shippingAddress)).append("\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 ");
}
}
| 5,131 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/InventoryPhysicalCount.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.squareup.connect.models.SourceApplication;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Represents the quantity of an item variation that is physically present at a specific location, verified by a seller or a seller's employee. For example, a physical count might come from an employee counting the item variations on hand or from syncing with an external system.
*/
@ApiModel(description = "Represents the quantity of an item variation that is physically present at a specific location, verified by a seller or a seller's employee. For example, a physical count might come from an employee counting the item variations on hand or from syncing with an external system.")
public class InventoryPhysicalCount {
@JsonProperty("id")
private String id = null;
@JsonProperty("reference_id")
private String referenceId = null;
@JsonProperty("catalog_object_id")
private String catalogObjectId = null;
@JsonProperty("catalog_object_type")
private String catalogObjectType = null;
@JsonProperty("state")
private String state = null;
@JsonProperty("location_id")
private String locationId = null;
@JsonProperty("quantity")
private String quantity = null;
@JsonProperty("source")
private SourceApplication source = null;
@JsonProperty("employee_id")
private String employeeId = null;
@JsonProperty("occurred_at")
private String occurredAt = null;
@JsonProperty("created_at")
private String createdAt = null;
public InventoryPhysicalCount id(String id) {
this.id = id;
return this;
}
/**
* A unique ID generated by Square for the `InventoryPhysicalCount`.
* @return id
**/
@ApiModelProperty(value = "A unique ID generated by Square for the `InventoryPhysicalCount`.")
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public InventoryPhysicalCount referenceId(String referenceId) {
this.referenceId = referenceId;
return this;
}
/**
* An optional ID provided by the application to tie the `InventoryPhysicalCount` to an external system.
* @return referenceId
**/
@ApiModelProperty(value = "An optional ID provided by the application to tie the `InventoryPhysicalCount` to an external system.")
public String getReferenceId() {
return referenceId;
}
public void setReferenceId(String referenceId) {
this.referenceId = referenceId;
}
public InventoryPhysicalCount catalogObjectId(String catalogObjectId) {
this.catalogObjectId = catalogObjectId;
return this;
}
/**
* The Square generated ID of the `CatalogObject` being tracked.
* @return catalogObjectId
**/
@ApiModelProperty(value = "The Square generated ID of the `CatalogObject` being tracked.")
public String getCatalogObjectId() {
return catalogObjectId;
}
public void setCatalogObjectId(String catalogObjectId) {
this.catalogObjectId = catalogObjectId;
}
public InventoryPhysicalCount catalogObjectType(String catalogObjectType) {
this.catalogObjectType = catalogObjectType;
return this;
}
/**
* The `CatalogObjectType` of the `CatalogObject` being tracked. Tracking is only supported for the `ITEM_VARIATION` type.
* @return catalogObjectType
**/
@ApiModelProperty(value = "The `CatalogObjectType` of the `CatalogObject` being tracked. Tracking is only supported for the `ITEM_VARIATION` type.")
public String getCatalogObjectType() {
return catalogObjectType;
}
public void setCatalogObjectType(String catalogObjectType) {
this.catalogObjectType = catalogObjectType;
}
public InventoryPhysicalCount state(String state) {
this.state = state;
return this;
}
/**
* The current `InventoryState` for the related quantity of items. See [InventoryState](#type-inventorystate) for possible values
* @return state
**/
@ApiModelProperty(value = "The current `InventoryState` for the related quantity of items. See [InventoryState](#type-inventorystate) for possible values")
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public InventoryPhysicalCount locationId(String locationId) {
this.locationId = locationId;
return this;
}
/**
* The Square ID of the `Location` where the related quantity of items are being tracked.
* @return locationId
**/
@ApiModelProperty(value = "The Square ID of the `Location` where the related quantity of items are being tracked.")
public String getLocationId() {
return locationId;
}
public void setLocationId(String locationId) {
this.locationId = locationId;
}
public InventoryPhysicalCount quantity(String quantity) {
this.quantity = quantity;
return this;
}
/**
* The number of items affected by the physical count as a decimal string. Can support up to 5 digits after the decimal point. _Important_: The Point of Sale app and Dashboard do not currently support decimal quantities. If a Point of Sale app or Dashboard attempts to read a decimal quantity on inventory counts or adjustments, the quantity will be rounded down to the nearest integer. For example, `2.5` will become `2`, and `-2.5` will become `-3`. Read [Decimal Quantities (BETA)](https://developer.squareup.com/docs/docs/inventory-api/what-it-does#decimal-quantities-beta) for more information.
* Note: This model is in beta.
* @return quantity
**/
@ApiModelProperty(value = "The number of items affected by the physical count as a decimal string. Can support up to 5 digits after the decimal point. _Important_: The Point of Sale app and Dashboard do not currently support decimal quantities. If a Point of Sale app or Dashboard attempts to read a decimal quantity on inventory counts or adjustments, the quantity will be rounded down to the nearest integer. For example, `2.5` will become `2`, and `-2.5` will become `-3`. Read [Decimal Quantities (BETA)](https://developer.squareup.com/docs/docs/inventory-api/what-it-does#decimal-quantities-beta) for more information.")
public String getQuantity() {
return quantity;
}
public void setQuantity(String quantity) {
this.quantity = quantity;
}
public InventoryPhysicalCount source(SourceApplication source) {
this.source = source;
return this;
}
/**
* Read-only information about the application that submitted the physical count.
* @return source
**/
@ApiModelProperty(value = "Read-only information about the application that submitted the physical count.")
public SourceApplication getSource() {
return source;
}
public void setSource(SourceApplication source) {
this.source = source;
}
public InventoryPhysicalCount employeeId(String employeeId) {
this.employeeId = employeeId;
return this;
}
/**
* The Square ID of the `Employee` responsible for the physical count.
* @return employeeId
**/
@ApiModelProperty(value = "The Square ID of the `Employee` responsible for the physical count.")
public String getEmployeeId() {
return employeeId;
}
public void setEmployeeId(String employeeId) {
this.employeeId = employeeId;
}
public InventoryPhysicalCount occurredAt(String occurredAt) {
this.occurredAt = occurredAt;
return this;
}
/**
* A client-generated timestamp in RFC 3339 format that indicates when the physical count took place. For write actions, the `occurred_at` timestamp cannot be older than 24 hours or in the future relative to the time of the request.
* @return occurredAt
**/
@ApiModelProperty(value = "A client-generated timestamp in RFC 3339 format that indicates when the physical count took place. For write actions, the `occurred_at` timestamp cannot be older than 24 hours or in the future relative to the time of the request.")
public String getOccurredAt() {
return occurredAt;
}
public void setOccurredAt(String occurredAt) {
this.occurredAt = occurredAt;
}
public InventoryPhysicalCount createdAt(String createdAt) {
this.createdAt = createdAt;
return this;
}
/**
* A read-only timestamp in RFC 3339 format that indicates when Square received the physical count.
* @return createdAt
**/
@ApiModelProperty(value = "A read-only timestamp in RFC 3339 format that indicates when Square received the physical count.")
public String getCreatedAt() {
return createdAt;
}
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
InventoryPhysicalCount inventoryPhysicalCount = (InventoryPhysicalCount) o;
return Objects.equals(this.id, inventoryPhysicalCount.id) &&
Objects.equals(this.referenceId, inventoryPhysicalCount.referenceId) &&
Objects.equals(this.catalogObjectId, inventoryPhysicalCount.catalogObjectId) &&
Objects.equals(this.catalogObjectType, inventoryPhysicalCount.catalogObjectType) &&
Objects.equals(this.state, inventoryPhysicalCount.state) &&
Objects.equals(this.locationId, inventoryPhysicalCount.locationId) &&
Objects.equals(this.quantity, inventoryPhysicalCount.quantity) &&
Objects.equals(this.source, inventoryPhysicalCount.source) &&
Objects.equals(this.employeeId, inventoryPhysicalCount.employeeId) &&
Objects.equals(this.occurredAt, inventoryPhysicalCount.occurredAt) &&
Objects.equals(this.createdAt, inventoryPhysicalCount.createdAt);
}
@Override
public int hashCode() {
return Objects.hash(id, referenceId, catalogObjectId, catalogObjectType, state, locationId, quantity, source, employeeId, occurredAt, createdAt);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class InventoryPhysicalCount {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" referenceId: ").append(toIndentedString(referenceId)).append("\n");
sb.append(" catalogObjectId: ").append(toIndentedString(catalogObjectId)).append("\n");
sb.append(" catalogObjectType: ").append(toIndentedString(catalogObjectType)).append("\n");
sb.append(" state: ").append(toIndentedString(state)).append("\n");
sb.append(" locationId: ").append(toIndentedString(locationId)).append("\n");
sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n");
sb.append(" source: ").append(toIndentedString(source)).append("\n");
sb.append(" employeeId: ").append(toIndentedString(employeeId)).append("\n");
sb.append(" occurredAt: ").append(toIndentedString(occurredAt)).append("\n");
sb.append(" createdAt: ").append(toIndentedString(createdAt)).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 ");
}
}
| 5,132 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/models/UpdateLocationRequest.java | /*
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* 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.squareup.connect.models;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.squareup.connect.models.Location;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Request object for the [UpdateLocation](#endpoint-updatelocation) endpoint.
*/
@ApiModel(description = "Request object for the [UpdateLocation](#endpoint-updatelocation) endpoint.")
public class UpdateLocationRequest {
@JsonProperty("location")
private Location location = null;
public UpdateLocationRequest location(Location location) {
this.location = location;
return this;
}
/**
* The `Location` object with only the fields to update.
* @return location
**/
@ApiModelProperty(value = "The `Location` object with only the fields to update.")
public Location getLocation() {
return location;
}
public void setLocation(Location location) {
this.location = location;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
UpdateLocationRequest updateLocationRequest = (UpdateLocationRequest) o;
return Objects.equals(this.location, updateLocationRequest.location);
}
@Override
public int hashCode() {
return Objects.hash(location);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class UpdateLocationRequest {\n");
sb.append(" location: ").append(toIndentedString(location)).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 ");
}
}
| 5,133 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/api/CatalogApi.java | package com.squareup.connect.api;
import com.squareup.connect.ApiException;
import com.squareup.connect.ApiClient;
import com.squareup.connect.Configuration;
import com.squareup.connect.Pair;
import com.squareup.connect.CompleteResponse;
import javax.ws.rs.core.GenericType;
import com.squareup.connect.models.BatchDeleteCatalogObjectsRequest;
import com.squareup.connect.models.BatchDeleteCatalogObjectsResponse;
import com.squareup.connect.models.BatchRetrieveCatalogObjectsRequest;
import com.squareup.connect.models.BatchRetrieveCatalogObjectsResponse;
import com.squareup.connect.models.BatchUpsertCatalogObjectsRequest;
import com.squareup.connect.models.BatchUpsertCatalogObjectsResponse;
import com.squareup.connect.models.CatalogInfoResponse;
import com.squareup.connect.models.DeleteCatalogObjectResponse;
import com.squareup.connect.models.ListCatalogResponse;
import com.squareup.connect.models.RetrieveCatalogObjectResponse;
import com.squareup.connect.models.SearchCatalogObjectsRequest;
import com.squareup.connect.models.SearchCatalogObjectsResponse;
import com.squareup.connect.models.UpdateItemModifierListsRequest;
import com.squareup.connect.models.UpdateItemModifierListsResponse;
import com.squareup.connect.models.UpdateItemTaxesRequest;
import com.squareup.connect.models.UpdateItemTaxesResponse;
import com.squareup.connect.models.UpsertCatalogObjectRequest;
import com.squareup.connect.models.UpsertCatalogObjectResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CatalogApi {
private ApiClient apiClient;
public CatalogApi() {
this(Configuration.getDefaultApiClient());
}
public CatalogApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* BatchDeleteCatalogObjects
* Deletes a set of [CatalogItem](#type-catalogitem)s based on the provided list of target IDs and returns a set of successfully deleted IDs in the response. Deletion is a cascading event such that all children of the targeted object are also deleted. For example, deleting a CatalogItem will also delete all of its [CatalogItemVariation](#type-catalogitemvariation) children. `BatchDeleteCatalogObjects` succeeds even if only a portion of the targeted IDs can be deleted. The response will only include IDs that were actually deleted.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return BatchDeleteCatalogObjectsResponse
* @throws ApiException if fails to make API call
*/
public BatchDeleteCatalogObjectsResponse batchDeleteCatalogObjects(BatchDeleteCatalogObjectsRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling batchDeleteCatalogObjects");
}
// create path and map variables
String localVarPath = "/v2/catalog/batch-delete";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<BatchDeleteCatalogObjectsResponse> localVarReturnType = new GenericType<BatchDeleteCatalogObjectsResponse>() {};
CompleteResponse<BatchDeleteCatalogObjectsResponse> completeResponse = (CompleteResponse<BatchDeleteCatalogObjectsResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* BatchDeleteCatalogObjects
* Deletes a set of [CatalogItem](#type-catalogitem)s based on the provided list of target IDs and returns a set of successfully deleted IDs in the response. Deletion is a cascading event such that all children of the targeted object are also deleted. For example, deleting a CatalogItem will also delete all of its [CatalogItemVariation](#type-catalogitemvariation) children. `BatchDeleteCatalogObjects` succeeds even if only a portion of the targeted IDs can be deleted. The response will only include IDs that were actually deleted.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<BatchDeleteCatalogObjectsResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<BatchDeleteCatalogObjectsResponse>batchDeleteCatalogObjectsWithHttpInfo(BatchDeleteCatalogObjectsRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling batchDeleteCatalogObjects");
}
// create path and map variables
String localVarPath = "/v2/catalog/batch-delete";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<BatchDeleteCatalogObjectsResponse> localVarReturnType = new GenericType<BatchDeleteCatalogObjectsResponse>() {};
return (CompleteResponse<BatchDeleteCatalogObjectsResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* BatchRetrieveCatalogObjects
* Returns a set of objects based on the provided ID. Each [CatalogItem](#type-catalogitem) returned in the set includes all of its child information including: all of its [CatalogItemVariation](#type-catalogitemvariation) objects, references to its [CatalogModifierList](#type-catalogmodifierlist) objects, and the ids of any [CatalogTax](#type-catalogtax) objects that apply to it.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return BatchRetrieveCatalogObjectsResponse
* @throws ApiException if fails to make API call
*/
public BatchRetrieveCatalogObjectsResponse batchRetrieveCatalogObjects(BatchRetrieveCatalogObjectsRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling batchRetrieveCatalogObjects");
}
// create path and map variables
String localVarPath = "/v2/catalog/batch-retrieve";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<BatchRetrieveCatalogObjectsResponse> localVarReturnType = new GenericType<BatchRetrieveCatalogObjectsResponse>() {};
CompleteResponse<BatchRetrieveCatalogObjectsResponse> completeResponse = (CompleteResponse<BatchRetrieveCatalogObjectsResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* BatchRetrieveCatalogObjects
* Returns a set of objects based on the provided ID. Each [CatalogItem](#type-catalogitem) returned in the set includes all of its child information including: all of its [CatalogItemVariation](#type-catalogitemvariation) objects, references to its [CatalogModifierList](#type-catalogmodifierlist) objects, and the ids of any [CatalogTax](#type-catalogtax) objects that apply to it.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<BatchRetrieveCatalogObjectsResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<BatchRetrieveCatalogObjectsResponse>batchRetrieveCatalogObjectsWithHttpInfo(BatchRetrieveCatalogObjectsRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling batchRetrieveCatalogObjects");
}
// create path and map variables
String localVarPath = "/v2/catalog/batch-retrieve";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<BatchRetrieveCatalogObjectsResponse> localVarReturnType = new GenericType<BatchRetrieveCatalogObjectsResponse>() {};
return (CompleteResponse<BatchRetrieveCatalogObjectsResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* BatchUpsertCatalogObjects
* Creates or updates up to 10,000 target objects based on the provided list of objects. The target objects are grouped into batches and each batch is inserted/updated in an all-or-nothing manner. If an object within a batch is malformed in some way, or violates a database constraint, the entire batch containing that item will be disregarded. However, other batches in the same request may still succeed. Each batch may contain up to 1,000 objects, and batches will be processed in order as long as the total object count for the request (items, variations, modifier lists, discounts, and taxes) is no more than 10,000.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return BatchUpsertCatalogObjectsResponse
* @throws ApiException if fails to make API call
*/
public BatchUpsertCatalogObjectsResponse batchUpsertCatalogObjects(BatchUpsertCatalogObjectsRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling batchUpsertCatalogObjects");
}
// create path and map variables
String localVarPath = "/v2/catalog/batch-upsert";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<BatchUpsertCatalogObjectsResponse> localVarReturnType = new GenericType<BatchUpsertCatalogObjectsResponse>() {};
CompleteResponse<BatchUpsertCatalogObjectsResponse> completeResponse = (CompleteResponse<BatchUpsertCatalogObjectsResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* BatchUpsertCatalogObjects
* Creates or updates up to 10,000 target objects based on the provided list of objects. The target objects are grouped into batches and each batch is inserted/updated in an all-or-nothing manner. If an object within a batch is malformed in some way, or violates a database constraint, the entire batch containing that item will be disregarded. However, other batches in the same request may still succeed. Each batch may contain up to 1,000 objects, and batches will be processed in order as long as the total object count for the request (items, variations, modifier lists, discounts, and taxes) is no more than 10,000.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<BatchUpsertCatalogObjectsResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<BatchUpsertCatalogObjectsResponse>batchUpsertCatalogObjectsWithHttpInfo(BatchUpsertCatalogObjectsRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling batchUpsertCatalogObjects");
}
// create path and map variables
String localVarPath = "/v2/catalog/batch-upsert";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<BatchUpsertCatalogObjectsResponse> localVarReturnType = new GenericType<BatchUpsertCatalogObjectsResponse>() {};
return (CompleteResponse<BatchUpsertCatalogObjectsResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CatalogInfo
* Returns information about the Square Catalog API, such as batch size limits for `BatchUpsertCatalogObjects`.
* @return CatalogInfoResponse
* @throws ApiException if fails to make API call
*/
public CatalogInfoResponse catalogInfo() throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v2/catalog/info";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CatalogInfoResponse> localVarReturnType = new GenericType<CatalogInfoResponse>() {};
CompleteResponse<CatalogInfoResponse> completeResponse = (CompleteResponse<CatalogInfoResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CatalogInfo
* Returns information about the Square Catalog API, such as batch size limits for `BatchUpsertCatalogObjects`.
* @return CompleteResponse<CatalogInfoResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<CatalogInfoResponse>catalogInfoWithHttpInfo() throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v2/catalog/info";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CatalogInfoResponse> localVarReturnType = new GenericType<CatalogInfoResponse>() {};
return (CompleteResponse<CatalogInfoResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* DeleteCatalogObject
* Deletes a single [CatalogObject](#type-catalogobject) based on the provided ID and returns the set of successfully deleted IDs in the response. Deletion is a cascading event such that all children of the targeted object are also deleted. For example, deleting a [CatalogItem](#type-catalogitem) will also delete all of its [CatalogItemVariation](#type-catalogitemvariation) children.
* @param objectId The ID of the catalog object to be deleted. When an object is deleted, other objects in the graph that depend on that object will be deleted as well (for example, deleting a catalog item will delete its catalog item variations). (required)
* @return DeleteCatalogObjectResponse
* @throws ApiException if fails to make API call
*/
public DeleteCatalogObjectResponse deleteCatalogObject(String objectId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'objectId' is set
if (objectId == null) {
throw new ApiException(400, "Missing the required parameter 'objectId' when calling deleteCatalogObject");
}
// create path and map variables
String localVarPath = "/v2/catalog/object/{object_id}"
.replaceAll("\\{" + "object_id" + "\\}", apiClient.escapeString(objectId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<DeleteCatalogObjectResponse> localVarReturnType = new GenericType<DeleteCatalogObjectResponse>() {};
CompleteResponse<DeleteCatalogObjectResponse> completeResponse = (CompleteResponse<DeleteCatalogObjectResponse>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* DeleteCatalogObject
* Deletes a single [CatalogObject](#type-catalogobject) based on the provided ID and returns the set of successfully deleted IDs in the response. Deletion is a cascading event such that all children of the targeted object are also deleted. For example, deleting a [CatalogItem](#type-catalogitem) will also delete all of its [CatalogItemVariation](#type-catalogitemvariation) children.
* @param objectId The ID of the catalog object to be deleted. When an object is deleted, other objects in the graph that depend on that object will be deleted as well (for example, deleting a catalog item will delete its catalog item variations). (required)
* @return CompleteResponse<DeleteCatalogObjectResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<DeleteCatalogObjectResponse>deleteCatalogObjectWithHttpInfo(String objectId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'objectId' is set
if (objectId == null) {
throw new ApiException(400, "Missing the required parameter 'objectId' when calling deleteCatalogObject");
}
// create path and map variables
String localVarPath = "/v2/catalog/object/{object_id}"
.replaceAll("\\{" + "object_id" + "\\}", apiClient.escapeString(objectId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<DeleteCatalogObjectResponse> localVarReturnType = new GenericType<DeleteCatalogObjectResponse>() {};
return (CompleteResponse<DeleteCatalogObjectResponse>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListCatalog
* Returns a list of [CatalogObject](#type-catalogobject)s that includes all objects of a set of desired types (for example, all [CatalogItem](#type-catalogitem) and [CatalogTax](#type-catalogtax) objects) in the catalog. The `types` parameter is specified as a comma-separated list of valid [CatalogObject](#type-catalogobject) types: `ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`, `DISCOUNT`, `TAX`, `IMAGE`. __Important:__ ListCatalog does not return deleted catalog items. To retrieve deleted catalog items, use SearchCatalogObjects and set `include_deleted_objects` to `true`.
* @param cursor The pagination cursor returned in the previous response. Leave unset for an initial request. See [Pagination](https://developer.squareup.com/docs/basics/api101/pagination) for more information. (optional)
* @param types An optional case-insensitive, comma-separated list of object types to retrieve, for example `ITEM,ITEM_VARIATION,CATEGORY,IMAGE`. The legal values are taken from the CatalogObjectType enum: `ITEM`, `ITEM_VARIATION`, `CATEGORY`, `DISCOUNT`, `TAX`, `MODIFIER`, `MODIFIER_LIST`, or `IMAGE`. (optional)
* @return ListCatalogResponse
* @throws ApiException if fails to make API call
*/
public ListCatalogResponse listCatalog(String cursor, String types) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v2/catalog/list";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "types", types));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListCatalogResponse> localVarReturnType = new GenericType<ListCatalogResponse>() {};
CompleteResponse<ListCatalogResponse> completeResponse = (CompleteResponse<ListCatalogResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListCatalog
* Returns a list of [CatalogObject](#type-catalogobject)s that includes all objects of a set of desired types (for example, all [CatalogItem](#type-catalogitem) and [CatalogTax](#type-catalogtax) objects) in the catalog. The `types` parameter is specified as a comma-separated list of valid [CatalogObject](#type-catalogobject) types: `ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`, `DISCOUNT`, `TAX`, `IMAGE`. __Important:__ ListCatalog does not return deleted catalog items. To retrieve deleted catalog items, use SearchCatalogObjects and set `include_deleted_objects` to `true`.
* @param cursor The pagination cursor returned in the previous response. Leave unset for an initial request. See [Pagination](https://developer.squareup.com/docs/basics/api101/pagination) for more information. (optional)
* @param types An optional case-insensitive, comma-separated list of object types to retrieve, for example `ITEM,ITEM_VARIATION,CATEGORY,IMAGE`. The legal values are taken from the CatalogObjectType enum: `ITEM`, `ITEM_VARIATION`, `CATEGORY`, `DISCOUNT`, `TAX`, `MODIFIER`, `MODIFIER_LIST`, or `IMAGE`. (optional)
* @return CompleteResponse<ListCatalogResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<ListCatalogResponse>listCatalogWithHttpInfo(String cursor, String types) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v2/catalog/list";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "types", types));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListCatalogResponse> localVarReturnType = new GenericType<ListCatalogResponse>() {};
return (CompleteResponse<ListCatalogResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RetrieveCatalogObject
* Returns a single [CatalogItem](#type-catalogitem) as a [CatalogObject](#type-catalogobject) based on the provided ID. The returned object includes all of the relevant [CatalogItem](#type-catalogitem) information including: [CatalogItemVariation](#type-catalogitemvariation) children, references to its [CatalogModifierList](#type-catalogmodifierlist) objects, and the ids of any [CatalogTax](#type-catalogtax) objects that apply to it.
* @param objectId The object ID of any type of catalog objects to be retrieved. (required)
* @param includeRelatedObjects If `true`, the response will include additional objects that are related to the requested object, as follows: If the `object` field of the response contains a CatalogItem, its associated CatalogCategory, CatalogTax objects, CatalogImages and CatalogModifierLists will be returned in the `related_objects` field of the response. If the `object` field of the response contains a CatalogItemVariation, its parent CatalogItem will be returned in the `related_objects` field of the response. Default value: `false` (optional)
* @return RetrieveCatalogObjectResponse
* @throws ApiException if fails to make API call
*/
public RetrieveCatalogObjectResponse retrieveCatalogObject(String objectId, Boolean includeRelatedObjects) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'objectId' is set
if (objectId == null) {
throw new ApiException(400, "Missing the required parameter 'objectId' when calling retrieveCatalogObject");
}
// create path and map variables
String localVarPath = "/v2/catalog/object/{object_id}"
.replaceAll("\\{" + "object_id" + "\\}", apiClient.escapeString(objectId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_related_objects", includeRelatedObjects));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RetrieveCatalogObjectResponse> localVarReturnType = new GenericType<RetrieveCatalogObjectResponse>() {};
CompleteResponse<RetrieveCatalogObjectResponse> completeResponse = (CompleteResponse<RetrieveCatalogObjectResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RetrieveCatalogObject
* Returns a single [CatalogItem](#type-catalogitem) as a [CatalogObject](#type-catalogobject) based on the provided ID. The returned object includes all of the relevant [CatalogItem](#type-catalogitem) information including: [CatalogItemVariation](#type-catalogitemvariation) children, references to its [CatalogModifierList](#type-catalogmodifierlist) objects, and the ids of any [CatalogTax](#type-catalogtax) objects that apply to it.
* @param objectId The object ID of any type of catalog objects to be retrieved. (required)
* @param includeRelatedObjects If `true`, the response will include additional objects that are related to the requested object, as follows: If the `object` field of the response contains a CatalogItem, its associated CatalogCategory, CatalogTax objects, CatalogImages and CatalogModifierLists will be returned in the `related_objects` field of the response. If the `object` field of the response contains a CatalogItemVariation, its parent CatalogItem will be returned in the `related_objects` field of the response. Default value: `false` (optional)
* @return CompleteResponse<RetrieveCatalogObjectResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<RetrieveCatalogObjectResponse>retrieveCatalogObjectWithHttpInfo(String objectId, Boolean includeRelatedObjects) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'objectId' is set
if (objectId == null) {
throw new ApiException(400, "Missing the required parameter 'objectId' when calling retrieveCatalogObject");
}
// create path and map variables
String localVarPath = "/v2/catalog/object/{object_id}"
.replaceAll("\\{" + "object_id" + "\\}", apiClient.escapeString(objectId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_related_objects", includeRelatedObjects));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RetrieveCatalogObjectResponse> localVarReturnType = new GenericType<RetrieveCatalogObjectResponse>() {};
return (CompleteResponse<RetrieveCatalogObjectResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* SearchCatalogObjects
* Queries the targeted catalog using a variety of query types: [CatalogQuerySortedAttribute](#type-catalogquerysortedattribute), [CatalogQueryExact](#type-catalogqueryexact), [CatalogQueryRange](#type-catalogqueryrange), [CatalogQueryText](#type-catalogquerytext), [CatalogQueryItemsForTax](#type-catalogqueryitemsfortax), and [CatalogQueryItemsForModifierList](#type-catalogqueryitemsformodifierlist). -- -- Future end of the above comment: [CatalogQueryItemsForTax](#type-catalogqueryitemsfortax), [CatalogQueryItemsForModifierList](#type-catalogqueryitemsformodifierlist), [CatalogQueryItemsForItemOptions](#type-catalogqueryitemsforitemoptions), and [CatalogQueryItemVariationsForItemOptionValues](#type-catalogqueryitemvariationsforitemoptionvalues).
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return SearchCatalogObjectsResponse
* @throws ApiException if fails to make API call
*/
public SearchCatalogObjectsResponse searchCatalogObjects(SearchCatalogObjectsRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling searchCatalogObjects");
}
// create path and map variables
String localVarPath = "/v2/catalog/search";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<SearchCatalogObjectsResponse> localVarReturnType = new GenericType<SearchCatalogObjectsResponse>() {};
CompleteResponse<SearchCatalogObjectsResponse> completeResponse = (CompleteResponse<SearchCatalogObjectsResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* SearchCatalogObjects
* Queries the targeted catalog using a variety of query types: [CatalogQuerySortedAttribute](#type-catalogquerysortedattribute), [CatalogQueryExact](#type-catalogqueryexact), [CatalogQueryRange](#type-catalogqueryrange), [CatalogQueryText](#type-catalogquerytext), [CatalogQueryItemsForTax](#type-catalogqueryitemsfortax), and [CatalogQueryItemsForModifierList](#type-catalogqueryitemsformodifierlist). -- -- Future end of the above comment: [CatalogQueryItemsForTax](#type-catalogqueryitemsfortax), [CatalogQueryItemsForModifierList](#type-catalogqueryitemsformodifierlist), [CatalogQueryItemsForItemOptions](#type-catalogqueryitemsforitemoptions), and [CatalogQueryItemVariationsForItemOptionValues](#type-catalogqueryitemvariationsforitemoptionvalues).
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<SearchCatalogObjectsResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<SearchCatalogObjectsResponse>searchCatalogObjectsWithHttpInfo(SearchCatalogObjectsRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling searchCatalogObjects");
}
// create path and map variables
String localVarPath = "/v2/catalog/search";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<SearchCatalogObjectsResponse> localVarReturnType = new GenericType<SearchCatalogObjectsResponse>() {};
return (CompleteResponse<SearchCatalogObjectsResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* UpdateItemModifierLists
* Updates the [CatalogModifierList](#type-catalogmodifierlist) objects that apply to the targeted [CatalogItem](#type-catalogitem) without having to perform an upsert on the entire item.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return UpdateItemModifierListsResponse
* @throws ApiException if fails to make API call
*/
public UpdateItemModifierListsResponse updateItemModifierLists(UpdateItemModifierListsRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateItemModifierLists");
}
// create path and map variables
String localVarPath = "/v2/catalog/update-item-modifier-lists";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<UpdateItemModifierListsResponse> localVarReturnType = new GenericType<UpdateItemModifierListsResponse>() {};
CompleteResponse<UpdateItemModifierListsResponse> completeResponse = (CompleteResponse<UpdateItemModifierListsResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* UpdateItemModifierLists
* Updates the [CatalogModifierList](#type-catalogmodifierlist) objects that apply to the targeted [CatalogItem](#type-catalogitem) without having to perform an upsert on the entire item.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<UpdateItemModifierListsResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<UpdateItemModifierListsResponse>updateItemModifierListsWithHttpInfo(UpdateItemModifierListsRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateItemModifierLists");
}
// create path and map variables
String localVarPath = "/v2/catalog/update-item-modifier-lists";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<UpdateItemModifierListsResponse> localVarReturnType = new GenericType<UpdateItemModifierListsResponse>() {};
return (CompleteResponse<UpdateItemModifierListsResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* UpdateItemTaxes
* Updates the [CatalogTax](#type-catalogtax) objects that apply to the targeted [CatalogItem](#type-catalogitem) without having to perform an upsert on the entire item.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return UpdateItemTaxesResponse
* @throws ApiException if fails to make API call
*/
public UpdateItemTaxesResponse updateItemTaxes(UpdateItemTaxesRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateItemTaxes");
}
// create path and map variables
String localVarPath = "/v2/catalog/update-item-taxes";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<UpdateItemTaxesResponse> localVarReturnType = new GenericType<UpdateItemTaxesResponse>() {};
CompleteResponse<UpdateItemTaxesResponse> completeResponse = (CompleteResponse<UpdateItemTaxesResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* UpdateItemTaxes
* Updates the [CatalogTax](#type-catalogtax) objects that apply to the targeted [CatalogItem](#type-catalogitem) without having to perform an upsert on the entire item.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<UpdateItemTaxesResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<UpdateItemTaxesResponse>updateItemTaxesWithHttpInfo(UpdateItemTaxesRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateItemTaxes");
}
// create path and map variables
String localVarPath = "/v2/catalog/update-item-taxes";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<UpdateItemTaxesResponse> localVarReturnType = new GenericType<UpdateItemTaxesResponse>() {};
return (CompleteResponse<UpdateItemTaxesResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* UpsertCatalogObject
* Creates or updates the target [CatalogObject](#type-catalogobject).
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return UpsertCatalogObjectResponse
* @throws ApiException if fails to make API call
*/
public UpsertCatalogObjectResponse upsertCatalogObject(UpsertCatalogObjectRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling upsertCatalogObject");
}
// create path and map variables
String localVarPath = "/v2/catalog/object";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<UpsertCatalogObjectResponse> localVarReturnType = new GenericType<UpsertCatalogObjectResponse>() {};
CompleteResponse<UpsertCatalogObjectResponse> completeResponse = (CompleteResponse<UpsertCatalogObjectResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* UpsertCatalogObject
* Creates or updates the target [CatalogObject](#type-catalogobject).
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<UpsertCatalogObjectResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<UpsertCatalogObjectResponse>upsertCatalogObjectWithHttpInfo(UpsertCatalogObjectRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling upsertCatalogObject");
}
// create path and map variables
String localVarPath = "/v2/catalog/object";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<UpsertCatalogObjectResponse> localVarReturnType = new GenericType<UpsertCatalogObjectResponse>() {};
return (CompleteResponse<UpsertCatalogObjectResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}
| 5,134 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/api/CheckoutApi.java | package com.squareup.connect.api;
import com.squareup.connect.ApiException;
import com.squareup.connect.ApiClient;
import com.squareup.connect.Configuration;
import com.squareup.connect.Pair;
import com.squareup.connect.CompleteResponse;
import javax.ws.rs.core.GenericType;
import com.squareup.connect.models.CreateCheckoutRequest;
import com.squareup.connect.models.CreateCheckoutResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CheckoutApi {
private ApiClient apiClient;
public CheckoutApi() {
this(Configuration.getDefaultApiClient());
}
public CheckoutApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* CreateCheckout
* Links a `checkoutId` to a `checkout_page_url` that customers will be directed to in order to provide their payment information using a payment processing workflow hosted on connect.squareup.com.
* @param locationId The ID of the business location to associate the checkout with. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CreateCheckoutResponse
* @throws ApiException if fails to make API call
*/
public CreateCheckoutResponse createCheckout(String locationId, CreateCheckoutRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createCheckout");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createCheckout");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/checkouts"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CreateCheckoutResponse> localVarReturnType = new GenericType<CreateCheckoutResponse>() {};
CompleteResponse<CreateCheckoutResponse> completeResponse = (CompleteResponse<CreateCheckoutResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateCheckout
* Links a `checkoutId` to a `checkout_page_url` that customers will be directed to in order to provide their payment information using a payment processing workflow hosted on connect.squareup.com.
* @param locationId The ID of the business location to associate the checkout with. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<CreateCheckoutResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<CreateCheckoutResponse>createCheckoutWithHttpInfo(String locationId, CreateCheckoutRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createCheckout");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createCheckout");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/checkouts"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CreateCheckoutResponse> localVarReturnType = new GenericType<CreateCheckoutResponse>() {};
return (CompleteResponse<CreateCheckoutResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}
| 5,135 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/api/TransactionsApi.java | package com.squareup.connect.api;
import com.squareup.connect.ApiException;
import com.squareup.connect.ApiClient;
import com.squareup.connect.Configuration;
import com.squareup.connect.Pair;
import com.squareup.connect.CompleteResponse;
import javax.ws.rs.core.GenericType;
import com.squareup.connect.models.CaptureTransactionResponse;
import com.squareup.connect.models.ChargeRequest;
import com.squareup.connect.models.ChargeResponse;
import com.squareup.connect.models.CreateRefundRequest;
import com.squareup.connect.models.CreateRefundResponse;
import com.squareup.connect.models.ListRefundsResponse;
import com.squareup.connect.models.ListTransactionsResponse;
import com.squareup.connect.models.RetrieveTransactionResponse;
import com.squareup.connect.models.VoidTransactionResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class TransactionsApi {
private ApiClient apiClient;
public TransactionsApi() {
this(Configuration.getDefaultApiClient());
}
public TransactionsApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* CaptureTransaction
* Captures a transaction that was created with the [Charge](#endpoint-charge) endpoint with a `delay_capture` value of `true`. See [Delayed capture transactions](/payments/transactions/overview#delayed-capture) for more information.
* @param locationId (required)
* @param transactionId (required)
* @return CaptureTransactionResponse
* @throws ApiException if fails to make API call
*/
@Deprecated
public CaptureTransactionResponse captureTransaction(String locationId, String transactionId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling captureTransaction");
}
// verify the required parameter 'transactionId' is set
if (transactionId == null) {
throw new ApiException(400, "Missing the required parameter 'transactionId' when calling captureTransaction");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/transactions/{transaction_id}/capture"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "transaction_id" + "\\}", apiClient.escapeString(transactionId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CaptureTransactionResponse> localVarReturnType = new GenericType<CaptureTransactionResponse>() {};
CompleteResponse<CaptureTransactionResponse> completeResponse = (CompleteResponse<CaptureTransactionResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CaptureTransaction
* Captures a transaction that was created with the [Charge](#endpoint-charge) endpoint with a `delay_capture` value of `true`. See [Delayed capture transactions](/payments/transactions/overview#delayed-capture) for more information.
* @param locationId (required)
* @param transactionId (required)
* @return CompleteResponse<CaptureTransactionResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<CaptureTransactionResponse>captureTransactionWithHttpInfo(String locationId, String transactionId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling captureTransaction");
}
// verify the required parameter 'transactionId' is set
if (transactionId == null) {
throw new ApiException(400, "Missing the required parameter 'transactionId' when calling captureTransaction");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/transactions/{transaction_id}/capture"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "transaction_id" + "\\}", apiClient.escapeString(transactionId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CaptureTransactionResponse> localVarReturnType = new GenericType<CaptureTransactionResponse>() {};
return (CompleteResponse<CaptureTransactionResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Charge
* Charges a card represented by a card nonce or a customer's card on file. Deprecated - recommend using [CreatePayment](#endpoint-payments-createpayment) Your request to this endpoint must include _either_: - A value for the `card_nonce` parameter (to charge a card nonce generated with the `SqPaymentForm`) - Values for the `customer_card_id` and `customer_id` parameters (to charge a customer's card on file) In order for an eCommerce payment to potentially qualify for [Square chargeback protection](https://squareup.com/help/article/5394), you _must_ provide values for the following parameters in your request: - `buyer_email_address` - At least one of `billing_address` or `shipping_address` When this response is returned, the amount of Square's processing fee might not yet be calculated. To obtain the processing fee, wait about ten seconds and call [RetrieveTransaction](#endpoint-retrievetransaction). See the `processing_fee_money` field of each [Tender included](#type-tender) in the transaction.
* @param locationId The ID of the location to associate the created transaction with. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return ChargeResponse
* @throws ApiException if fails to make API call
*/
@Deprecated
public ChargeResponse charge(String locationId, ChargeRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling charge");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling charge");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/transactions"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ChargeResponse> localVarReturnType = new GenericType<ChargeResponse>() {};
CompleteResponse<ChargeResponse> completeResponse = (CompleteResponse<ChargeResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* Charge
* Charges a card represented by a card nonce or a customer's card on file. Deprecated - recommend using [CreatePayment](#endpoint-payments-createpayment) Your request to this endpoint must include _either_: - A value for the `card_nonce` parameter (to charge a card nonce generated with the `SqPaymentForm`) - Values for the `customer_card_id` and `customer_id` parameters (to charge a customer's card on file) In order for an eCommerce payment to potentially qualify for [Square chargeback protection](https://squareup.com/help/article/5394), you _must_ provide values for the following parameters in your request: - `buyer_email_address` - At least one of `billing_address` or `shipping_address` When this response is returned, the amount of Square's processing fee might not yet be calculated. To obtain the processing fee, wait about ten seconds and call [RetrieveTransaction](#endpoint-retrievetransaction). See the `processing_fee_money` field of each [Tender included](#type-tender) in the transaction.
* @param locationId The ID of the location to associate the created transaction with. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<ChargeResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<ChargeResponse>chargeWithHttpInfo(String locationId, ChargeRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling charge");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling charge");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/transactions"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ChargeResponse> localVarReturnType = new GenericType<ChargeResponse>() {};
return (CompleteResponse<ChargeResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CreateRefund
* Initiates a refund for a previously charged tender. Deprecated - recommend using [RefundPayment](#endpoint-refunds-refundpayment) You must issue a refund within 120 days of the associated payment. See [this article](https://squareup.com/help/us/en/article/5060) for more information on refund behavior. NOTE: Card-present transactions with Interac credit cards **cannot be refunded using the Connect API**. Interac transactions must refunded in-person (e.g., dipping the card using POS app).
* @param locationId The ID of the original transaction's associated location. (required)
* @param transactionId The ID of the original transaction that includes the tender to refund. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CreateRefundResponse
* @throws ApiException if fails to make API call
*/
@Deprecated
public CreateRefundResponse createRefund(String locationId, String transactionId, CreateRefundRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createRefund");
}
// verify the required parameter 'transactionId' is set
if (transactionId == null) {
throw new ApiException(400, "Missing the required parameter 'transactionId' when calling createRefund");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createRefund");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/transactions/{transaction_id}/refund"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "transaction_id" + "\\}", apiClient.escapeString(transactionId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CreateRefundResponse> localVarReturnType = new GenericType<CreateRefundResponse>() {};
CompleteResponse<CreateRefundResponse> completeResponse = (CompleteResponse<CreateRefundResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateRefund
* Initiates a refund for a previously charged tender. Deprecated - recommend using [RefundPayment](#endpoint-refunds-refundpayment) You must issue a refund within 120 days of the associated payment. See [this article](https://squareup.com/help/us/en/article/5060) for more information on refund behavior. NOTE: Card-present transactions with Interac credit cards **cannot be refunded using the Connect API**. Interac transactions must refunded in-person (e.g., dipping the card using POS app).
* @param locationId The ID of the original transaction's associated location. (required)
* @param transactionId The ID of the original transaction that includes the tender to refund. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<CreateRefundResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<CreateRefundResponse>createRefundWithHttpInfo(String locationId, String transactionId, CreateRefundRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createRefund");
}
// verify the required parameter 'transactionId' is set
if (transactionId == null) {
throw new ApiException(400, "Missing the required parameter 'transactionId' when calling createRefund");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createRefund");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/transactions/{transaction_id}/refund"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "transaction_id" + "\\}", apiClient.escapeString(transactionId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CreateRefundResponse> localVarReturnType = new GenericType<CreateRefundResponse>() {};
return (CompleteResponse<CreateRefundResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListRefunds
* Lists refunds for one of a business's locations. Deprecated - recommend using [SearchOrders](#endpoint-orders-searchorders) In addition to full or partial tender refunds processed through Square APIs, refunds may result from itemized returns or exchanges through Square's Point of Sale applications. Refunds with a `status` of `PENDING` are not currently included in this endpoint's response. Max results per [page](#paginatingresults): 50
* @param locationId The ID of the location to list refunds for. (required)
* @param beginTime The beginning of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time minus one year. (optional)
* @param endTime The end of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time. (optional)
* @param sortOrder The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC` (optional)
* @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. See [Paginating results](#paginatingresults) for more information. (optional)
* @return ListRefundsResponse
* @throws ApiException if fails to make API call
*/
@Deprecated
public ListRefundsResponse listRefunds(String locationId, String beginTime, String endTime, String sortOrder, String cursor) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listRefunds");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/refunds"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_time", beginTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_time", endTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort_order", sortOrder));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListRefundsResponse> localVarReturnType = new GenericType<ListRefundsResponse>() {};
CompleteResponse<ListRefundsResponse> completeResponse = (CompleteResponse<ListRefundsResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListRefunds
* Lists refunds for one of a business's locations. Deprecated - recommend using [SearchOrders](#endpoint-orders-searchorders) In addition to full or partial tender refunds processed through Square APIs, refunds may result from itemized returns or exchanges through Square's Point of Sale applications. Refunds with a `status` of `PENDING` are not currently included in this endpoint's response. Max results per [page](#paginatingresults): 50
* @param locationId The ID of the location to list refunds for. (required)
* @param beginTime The beginning of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time minus one year. (optional)
* @param endTime The end of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time. (optional)
* @param sortOrder The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC` (optional)
* @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. See [Paginating results](#paginatingresults) for more information. (optional)
* @return CompleteResponse<ListRefundsResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<ListRefundsResponse>listRefundsWithHttpInfo(String locationId, String beginTime, String endTime, String sortOrder, String cursor) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listRefunds");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/refunds"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_time", beginTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_time", endTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort_order", sortOrder));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListRefundsResponse> localVarReturnType = new GenericType<ListRefundsResponse>() {};
return (CompleteResponse<ListRefundsResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListTransactions
* Lists transactions for a particular location. Deprecated - recommend using [SearchOrders](#endpoint-orders-searchorders) Transactions include payment information from sales and exchanges and refund information from returns and exchanges. Max results per [page](#paginatingresults): 50
* @param locationId The ID of the location to list transactions for. (required)
* @param beginTime The beginning of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time minus one year. (optional)
* @param endTime The end of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time. (optional)
* @param sortOrder The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC` (optional)
* @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. See [Paginating results](#paginatingresults) for more information. (optional)
* @return ListTransactionsResponse
* @throws ApiException if fails to make API call
*/
@Deprecated
public ListTransactionsResponse listTransactions(String locationId, String beginTime, String endTime, String sortOrder, String cursor) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listTransactions");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/transactions"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_time", beginTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_time", endTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort_order", sortOrder));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListTransactionsResponse> localVarReturnType = new GenericType<ListTransactionsResponse>() {};
CompleteResponse<ListTransactionsResponse> completeResponse = (CompleteResponse<ListTransactionsResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListTransactions
* Lists transactions for a particular location. Deprecated - recommend using [SearchOrders](#endpoint-orders-searchorders) Transactions include payment information from sales and exchanges and refund information from returns and exchanges. Max results per [page](#paginatingresults): 50
* @param locationId The ID of the location to list transactions for. (required)
* @param beginTime The beginning of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time minus one year. (optional)
* @param endTime The end of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time. (optional)
* @param sortOrder The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC` (optional)
* @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. See [Paginating results](#paginatingresults) for more information. (optional)
* @return CompleteResponse<ListTransactionsResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<ListTransactionsResponse>listTransactionsWithHttpInfo(String locationId, String beginTime, String endTime, String sortOrder, String cursor) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listTransactions");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/transactions"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_time", beginTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_time", endTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort_order", sortOrder));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListTransactionsResponse> localVarReturnType = new GenericType<ListTransactionsResponse>() {};
return (CompleteResponse<ListTransactionsResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RetrieveTransaction
* Retrieves details for a single transaction. Deprecated - recommend using [BatchRetrieveOrders](#endpoint-batchretrieveorders)
* @param locationId The ID of the transaction's associated location. (required)
* @param transactionId The ID of the transaction to retrieve. (required)
* @return RetrieveTransactionResponse
* @throws ApiException if fails to make API call
*/
@Deprecated
public RetrieveTransactionResponse retrieveTransaction(String locationId, String transactionId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling retrieveTransaction");
}
// verify the required parameter 'transactionId' is set
if (transactionId == null) {
throw new ApiException(400, "Missing the required parameter 'transactionId' when calling retrieveTransaction");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/transactions/{transaction_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "transaction_id" + "\\}", apiClient.escapeString(transactionId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RetrieveTransactionResponse> localVarReturnType = new GenericType<RetrieveTransactionResponse>() {};
CompleteResponse<RetrieveTransactionResponse> completeResponse = (CompleteResponse<RetrieveTransactionResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RetrieveTransaction
* Retrieves details for a single transaction. Deprecated - recommend using [BatchRetrieveOrders](#endpoint-batchretrieveorders)
* @param locationId The ID of the transaction's associated location. (required)
* @param transactionId The ID of the transaction to retrieve. (required)
* @return CompleteResponse<RetrieveTransactionResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<RetrieveTransactionResponse>retrieveTransactionWithHttpInfo(String locationId, String transactionId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling retrieveTransaction");
}
// verify the required parameter 'transactionId' is set
if (transactionId == null) {
throw new ApiException(400, "Missing the required parameter 'transactionId' when calling retrieveTransaction");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/transactions/{transaction_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "transaction_id" + "\\}", apiClient.escapeString(transactionId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RetrieveTransactionResponse> localVarReturnType = new GenericType<RetrieveTransactionResponse>() {};
return (CompleteResponse<RetrieveTransactionResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* VoidTransaction
* Cancels a transaction that was created with the [Charge](#endpoint-charge) endpoint with a `delay_capture` value of `true`. See [Delayed capture transactions](/payments/transactions/overview#delayed-capture) for more information.
* @param locationId (required)
* @param transactionId (required)
* @return VoidTransactionResponse
* @throws ApiException if fails to make API call
*/
@Deprecated
public VoidTransactionResponse voidTransaction(String locationId, String transactionId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling voidTransaction");
}
// verify the required parameter 'transactionId' is set
if (transactionId == null) {
throw new ApiException(400, "Missing the required parameter 'transactionId' when calling voidTransaction");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/transactions/{transaction_id}/void"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "transaction_id" + "\\}", apiClient.escapeString(transactionId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<VoidTransactionResponse> localVarReturnType = new GenericType<VoidTransactionResponse>() {};
CompleteResponse<VoidTransactionResponse> completeResponse = (CompleteResponse<VoidTransactionResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* VoidTransaction
* Cancels a transaction that was created with the [Charge](#endpoint-charge) endpoint with a `delay_capture` value of `true`. See [Delayed capture transactions](/payments/transactions/overview#delayed-capture) for more information.
* @param locationId (required)
* @param transactionId (required)
* @return CompleteResponse<VoidTransactionResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<VoidTransactionResponse>voidTransactionWithHttpInfo(String locationId, String transactionId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling voidTransaction");
}
// verify the required parameter 'transactionId' is set
if (transactionId == null) {
throw new ApiException(400, "Missing the required parameter 'transactionId' when calling voidTransaction");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/transactions/{transaction_id}/void"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "transaction_id" + "\\}", apiClient.escapeString(transactionId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<VoidTransactionResponse> localVarReturnType = new GenericType<VoidTransactionResponse>() {};
return (CompleteResponse<VoidTransactionResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}
| 5,136 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/api/ReportingApi.java | package com.squareup.connect.api;
import com.squareup.connect.ApiException;
import com.squareup.connect.ApiClient;
import com.squareup.connect.Configuration;
import com.squareup.connect.Pair;
import com.squareup.connect.CompleteResponse;
import javax.ws.rs.core.GenericType;
import com.squareup.connect.models.ListAdditionalRecipientReceivableRefundsResponse;
import com.squareup.connect.models.ListAdditionalRecipientReceivablesResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ReportingApi {
private ApiClient apiClient;
public ReportingApi() {
this(Configuration.getDefaultApiClient());
}
public ReportingApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* ListAdditionalRecipientReceivableRefunds
* Returns a list of refunded transactions (across all possible originating locations) relating to monies credited to the provided location ID by another Square account using the `additional_recipients` field in a transaction. Max results per [page](#paginatingresults): 50
* @param locationId The ID of the location to list AdditionalRecipientReceivableRefunds for. (required)
* @param beginTime The beginning of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time minus one year. (optional)
* @param endTime The end of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time. (optional)
* @param sortOrder The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC` (optional)
* @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. See [Paginating results](#paginatingresults) for more information. (optional)
* @return ListAdditionalRecipientReceivableRefundsResponse
* @throws ApiException if fails to make API call
*/
@Deprecated
public ListAdditionalRecipientReceivableRefundsResponse listAdditionalRecipientReceivableRefunds(String locationId, String beginTime, String endTime, String sortOrder, String cursor) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listAdditionalRecipientReceivableRefunds");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/additional-recipient-receivable-refunds"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_time", beginTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_time", endTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort_order", sortOrder));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListAdditionalRecipientReceivableRefundsResponse> localVarReturnType = new GenericType<ListAdditionalRecipientReceivableRefundsResponse>() {};
CompleteResponse<ListAdditionalRecipientReceivableRefundsResponse> completeResponse = (CompleteResponse<ListAdditionalRecipientReceivableRefundsResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListAdditionalRecipientReceivableRefunds
* Returns a list of refunded transactions (across all possible originating locations) relating to monies credited to the provided location ID by another Square account using the `additional_recipients` field in a transaction. Max results per [page](#paginatingresults): 50
* @param locationId The ID of the location to list AdditionalRecipientReceivableRefunds for. (required)
* @param beginTime The beginning of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time minus one year. (optional)
* @param endTime The end of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time. (optional)
* @param sortOrder The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC` (optional)
* @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. See [Paginating results](#paginatingresults) for more information. (optional)
* @return CompleteResponse<ListAdditionalRecipientReceivableRefundsResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<ListAdditionalRecipientReceivableRefundsResponse>listAdditionalRecipientReceivableRefundsWithHttpInfo(String locationId, String beginTime, String endTime, String sortOrder, String cursor) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listAdditionalRecipientReceivableRefunds");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/additional-recipient-receivable-refunds"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_time", beginTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_time", endTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort_order", sortOrder));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListAdditionalRecipientReceivableRefundsResponse> localVarReturnType = new GenericType<ListAdditionalRecipientReceivableRefundsResponse>() {};
return (CompleteResponse<ListAdditionalRecipientReceivableRefundsResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListAdditionalRecipientReceivables
* Returns a list of receivables (across all possible sending locations) representing monies credited to the provided location ID by another Square account using the `additional_recipients` field in a transaction. Max results per [page](#paginatingresults): 50
* @param locationId The ID of the location to list AdditionalRecipientReceivables for. (required)
* @param beginTime The beginning of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time minus one year. (optional)
* @param endTime The end of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time. (optional)
* @param sortOrder The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC` (optional)
* @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. See [Paginating results](#paginatingresults) for more information. (optional)
* @return ListAdditionalRecipientReceivablesResponse
* @throws ApiException if fails to make API call
*/
@Deprecated
public ListAdditionalRecipientReceivablesResponse listAdditionalRecipientReceivables(String locationId, String beginTime, String endTime, String sortOrder, String cursor) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listAdditionalRecipientReceivables");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/additional-recipient-receivables"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_time", beginTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_time", endTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort_order", sortOrder));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListAdditionalRecipientReceivablesResponse> localVarReturnType = new GenericType<ListAdditionalRecipientReceivablesResponse>() {};
CompleteResponse<ListAdditionalRecipientReceivablesResponse> completeResponse = (CompleteResponse<ListAdditionalRecipientReceivablesResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListAdditionalRecipientReceivables
* Returns a list of receivables (across all possible sending locations) representing monies credited to the provided location ID by another Square account using the `additional_recipients` field in a transaction. Max results per [page](#paginatingresults): 50
* @param locationId The ID of the location to list AdditionalRecipientReceivables for. (required)
* @param beginTime The beginning of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time minus one year. (optional)
* @param endTime The end of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time. (optional)
* @param sortOrder The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC` (optional)
* @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. See [Paginating results](#paginatingresults) for more information. (optional)
* @return CompleteResponse<ListAdditionalRecipientReceivablesResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<ListAdditionalRecipientReceivablesResponse>listAdditionalRecipientReceivablesWithHttpInfo(String locationId, String beginTime, String endTime, String sortOrder, String cursor) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listAdditionalRecipientReceivables");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/additional-recipient-receivables"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_time", beginTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_time", endTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort_order", sortOrder));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListAdditionalRecipientReceivablesResponse> localVarReturnType = new GenericType<ListAdditionalRecipientReceivablesResponse>() {};
return (CompleteResponse<ListAdditionalRecipientReceivablesResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}
| 5,137 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/api/OrdersApi.java | package com.squareup.connect.api;
import com.squareup.connect.ApiException;
import com.squareup.connect.ApiClient;
import com.squareup.connect.Configuration;
import com.squareup.connect.Pair;
import com.squareup.connect.CompleteResponse;
import javax.ws.rs.core.GenericType;
import com.squareup.connect.models.BatchRetrieveOrdersRequest;
import com.squareup.connect.models.BatchRetrieveOrdersResponse;
import com.squareup.connect.models.CreateOrderRequest;
import com.squareup.connect.models.CreateOrderResponse;
import com.squareup.connect.models.PayOrderRequest;
import com.squareup.connect.models.PayOrderResponse;
import com.squareup.connect.models.SearchOrdersRequest;
import com.squareup.connect.models.SearchOrdersResponse;
import com.squareup.connect.models.UpdateOrderRequest;
import com.squareup.connect.models.UpdateOrderResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class OrdersApi {
private ApiClient apiClient;
public OrdersApi() {
this(Configuration.getDefaultApiClient());
}
public OrdersApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* BatchRetrieveOrders
* Retrieves a set of [Order](#type-order)s by their IDs. If a given Order ID does not exist, the ID is ignored instead of generating an error.
* @param locationId The ID of the orders' associated location. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return BatchRetrieveOrdersResponse
* @throws ApiException if fails to make API call
*/
public BatchRetrieveOrdersResponse batchRetrieveOrders(String locationId, BatchRetrieveOrdersRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling batchRetrieveOrders");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling batchRetrieveOrders");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/orders/batch-retrieve"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<BatchRetrieveOrdersResponse> localVarReturnType = new GenericType<BatchRetrieveOrdersResponse>() {};
CompleteResponse<BatchRetrieveOrdersResponse> completeResponse = (CompleteResponse<BatchRetrieveOrdersResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* BatchRetrieveOrders
* Retrieves a set of [Order](#type-order)s by their IDs. If a given Order ID does not exist, the ID is ignored instead of generating an error.
* @param locationId The ID of the orders' associated location. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<BatchRetrieveOrdersResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<BatchRetrieveOrdersResponse>batchRetrieveOrdersWithHttpInfo(String locationId, BatchRetrieveOrdersRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling batchRetrieveOrders");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling batchRetrieveOrders");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/orders/batch-retrieve"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<BatchRetrieveOrdersResponse> localVarReturnType = new GenericType<BatchRetrieveOrdersResponse>() {};
return (CompleteResponse<BatchRetrieveOrdersResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CreateOrder
* Creates a new [Order](#type-order) which can include information on products for purchase and settings to apply to the purchase. To pay for a created order, please refer to the [Pay for Orders](/orders-api/pay-for-orders) guide. You can modify open orders using the [UpdateOrder](#endpoint-orders-updateorder) endpoint. To learn more about the Orders API, see the [Orders API Overview](/orders-api/what-it-does).
* @param locationId The ID of the business location to associate the order with. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CreateOrderResponse
* @throws ApiException if fails to make API call
*/
public CreateOrderResponse createOrder(String locationId, CreateOrderRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createOrder");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createOrder");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/orders"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CreateOrderResponse> localVarReturnType = new GenericType<CreateOrderResponse>() {};
CompleteResponse<CreateOrderResponse> completeResponse = (CompleteResponse<CreateOrderResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateOrder
* Creates a new [Order](#type-order) which can include information on products for purchase and settings to apply to the purchase. To pay for a created order, please refer to the [Pay for Orders](/orders-api/pay-for-orders) guide. You can modify open orders using the [UpdateOrder](#endpoint-orders-updateorder) endpoint. To learn more about the Orders API, see the [Orders API Overview](/orders-api/what-it-does).
* @param locationId The ID of the business location to associate the order with. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<CreateOrderResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<CreateOrderResponse>createOrderWithHttpInfo(String locationId, CreateOrderRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createOrder");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createOrder");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/orders"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CreateOrderResponse> localVarReturnType = new GenericType<CreateOrderResponse>() {};
return (CompleteResponse<CreateOrderResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* PayOrder
* Pay for an [order](#type-order) using one or more approved [payments](#type-payment), or settle an order with a total of `0`. The total of the `payment_ids` listed in the request must be equal to the order total. Orders with a total amount of `0` can be marked as paid by specifying an empty array of `payment_ids` in the request. To be used with PayOrder, a payment must: - Reference the order by specifying the `order_id` when [creating the payment](#endpoint-payments-createpayment). Any approved payments that reference the same `order_id` not specified in the `payment_ids` will be canceled. - Be approved with [delayed capture](/payments-api/take-payments#delayed-capture). Using a delayed capture payment with PayOrder will complete the approved payment. Learn how to [pay for orders with a single payment using the Payments API](/orders-api/pay-for-orders).
* Note: This endpoint is in beta.
* @param orderId The ID of the order being paid. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return PayOrderResponse
* @throws ApiException if fails to make API call
*/
public PayOrderResponse payOrder(String orderId, PayOrderRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'orderId' is set
if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling payOrder");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling payOrder");
}
// create path and map variables
String localVarPath = "/v2/orders/{order_id}/pay"
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<PayOrderResponse> localVarReturnType = new GenericType<PayOrderResponse>() {};
CompleteResponse<PayOrderResponse> completeResponse = (CompleteResponse<PayOrderResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* PayOrder
* Pay for an [order](#type-order) using one or more approved [payments](#type-payment), or settle an order with a total of `0`. The total of the `payment_ids` listed in the request must be equal to the order total. Orders with a total amount of `0` can be marked as paid by specifying an empty array of `payment_ids` in the request. To be used with PayOrder, a payment must: - Reference the order by specifying the `order_id` when [creating the payment](#endpoint-payments-createpayment). Any approved payments that reference the same `order_id` not specified in the `payment_ids` will be canceled. - Be approved with [delayed capture](/payments-api/take-payments#delayed-capture). Using a delayed capture payment with PayOrder will complete the approved payment. Learn how to [pay for orders with a single payment using the Payments API](/orders-api/pay-for-orders).
* @param orderId The ID of the order being paid. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<PayOrderResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<PayOrderResponse>payOrderWithHttpInfo(String orderId, PayOrderRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'orderId' is set
if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling payOrder");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling payOrder");
}
// create path and map variables
String localVarPath = "/v2/orders/{order_id}/pay"
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<PayOrderResponse> localVarReturnType = new GenericType<PayOrderResponse>() {};
return (CompleteResponse<PayOrderResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* SearchOrders
* Search all orders for one or more locations. Orders include all sales, returns, and exchanges regardless of how or when they entered the Square Ecosystem (e.g. Point of Sale, Invoices, Connect APIs, etc). SearchOrders requests need to specify which locations to search and define a [`SearchOrdersQuery`](#type-searchordersquery) object which controls how to sort or filter the results. Your SearchOrdersQuery can: Set filter criteria. Set sort order. Determine whether to return results as complete Order objects, or as [OrderEntry](#type-orderentry) objects. Note that details for orders processed with Square Point of Sale while in offline mode may not be transmitted to Square for up to 72 hours. Offline orders have a `created_at` value that reflects the time the order was created, not the time it was subsequently transmitted to Square.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return SearchOrdersResponse
* @throws ApiException if fails to make API call
*/
public SearchOrdersResponse searchOrders(SearchOrdersRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling searchOrders");
}
// create path and map variables
String localVarPath = "/v2/orders/search";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<SearchOrdersResponse> localVarReturnType = new GenericType<SearchOrdersResponse>() {};
CompleteResponse<SearchOrdersResponse> completeResponse = (CompleteResponse<SearchOrdersResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* SearchOrders
* Search all orders for one or more locations. Orders include all sales, returns, and exchanges regardless of how or when they entered the Square Ecosystem (e.g. Point of Sale, Invoices, Connect APIs, etc). SearchOrders requests need to specify which locations to search and define a [`SearchOrdersQuery`](#type-searchordersquery) object which controls how to sort or filter the results. Your SearchOrdersQuery can: Set filter criteria. Set sort order. Determine whether to return results as complete Order objects, or as [OrderEntry](#type-orderentry) objects. Note that details for orders processed with Square Point of Sale while in offline mode may not be transmitted to Square for up to 72 hours. Offline orders have a `created_at` value that reflects the time the order was created, not the time it was subsequently transmitted to Square.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<SearchOrdersResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<SearchOrdersResponse>searchOrdersWithHttpInfo(SearchOrdersRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling searchOrders");
}
// create path and map variables
String localVarPath = "/v2/orders/search";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<SearchOrdersResponse> localVarReturnType = new GenericType<SearchOrdersResponse>() {};
return (CompleteResponse<SearchOrdersResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* UpdateOrder
* Updates an open [Order](#type-order) by adding, replacing, or deleting fields. Orders with a `COMPLETED` or `CANCELED` state cannot be updated. An UpdateOrder request requires the following: - The `order_id` in the endpoint path, identifying the order to update. - The latest `version` of the order to update. - The [sparse order](/orders-api/manage-orders#sparse-order-objects) containing only the fields to update and the version the update is being applied to. - If deleting fields, the [dot notation paths](/orders-api/manage-orders#on-dot-notation) identifying fields to clear. To pay for an order, please refer to the [Pay for Orders](/orders-api/pay-for-orders) guide. To learn more about the Orders API, see the [Orders API Overview](/orders-api/what-it-does).
* Note: This endpoint is in beta.
* @param locationId The ID of the order's associated location. (required)
* @param orderId The ID of the order to update. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return UpdateOrderResponse
* @throws ApiException if fails to make API call
*/
public UpdateOrderResponse updateOrder(String locationId, String orderId, UpdateOrderRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling updateOrder");
}
// verify the required parameter 'orderId' is set
if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling updateOrder");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateOrder");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/orders/{order_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<UpdateOrderResponse> localVarReturnType = new GenericType<UpdateOrderResponse>() {};
CompleteResponse<UpdateOrderResponse> completeResponse = (CompleteResponse<UpdateOrderResponse>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* UpdateOrder
* Updates an open [Order](#type-order) by adding, replacing, or deleting fields. Orders with a `COMPLETED` or `CANCELED` state cannot be updated. An UpdateOrder request requires the following: - The `order_id` in the endpoint path, identifying the order to update. - The latest `version` of the order to update. - The [sparse order](/orders-api/manage-orders#sparse-order-objects) containing only the fields to update and the version the update is being applied to. - If deleting fields, the [dot notation paths](/orders-api/manage-orders#on-dot-notation) identifying fields to clear. To pay for an order, please refer to the [Pay for Orders](/orders-api/pay-for-orders) guide. To learn more about the Orders API, see the [Orders API Overview](/orders-api/what-it-does).
* @param locationId The ID of the order's associated location. (required)
* @param orderId The ID of the order to update. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<UpdateOrderResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<UpdateOrderResponse>updateOrderWithHttpInfo(String locationId, String orderId, UpdateOrderRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling updateOrder");
}
// verify the required parameter 'orderId' is set
if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling updateOrder");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateOrder");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/orders/{order_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<UpdateOrderResponse> localVarReturnType = new GenericType<UpdateOrderResponse>() {};
return (CompleteResponse<UpdateOrderResponse>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}
| 5,138 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/api/LaborApi.java | package com.squareup.connect.api;
import com.squareup.connect.ApiException;
import com.squareup.connect.ApiClient;
import com.squareup.connect.Configuration;
import com.squareup.connect.Pair;
import com.squareup.connect.CompleteResponse;
import javax.ws.rs.core.GenericType;
import com.squareup.connect.models.CreateBreakTypeRequest;
import com.squareup.connect.models.CreateBreakTypeResponse;
import com.squareup.connect.models.CreateShiftRequest;
import com.squareup.connect.models.CreateShiftResponse;
import com.squareup.connect.models.DeleteBreakTypeResponse;
import com.squareup.connect.models.DeleteShiftResponse;
import com.squareup.connect.models.GetBreakTypeResponse;
import com.squareup.connect.models.GetEmployeeWageResponse;
import com.squareup.connect.models.GetShiftResponse;
import com.squareup.connect.models.ListBreakTypesResponse;
import com.squareup.connect.models.ListEmployeeWagesResponse;
import com.squareup.connect.models.ListWorkweekConfigsResponse;
import com.squareup.connect.models.SearchShiftsRequest;
import com.squareup.connect.models.SearchShiftsResponse;
import com.squareup.connect.models.UpdateBreakTypeRequest;
import com.squareup.connect.models.UpdateBreakTypeResponse;
import com.squareup.connect.models.UpdateShiftRequest;
import com.squareup.connect.models.UpdateShiftResponse;
import com.squareup.connect.models.UpdateWorkweekConfigRequest;
import com.squareup.connect.models.UpdateWorkweekConfigResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class LaborApi {
private ApiClient apiClient;
public LaborApi() {
this(Configuration.getDefaultApiClient());
}
public LaborApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* CreateBreakType
* Creates a new `BreakType`. A `BreakType` is a template for creating `Break` objects. You must provide the following values in your request to this endpoint: - `location_id` - `break_name` - `expected_duration` - `is_paid` You can only have 3 `BreakType` instances per location. If you attempt to add a 4th `BreakType` for a location, an `INVALID_REQUEST_ERROR` \"Exceeded limit of 3 breaks per location.\" is returned.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CreateBreakTypeResponse
* @throws ApiException if fails to make API call
*/
public CreateBreakTypeResponse createBreakType(CreateBreakTypeRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createBreakType");
}
// create path and map variables
String localVarPath = "/v2/labor/break-types";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CreateBreakTypeResponse> localVarReturnType = new GenericType<CreateBreakTypeResponse>() {};
CompleteResponse<CreateBreakTypeResponse> completeResponse = (CompleteResponse<CreateBreakTypeResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateBreakType
* Creates a new `BreakType`. A `BreakType` is a template for creating `Break` objects. You must provide the following values in your request to this endpoint: - `location_id` - `break_name` - `expected_duration` - `is_paid` You can only have 3 `BreakType` instances per location. If you attempt to add a 4th `BreakType` for a location, an `INVALID_REQUEST_ERROR` \"Exceeded limit of 3 breaks per location.\" is returned.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<CreateBreakTypeResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<CreateBreakTypeResponse>createBreakTypeWithHttpInfo(CreateBreakTypeRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createBreakType");
}
// create path and map variables
String localVarPath = "/v2/labor/break-types";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CreateBreakTypeResponse> localVarReturnType = new GenericType<CreateBreakTypeResponse>() {};
return (CompleteResponse<CreateBreakTypeResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CreateShift
* Creates a new `Shift`. A `Shift` represents a complete work day for a single employee. You must provide the following values in your request to this endpoint: - `location_id` - `employee_id` - `start_at` An attempt to create a new `Shift` can result in a `BAD_REQUEST` error when: - The `status` of the new `Shift` is `OPEN` and the employee has another shift with an `OPEN` status. - The `start_at` date is in the future - the `start_at` or `end_at` overlaps another shift for the same employee - If `Break`s are set in the request, a break `start_at` must not be before the `Shift.start_at`. A break `end_at` must not be after the `Shift.end_at`
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CreateShiftResponse
* @throws ApiException if fails to make API call
*/
public CreateShiftResponse createShift(CreateShiftRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createShift");
}
// create path and map variables
String localVarPath = "/v2/labor/shifts";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CreateShiftResponse> localVarReturnType = new GenericType<CreateShiftResponse>() {};
CompleteResponse<CreateShiftResponse> completeResponse = (CompleteResponse<CreateShiftResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateShift
* Creates a new `Shift`. A `Shift` represents a complete work day for a single employee. You must provide the following values in your request to this endpoint: - `location_id` - `employee_id` - `start_at` An attempt to create a new `Shift` can result in a `BAD_REQUEST` error when: - The `status` of the new `Shift` is `OPEN` and the employee has another shift with an `OPEN` status. - The `start_at` date is in the future - the `start_at` or `end_at` overlaps another shift for the same employee - If `Break`s are set in the request, a break `start_at` must not be before the `Shift.start_at`. A break `end_at` must not be after the `Shift.end_at`
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<CreateShiftResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<CreateShiftResponse>createShiftWithHttpInfo(CreateShiftRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createShift");
}
// create path and map variables
String localVarPath = "/v2/labor/shifts";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CreateShiftResponse> localVarReturnType = new GenericType<CreateShiftResponse>() {};
return (CompleteResponse<CreateShiftResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* DeleteBreakType
* Deletes an existing `BreakType`. A `BreakType` can be deleted even if it is referenced from a `Shift`.
* @param id UUID for the `BreakType` being deleted. (required)
* @return DeleteBreakTypeResponse
* @throws ApiException if fails to make API call
*/
public DeleteBreakTypeResponse deleteBreakType(String id) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling deleteBreakType");
}
// create path and map variables
String localVarPath = "/v2/labor/break-types/{id}"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<DeleteBreakTypeResponse> localVarReturnType = new GenericType<DeleteBreakTypeResponse>() {};
CompleteResponse<DeleteBreakTypeResponse> completeResponse = (CompleteResponse<DeleteBreakTypeResponse>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* DeleteBreakType
* Deletes an existing `BreakType`. A `BreakType` can be deleted even if it is referenced from a `Shift`.
* @param id UUID for the `BreakType` being deleted. (required)
* @return CompleteResponse<DeleteBreakTypeResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<DeleteBreakTypeResponse>deleteBreakTypeWithHttpInfo(String id) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling deleteBreakType");
}
// create path and map variables
String localVarPath = "/v2/labor/break-types/{id}"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<DeleteBreakTypeResponse> localVarReturnType = new GenericType<DeleteBreakTypeResponse>() {};
return (CompleteResponse<DeleteBreakTypeResponse>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* DeleteShift
* Deletes a `Shift`.
* @param id UUID for the `Shift` being deleted. (required)
* @return DeleteShiftResponse
* @throws ApiException if fails to make API call
*/
public DeleteShiftResponse deleteShift(String id) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling deleteShift");
}
// create path and map variables
String localVarPath = "/v2/labor/shifts/{id}"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<DeleteShiftResponse> localVarReturnType = new GenericType<DeleteShiftResponse>() {};
CompleteResponse<DeleteShiftResponse> completeResponse = (CompleteResponse<DeleteShiftResponse>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* DeleteShift
* Deletes a `Shift`.
* @param id UUID for the `Shift` being deleted. (required)
* @return CompleteResponse<DeleteShiftResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<DeleteShiftResponse>deleteShiftWithHttpInfo(String id) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling deleteShift");
}
// create path and map variables
String localVarPath = "/v2/labor/shifts/{id}"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<DeleteShiftResponse> localVarReturnType = new GenericType<DeleteShiftResponse>() {};
return (CompleteResponse<DeleteShiftResponse>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* GetBreakType
* Returns a single `BreakType` specified by id.
* @param id UUID for the `BreakType` being retrieved. (required)
* @return GetBreakTypeResponse
* @throws ApiException if fails to make API call
*/
public GetBreakTypeResponse getBreakType(String id) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling getBreakType");
}
// create path and map variables
String localVarPath = "/v2/labor/break-types/{id}"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<GetBreakTypeResponse> localVarReturnType = new GenericType<GetBreakTypeResponse>() {};
CompleteResponse<GetBreakTypeResponse> completeResponse = (CompleteResponse<GetBreakTypeResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* GetBreakType
* Returns a single `BreakType` specified by id.
* @param id UUID for the `BreakType` being retrieved. (required)
* @return CompleteResponse<GetBreakTypeResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<GetBreakTypeResponse>getBreakTypeWithHttpInfo(String id) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling getBreakType");
}
// create path and map variables
String localVarPath = "/v2/labor/break-types/{id}"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<GetBreakTypeResponse> localVarReturnType = new GenericType<GetBreakTypeResponse>() {};
return (CompleteResponse<GetBreakTypeResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* GetEmployeeWage
* Returns a single `EmployeeWage` specified by id.
* @param id UUID for the `EmployeeWage` being retrieved. (required)
* @return GetEmployeeWageResponse
* @throws ApiException if fails to make API call
*/
public GetEmployeeWageResponse getEmployeeWage(String id) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling getEmployeeWage");
}
// create path and map variables
String localVarPath = "/v2/labor/employee-wages/{id}"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<GetEmployeeWageResponse> localVarReturnType = new GenericType<GetEmployeeWageResponse>() {};
CompleteResponse<GetEmployeeWageResponse> completeResponse = (CompleteResponse<GetEmployeeWageResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* GetEmployeeWage
* Returns a single `EmployeeWage` specified by id.
* @param id UUID for the `EmployeeWage` being retrieved. (required)
* @return CompleteResponse<GetEmployeeWageResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<GetEmployeeWageResponse>getEmployeeWageWithHttpInfo(String id) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling getEmployeeWage");
}
// create path and map variables
String localVarPath = "/v2/labor/employee-wages/{id}"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<GetEmployeeWageResponse> localVarReturnType = new GenericType<GetEmployeeWageResponse>() {};
return (CompleteResponse<GetEmployeeWageResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* GetShift
* Returns a single `Shift` specified by id.
* @param id UUID for the `Shift` being retrieved. (required)
* @return GetShiftResponse
* @throws ApiException if fails to make API call
*/
public GetShiftResponse getShift(String id) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling getShift");
}
// create path and map variables
String localVarPath = "/v2/labor/shifts/{id}"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<GetShiftResponse> localVarReturnType = new GenericType<GetShiftResponse>() {};
CompleteResponse<GetShiftResponse> completeResponse = (CompleteResponse<GetShiftResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* GetShift
* Returns a single `Shift` specified by id.
* @param id UUID for the `Shift` being retrieved. (required)
* @return CompleteResponse<GetShiftResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<GetShiftResponse>getShiftWithHttpInfo(String id) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling getShift");
}
// create path and map variables
String localVarPath = "/v2/labor/shifts/{id}"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<GetShiftResponse> localVarReturnType = new GenericType<GetShiftResponse>() {};
return (CompleteResponse<GetShiftResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListBreakTypes
* Returns a paginated list of `BreakType` instances for a business.
* @param locationId Filter Break Types returned to only those that are associated with the specified location. (optional)
* @param limit Maximum number of Break Types to return per page. Can range between 1 and 200. The default is the maximum at 200. (optional)
* @param cursor Pointer to the next page of Break Type results to fetch. (optional)
* @return ListBreakTypesResponse
* @throws ApiException if fails to make API call
*/
public ListBreakTypesResponse listBreakTypes(String locationId, Integer limit, String cursor) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v2/labor/break-types";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "location_id", locationId));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListBreakTypesResponse> localVarReturnType = new GenericType<ListBreakTypesResponse>() {};
CompleteResponse<ListBreakTypesResponse> completeResponse = (CompleteResponse<ListBreakTypesResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListBreakTypes
* Returns a paginated list of `BreakType` instances for a business.
* @param locationId Filter Break Types returned to only those that are associated with the specified location. (optional)
* @param limit Maximum number of Break Types to return per page. Can range between 1 and 200. The default is the maximum at 200. (optional)
* @param cursor Pointer to the next page of Break Type results to fetch. (optional)
* @return CompleteResponse<ListBreakTypesResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<ListBreakTypesResponse>listBreakTypesWithHttpInfo(String locationId, Integer limit, String cursor) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v2/labor/break-types";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "location_id", locationId));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListBreakTypesResponse> localVarReturnType = new GenericType<ListBreakTypesResponse>() {};
return (CompleteResponse<ListBreakTypesResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListEmployeeWages
* Returns a paginated list of `EmployeeWage` instances for a business.
* @param employeeId Filter wages returned to only those that are associated with the specified employee. (optional)
* @param limit Maximum number of Employee Wages to return per page. Can range between 1 and 200. The default is the maximum at 200. (optional)
* @param cursor Pointer to the next page of Employee Wage results to fetch. (optional)
* @return ListEmployeeWagesResponse
* @throws ApiException if fails to make API call
*/
public ListEmployeeWagesResponse listEmployeeWages(String employeeId, Integer limit, String cursor) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v2/labor/employee-wages";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "employee_id", employeeId));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListEmployeeWagesResponse> localVarReturnType = new GenericType<ListEmployeeWagesResponse>() {};
CompleteResponse<ListEmployeeWagesResponse> completeResponse = (CompleteResponse<ListEmployeeWagesResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListEmployeeWages
* Returns a paginated list of `EmployeeWage` instances for a business.
* @param employeeId Filter wages returned to only those that are associated with the specified employee. (optional)
* @param limit Maximum number of Employee Wages to return per page. Can range between 1 and 200. The default is the maximum at 200. (optional)
* @param cursor Pointer to the next page of Employee Wage results to fetch. (optional)
* @return CompleteResponse<ListEmployeeWagesResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<ListEmployeeWagesResponse>listEmployeeWagesWithHttpInfo(String employeeId, Integer limit, String cursor) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v2/labor/employee-wages";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "employee_id", employeeId));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListEmployeeWagesResponse> localVarReturnType = new GenericType<ListEmployeeWagesResponse>() {};
return (CompleteResponse<ListEmployeeWagesResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListWorkweekConfigs
* Returns a list of `WorkweekConfig` instances for a business.
* @param limit Maximum number of Workweek Configs to return per page. (optional)
* @param cursor Pointer to the next page of Workweek Config results to fetch. (optional)
* @return ListWorkweekConfigsResponse
* @throws ApiException if fails to make API call
*/
public ListWorkweekConfigsResponse listWorkweekConfigs(Integer limit, String cursor) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v2/labor/workweek-configs";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListWorkweekConfigsResponse> localVarReturnType = new GenericType<ListWorkweekConfigsResponse>() {};
CompleteResponse<ListWorkweekConfigsResponse> completeResponse = (CompleteResponse<ListWorkweekConfigsResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListWorkweekConfigs
* Returns a list of `WorkweekConfig` instances for a business.
* @param limit Maximum number of Workweek Configs to return per page. (optional)
* @param cursor Pointer to the next page of Workweek Config results to fetch. (optional)
* @return CompleteResponse<ListWorkweekConfigsResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<ListWorkweekConfigsResponse>listWorkweekConfigsWithHttpInfo(Integer limit, String cursor) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v2/labor/workweek-configs";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListWorkweekConfigsResponse> localVarReturnType = new GenericType<ListWorkweekConfigsResponse>() {};
return (CompleteResponse<ListWorkweekConfigsResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* SearchShifts
* Returns a paginated list of `Shift` records for a business. The list to be returned can be filtered by: - Location IDs **and** - employee IDs **and** - shift status (`OPEN`, `CLOSED`) **and** - shift start **and** - shift end **and** - work day details The list can be sorted by: - `start_at` - `end_at` - `created_at` - `updated_at`
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return SearchShiftsResponse
* @throws ApiException if fails to make API call
*/
public SearchShiftsResponse searchShifts(SearchShiftsRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling searchShifts");
}
// create path and map variables
String localVarPath = "/v2/labor/shifts/search";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<SearchShiftsResponse> localVarReturnType = new GenericType<SearchShiftsResponse>() {};
CompleteResponse<SearchShiftsResponse> completeResponse = (CompleteResponse<SearchShiftsResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* SearchShifts
* Returns a paginated list of `Shift` records for a business. The list to be returned can be filtered by: - Location IDs **and** - employee IDs **and** - shift status (`OPEN`, `CLOSED`) **and** - shift start **and** - shift end **and** - work day details The list can be sorted by: - `start_at` - `end_at` - `created_at` - `updated_at`
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<SearchShiftsResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<SearchShiftsResponse>searchShiftsWithHttpInfo(SearchShiftsRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling searchShifts");
}
// create path and map variables
String localVarPath = "/v2/labor/shifts/search";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<SearchShiftsResponse> localVarReturnType = new GenericType<SearchShiftsResponse>() {};
return (CompleteResponse<SearchShiftsResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* UpdateBreakType
* Updates an existing `BreakType`.
* @param id UUID for the `BreakType` being updated. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return UpdateBreakTypeResponse
* @throws ApiException if fails to make API call
*/
public UpdateBreakTypeResponse updateBreakType(String id, UpdateBreakTypeRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling updateBreakType");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateBreakType");
}
// create path and map variables
String localVarPath = "/v2/labor/break-types/{id}"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<UpdateBreakTypeResponse> localVarReturnType = new GenericType<UpdateBreakTypeResponse>() {};
CompleteResponse<UpdateBreakTypeResponse> completeResponse = (CompleteResponse<UpdateBreakTypeResponse>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* UpdateBreakType
* Updates an existing `BreakType`.
* @param id UUID for the `BreakType` being updated. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<UpdateBreakTypeResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<UpdateBreakTypeResponse>updateBreakTypeWithHttpInfo(String id, UpdateBreakTypeRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling updateBreakType");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateBreakType");
}
// create path and map variables
String localVarPath = "/v2/labor/break-types/{id}"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<UpdateBreakTypeResponse> localVarReturnType = new GenericType<UpdateBreakTypeResponse>() {};
return (CompleteResponse<UpdateBreakTypeResponse>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* UpdateShift
* Updates an existing `Shift`. When adding a `Break` to a `Shift`, any earlier `Breaks` in the `Shift` have the `end_at` property set to a valid RFC-3339 datetime string. When closing a `Shift`, all `Break` instances in the shift must be complete with `end_at` set on each `Break`.
* @param id ID of the object being updated. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return UpdateShiftResponse
* @throws ApiException if fails to make API call
*/
public UpdateShiftResponse updateShift(String id, UpdateShiftRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling updateShift");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateShift");
}
// create path and map variables
String localVarPath = "/v2/labor/shifts/{id}"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<UpdateShiftResponse> localVarReturnType = new GenericType<UpdateShiftResponse>() {};
CompleteResponse<UpdateShiftResponse> completeResponse = (CompleteResponse<UpdateShiftResponse>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* UpdateShift
* Updates an existing `Shift`. When adding a `Break` to a `Shift`, any earlier `Breaks` in the `Shift` have the `end_at` property set to a valid RFC-3339 datetime string. When closing a `Shift`, all `Break` instances in the shift must be complete with `end_at` set on each `Break`.
* @param id ID of the object being updated. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<UpdateShiftResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<UpdateShiftResponse>updateShiftWithHttpInfo(String id, UpdateShiftRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling updateShift");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateShift");
}
// create path and map variables
String localVarPath = "/v2/labor/shifts/{id}"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<UpdateShiftResponse> localVarReturnType = new GenericType<UpdateShiftResponse>() {};
return (CompleteResponse<UpdateShiftResponse>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* UpdateWorkweekConfig
* Updates a `WorkweekConfig`.
* @param id UUID for the `WorkweekConfig` object being updated. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return UpdateWorkweekConfigResponse
* @throws ApiException if fails to make API call
*/
public UpdateWorkweekConfigResponse updateWorkweekConfig(String id, UpdateWorkweekConfigRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling updateWorkweekConfig");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateWorkweekConfig");
}
// create path and map variables
String localVarPath = "/v2/labor/workweek-configs/{id}"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<UpdateWorkweekConfigResponse> localVarReturnType = new GenericType<UpdateWorkweekConfigResponse>() {};
CompleteResponse<UpdateWorkweekConfigResponse> completeResponse = (CompleteResponse<UpdateWorkweekConfigResponse>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* UpdateWorkweekConfig
* Updates a `WorkweekConfig`.
* @param id UUID for the `WorkweekConfig` object being updated. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<UpdateWorkweekConfigResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<UpdateWorkweekConfigResponse>updateWorkweekConfigWithHttpInfo(String id, UpdateWorkweekConfigRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling updateWorkweekConfig");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateWorkweekConfig");
}
// create path and map variables
String localVarPath = "/v2/labor/workweek-configs/{id}"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<UpdateWorkweekConfigResponse> localVarReturnType = new GenericType<UpdateWorkweekConfigResponse>() {};
return (CompleteResponse<UpdateWorkweekConfigResponse>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}
| 5,139 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/api/ApplePayApi.java | package com.squareup.connect.api;
import com.squareup.connect.ApiException;
import com.squareup.connect.ApiClient;
import com.squareup.connect.Configuration;
import com.squareup.connect.Pair;
import com.squareup.connect.CompleteResponse;
import javax.ws.rs.core.GenericType;
import com.squareup.connect.models.RegisterDomainRequest;
import com.squareup.connect.models.RegisterDomainResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ApplePayApi {
private ApiClient apiClient;
public ApplePayApi() {
this(Configuration.getDefaultApiClient());
}
public ApplePayApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* RegisterDomain
* Activates a domain for use with Web Apple Pay and Square. A validation will be performed on this domain by Apple to ensure is it properly set up as an Apple Pay enabled domain. This endpoint provides an easy way for platform developers to bulk activate Web Apple Pay with Square for merchants using their platform. To learn more about Apple Pay on Web see the Apple Pay section in the [Square Payment Form Walkthrough](/docs/payment-form/payment-form-walkthrough).
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return RegisterDomainResponse
* @throws ApiException if fails to make API call
*/
public RegisterDomainResponse registerDomain(RegisterDomainRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling registerDomain");
}
// create path and map variables
String localVarPath = "/v2/apple-pay/domains";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RegisterDomainResponse> localVarReturnType = new GenericType<RegisterDomainResponse>() {};
CompleteResponse<RegisterDomainResponse> completeResponse = (CompleteResponse<RegisterDomainResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RegisterDomain
* Activates a domain for use with Web Apple Pay and Square. A validation will be performed on this domain by Apple to ensure is it properly set up as an Apple Pay enabled domain. This endpoint provides an easy way for platform developers to bulk activate Web Apple Pay with Square for merchants using their platform. To learn more about Apple Pay on Web see the Apple Pay section in the [Square Payment Form Walkthrough](/docs/payment-form/payment-form-walkthrough).
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<RegisterDomainResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<RegisterDomainResponse>registerDomainWithHttpInfo(RegisterDomainRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling registerDomain");
}
// create path and map variables
String localVarPath = "/v2/apple-pay/domains";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RegisterDomainResponse> localVarReturnType = new GenericType<RegisterDomainResponse>() {};
return (CompleteResponse<RegisterDomainResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}
| 5,140 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/api/MerchantsApi.java | package com.squareup.connect.api;
import com.squareup.connect.ApiException;
import com.squareup.connect.ApiClient;
import com.squareup.connect.Configuration;
import com.squareup.connect.Pair;
import com.squareup.connect.CompleteResponse;
import javax.ws.rs.core.GenericType;
import com.squareup.connect.models.ListMerchantsResponse;
import com.squareup.connect.models.RetrieveMerchantResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MerchantsApi {
private ApiClient apiClient;
public MerchantsApi() {
this(Configuration.getDefaultApiClient());
}
public MerchantsApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* ListMerchants
* Returns `Merchant` information for a given access token. If you don't know a `Merchant` ID, you can use this endpoint to retrieve the merchant ID for an access token. You can specify your personal access token to get your own merchant information or specify an OAuth token to get the information for the merchant that granted you access. If you know the merchant ID, you can also use the [RetrieveMerchant](#endpoint-merchants-retrievemerchant) endpoint to get the merchant information.
* @param cursor The cursor generated by the previous response. (optional)
* @return ListMerchantsResponse
* @throws ApiException if fails to make API call
*/
public ListMerchantsResponse listMerchants(Integer cursor) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v2/merchants";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListMerchantsResponse> localVarReturnType = new GenericType<ListMerchantsResponse>() {};
CompleteResponse<ListMerchantsResponse> completeResponse = (CompleteResponse<ListMerchantsResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListMerchants
* Returns `Merchant` information for a given access token. If you don't know a `Merchant` ID, you can use this endpoint to retrieve the merchant ID for an access token. You can specify your personal access token to get your own merchant information or specify an OAuth token to get the information for the merchant that granted you access. If you know the merchant ID, you can also use the [RetrieveMerchant](#endpoint-merchants-retrievemerchant) endpoint to get the merchant information.
* @param cursor The cursor generated by the previous response. (optional)
* @return CompleteResponse<ListMerchantsResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<ListMerchantsResponse>listMerchantsWithHttpInfo(Integer cursor) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v2/merchants";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListMerchantsResponse> localVarReturnType = new GenericType<ListMerchantsResponse>() {};
return (CompleteResponse<ListMerchantsResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RetrieveMerchant
* Retrieve a `Merchant` object for the given `merchant_id`.
* @param merchantId The ID of the merchant to retrieve. (required)
* @return RetrieveMerchantResponse
* @throws ApiException if fails to make API call
*/
public RetrieveMerchantResponse retrieveMerchant(String merchantId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'merchantId' is set
if (merchantId == null) {
throw new ApiException(400, "Missing the required parameter 'merchantId' when calling retrieveMerchant");
}
// create path and map variables
String localVarPath = "/v2/merchants/{merchant_id}"
.replaceAll("\\{" + "merchant_id" + "\\}", apiClient.escapeString(merchantId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RetrieveMerchantResponse> localVarReturnType = new GenericType<RetrieveMerchantResponse>() {};
CompleteResponse<RetrieveMerchantResponse> completeResponse = (CompleteResponse<RetrieveMerchantResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RetrieveMerchant
* Retrieve a `Merchant` object for the given `merchant_id`.
* @param merchantId The ID of the merchant to retrieve. (required)
* @return CompleteResponse<RetrieveMerchantResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<RetrieveMerchantResponse>retrieveMerchantWithHttpInfo(String merchantId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'merchantId' is set
if (merchantId == null) {
throw new ApiException(400, "Missing the required parameter 'merchantId' when calling retrieveMerchant");
}
// create path and map variables
String localVarPath = "/v2/merchants/{merchant_id}"
.replaceAll("\\{" + "merchant_id" + "\\}", apiClient.escapeString(merchantId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RetrieveMerchantResponse> localVarReturnType = new GenericType<RetrieveMerchantResponse>() {};
return (CompleteResponse<RetrieveMerchantResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}
| 5,141 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/api/V1LocationsApi.java | package com.squareup.connect.api;
import com.squareup.connect.ApiException;
import com.squareup.connect.ApiClient;
import com.squareup.connect.Configuration;
import com.squareup.connect.Pair;
import com.squareup.connect.CompleteResponse;
import javax.ws.rs.core.GenericType;
import com.squareup.connect.models.V1Merchant;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class V1LocationsApi {
private ApiClient apiClient;
public V1LocationsApi() {
this(Configuration.getDefaultApiClient());
}
public V1LocationsApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* ListLocations
* Provides details for all business locations associated with a Square account, including the Square-assigned object ID for the location. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-locations) ---
* @return List<V1Merchant>
* @throws ApiException if fails to make API call
*/
@Deprecated
public List<V1Merchant> listLocations() throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/me/locations";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1Merchant>> localVarReturnType = new GenericType<List<V1Merchant>>() {};
CompleteResponse<List<V1Merchant>> completeResponse = (CompleteResponse<List<V1Merchant>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListLocations
* Provides details for all business locations associated with a Square account, including the Square-assigned object ID for the location. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-locations) ---
* @return CompleteResponse<List<V1Merchant>>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<List<V1Merchant>>listLocationsWithHttpInfo() throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/me/locations";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1Merchant>> localVarReturnType = new GenericType<List<V1Merchant>>() {};
return (CompleteResponse<List<V1Merchant>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RetrieveBusiness
* Get the general information for a business. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-locations) ---
* @return V1Merchant
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Merchant retrieveBusiness() throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/me";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Merchant> localVarReturnType = new GenericType<V1Merchant>() {};
CompleteResponse<V1Merchant> completeResponse = (CompleteResponse<V1Merchant>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RetrieveBusiness
* Get the general information for a business. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-locations) ---
* @return CompleteResponse<V1Merchant>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Merchant>retrieveBusinessWithHttpInfo() throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/me";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Merchant> localVarReturnType = new GenericType<V1Merchant>() {};
return (CompleteResponse<V1Merchant>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}
| 5,142 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/api/V1ItemsApi.java | package com.squareup.connect.api;
import com.squareup.connect.ApiException;
import com.squareup.connect.ApiClient;
import com.squareup.connect.Configuration;
import com.squareup.connect.Pair;
import com.squareup.connect.CompleteResponse;
import javax.ws.rs.core.GenericType;
import com.squareup.connect.models.V1AdjustInventoryRequest;
import com.squareup.connect.models.V1Category;
import com.squareup.connect.models.V1Discount;
import com.squareup.connect.models.V1Fee;
import com.squareup.connect.models.V1InventoryEntry;
import com.squareup.connect.models.V1Item;
import com.squareup.connect.models.V1ModifierList;
import com.squareup.connect.models.V1ModifierOption;
import com.squareup.connect.models.V1Page;
import com.squareup.connect.models.V1PageCell;
import com.squareup.connect.models.V1UpdateModifierListRequest;
import com.squareup.connect.models.V1Variation;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class V1ItemsApi {
private ApiClient apiClient;
public V1ItemsApi() {
this(Configuration.getDefaultApiClient());
}
public V1ItemsApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* AdjustInventory
* Adjusts the current available inventory of an item variation. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the item's associated location. (required)
* @param variationId The ID of the variation to adjust inventory information for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1InventoryEntry
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1InventoryEntry adjustInventory(String locationId, String variationId, V1AdjustInventoryRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling adjustInventory");
}
// verify the required parameter 'variationId' is set
if (variationId == null) {
throw new ApiException(400, "Missing the required parameter 'variationId' when calling adjustInventory");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling adjustInventory");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/inventory/{variation_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "variation_id" + "\\}", apiClient.escapeString(variationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1InventoryEntry> localVarReturnType = new GenericType<V1InventoryEntry>() {};
CompleteResponse<V1InventoryEntry> completeResponse = (CompleteResponse<V1InventoryEntry>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* AdjustInventory
* Adjusts the current available inventory of an item variation. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the item's associated location. (required)
* @param variationId The ID of the variation to adjust inventory information for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1InventoryEntry>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1InventoryEntry>adjustInventoryWithHttpInfo(String locationId, String variationId, V1AdjustInventoryRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling adjustInventory");
}
// verify the required parameter 'variationId' is set
if (variationId == null) {
throw new ApiException(400, "Missing the required parameter 'variationId' when calling adjustInventory");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling adjustInventory");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/inventory/{variation_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "variation_id" + "\\}", apiClient.escapeString(variationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1InventoryEntry> localVarReturnType = new GenericType<V1InventoryEntry>() {};
return (CompleteResponse<V1InventoryEntry>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ApplyFee
* Associates a fee with an item so the fee is automatically applied to the item in Square Point of Sale. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the fee's associated location. (required)
* @param itemId The ID of the item to add the fee to. (required)
* @param feeId The ID of the fee to apply. (required)
* @return V1Item
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Item applyFee(String locationId, String itemId, String feeId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling applyFee");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling applyFee");
}
// verify the required parameter 'feeId' is set
if (feeId == null) {
throw new ApiException(400, "Missing the required parameter 'feeId' when calling applyFee");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}/fees/{fee_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()))
.replaceAll("\\{" + "fee_id" + "\\}", apiClient.escapeString(feeId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Item> localVarReturnType = new GenericType<V1Item>() {};
CompleteResponse<V1Item> completeResponse = (CompleteResponse<V1Item>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ApplyFee
* Associates a fee with an item so the fee is automatically applied to the item in Square Point of Sale. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the fee's associated location. (required)
* @param itemId The ID of the item to add the fee to. (required)
* @param feeId The ID of the fee to apply. (required)
* @return CompleteResponse<V1Item>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Item>applyFeeWithHttpInfo(String locationId, String itemId, String feeId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling applyFee");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling applyFee");
}
// verify the required parameter 'feeId' is set
if (feeId == null) {
throw new ApiException(400, "Missing the required parameter 'feeId' when calling applyFee");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}/fees/{fee_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()))
.replaceAll("\\{" + "fee_id" + "\\}", apiClient.escapeString(feeId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Item> localVarReturnType = new GenericType<V1Item>() {};
return (CompleteResponse<V1Item>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ApplyModifierList
* Associates a modifier list with an item so the associated modifier options can be applied to the item. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the item's associated location. (required)
* @param modifierListId The ID of the modifier list to apply. (required)
* @param itemId The ID of the item to add the modifier list to. (required)
* @return V1Item
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Item applyModifierList(String locationId, String modifierListId, String itemId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling applyModifierList");
}
// verify the required parameter 'modifierListId' is set
if (modifierListId == null) {
throw new ApiException(400, "Missing the required parameter 'modifierListId' when calling applyModifierList");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling applyModifierList");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}/modifier-lists/{modifier_list_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "modifier_list_id" + "\\}", apiClient.escapeString(modifierListId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Item> localVarReturnType = new GenericType<V1Item>() {};
CompleteResponse<V1Item> completeResponse = (CompleteResponse<V1Item>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ApplyModifierList
* Associates a modifier list with an item so the associated modifier options can be applied to the item. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the item's associated location. (required)
* @param modifierListId The ID of the modifier list to apply. (required)
* @param itemId The ID of the item to add the modifier list to. (required)
* @return CompleteResponse<V1Item>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Item>applyModifierListWithHttpInfo(String locationId, String modifierListId, String itemId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling applyModifierList");
}
// verify the required parameter 'modifierListId' is set
if (modifierListId == null) {
throw new ApiException(400, "Missing the required parameter 'modifierListId' when calling applyModifierList");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling applyModifierList");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}/modifier-lists/{modifier_list_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "modifier_list_id" + "\\}", apiClient.escapeString(modifierListId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Item> localVarReturnType = new GenericType<V1Item>() {};
return (CompleteResponse<V1Item>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CreateCategory
* Creates an item category. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the location to create an item for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Category
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Category createCategory(String locationId, V1Category body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createCategory");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createCategory");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/categories"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Category> localVarReturnType = new GenericType<V1Category>() {};
CompleteResponse<V1Category> completeResponse = (CompleteResponse<V1Category>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateCategory
* Creates an item category. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the location to create an item for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1Category>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Category>createCategoryWithHttpInfo(String locationId, V1Category body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createCategory");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createCategory");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/categories"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Category> localVarReturnType = new GenericType<V1Category>() {};
return (CompleteResponse<V1Category>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CreateDiscount
* Creates a discount. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the location to create an item for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Discount
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Discount createDiscount(String locationId, V1Discount body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createDiscount");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createDiscount");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/discounts"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Discount> localVarReturnType = new GenericType<V1Discount>() {};
CompleteResponse<V1Discount> completeResponse = (CompleteResponse<V1Discount>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateDiscount
* Creates a discount. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the location to create an item for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1Discount>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Discount>createDiscountWithHttpInfo(String locationId, V1Discount body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createDiscount");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createDiscount");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/discounts"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Discount> localVarReturnType = new GenericType<V1Discount>() {};
return (CompleteResponse<V1Discount>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CreateFee
* Creates a fee (tax). --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the location to create a fee for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Fee
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Fee createFee(String locationId, V1Fee body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createFee");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createFee");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/fees"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Fee> localVarReturnType = new GenericType<V1Fee>() {};
CompleteResponse<V1Fee> completeResponse = (CompleteResponse<V1Fee>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateFee
* Creates a fee (tax). --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the location to create a fee for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1Fee>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Fee>createFeeWithHttpInfo(String locationId, V1Fee body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createFee");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createFee");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/fees"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Fee> localVarReturnType = new GenericType<V1Fee>() {};
return (CompleteResponse<V1Fee>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CreateItem
* Creates an item and at least one variation for it. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) --- Item-related entities include fields you can use to associate them with entities in a non-Square system. When you create an item-related entity, you can optionally specify `id`. This value must be unique among all IDs ever specified for the account, including those specified by other applications. You can never reuse an entity ID. If you do not specify an ID, Square generates one for the entity. Item variations have a `user_data` string that lets you associate arbitrary metadata with the variation. The string cannot exceed 255 characters.
* @param locationId The ID of the location to create an item for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Item
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Item createItem(String locationId, V1Item body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createItem");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createItem");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Item> localVarReturnType = new GenericType<V1Item>() {};
CompleteResponse<V1Item> completeResponse = (CompleteResponse<V1Item>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateItem
* Creates an item and at least one variation for it. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) --- Item-related entities include fields you can use to associate them with entities in a non-Square system. When you create an item-related entity, you can optionally specify `id`. This value must be unique among all IDs ever specified for the account, including those specified by other applications. You can never reuse an entity ID. If you do not specify an ID, Square generates one for the entity. Item variations have a `user_data` string that lets you associate arbitrary metadata with the variation. The string cannot exceed 255 characters.
* @param locationId The ID of the location to create an item for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1Item>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Item>createItemWithHttpInfo(String locationId, V1Item body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createItem");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createItem");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Item> localVarReturnType = new GenericType<V1Item>() {};
return (CompleteResponse<V1Item>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CreateModifierList
* Creates an item modifier list and at least 1 modifier option for it. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the location to create a modifier list for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1ModifierList
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1ModifierList createModifierList(String locationId, V1ModifierList body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createModifierList");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createModifierList");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/modifier-lists"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1ModifierList> localVarReturnType = new GenericType<V1ModifierList>() {};
CompleteResponse<V1ModifierList> completeResponse = (CompleteResponse<V1ModifierList>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateModifierList
* Creates an item modifier list and at least 1 modifier option for it. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the location to create a modifier list for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1ModifierList>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1ModifierList>createModifierListWithHttpInfo(String locationId, V1ModifierList body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createModifierList");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createModifierList");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/modifier-lists"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1ModifierList> localVarReturnType = new GenericType<V1ModifierList>() {};
return (CompleteResponse<V1ModifierList>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CreateModifierOption
* Creates an item modifier option and adds it to a modifier list. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the item's associated location. (required)
* @param modifierListId The ID of the modifier list to edit. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1ModifierOption
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1ModifierOption createModifierOption(String locationId, String modifierListId, V1ModifierOption body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createModifierOption");
}
// verify the required parameter 'modifierListId' is set
if (modifierListId == null) {
throw new ApiException(400, "Missing the required parameter 'modifierListId' when calling createModifierOption");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createModifierOption");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/modifier-lists/{modifier_list_id}/modifier-options"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "modifier_list_id" + "\\}", apiClient.escapeString(modifierListId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1ModifierOption> localVarReturnType = new GenericType<V1ModifierOption>() {};
CompleteResponse<V1ModifierOption> completeResponse = (CompleteResponse<V1ModifierOption>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateModifierOption
* Creates an item modifier option and adds it to a modifier list. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the item's associated location. (required)
* @param modifierListId The ID of the modifier list to edit. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1ModifierOption>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1ModifierOption>createModifierOptionWithHttpInfo(String locationId, String modifierListId, V1ModifierOption body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createModifierOption");
}
// verify the required parameter 'modifierListId' is set
if (modifierListId == null) {
throw new ApiException(400, "Missing the required parameter 'modifierListId' when calling createModifierOption");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createModifierOption");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/modifier-lists/{modifier_list_id}/modifier-options"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "modifier_list_id" + "\\}", apiClient.escapeString(modifierListId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1ModifierOption> localVarReturnType = new GenericType<V1ModifierOption>() {};
return (CompleteResponse<V1ModifierOption>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CreatePage
* Creates a Favorites page in Square Point of Sale. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the location to create an item for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Page
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Page createPage(String locationId, V1Page body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createPage");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createPage");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/pages"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Page> localVarReturnType = new GenericType<V1Page>() {};
CompleteResponse<V1Page> completeResponse = (CompleteResponse<V1Page>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreatePage
* Creates a Favorites page in Square Point of Sale. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the location to create an item for. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1Page>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Page>createPageWithHttpInfo(String locationId, V1Page body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createPage");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createPage");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/pages"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Page> localVarReturnType = new GenericType<V1Page>() {};
return (CompleteResponse<V1Page>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CreateVariation
* Creates an item variation for an existing item. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the item's associated location. (required)
* @param itemId The item's ID. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Variation
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Variation createVariation(String locationId, String itemId, V1Variation body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createVariation");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling createVariation");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createVariation");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}/variations"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Variation> localVarReturnType = new GenericType<V1Variation>() {};
CompleteResponse<V1Variation> completeResponse = (CompleteResponse<V1Variation>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateVariation
* Creates an item variation for an existing item. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the item's associated location. (required)
* @param itemId The item's ID. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1Variation>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Variation>createVariationWithHttpInfo(String locationId, String itemId, V1Variation body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createVariation");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling createVariation");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createVariation");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}/variations"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Variation> localVarReturnType = new GenericType<V1Variation>() {};
return (CompleteResponse<V1Variation>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* DeleteCategory
* Deletes an existing item category. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) --- __DeleteCategory__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteCategoryRequest` object as documented below.
* @param locationId The ID of the item's associated location. (required)
* @param categoryId The ID of the category to delete. (required)
* @return V1Category
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Category deleteCategory(String locationId, String categoryId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling deleteCategory");
}
// verify the required parameter 'categoryId' is set
if (categoryId == null) {
throw new ApiException(400, "Missing the required parameter 'categoryId' when calling deleteCategory");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/categories/{category_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "category_id" + "\\}", apiClient.escapeString(categoryId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Category> localVarReturnType = new GenericType<V1Category>() {};
CompleteResponse<V1Category> completeResponse = (CompleteResponse<V1Category>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* DeleteCategory
* Deletes an existing item category. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) --- __DeleteCategory__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteCategoryRequest` object as documented below.
* @param locationId The ID of the item's associated location. (required)
* @param categoryId The ID of the category to delete. (required)
* @return CompleteResponse<V1Category>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Category>deleteCategoryWithHttpInfo(String locationId, String categoryId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling deleteCategory");
}
// verify the required parameter 'categoryId' is set
if (categoryId == null) {
throw new ApiException(400, "Missing the required parameter 'categoryId' when calling deleteCategory");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/categories/{category_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "category_id" + "\\}", apiClient.escapeString(categoryId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Category> localVarReturnType = new GenericType<V1Category>() {};
return (CompleteResponse<V1Category>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* DeleteDiscount
* Deletes an existing discount. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) --- __DeleteDiscount__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteDiscountRequest` object as documented below.
* @param locationId The ID of the item's associated location. (required)
* @param discountId The ID of the discount to delete. (required)
* @return V1Discount
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Discount deleteDiscount(String locationId, String discountId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling deleteDiscount");
}
// verify the required parameter 'discountId' is set
if (discountId == null) {
throw new ApiException(400, "Missing the required parameter 'discountId' when calling deleteDiscount");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/discounts/{discount_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "discount_id" + "\\}", apiClient.escapeString(discountId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Discount> localVarReturnType = new GenericType<V1Discount>() {};
CompleteResponse<V1Discount> completeResponse = (CompleteResponse<V1Discount>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* DeleteDiscount
* Deletes an existing discount. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) --- __DeleteDiscount__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteDiscountRequest` object as documented below.
* @param locationId The ID of the item's associated location. (required)
* @param discountId The ID of the discount to delete. (required)
* @return CompleteResponse<V1Discount>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Discount>deleteDiscountWithHttpInfo(String locationId, String discountId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling deleteDiscount");
}
// verify the required parameter 'discountId' is set
if (discountId == null) {
throw new ApiException(400, "Missing the required parameter 'discountId' when calling deleteDiscount");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/discounts/{discount_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "discount_id" + "\\}", apiClient.escapeString(discountId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Discount> localVarReturnType = new GenericType<V1Discount>() {};
return (CompleteResponse<V1Discount>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* DeleteFee
* Deletes an existing fee (tax). --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) --- __DeleteFee__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteFeeRequest` object as documented below.
* @param locationId The ID of the fee's associated location. (required)
* @param feeId The ID of the fee to delete. (required)
* @return V1Fee
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Fee deleteFee(String locationId, String feeId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling deleteFee");
}
// verify the required parameter 'feeId' is set
if (feeId == null) {
throw new ApiException(400, "Missing the required parameter 'feeId' when calling deleteFee");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/fees/{fee_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "fee_id" + "\\}", apiClient.escapeString(feeId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Fee> localVarReturnType = new GenericType<V1Fee>() {};
CompleteResponse<V1Fee> completeResponse = (CompleteResponse<V1Fee>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* DeleteFee
* Deletes an existing fee (tax). --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) --- __DeleteFee__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteFeeRequest` object as documented below.
* @param locationId The ID of the fee's associated location. (required)
* @param feeId The ID of the fee to delete. (required)
* @return CompleteResponse<V1Fee>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Fee>deleteFeeWithHttpInfo(String locationId, String feeId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling deleteFee");
}
// verify the required parameter 'feeId' is set
if (feeId == null) {
throw new ApiException(400, "Missing the required parameter 'feeId' when calling deleteFee");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/fees/{fee_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "fee_id" + "\\}", apiClient.escapeString(feeId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Fee> localVarReturnType = new GenericType<V1Fee>() {};
return (CompleteResponse<V1Fee>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* DeleteItem
* Deletes an existing item and all item variations associated with it. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) --- __DeleteItem__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteItemRequest` object as documented below.
* @param locationId The ID of the item's associated location. (required)
* @param itemId The ID of the item to modify. (required)
* @return V1Item
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Item deleteItem(String locationId, String itemId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling deleteItem");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling deleteItem");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Item> localVarReturnType = new GenericType<V1Item>() {};
CompleteResponse<V1Item> completeResponse = (CompleteResponse<V1Item>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* DeleteItem
* Deletes an existing item and all item variations associated with it. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) --- __DeleteItem__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteItemRequest` object as documented below.
* @param locationId The ID of the item's associated location. (required)
* @param itemId The ID of the item to modify. (required)
* @return CompleteResponse<V1Item>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Item>deleteItemWithHttpInfo(String locationId, String itemId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling deleteItem");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling deleteItem");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Item> localVarReturnType = new GenericType<V1Item>() {};
return (CompleteResponse<V1Item>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* DeleteModifierList
* Deletes an existing item modifier list and all modifier options associated with it. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) --- __DeleteModifierList__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteModifierListRequest` object as documented below.
* @param locationId The ID of the item's associated location. (required)
* @param modifierListId The ID of the modifier list to delete. (required)
* @return V1ModifierList
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1ModifierList deleteModifierList(String locationId, String modifierListId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling deleteModifierList");
}
// verify the required parameter 'modifierListId' is set
if (modifierListId == null) {
throw new ApiException(400, "Missing the required parameter 'modifierListId' when calling deleteModifierList");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/modifier-lists/{modifier_list_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "modifier_list_id" + "\\}", apiClient.escapeString(modifierListId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1ModifierList> localVarReturnType = new GenericType<V1ModifierList>() {};
CompleteResponse<V1ModifierList> completeResponse = (CompleteResponse<V1ModifierList>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* DeleteModifierList
* Deletes an existing item modifier list and all modifier options associated with it. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) --- __DeleteModifierList__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteModifierListRequest` object as documented below.
* @param locationId The ID of the item's associated location. (required)
* @param modifierListId The ID of the modifier list to delete. (required)
* @return CompleteResponse<V1ModifierList>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1ModifierList>deleteModifierListWithHttpInfo(String locationId, String modifierListId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling deleteModifierList");
}
// verify the required parameter 'modifierListId' is set
if (modifierListId == null) {
throw new ApiException(400, "Missing the required parameter 'modifierListId' when calling deleteModifierList");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/modifier-lists/{modifier_list_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "modifier_list_id" + "\\}", apiClient.escapeString(modifierListId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1ModifierList> localVarReturnType = new GenericType<V1ModifierList>() {};
return (CompleteResponse<V1ModifierList>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* DeleteModifierOption
* Deletes an existing item modifier option from a modifier list. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) --- __DeleteModifierOption__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteModifierOptionRequest` object.
* @param locationId The ID of the item's associated location. (required)
* @param modifierListId The ID of the modifier list to delete. (required)
* @param modifierOptionId The ID of the modifier list to edit. (required)
* @return V1ModifierOption
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1ModifierOption deleteModifierOption(String locationId, String modifierListId, String modifierOptionId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling deleteModifierOption");
}
// verify the required parameter 'modifierListId' is set
if (modifierListId == null) {
throw new ApiException(400, "Missing the required parameter 'modifierListId' when calling deleteModifierOption");
}
// verify the required parameter 'modifierOptionId' is set
if (modifierOptionId == null) {
throw new ApiException(400, "Missing the required parameter 'modifierOptionId' when calling deleteModifierOption");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/modifier-lists/{modifier_list_id}/modifier-options/{modifier_option_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "modifier_list_id" + "\\}", apiClient.escapeString(modifierListId.toString()))
.replaceAll("\\{" + "modifier_option_id" + "\\}", apiClient.escapeString(modifierOptionId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1ModifierOption> localVarReturnType = new GenericType<V1ModifierOption>() {};
CompleteResponse<V1ModifierOption> completeResponse = (CompleteResponse<V1ModifierOption>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* DeleteModifierOption
* Deletes an existing item modifier option from a modifier list. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) --- __DeleteModifierOption__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteModifierOptionRequest` object.
* @param locationId The ID of the item's associated location. (required)
* @param modifierListId The ID of the modifier list to delete. (required)
* @param modifierOptionId The ID of the modifier list to edit. (required)
* @return CompleteResponse<V1ModifierOption>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1ModifierOption>deleteModifierOptionWithHttpInfo(String locationId, String modifierListId, String modifierOptionId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling deleteModifierOption");
}
// verify the required parameter 'modifierListId' is set
if (modifierListId == null) {
throw new ApiException(400, "Missing the required parameter 'modifierListId' when calling deleteModifierOption");
}
// verify the required parameter 'modifierOptionId' is set
if (modifierOptionId == null) {
throw new ApiException(400, "Missing the required parameter 'modifierOptionId' when calling deleteModifierOption");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/modifier-lists/{modifier_list_id}/modifier-options/{modifier_option_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "modifier_list_id" + "\\}", apiClient.escapeString(modifierListId.toString()))
.replaceAll("\\{" + "modifier_option_id" + "\\}", apiClient.escapeString(modifierOptionId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1ModifierOption> localVarReturnType = new GenericType<V1ModifierOption>() {};
return (CompleteResponse<V1ModifierOption>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* DeletePage
* Deletes an existing Favorites page and all of its cells. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) --- __DeletePage__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeletePageRequest` object.
* @param locationId The ID of the Favorites page's associated location. (required)
* @param pageId The ID of the page to delete. (required)
* @return V1Page
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Page deletePage(String locationId, String pageId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling deletePage");
}
// verify the required parameter 'pageId' is set
if (pageId == null) {
throw new ApiException(400, "Missing the required parameter 'pageId' when calling deletePage");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/pages/{page_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "page_id" + "\\}", apiClient.escapeString(pageId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Page> localVarReturnType = new GenericType<V1Page>() {};
CompleteResponse<V1Page> completeResponse = (CompleteResponse<V1Page>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* DeletePage
* Deletes an existing Favorites page and all of its cells. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) --- __DeletePage__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeletePageRequest` object.
* @param locationId The ID of the Favorites page's associated location. (required)
* @param pageId The ID of the page to delete. (required)
* @return CompleteResponse<V1Page>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Page>deletePageWithHttpInfo(String locationId, String pageId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling deletePage");
}
// verify the required parameter 'pageId' is set
if (pageId == null) {
throw new ApiException(400, "Missing the required parameter 'pageId' when calling deletePage");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/pages/{page_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "page_id" + "\\}", apiClient.escapeString(pageId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Page> localVarReturnType = new GenericType<V1Page>() {};
return (CompleteResponse<V1Page>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* DeletePageCell
* Deletes a cell from a Favorites page in Square Point of Sale. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) --- __DeletePageCell__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeletePageCellRequest` object as documented below.
* @param locationId The ID of the Favorites page's associated location. (required)
* @param pageId The ID of the page to delete. (required)
* @param row The row of the cell to clear. Always an integer between 0 and 4, inclusive. Row 0 is the top row. (optional)
* @param column The column of the cell to clear. Always an integer between 0 and 4, inclusive. Column 0 is the leftmost column. (optional)
* @return V1Page
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Page deletePageCell(String locationId, String pageId, String row, String column) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling deletePageCell");
}
// verify the required parameter 'pageId' is set
if (pageId == null) {
throw new ApiException(400, "Missing the required parameter 'pageId' when calling deletePageCell");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/pages/{page_id}/cells"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "page_id" + "\\}", apiClient.escapeString(pageId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "row", row));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "column", column));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Page> localVarReturnType = new GenericType<V1Page>() {};
CompleteResponse<V1Page> completeResponse = (CompleteResponse<V1Page>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* DeletePageCell
* Deletes a cell from a Favorites page in Square Point of Sale. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) --- __DeletePageCell__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeletePageCellRequest` object as documented below.
* @param locationId The ID of the Favorites page's associated location. (required)
* @param pageId The ID of the page to delete. (required)
* @param row The row of the cell to clear. Always an integer between 0 and 4, inclusive. Row 0 is the top row. (optional)
* @param column The column of the cell to clear. Always an integer between 0 and 4, inclusive. Column 0 is the leftmost column. (optional)
* @return CompleteResponse<V1Page>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Page>deletePageCellWithHttpInfo(String locationId, String pageId, String row, String column) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling deletePageCell");
}
// verify the required parameter 'pageId' is set
if (pageId == null) {
throw new ApiException(400, "Missing the required parameter 'pageId' when calling deletePageCell");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/pages/{page_id}/cells"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "page_id" + "\\}", apiClient.escapeString(pageId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "row", row));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "column", column));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Page> localVarReturnType = new GenericType<V1Page>() {};
return (CompleteResponse<V1Page>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* DeleteVariation
* Deletes an existing item variation from an item. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) --- __DeleteVariation__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteVariationRequest` object as documented below.
* @param locationId The ID of the item's associated location. (required)
* @param itemId The ID of the item to delete. (required)
* @param variationId The ID of the variation to delete. (required)
* @return V1Variation
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Variation deleteVariation(String locationId, String itemId, String variationId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling deleteVariation");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling deleteVariation");
}
// verify the required parameter 'variationId' is set
if (variationId == null) {
throw new ApiException(400, "Missing the required parameter 'variationId' when calling deleteVariation");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}/variations/{variation_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()))
.replaceAll("\\{" + "variation_id" + "\\}", apiClient.escapeString(variationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Variation> localVarReturnType = new GenericType<V1Variation>() {};
CompleteResponse<V1Variation> completeResponse = (CompleteResponse<V1Variation>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* DeleteVariation
* Deletes an existing item variation from an item. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) --- __DeleteVariation__ returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteVariationRequest` object as documented below.
* @param locationId The ID of the item's associated location. (required)
* @param itemId The ID of the item to delete. (required)
* @param variationId The ID of the variation to delete. (required)
* @return CompleteResponse<V1Variation>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Variation>deleteVariationWithHttpInfo(String locationId, String itemId, String variationId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling deleteVariation");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling deleteVariation");
}
// verify the required parameter 'variationId' is set
if (variationId == null) {
throw new ApiException(400, "Missing the required parameter 'variationId' when calling deleteVariation");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}/variations/{variation_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()))
.replaceAll("\\{" + "variation_id" + "\\}", apiClient.escapeString(variationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Variation> localVarReturnType = new GenericType<V1Variation>() {};
return (CompleteResponse<V1Variation>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListCategories
* Lists all the item categories for a given location. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the location to list categories for. (required)
* @return List<V1Category>
* @throws ApiException if fails to make API call
*/
@Deprecated
public List<V1Category> listCategories(String locationId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listCategories");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/categories"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1Category>> localVarReturnType = new GenericType<List<V1Category>>() {};
CompleteResponse<List<V1Category>> completeResponse = (CompleteResponse<List<V1Category>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListCategories
* Lists all the item categories for a given location. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the location to list categories for. (required)
* @return CompleteResponse<List<V1Category>>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<List<V1Category>>listCategoriesWithHttpInfo(String locationId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listCategories");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/categories"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1Category>> localVarReturnType = new GenericType<List<V1Category>>() {};
return (CompleteResponse<List<V1Category>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListDiscounts
* Lists all the discounts for a given location. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the location to list categories for. (required)
* @return List<V1Discount>
* @throws ApiException if fails to make API call
*/
@Deprecated
public List<V1Discount> listDiscounts(String locationId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listDiscounts");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/discounts"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1Discount>> localVarReturnType = new GenericType<List<V1Discount>>() {};
CompleteResponse<List<V1Discount>> completeResponse = (CompleteResponse<List<V1Discount>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListDiscounts
* Lists all the discounts for a given location. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the location to list categories for. (required)
* @return CompleteResponse<List<V1Discount>>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<List<V1Discount>>listDiscountsWithHttpInfo(String locationId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listDiscounts");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/discounts"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1Discount>> localVarReturnType = new GenericType<List<V1Discount>>() {};
return (CompleteResponse<List<V1Discount>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListFees
* Lists all the fees (taxes) for a given location. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the location to list fees for. (required)
* @return List<V1Fee>
* @throws ApiException if fails to make API call
*/
@Deprecated
public List<V1Fee> listFees(String locationId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listFees");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/fees"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1Fee>> localVarReturnType = new GenericType<List<V1Fee>>() {};
CompleteResponse<List<V1Fee>> completeResponse = (CompleteResponse<List<V1Fee>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListFees
* Lists all the fees (taxes) for a given location. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the location to list fees for. (required)
* @return CompleteResponse<List<V1Fee>>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<List<V1Fee>>listFeesWithHttpInfo(String locationId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listFees");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/fees"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1Fee>> localVarReturnType = new GenericType<List<V1Fee>>() {};
return (CompleteResponse<List<V1Fee>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListInventory
* Provides inventory information for all inventory-enabled item variations. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the item's associated location. (required)
* @param limit The maximum number of inventory entries to return in a single response. This value cannot exceed 1000. (optional)
* @param batchToken A pagination cursor to retrieve the next set of results for your original query to the endpoint. (optional)
* @return List<V1InventoryEntry>
* @throws ApiException if fails to make API call
*/
@Deprecated
public List<V1InventoryEntry> listInventory(String locationId, Integer limit, String batchToken) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listInventory");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/inventory"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "batch_token", batchToken));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1InventoryEntry>> localVarReturnType = new GenericType<List<V1InventoryEntry>>() {};
CompleteResponse<List<V1InventoryEntry>> completeResponse = (CompleteResponse<List<V1InventoryEntry>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListInventory
* Provides inventory information for all inventory-enabled item variations. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the item's associated location. (required)
* @param limit The maximum number of inventory entries to return in a single response. This value cannot exceed 1000. (optional)
* @param batchToken A pagination cursor to retrieve the next set of results for your original query to the endpoint. (optional)
* @return CompleteResponse<List<V1InventoryEntry>>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<List<V1InventoryEntry>>listInventoryWithHttpInfo(String locationId, Integer limit, String batchToken) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listInventory");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/inventory"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "batch_token", batchToken));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1InventoryEntry>> localVarReturnType = new GenericType<List<V1InventoryEntry>>() {};
return (CompleteResponse<List<V1InventoryEntry>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListItems
* Provides summary information of all items for a given location. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the location to list items for. (required)
* @param batchToken A pagination cursor to retrieve the next set of results for your original query to the endpoint. (optional)
* @return List<V1Item>
* @throws ApiException if fails to make API call
*/
@Deprecated
public List<V1Item> listItems(String locationId, String batchToken) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listItems");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "batch_token", batchToken));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1Item>> localVarReturnType = new GenericType<List<V1Item>>() {};
CompleteResponse<List<V1Item>> completeResponse = (CompleteResponse<List<V1Item>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListItems
* Provides summary information of all items for a given location. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the location to list items for. (required)
* @param batchToken A pagination cursor to retrieve the next set of results for your original query to the endpoint. (optional)
* @return CompleteResponse<List<V1Item>>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<List<V1Item>>listItemsWithHttpInfo(String locationId, String batchToken) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listItems");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "batch_token", batchToken));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1Item>> localVarReturnType = new GenericType<List<V1Item>>() {};
return (CompleteResponse<List<V1Item>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListModifierLists
* Lists all the modifier lists for a given location. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the location to list modifier lists for. (required)
* @return List<V1ModifierList>
* @throws ApiException if fails to make API call
*/
@Deprecated
public List<V1ModifierList> listModifierLists(String locationId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listModifierLists");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/modifier-lists"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1ModifierList>> localVarReturnType = new GenericType<List<V1ModifierList>>() {};
CompleteResponse<List<V1ModifierList>> completeResponse = (CompleteResponse<List<V1ModifierList>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListModifierLists
* Lists all the modifier lists for a given location. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the location to list modifier lists for. (required)
* @return CompleteResponse<List<V1ModifierList>>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<List<V1ModifierList>>listModifierListsWithHttpInfo(String locationId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listModifierLists");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/modifier-lists"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1ModifierList>> localVarReturnType = new GenericType<List<V1ModifierList>>() {};
return (CompleteResponse<List<V1ModifierList>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListPages
* Lists all Favorites pages (in Square Point of Sale) for a given location. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the location to list Favorites pages for. (required)
* @return List<V1Page>
* @throws ApiException if fails to make API call
*/
@Deprecated
public List<V1Page> listPages(String locationId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listPages");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/pages"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1Page>> localVarReturnType = new GenericType<List<V1Page>>() {};
CompleteResponse<List<V1Page>> completeResponse = (CompleteResponse<List<V1Page>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListPages
* Lists all Favorites pages (in Square Point of Sale) for a given location. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the location to list Favorites pages for. (required)
* @return CompleteResponse<List<V1Page>>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<List<V1Page>>listPagesWithHttpInfo(String locationId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listPages");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/pages"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1Page>> localVarReturnType = new GenericType<List<V1Page>>() {};
return (CompleteResponse<List<V1Page>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RemoveFee
* Removes a fee assocation from an item so the fee is no longer automatically applied to the item in Square Point of Sale. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the fee's associated location. (required)
* @param itemId The ID of the item to add the fee to. (required)
* @param feeId The ID of the fee to apply. (required)
* @return V1Item
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Item removeFee(String locationId, String itemId, String feeId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling removeFee");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling removeFee");
}
// verify the required parameter 'feeId' is set
if (feeId == null) {
throw new ApiException(400, "Missing the required parameter 'feeId' when calling removeFee");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}/fees/{fee_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()))
.replaceAll("\\{" + "fee_id" + "\\}", apiClient.escapeString(feeId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Item> localVarReturnType = new GenericType<V1Item>() {};
CompleteResponse<V1Item> completeResponse = (CompleteResponse<V1Item>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RemoveFee
* Removes a fee assocation from an item so the fee is no longer automatically applied to the item in Square Point of Sale. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the fee's associated location. (required)
* @param itemId The ID of the item to add the fee to. (required)
* @param feeId The ID of the fee to apply. (required)
* @return CompleteResponse<V1Item>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Item>removeFeeWithHttpInfo(String locationId, String itemId, String feeId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling removeFee");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling removeFee");
}
// verify the required parameter 'feeId' is set
if (feeId == null) {
throw new ApiException(400, "Missing the required parameter 'feeId' when calling removeFee");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}/fees/{fee_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()))
.replaceAll("\\{" + "fee_id" + "\\}", apiClient.escapeString(feeId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Item> localVarReturnType = new GenericType<V1Item>() {};
return (CompleteResponse<V1Item>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RemoveModifierList
* Removes a modifier list association from an item so the modifier options from the list can no longer be applied to the item. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the item's associated location. (required)
* @param modifierListId The ID of the modifier list to remove. (required)
* @param itemId The ID of the item to remove the modifier list from. (required)
* @return V1Item
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Item removeModifierList(String locationId, String modifierListId, String itemId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling removeModifierList");
}
// verify the required parameter 'modifierListId' is set
if (modifierListId == null) {
throw new ApiException(400, "Missing the required parameter 'modifierListId' when calling removeModifierList");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling removeModifierList");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}/modifier-lists/{modifier_list_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "modifier_list_id" + "\\}", apiClient.escapeString(modifierListId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Item> localVarReturnType = new GenericType<V1Item>() {};
CompleteResponse<V1Item> completeResponse = (CompleteResponse<V1Item>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RemoveModifierList
* Removes a modifier list association from an item so the modifier options from the list can no longer be applied to the item. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the item's associated location. (required)
* @param modifierListId The ID of the modifier list to remove. (required)
* @param itemId The ID of the item to remove the modifier list from. (required)
* @return CompleteResponse<V1Item>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Item>removeModifierListWithHttpInfo(String locationId, String modifierListId, String itemId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling removeModifierList");
}
// verify the required parameter 'modifierListId' is set
if (modifierListId == null) {
throw new ApiException(400, "Missing the required parameter 'modifierListId' when calling removeModifierList");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling removeModifierList");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}/modifier-lists/{modifier_list_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "modifier_list_id" + "\\}", apiClient.escapeString(modifierListId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Item> localVarReturnType = new GenericType<V1Item>() {};
return (CompleteResponse<V1Item>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RetrieveItem
* Provides the details for a single item, including associated modifier lists and fees. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the item's associated location. (required)
* @param itemId The item's ID. (required)
* @return V1Item
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Item retrieveItem(String locationId, String itemId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling retrieveItem");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling retrieveItem");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Item> localVarReturnType = new GenericType<V1Item>() {};
CompleteResponse<V1Item> completeResponse = (CompleteResponse<V1Item>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RetrieveItem
* Provides the details for a single item, including associated modifier lists and fees. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the item's associated location. (required)
* @param itemId The item's ID. (required)
* @return CompleteResponse<V1Item>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Item>retrieveItemWithHttpInfo(String locationId, String itemId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling retrieveItem");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling retrieveItem");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Item> localVarReturnType = new GenericType<V1Item>() {};
return (CompleteResponse<V1Item>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RetrieveModifierList
* Provides the details for a single modifier list. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the item's associated location. (required)
* @param modifierListId The modifier list's ID. (required)
* @return V1ModifierList
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1ModifierList retrieveModifierList(String locationId, String modifierListId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling retrieveModifierList");
}
// verify the required parameter 'modifierListId' is set
if (modifierListId == null) {
throw new ApiException(400, "Missing the required parameter 'modifierListId' when calling retrieveModifierList");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/modifier-lists/{modifier_list_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "modifier_list_id" + "\\}", apiClient.escapeString(modifierListId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1ModifierList> localVarReturnType = new GenericType<V1ModifierList>() {};
CompleteResponse<V1ModifierList> completeResponse = (CompleteResponse<V1ModifierList>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RetrieveModifierList
* Provides the details for a single modifier list. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the item's associated location. (required)
* @param modifierListId The modifier list's ID. (required)
* @return CompleteResponse<V1ModifierList>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1ModifierList>retrieveModifierListWithHttpInfo(String locationId, String modifierListId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling retrieveModifierList");
}
// verify the required parameter 'modifierListId' is set
if (modifierListId == null) {
throw new ApiException(400, "Missing the required parameter 'modifierListId' when calling retrieveModifierList");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/modifier-lists/{modifier_list_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "modifier_list_id" + "\\}", apiClient.escapeString(modifierListId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1ModifierList> localVarReturnType = new GenericType<V1ModifierList>() {};
return (CompleteResponse<V1ModifierList>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* UpdateCategory
* Modifies the details of an existing item category. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the category's associated location. (required)
* @param categoryId The ID of the category to edit. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Category
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Category updateCategory(String locationId, String categoryId, V1Category body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling updateCategory");
}
// verify the required parameter 'categoryId' is set
if (categoryId == null) {
throw new ApiException(400, "Missing the required parameter 'categoryId' when calling updateCategory");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateCategory");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/categories/{category_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "category_id" + "\\}", apiClient.escapeString(categoryId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Category> localVarReturnType = new GenericType<V1Category>() {};
CompleteResponse<V1Category> completeResponse = (CompleteResponse<V1Category>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* UpdateCategory
* Modifies the details of an existing item category. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the category's associated location. (required)
* @param categoryId The ID of the category to edit. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1Category>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Category>updateCategoryWithHttpInfo(String locationId, String categoryId, V1Category body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling updateCategory");
}
// verify the required parameter 'categoryId' is set
if (categoryId == null) {
throw new ApiException(400, "Missing the required parameter 'categoryId' when calling updateCategory");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateCategory");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/categories/{category_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "category_id" + "\\}", apiClient.escapeString(categoryId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Category> localVarReturnType = new GenericType<V1Category>() {};
return (CompleteResponse<V1Category>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* UpdateDiscount
* Modifies the details of an existing discount. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the category's associated location. (required)
* @param discountId The ID of the discount to edit. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Discount
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Discount updateDiscount(String locationId, String discountId, V1Discount body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling updateDiscount");
}
// verify the required parameter 'discountId' is set
if (discountId == null) {
throw new ApiException(400, "Missing the required parameter 'discountId' when calling updateDiscount");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateDiscount");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/discounts/{discount_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "discount_id" + "\\}", apiClient.escapeString(discountId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Discount> localVarReturnType = new GenericType<V1Discount>() {};
CompleteResponse<V1Discount> completeResponse = (CompleteResponse<V1Discount>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* UpdateDiscount
* Modifies the details of an existing discount. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the category's associated location. (required)
* @param discountId The ID of the discount to edit. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1Discount>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Discount>updateDiscountWithHttpInfo(String locationId, String discountId, V1Discount body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling updateDiscount");
}
// verify the required parameter 'discountId' is set
if (discountId == null) {
throw new ApiException(400, "Missing the required parameter 'discountId' when calling updateDiscount");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateDiscount");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/discounts/{discount_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "discount_id" + "\\}", apiClient.escapeString(discountId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Discount> localVarReturnType = new GenericType<V1Discount>() {};
return (CompleteResponse<V1Discount>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* UpdateFee
* Modifies the details of an existing fee (tax). --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the fee's associated location. (required)
* @param feeId The ID of the fee to edit. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Fee
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Fee updateFee(String locationId, String feeId, V1Fee body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling updateFee");
}
// verify the required parameter 'feeId' is set
if (feeId == null) {
throw new ApiException(400, "Missing the required parameter 'feeId' when calling updateFee");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateFee");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/fees/{fee_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "fee_id" + "\\}", apiClient.escapeString(feeId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Fee> localVarReturnType = new GenericType<V1Fee>() {};
CompleteResponse<V1Fee> completeResponse = (CompleteResponse<V1Fee>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* UpdateFee
* Modifies the details of an existing fee (tax). --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the fee's associated location. (required)
* @param feeId The ID of the fee to edit. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1Fee>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Fee>updateFeeWithHttpInfo(String locationId, String feeId, V1Fee body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling updateFee");
}
// verify the required parameter 'feeId' is set
if (feeId == null) {
throw new ApiException(400, "Missing the required parameter 'feeId' when calling updateFee");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateFee");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/fees/{fee_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "fee_id" + "\\}", apiClient.escapeString(feeId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Fee> localVarReturnType = new GenericType<V1Fee>() {};
return (CompleteResponse<V1Fee>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* UpdateItem
* Modifies the core details of an existing item. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the item's associated location. (required)
* @param itemId The ID of the item to modify. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Item
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Item updateItem(String locationId, String itemId, V1Item body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling updateItem");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling updateItem");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateItem");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Item> localVarReturnType = new GenericType<V1Item>() {};
CompleteResponse<V1Item> completeResponse = (CompleteResponse<V1Item>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* UpdateItem
* Modifies the core details of an existing item. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the item's associated location. (required)
* @param itemId The ID of the item to modify. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1Item>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Item>updateItemWithHttpInfo(String locationId, String itemId, V1Item body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling updateItem");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling updateItem");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateItem");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Item> localVarReturnType = new GenericType<V1Item>() {};
return (CompleteResponse<V1Item>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* UpdateModifierList
* Modifies the details of an existing item modifier list. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the item's associated location. (required)
* @param modifierListId The ID of the modifier list to edit. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1ModifierList
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1ModifierList updateModifierList(String locationId, String modifierListId, V1UpdateModifierListRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling updateModifierList");
}
// verify the required parameter 'modifierListId' is set
if (modifierListId == null) {
throw new ApiException(400, "Missing the required parameter 'modifierListId' when calling updateModifierList");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateModifierList");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/modifier-lists/{modifier_list_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "modifier_list_id" + "\\}", apiClient.escapeString(modifierListId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1ModifierList> localVarReturnType = new GenericType<V1ModifierList>() {};
CompleteResponse<V1ModifierList> completeResponse = (CompleteResponse<V1ModifierList>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* UpdateModifierList
* Modifies the details of an existing item modifier list. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the item's associated location. (required)
* @param modifierListId The ID of the modifier list to edit. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1ModifierList>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1ModifierList>updateModifierListWithHttpInfo(String locationId, String modifierListId, V1UpdateModifierListRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling updateModifierList");
}
// verify the required parameter 'modifierListId' is set
if (modifierListId == null) {
throw new ApiException(400, "Missing the required parameter 'modifierListId' when calling updateModifierList");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateModifierList");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/modifier-lists/{modifier_list_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "modifier_list_id" + "\\}", apiClient.escapeString(modifierListId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1ModifierList> localVarReturnType = new GenericType<V1ModifierList>() {};
return (CompleteResponse<V1ModifierList>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* UpdateModifierOption
* Modifies the details of an existing item modifier option. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the item's associated location. (required)
* @param modifierListId The ID of the modifier list to edit. (required)
* @param modifierOptionId The ID of the modifier list to edit. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1ModifierOption
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1ModifierOption updateModifierOption(String locationId, String modifierListId, String modifierOptionId, V1ModifierOption body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling updateModifierOption");
}
// verify the required parameter 'modifierListId' is set
if (modifierListId == null) {
throw new ApiException(400, "Missing the required parameter 'modifierListId' when calling updateModifierOption");
}
// verify the required parameter 'modifierOptionId' is set
if (modifierOptionId == null) {
throw new ApiException(400, "Missing the required parameter 'modifierOptionId' when calling updateModifierOption");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateModifierOption");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/modifier-lists/{modifier_list_id}/modifier-options/{modifier_option_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "modifier_list_id" + "\\}", apiClient.escapeString(modifierListId.toString()))
.replaceAll("\\{" + "modifier_option_id" + "\\}", apiClient.escapeString(modifierOptionId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1ModifierOption> localVarReturnType = new GenericType<V1ModifierOption>() {};
CompleteResponse<V1ModifierOption> completeResponse = (CompleteResponse<V1ModifierOption>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* UpdateModifierOption
* Modifies the details of an existing item modifier option. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the item's associated location. (required)
* @param modifierListId The ID of the modifier list to edit. (required)
* @param modifierOptionId The ID of the modifier list to edit. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1ModifierOption>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1ModifierOption>updateModifierOptionWithHttpInfo(String locationId, String modifierListId, String modifierOptionId, V1ModifierOption body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling updateModifierOption");
}
// verify the required parameter 'modifierListId' is set
if (modifierListId == null) {
throw new ApiException(400, "Missing the required parameter 'modifierListId' when calling updateModifierOption");
}
// verify the required parameter 'modifierOptionId' is set
if (modifierOptionId == null) {
throw new ApiException(400, "Missing the required parameter 'modifierOptionId' when calling updateModifierOption");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateModifierOption");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/modifier-lists/{modifier_list_id}/modifier-options/{modifier_option_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "modifier_list_id" + "\\}", apiClient.escapeString(modifierListId.toString()))
.replaceAll("\\{" + "modifier_option_id" + "\\}", apiClient.escapeString(modifierOptionId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1ModifierOption> localVarReturnType = new GenericType<V1ModifierOption>() {};
return (CompleteResponse<V1ModifierOption>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* UpdatePage
* Modifies the details of a Favorites page in Square Point of Sale. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the Favorites page's associated location (required)
* @param pageId The ID of the page to modify. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Page
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Page updatePage(String locationId, String pageId, V1Page body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling updatePage");
}
// verify the required parameter 'pageId' is set
if (pageId == null) {
throw new ApiException(400, "Missing the required parameter 'pageId' when calling updatePage");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updatePage");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/pages/{page_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "page_id" + "\\}", apiClient.escapeString(pageId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Page> localVarReturnType = new GenericType<V1Page>() {};
CompleteResponse<V1Page> completeResponse = (CompleteResponse<V1Page>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* UpdatePage
* Modifies the details of a Favorites page in Square Point of Sale. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the Favorites page's associated location (required)
* @param pageId The ID of the page to modify. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1Page>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Page>updatePageWithHttpInfo(String locationId, String pageId, V1Page body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling updatePage");
}
// verify the required parameter 'pageId' is set
if (pageId == null) {
throw new ApiException(400, "Missing the required parameter 'pageId' when calling updatePage");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updatePage");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/pages/{page_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "page_id" + "\\}", apiClient.escapeString(pageId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Page> localVarReturnType = new GenericType<V1Page>() {};
return (CompleteResponse<V1Page>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* UpdatePageCell
* Modifies a cell of a Favorites page in Square Point of Sale. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the Favorites page's associated location. (required)
* @param pageId The ID of the page the cell belongs to. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Page
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Page updatePageCell(String locationId, String pageId, V1PageCell body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling updatePageCell");
}
// verify the required parameter 'pageId' is set
if (pageId == null) {
throw new ApiException(400, "Missing the required parameter 'pageId' when calling updatePageCell");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updatePageCell");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/pages/{page_id}/cells"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "page_id" + "\\}", apiClient.escapeString(pageId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Page> localVarReturnType = new GenericType<V1Page>() {};
CompleteResponse<V1Page> completeResponse = (CompleteResponse<V1Page>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* UpdatePageCell
* Modifies a cell of a Favorites page in Square Point of Sale. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the Favorites page's associated location. (required)
* @param pageId The ID of the page the cell belongs to. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1Page>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Page>updatePageCellWithHttpInfo(String locationId, String pageId, V1PageCell body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling updatePageCell");
}
// verify the required parameter 'pageId' is set
if (pageId == null) {
throw new ApiException(400, "Missing the required parameter 'pageId' when calling updatePageCell");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updatePageCell");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/pages/{page_id}/cells"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "page_id" + "\\}", apiClient.escapeString(pageId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Page> localVarReturnType = new GenericType<V1Page>() {};
return (CompleteResponse<V1Page>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* UpdateVariation
* Modifies the details of an existing item variation. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the item's associated location. (required)
* @param itemId The ID of the item to modify. (required)
* @param variationId The ID of the variation to modify. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Variation
* @throws ApiException if fails to make API call
*/
@Deprecated
public V1Variation updateVariation(String locationId, String itemId, String variationId, V1Variation body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling updateVariation");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling updateVariation");
}
// verify the required parameter 'variationId' is set
if (variationId == null) {
throw new ApiException(400, "Missing the required parameter 'variationId' when calling updateVariation");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateVariation");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}/variations/{variation_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()))
.replaceAll("\\{" + "variation_id" + "\\}", apiClient.escapeString(variationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Variation> localVarReturnType = new GenericType<V1Variation>() {};
CompleteResponse<V1Variation> completeResponse = (CompleteResponse<V1Variation>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* UpdateVariation
* Modifies the details of an existing item variation. --- - __Deprecation date__: 2019-11-20 - [__Retirement date__](/build-basics/api-lifecycle#deprecated): 2020-11-18 - [Migration guide](/migrate-from-v1/guides/v1-items) ---
* @param locationId The ID of the item's associated location. (required)
* @param itemId The ID of the item to modify. (required)
* @param variationId The ID of the variation to modify. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1Variation>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Variation>updateVariationWithHttpInfo(String locationId, String itemId, String variationId, V1Variation body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling updateVariation");
}
// verify the required parameter 'itemId' is set
if (itemId == null) {
throw new ApiException(400, "Missing the required parameter 'itemId' when calling updateVariation");
}
// verify the required parameter 'variationId' is set
if (variationId == null) {
throw new ApiException(400, "Missing the required parameter 'variationId' when calling updateVariation");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateVariation");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/items/{item_id}/variations/{variation_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "item_id" + "\\}", apiClient.escapeString(itemId.toString()))
.replaceAll("\\{" + "variation_id" + "\\}", apiClient.escapeString(variationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Variation> localVarReturnType = new GenericType<V1Variation>() {};
return (CompleteResponse<V1Variation>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}
| 5,143 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/api/InventoryApi.java | package com.squareup.connect.api;
import com.squareup.connect.ApiException;
import com.squareup.connect.ApiClient;
import com.squareup.connect.Configuration;
import com.squareup.connect.Pair;
import com.squareup.connect.CompleteResponse;
import javax.ws.rs.core.GenericType;
import com.squareup.connect.models.BatchChangeInventoryRequest;
import com.squareup.connect.models.BatchChangeInventoryResponse;
import com.squareup.connect.models.BatchRetrieveInventoryChangesRequest;
import com.squareup.connect.models.BatchRetrieveInventoryChangesResponse;
import com.squareup.connect.models.BatchRetrieveInventoryCountsRequest;
import com.squareup.connect.models.BatchRetrieveInventoryCountsResponse;
import com.squareup.connect.models.RetrieveInventoryAdjustmentResponse;
import com.squareup.connect.models.RetrieveInventoryChangesResponse;
import com.squareup.connect.models.RetrieveInventoryCountResponse;
import com.squareup.connect.models.RetrieveInventoryPhysicalCountResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class InventoryApi {
private ApiClient apiClient;
public InventoryApi() {
this(Configuration.getDefaultApiClient());
}
public InventoryApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* BatchChangeInventory
* Applies adjustments and counts to the provided item quantities. On success: returns the current calculated counts for all objects referenced in the request. On failure: returns a list of related errors.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return BatchChangeInventoryResponse
* @throws ApiException if fails to make API call
*/
public BatchChangeInventoryResponse batchChangeInventory(BatchChangeInventoryRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling batchChangeInventory");
}
// create path and map variables
String localVarPath = "/v2/inventory/batch-change";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<BatchChangeInventoryResponse> localVarReturnType = new GenericType<BatchChangeInventoryResponse>() {};
CompleteResponse<BatchChangeInventoryResponse> completeResponse = (CompleteResponse<BatchChangeInventoryResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* BatchChangeInventory
* Applies adjustments and counts to the provided item quantities. On success: returns the current calculated counts for all objects referenced in the request. On failure: returns a list of related errors.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<BatchChangeInventoryResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<BatchChangeInventoryResponse>batchChangeInventoryWithHttpInfo(BatchChangeInventoryRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling batchChangeInventory");
}
// create path and map variables
String localVarPath = "/v2/inventory/batch-change";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<BatchChangeInventoryResponse> localVarReturnType = new GenericType<BatchChangeInventoryResponse>() {};
return (CompleteResponse<BatchChangeInventoryResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* BatchRetrieveInventoryChanges
* Returns historical physical counts and adjustments based on the provided filter criteria. Results are paginated and sorted in ascending order according their `occurred_at` timestamp (oldest first). BatchRetrieveInventoryChanges is a catch-all query endpoint for queries that cannot be handled by other, simpler endpoints.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return BatchRetrieveInventoryChangesResponse
* @throws ApiException if fails to make API call
*/
public BatchRetrieveInventoryChangesResponse batchRetrieveInventoryChanges(BatchRetrieveInventoryChangesRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling batchRetrieveInventoryChanges");
}
// create path and map variables
String localVarPath = "/v2/inventory/batch-retrieve-changes";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<BatchRetrieveInventoryChangesResponse> localVarReturnType = new GenericType<BatchRetrieveInventoryChangesResponse>() {};
CompleteResponse<BatchRetrieveInventoryChangesResponse> completeResponse = (CompleteResponse<BatchRetrieveInventoryChangesResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* BatchRetrieveInventoryChanges
* Returns historical physical counts and adjustments based on the provided filter criteria. Results are paginated and sorted in ascending order according their `occurred_at` timestamp (oldest first). BatchRetrieveInventoryChanges is a catch-all query endpoint for queries that cannot be handled by other, simpler endpoints.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<BatchRetrieveInventoryChangesResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<BatchRetrieveInventoryChangesResponse>batchRetrieveInventoryChangesWithHttpInfo(BatchRetrieveInventoryChangesRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling batchRetrieveInventoryChanges");
}
// create path and map variables
String localVarPath = "/v2/inventory/batch-retrieve-changes";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<BatchRetrieveInventoryChangesResponse> localVarReturnType = new GenericType<BatchRetrieveInventoryChangesResponse>() {};
return (CompleteResponse<BatchRetrieveInventoryChangesResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* BatchRetrieveInventoryCounts
* Returns current counts for the provided [CatalogObject](#type-catalogobject)s at the requested [Location](#type-location)s. Results are paginated and sorted in descending order according to their `calculated_at` timestamp (newest first). When `updated_after` is specified, only counts that have changed since that time (based on the server timestamp for the most recent change) are returned. This allows clients to perform a \"sync\" operation, for example in response to receiving a Webhook notification.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return BatchRetrieveInventoryCountsResponse
* @throws ApiException if fails to make API call
*/
public BatchRetrieveInventoryCountsResponse batchRetrieveInventoryCounts(BatchRetrieveInventoryCountsRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling batchRetrieveInventoryCounts");
}
// create path and map variables
String localVarPath = "/v2/inventory/batch-retrieve-counts";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<BatchRetrieveInventoryCountsResponse> localVarReturnType = new GenericType<BatchRetrieveInventoryCountsResponse>() {};
CompleteResponse<BatchRetrieveInventoryCountsResponse> completeResponse = (CompleteResponse<BatchRetrieveInventoryCountsResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* BatchRetrieveInventoryCounts
* Returns current counts for the provided [CatalogObject](#type-catalogobject)s at the requested [Location](#type-location)s. Results are paginated and sorted in descending order according to their `calculated_at` timestamp (newest first). When `updated_after` is specified, only counts that have changed since that time (based on the server timestamp for the most recent change) are returned. This allows clients to perform a \"sync\" operation, for example in response to receiving a Webhook notification.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<BatchRetrieveInventoryCountsResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<BatchRetrieveInventoryCountsResponse>batchRetrieveInventoryCountsWithHttpInfo(BatchRetrieveInventoryCountsRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling batchRetrieveInventoryCounts");
}
// create path and map variables
String localVarPath = "/v2/inventory/batch-retrieve-counts";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<BatchRetrieveInventoryCountsResponse> localVarReturnType = new GenericType<BatchRetrieveInventoryCountsResponse>() {};
return (CompleteResponse<BatchRetrieveInventoryCountsResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RetrieveInventoryAdjustment
* Returns the [InventoryAdjustment](#type-inventoryadjustment) object with the provided `adjustment_id`.
* @param adjustmentId ID of the `InventoryAdjustment` to retrieve. (required)
* @return RetrieveInventoryAdjustmentResponse
* @throws ApiException if fails to make API call
*/
public RetrieveInventoryAdjustmentResponse retrieveInventoryAdjustment(String adjustmentId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'adjustmentId' is set
if (adjustmentId == null) {
throw new ApiException(400, "Missing the required parameter 'adjustmentId' when calling retrieveInventoryAdjustment");
}
// create path and map variables
String localVarPath = "/v2/inventory/adjustment/{adjustment_id}"
.replaceAll("\\{" + "adjustment_id" + "\\}", apiClient.escapeString(adjustmentId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RetrieveInventoryAdjustmentResponse> localVarReturnType = new GenericType<RetrieveInventoryAdjustmentResponse>() {};
CompleteResponse<RetrieveInventoryAdjustmentResponse> completeResponse = (CompleteResponse<RetrieveInventoryAdjustmentResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RetrieveInventoryAdjustment
* Returns the [InventoryAdjustment](#type-inventoryadjustment) object with the provided `adjustment_id`.
* @param adjustmentId ID of the `InventoryAdjustment` to retrieve. (required)
* @return CompleteResponse<RetrieveInventoryAdjustmentResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<RetrieveInventoryAdjustmentResponse>retrieveInventoryAdjustmentWithHttpInfo(String adjustmentId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'adjustmentId' is set
if (adjustmentId == null) {
throw new ApiException(400, "Missing the required parameter 'adjustmentId' when calling retrieveInventoryAdjustment");
}
// create path and map variables
String localVarPath = "/v2/inventory/adjustment/{adjustment_id}"
.replaceAll("\\{" + "adjustment_id" + "\\}", apiClient.escapeString(adjustmentId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RetrieveInventoryAdjustmentResponse> localVarReturnType = new GenericType<RetrieveInventoryAdjustmentResponse>() {};
return (CompleteResponse<RetrieveInventoryAdjustmentResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RetrieveInventoryChanges
* Returns a set of physical counts and inventory adjustments for the provided [CatalogObject](#type-catalogobject) at the requested [Location](#type-location)s. Results are paginated and sorted in descending order according to their `occurred_at` timestamp (newest first). There are no limits on how far back the caller can page. This endpoint is useful when displaying recent changes for a specific item. For more sophisticated queries, use a batch endpoint.
* @param catalogObjectId ID of the `CatalogObject` to retrieve. (required)
* @param locationIds The `Location` IDs to look up as a comma-separated list. An empty list queries all locations. (optional)
* @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query. See the [Pagination](https://developer.squareup.com/docs/docs/working-with-apis/pagination) guide for more information. (optional)
* @return RetrieveInventoryChangesResponse
* @throws ApiException if fails to make API call
*/
public RetrieveInventoryChangesResponse retrieveInventoryChanges(String catalogObjectId, String locationIds, String cursor) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'catalogObjectId' is set
if (catalogObjectId == null) {
throw new ApiException(400, "Missing the required parameter 'catalogObjectId' when calling retrieveInventoryChanges");
}
// create path and map variables
String localVarPath = "/v2/inventory/{catalog_object_id}/changes"
.replaceAll("\\{" + "catalog_object_id" + "\\}", apiClient.escapeString(catalogObjectId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "location_ids", locationIds));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RetrieveInventoryChangesResponse> localVarReturnType = new GenericType<RetrieveInventoryChangesResponse>() {};
CompleteResponse<RetrieveInventoryChangesResponse> completeResponse = (CompleteResponse<RetrieveInventoryChangesResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RetrieveInventoryChanges
* Returns a set of physical counts and inventory adjustments for the provided [CatalogObject](#type-catalogobject) at the requested [Location](#type-location)s. Results are paginated and sorted in descending order according to their `occurred_at` timestamp (newest first). There are no limits on how far back the caller can page. This endpoint is useful when displaying recent changes for a specific item. For more sophisticated queries, use a batch endpoint.
* @param catalogObjectId ID of the `CatalogObject` to retrieve. (required)
* @param locationIds The `Location` IDs to look up as a comma-separated list. An empty list queries all locations. (optional)
* @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query. See the [Pagination](https://developer.squareup.com/docs/docs/working-with-apis/pagination) guide for more information. (optional)
* @return CompleteResponse<RetrieveInventoryChangesResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<RetrieveInventoryChangesResponse>retrieveInventoryChangesWithHttpInfo(String catalogObjectId, String locationIds, String cursor) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'catalogObjectId' is set
if (catalogObjectId == null) {
throw new ApiException(400, "Missing the required parameter 'catalogObjectId' when calling retrieveInventoryChanges");
}
// create path and map variables
String localVarPath = "/v2/inventory/{catalog_object_id}/changes"
.replaceAll("\\{" + "catalog_object_id" + "\\}", apiClient.escapeString(catalogObjectId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "location_ids", locationIds));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RetrieveInventoryChangesResponse> localVarReturnType = new GenericType<RetrieveInventoryChangesResponse>() {};
return (CompleteResponse<RetrieveInventoryChangesResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RetrieveInventoryCount
* Retrieves the current calculated stock count for a given [CatalogObject](#type-catalogobject) at a given set of [Location](#type-location)s. Responses are paginated and unsorted. For more sophisticated queries, use a batch endpoint.
* @param catalogObjectId ID of the `CatalogObject` to retrieve. (required)
* @param locationIds The `Location` IDs to look up as a comma-separated list. An empty list queries all locations. (optional)
* @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query. See the [Pagination](https://developer.squareup.com/docs/docs/working-with-apis/pagination) guide for more information. (optional)
* @return RetrieveInventoryCountResponse
* @throws ApiException if fails to make API call
*/
public RetrieveInventoryCountResponse retrieveInventoryCount(String catalogObjectId, String locationIds, String cursor) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'catalogObjectId' is set
if (catalogObjectId == null) {
throw new ApiException(400, "Missing the required parameter 'catalogObjectId' when calling retrieveInventoryCount");
}
// create path and map variables
String localVarPath = "/v2/inventory/{catalog_object_id}"
.replaceAll("\\{" + "catalog_object_id" + "\\}", apiClient.escapeString(catalogObjectId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "location_ids", locationIds));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RetrieveInventoryCountResponse> localVarReturnType = new GenericType<RetrieveInventoryCountResponse>() {};
CompleteResponse<RetrieveInventoryCountResponse> completeResponse = (CompleteResponse<RetrieveInventoryCountResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RetrieveInventoryCount
* Retrieves the current calculated stock count for a given [CatalogObject](#type-catalogobject) at a given set of [Location](#type-location)s. Responses are paginated and unsorted. For more sophisticated queries, use a batch endpoint.
* @param catalogObjectId ID of the `CatalogObject` to retrieve. (required)
* @param locationIds The `Location` IDs to look up as a comma-separated list. An empty list queries all locations. (optional)
* @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query. See the [Pagination](https://developer.squareup.com/docs/docs/working-with-apis/pagination) guide for more information. (optional)
* @return CompleteResponse<RetrieveInventoryCountResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<RetrieveInventoryCountResponse>retrieveInventoryCountWithHttpInfo(String catalogObjectId, String locationIds, String cursor) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'catalogObjectId' is set
if (catalogObjectId == null) {
throw new ApiException(400, "Missing the required parameter 'catalogObjectId' when calling retrieveInventoryCount");
}
// create path and map variables
String localVarPath = "/v2/inventory/{catalog_object_id}"
.replaceAll("\\{" + "catalog_object_id" + "\\}", apiClient.escapeString(catalogObjectId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "location_ids", locationIds));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RetrieveInventoryCountResponse> localVarReturnType = new GenericType<RetrieveInventoryCountResponse>() {};
return (CompleteResponse<RetrieveInventoryCountResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RetrieveInventoryPhysicalCount
* Returns the [InventoryPhysicalCount](#type-inventoryphysicalcount) object with the provided `physical_count_id`.
* @param physicalCountId ID of the `InventoryPhysicalCount` to retrieve. (required)
* @return RetrieveInventoryPhysicalCountResponse
* @throws ApiException if fails to make API call
*/
public RetrieveInventoryPhysicalCountResponse retrieveInventoryPhysicalCount(String physicalCountId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'physicalCountId' is set
if (physicalCountId == null) {
throw new ApiException(400, "Missing the required parameter 'physicalCountId' when calling retrieveInventoryPhysicalCount");
}
// create path and map variables
String localVarPath = "/v2/inventory/physical-count/{physical_count_id}"
.replaceAll("\\{" + "physical_count_id" + "\\}", apiClient.escapeString(physicalCountId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RetrieveInventoryPhysicalCountResponse> localVarReturnType = new GenericType<RetrieveInventoryPhysicalCountResponse>() {};
CompleteResponse<RetrieveInventoryPhysicalCountResponse> completeResponse = (CompleteResponse<RetrieveInventoryPhysicalCountResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RetrieveInventoryPhysicalCount
* Returns the [InventoryPhysicalCount](#type-inventoryphysicalcount) object with the provided `physical_count_id`.
* @param physicalCountId ID of the `InventoryPhysicalCount` to retrieve. (required)
* @return CompleteResponse<RetrieveInventoryPhysicalCountResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<RetrieveInventoryPhysicalCountResponse>retrieveInventoryPhysicalCountWithHttpInfo(String physicalCountId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'physicalCountId' is set
if (physicalCountId == null) {
throw new ApiException(400, "Missing the required parameter 'physicalCountId' when calling retrieveInventoryPhysicalCount");
}
// create path and map variables
String localVarPath = "/v2/inventory/physical-count/{physical_count_id}"
.replaceAll("\\{" + "physical_count_id" + "\\}", apiClient.escapeString(physicalCountId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RetrieveInventoryPhysicalCountResponse> localVarReturnType = new GenericType<RetrieveInventoryPhysicalCountResponse>() {};
return (CompleteResponse<RetrieveInventoryPhysicalCountResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}
| 5,144 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/api/LocationsApi.java | package com.squareup.connect.api;
import com.squareup.connect.ApiException;
import com.squareup.connect.ApiClient;
import com.squareup.connect.Configuration;
import com.squareup.connect.Pair;
import com.squareup.connect.CompleteResponse;
import javax.ws.rs.core.GenericType;
import com.squareup.connect.models.CreateLocationRequest;
import com.squareup.connect.models.CreateLocationResponse;
import com.squareup.connect.models.ListLocationsResponse;
import com.squareup.connect.models.RetrieveLocationResponse;
import com.squareup.connect.models.UpdateLocationRequest;
import com.squareup.connect.models.UpdateLocationResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class LocationsApi {
private ApiClient apiClient;
public LocationsApi() {
this(Configuration.getDefaultApiClient());
}
public LocationsApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* CreateLocation
* Creates a location. For more information about locations, see [Locations API Overview](/locations-api).
* Note: This endpoint is in beta.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CreateLocationResponse
* @throws ApiException if fails to make API call
*/
public CreateLocationResponse createLocation(CreateLocationRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createLocation");
}
// create path and map variables
String localVarPath = "/v2/locations";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CreateLocationResponse> localVarReturnType = new GenericType<CreateLocationResponse>() {};
CompleteResponse<CreateLocationResponse> completeResponse = (CompleteResponse<CreateLocationResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateLocation
* Creates a location. For more information about locations, see [Locations API Overview](/locations-api).
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<CreateLocationResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<CreateLocationResponse>createLocationWithHttpInfo(CreateLocationRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createLocation");
}
// create path and map variables
String localVarPath = "/v2/locations";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CreateLocationResponse> localVarReturnType = new GenericType<CreateLocationResponse>() {};
return (CompleteResponse<CreateLocationResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListLocations
* Provides information of all locations of a business. Most other Connect API endpoints have a required `location_id` path parameter. The `id` field of the [`Location`](#type-location) objects returned by this endpoint correspond to that `location_id` parameter.
* @return ListLocationsResponse
* @throws ApiException if fails to make API call
*/
public ListLocationsResponse listLocations() throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v2/locations";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListLocationsResponse> localVarReturnType = new GenericType<ListLocationsResponse>() {};
CompleteResponse<ListLocationsResponse> completeResponse = (CompleteResponse<ListLocationsResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListLocations
* Provides information of all locations of a business. Most other Connect API endpoints have a required `location_id` path parameter. The `id` field of the [`Location`](#type-location) objects returned by this endpoint correspond to that `location_id` parameter.
* @return CompleteResponse<ListLocationsResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<ListLocationsResponse>listLocationsWithHttpInfo() throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v2/locations";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListLocationsResponse> localVarReturnType = new GenericType<ListLocationsResponse>() {};
return (CompleteResponse<ListLocationsResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RetrieveLocation
* Retrieves details of a location.
* @param locationId The ID of the location to retrieve. (required)
* @return RetrieveLocationResponse
* @throws ApiException if fails to make API call
*/
public RetrieveLocationResponse retrieveLocation(String locationId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling retrieveLocation");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RetrieveLocationResponse> localVarReturnType = new GenericType<RetrieveLocationResponse>() {};
CompleteResponse<RetrieveLocationResponse> completeResponse = (CompleteResponse<RetrieveLocationResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RetrieveLocation
* Retrieves details of a location.
* @param locationId The ID of the location to retrieve. (required)
* @return CompleteResponse<RetrieveLocationResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<RetrieveLocationResponse>retrieveLocationWithHttpInfo(String locationId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling retrieveLocation");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RetrieveLocationResponse> localVarReturnType = new GenericType<RetrieveLocationResponse>() {};
return (CompleteResponse<RetrieveLocationResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* UpdateLocation
* Updates a location.
* Note: This endpoint is in beta.
* @param locationId The ID of the location to update. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return UpdateLocationResponse
* @throws ApiException if fails to make API call
*/
public UpdateLocationResponse updateLocation(String locationId, UpdateLocationRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling updateLocation");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateLocation");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<UpdateLocationResponse> localVarReturnType = new GenericType<UpdateLocationResponse>() {};
CompleteResponse<UpdateLocationResponse> completeResponse = (CompleteResponse<UpdateLocationResponse>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* UpdateLocation
* Updates a location.
* @param locationId The ID of the location to update. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<UpdateLocationResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<UpdateLocationResponse>updateLocationWithHttpInfo(String locationId, UpdateLocationRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling updateLocation");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateLocation");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<UpdateLocationResponse> localVarReturnType = new GenericType<UpdateLocationResponse>() {};
return (CompleteResponse<UpdateLocationResponse>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}
| 5,145 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/api/PaymentsApi.java | package com.squareup.connect.api;
import com.squareup.connect.ApiException;
import com.squareup.connect.ApiClient;
import com.squareup.connect.Configuration;
import com.squareup.connect.Pair;
import com.squareup.connect.CompleteResponse;
import javax.ws.rs.core.GenericType;
import com.squareup.connect.models.CancelPaymentByIdempotencyKeyRequest;
import com.squareup.connect.models.CancelPaymentByIdempotencyKeyResponse;
import com.squareup.connect.models.CancelPaymentResponse;
import com.squareup.connect.models.CompletePaymentResponse;
import com.squareup.connect.models.CreatePaymentRequest;
import com.squareup.connect.models.CreatePaymentResponse;
import com.squareup.connect.models.GetPaymentResponse;
import com.squareup.connect.models.ListPaymentsResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class PaymentsApi {
private ApiClient apiClient;
public PaymentsApi() {
this(Configuration.getDefaultApiClient());
}
public PaymentsApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* CancelPayment
* Cancels (voids) a payment. If you set `autocomplete` to false when creating a payment, you can cancel the payment using this endpoint. For more information, see [Delayed Payments](/payments-api/take-payments#delayed-payments).
* @param paymentId `payment_id` identifying the payment to be canceled. (required)
* @return CancelPaymentResponse
* @throws ApiException if fails to make API call
*/
public CancelPaymentResponse cancelPayment(String paymentId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'paymentId' is set
if (paymentId == null) {
throw new ApiException(400, "Missing the required parameter 'paymentId' when calling cancelPayment");
}
// create path and map variables
String localVarPath = "/v2/payments/{payment_id}/cancel"
.replaceAll("\\{" + "payment_id" + "\\}", apiClient.escapeString(paymentId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CancelPaymentResponse> localVarReturnType = new GenericType<CancelPaymentResponse>() {};
CompleteResponse<CancelPaymentResponse> completeResponse = (CompleteResponse<CancelPaymentResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CancelPayment
* Cancels (voids) a payment. If you set `autocomplete` to false when creating a payment, you can cancel the payment using this endpoint. For more information, see [Delayed Payments](/payments-api/take-payments#delayed-payments).
* @param paymentId `payment_id` identifying the payment to be canceled. (required)
* @return CompleteResponse<CancelPaymentResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<CancelPaymentResponse>cancelPaymentWithHttpInfo(String paymentId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'paymentId' is set
if (paymentId == null) {
throw new ApiException(400, "Missing the required parameter 'paymentId' when calling cancelPayment");
}
// create path and map variables
String localVarPath = "/v2/payments/{payment_id}/cancel"
.replaceAll("\\{" + "payment_id" + "\\}", apiClient.escapeString(paymentId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CancelPaymentResponse> localVarReturnType = new GenericType<CancelPaymentResponse>() {};
return (CompleteResponse<CancelPaymentResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CancelPaymentByIdempotencyKey
* Cancels (voids) a payment identified by the idempotency key that is specified in the request. Use this method when status of a CreatePayment request is unknown. For example, after you send a CreatePayment request a network error occurs and you don't get a response. In this case, you can direct Square to cancel the payment using this endpoint. In the request, you provide the same idempotency key that you provided in your CreatePayment request you want to cancel. After cancelling the payment, you can submit your CreatePayment request again. Note that if no payment with the specified idempotency key is found, no action is taken, the end point returns successfully.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CancelPaymentByIdempotencyKeyResponse
* @throws ApiException if fails to make API call
*/
public CancelPaymentByIdempotencyKeyResponse cancelPaymentByIdempotencyKey(CancelPaymentByIdempotencyKeyRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling cancelPaymentByIdempotencyKey");
}
// create path and map variables
String localVarPath = "/v2/payments/cancel";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CancelPaymentByIdempotencyKeyResponse> localVarReturnType = new GenericType<CancelPaymentByIdempotencyKeyResponse>() {};
CompleteResponse<CancelPaymentByIdempotencyKeyResponse> completeResponse = (CompleteResponse<CancelPaymentByIdempotencyKeyResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CancelPaymentByIdempotencyKey
* Cancels (voids) a payment identified by the idempotency key that is specified in the request. Use this method when status of a CreatePayment request is unknown. For example, after you send a CreatePayment request a network error occurs and you don't get a response. In this case, you can direct Square to cancel the payment using this endpoint. In the request, you provide the same idempotency key that you provided in your CreatePayment request you want to cancel. After cancelling the payment, you can submit your CreatePayment request again. Note that if no payment with the specified idempotency key is found, no action is taken, the end point returns successfully.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<CancelPaymentByIdempotencyKeyResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<CancelPaymentByIdempotencyKeyResponse>cancelPaymentByIdempotencyKeyWithHttpInfo(CancelPaymentByIdempotencyKeyRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling cancelPaymentByIdempotencyKey");
}
// create path and map variables
String localVarPath = "/v2/payments/cancel";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CancelPaymentByIdempotencyKeyResponse> localVarReturnType = new GenericType<CancelPaymentByIdempotencyKeyResponse>() {};
return (CompleteResponse<CancelPaymentByIdempotencyKeyResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CompletePayment
* Completes (captures) a payment. By default, payments are set to complete immediately after they are created. If you set autocomplete to false when creating a payment, you can complete (capture) the payment using this endpoint. For more information, see [Delayed Payments](/payments-api/take-payments#delayed-payments).
* @param paymentId Unique ID identifying the payment to be completed. (required)
* @return CompletePaymentResponse
* @throws ApiException if fails to make API call
*/
public CompletePaymentResponse completePayment(String paymentId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'paymentId' is set
if (paymentId == null) {
throw new ApiException(400, "Missing the required parameter 'paymentId' when calling completePayment");
}
// create path and map variables
String localVarPath = "/v2/payments/{payment_id}/complete"
.replaceAll("\\{" + "payment_id" + "\\}", apiClient.escapeString(paymentId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CompletePaymentResponse> localVarReturnType = new GenericType<CompletePaymentResponse>() {};
CompleteResponse<CompletePaymentResponse> completeResponse = (CompleteResponse<CompletePaymentResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CompletePayment
* Completes (captures) a payment. By default, payments are set to complete immediately after they are created. If you set autocomplete to false when creating a payment, you can complete (capture) the payment using this endpoint. For more information, see [Delayed Payments](/payments-api/take-payments#delayed-payments).
* @param paymentId Unique ID identifying the payment to be completed. (required)
* @return CompleteResponse<CompletePaymentResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<CompletePaymentResponse>completePaymentWithHttpInfo(String paymentId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'paymentId' is set
if (paymentId == null) {
throw new ApiException(400, "Missing the required parameter 'paymentId' when calling completePayment");
}
// create path and map variables
String localVarPath = "/v2/payments/{payment_id}/complete"
.replaceAll("\\{" + "payment_id" + "\\}", apiClient.escapeString(paymentId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CompletePaymentResponse> localVarReturnType = new GenericType<CompletePaymentResponse>() {};
return (CompleteResponse<CompletePaymentResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CreatePayment
* Charges a payment source, for example, a card represented by customer's card on file or a card nonce. In addition to the payment source, the request must also include the amount to accept for the payment. There are several optional parameters that you can include in the request. For example, tip money, whether to autocomplete the payment, or a reference ID to correlate this payment with another system. For more information about these payment options, see [Take Payments](/payments-api/take-payments). The `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required to enable application fees.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CreatePaymentResponse
* @throws ApiException if fails to make API call
*/
public CreatePaymentResponse createPayment(CreatePaymentRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createPayment");
}
// create path and map variables
String localVarPath = "/v2/payments";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CreatePaymentResponse> localVarReturnType = new GenericType<CreatePaymentResponse>() {};
CompleteResponse<CreatePaymentResponse> completeResponse = (CompleteResponse<CreatePaymentResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreatePayment
* Charges a payment source, for example, a card represented by customer's card on file or a card nonce. In addition to the payment source, the request must also include the amount to accept for the payment. There are several optional parameters that you can include in the request. For example, tip money, whether to autocomplete the payment, or a reference ID to correlate this payment with another system. For more information about these payment options, see [Take Payments](/payments-api/take-payments). The `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required to enable application fees.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<CreatePaymentResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<CreatePaymentResponse>createPaymentWithHttpInfo(CreatePaymentRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createPayment");
}
// create path and map variables
String localVarPath = "/v2/payments";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CreatePaymentResponse> localVarReturnType = new GenericType<CreatePaymentResponse>() {};
return (CompleteResponse<CreatePaymentResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* GetPayment
* Retrieves details for a specific Payment.
* @param paymentId Unique ID for the desired `Payment`. (required)
* @return GetPaymentResponse
* @throws ApiException if fails to make API call
*/
public GetPaymentResponse getPayment(String paymentId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'paymentId' is set
if (paymentId == null) {
throw new ApiException(400, "Missing the required parameter 'paymentId' when calling getPayment");
}
// create path and map variables
String localVarPath = "/v2/payments/{payment_id}"
.replaceAll("\\{" + "payment_id" + "\\}", apiClient.escapeString(paymentId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<GetPaymentResponse> localVarReturnType = new GenericType<GetPaymentResponse>() {};
CompleteResponse<GetPaymentResponse> completeResponse = (CompleteResponse<GetPaymentResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* GetPayment
* Retrieves details for a specific Payment.
* @param paymentId Unique ID for the desired `Payment`. (required)
* @return CompleteResponse<GetPaymentResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<GetPaymentResponse>getPaymentWithHttpInfo(String paymentId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'paymentId' is set
if (paymentId == null) {
throw new ApiException(400, "Missing the required parameter 'paymentId' when calling getPayment");
}
// create path and map variables
String localVarPath = "/v2/payments/{payment_id}"
.replaceAll("\\{" + "payment_id" + "\\}", apiClient.escapeString(paymentId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<GetPaymentResponse> localVarReturnType = new GenericType<GetPaymentResponse>() {};
return (CompleteResponse<GetPaymentResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListPayments
* Retrieves a list of payments taken by the account making the request. Max results per page: 100
* @param beginTime Timestamp for the beginning of the reporting period, in RFC 3339 format. Inclusive. Default: The current time minus one year. (optional)
* @param endTime Timestamp for the end of the requested reporting period, in RFC 3339 format. Default: The current time. (optional)
* @param sortOrder The order in which results are listed. - `ASC` - oldest to newest - `DESC` - newest to oldest (default). (optional)
* @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query. See [Pagination](https://developer.squareup.com/docs/basics/api101/pagination) for more information. (optional)
* @param locationId ID of location associated with payment (optional)
* @param total The exact amount in the total_money for a `Payment`. (optional)
* @param last4 The last 4 digits of `Payment` card. (optional)
* @param cardBrand The brand of `Payment` card. For example, `VISA` (optional)
* @return ListPaymentsResponse
* @throws ApiException if fails to make API call
*/
public ListPaymentsResponse listPayments(String beginTime, String endTime, String sortOrder, String cursor, String locationId, Long total, String last4, String cardBrand) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v2/payments";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_time", beginTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_time", endTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort_order", sortOrder));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "location_id", locationId));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "total", total));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "last_4", last4));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "card_brand", cardBrand));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListPaymentsResponse> localVarReturnType = new GenericType<ListPaymentsResponse>() {};
CompleteResponse<ListPaymentsResponse> completeResponse = (CompleteResponse<ListPaymentsResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListPayments
* Retrieves a list of payments taken by the account making the request. Max results per page: 100
* @param beginTime Timestamp for the beginning of the reporting period, in RFC 3339 format. Inclusive. Default: The current time minus one year. (optional)
* @param endTime Timestamp for the end of the requested reporting period, in RFC 3339 format. Default: The current time. (optional)
* @param sortOrder The order in which results are listed. - `ASC` - oldest to newest - `DESC` - newest to oldest (default). (optional)
* @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query. See [Pagination](https://developer.squareup.com/docs/basics/api101/pagination) for more information. (optional)
* @param locationId ID of location associated with payment (optional)
* @param total The exact amount in the total_money for a `Payment`. (optional)
* @param last4 The last 4 digits of `Payment` card. (optional)
* @param cardBrand The brand of `Payment` card. For example, `VISA` (optional)
* @return CompleteResponse<ListPaymentsResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<ListPaymentsResponse>listPaymentsWithHttpInfo(String beginTime, String endTime, String sortOrder, String cursor, String locationId, Long total, String last4, String cardBrand) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v2/payments";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_time", beginTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_time", endTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort_order", sortOrder));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "location_id", locationId));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "total", total));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "last_4", last4));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "card_brand", cardBrand));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListPaymentsResponse> localVarReturnType = new GenericType<ListPaymentsResponse>() {};
return (CompleteResponse<ListPaymentsResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}
| 5,146 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/api/V1TransactionsApi.java | package com.squareup.connect.api;
import com.squareup.connect.ApiException;
import com.squareup.connect.ApiClient;
import com.squareup.connect.Configuration;
import com.squareup.connect.Pair;
import com.squareup.connect.CompleteResponse;
import javax.ws.rs.core.GenericType;
import com.squareup.connect.models.V1BankAccount;
import com.squareup.connect.models.V1CreateRefundRequest;
import com.squareup.connect.models.V1Order;
import com.squareup.connect.models.V1Payment;
import com.squareup.connect.models.V1Refund;
import com.squareup.connect.models.V1Settlement;
import com.squareup.connect.models.V1UpdateOrderRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class V1TransactionsApi {
private ApiClient apiClient;
public V1TransactionsApi() {
this(Configuration.getDefaultApiClient());
}
public V1TransactionsApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* CreateRefund
* Issues a refund for a previously processed payment. You must issue a refund within 60 days of the associated payment. You cannot issue a partial refund for a split tender payment. You must instead issue a full or partial refund for a particular tender, by providing the applicable tender id to the V1CreateRefund endpoint. Issuing a full refund for a split tender payment refunds all tenders associated with the payment. Issuing a refund for a card payment is not reversible. For development purposes, you can create fake cash payments in Square Point of Sale and refund them.
* @param locationId The ID of the original payment's associated location. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Refund
* @throws ApiException if fails to make API call
*/
public V1Refund createRefund(String locationId, V1CreateRefundRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createRefund");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createRefund");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/refunds"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Refund> localVarReturnType = new GenericType<V1Refund>() {};
CompleteResponse<V1Refund> completeResponse = (CompleteResponse<V1Refund>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateRefund
* Issues a refund for a previously processed payment. You must issue a refund within 60 days of the associated payment. You cannot issue a partial refund for a split tender payment. You must instead issue a full or partial refund for a particular tender, by providing the applicable tender id to the V1CreateRefund endpoint. Issuing a full refund for a split tender payment refunds all tenders associated with the payment. Issuing a refund for a card payment is not reversible. For development purposes, you can create fake cash payments in Square Point of Sale and refund them.
* @param locationId The ID of the original payment's associated location. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1Refund>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Refund>createRefundWithHttpInfo(String locationId, V1CreateRefundRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling createRefund");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createRefund");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/refunds"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Refund> localVarReturnType = new GenericType<V1Refund>() {};
return (CompleteResponse<V1Refund>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListBankAccounts
* Provides non-confidential details for all of a location's associated bank accounts. This endpoint does not provide full bank account numbers, and there is no way to obtain a full bank account number with the Connect API.
* @param locationId The ID of the location to list bank accounts for. (required)
* @return List<V1BankAccount>
* @throws ApiException if fails to make API call
*/
public List<V1BankAccount> listBankAccounts(String locationId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listBankAccounts");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/bank-accounts"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1BankAccount>> localVarReturnType = new GenericType<List<V1BankAccount>>() {};
CompleteResponse<List<V1BankAccount>> completeResponse = (CompleteResponse<List<V1BankAccount>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListBankAccounts
* Provides non-confidential details for all of a location's associated bank accounts. This endpoint does not provide full bank account numbers, and there is no way to obtain a full bank account number with the Connect API.
* @param locationId The ID of the location to list bank accounts for. (required)
* @return CompleteResponse<List<V1BankAccount>>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<List<V1BankAccount>>listBankAccountsWithHttpInfo(String locationId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listBankAccounts");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/bank-accounts"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1BankAccount>> localVarReturnType = new GenericType<List<V1BankAccount>>() {};
return (CompleteResponse<List<V1BankAccount>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListOrders
* Provides summary information for a merchant's online store orders.
* @param locationId The ID of the location to list online store orders for. (required)
* @param order TThe order in which payments are listed in the response. (optional)
* @param limit The maximum number of payments to return in a single response. This value cannot exceed 200. (optional)
* @param batchToken A pagination cursor to retrieve the next set of results for your original query to the endpoint. (optional)
* @return List<V1Order>
* @throws ApiException if fails to make API call
*/
public List<V1Order> listOrders(String locationId, String order, Integer limit, String batchToken) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listOrders");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/orders"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "batch_token", batchToken));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1Order>> localVarReturnType = new GenericType<List<V1Order>>() {};
CompleteResponse<List<V1Order>> completeResponse = (CompleteResponse<List<V1Order>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListOrders
* Provides summary information for a merchant's online store orders.
* @param locationId The ID of the location to list online store orders for. (required)
* @param order TThe order in which payments are listed in the response. (optional)
* @param limit The maximum number of payments to return in a single response. This value cannot exceed 200. (optional)
* @param batchToken A pagination cursor to retrieve the next set of results for your original query to the endpoint. (optional)
* @return CompleteResponse<List<V1Order>>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<List<V1Order>>listOrdersWithHttpInfo(String locationId, String order, Integer limit, String batchToken) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listOrders");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/orders"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "batch_token", batchToken));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1Order>> localVarReturnType = new GenericType<List<V1Order>>() {};
return (CompleteResponse<List<V1Order>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListPayments
* Provides summary information for all payments taken for a given Square account during a date range. Date ranges cannot exceed 1 year in length. See Date ranges for details of inclusive and exclusive dates. *Note**: Details for payments processed with Square Point of Sale while in offline mode may not be transmitted to Square for up to 72 hours. Offline payments have a `created_at` value that reflects the time the payment was originally processed, not the time it was subsequently transmitted to Square. Consequently, the ListPayments endpoint might list an offline payment chronologically between online payments that were seen in a previous request.
* @param locationId The ID of the location to list payments for. If you specify me, this endpoint returns payments aggregated from all of the business's locations. (required)
* @param order The order in which payments are listed in the response. (optional)
* @param beginTime The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. (optional)
* @param endTime The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. (optional)
* @param limit The maximum number of payments to return in a single response. This value cannot exceed 200. (optional)
* @param batchToken A pagination cursor to retrieve the next set of results for your original query to the endpoint. (optional)
* @param includePartial Indicates whether or not to include partial payments in the response. Partial payments will have the tenders collected so far, but the itemizations will be empty until the payment is completed. (optional)
* @return List<V1Payment>
* @throws ApiException if fails to make API call
*/
public List<V1Payment> listPayments(String locationId, String order, String beginTime, String endTime, Integer limit, String batchToken, Boolean includePartial) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listPayments");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/payments"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_time", beginTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_time", endTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "batch_token", batchToken));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_partial", includePartial));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1Payment>> localVarReturnType = new GenericType<List<V1Payment>>() {};
CompleteResponse<List<V1Payment>> completeResponse = (CompleteResponse<List<V1Payment>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListPayments
* Provides summary information for all payments taken for a given Square account during a date range. Date ranges cannot exceed 1 year in length. See Date ranges for details of inclusive and exclusive dates. *Note**: Details for payments processed with Square Point of Sale while in offline mode may not be transmitted to Square for up to 72 hours. Offline payments have a `created_at` value that reflects the time the payment was originally processed, not the time it was subsequently transmitted to Square. Consequently, the ListPayments endpoint might list an offline payment chronologically between online payments that were seen in a previous request.
* @param locationId The ID of the location to list payments for. If you specify me, this endpoint returns payments aggregated from all of the business's locations. (required)
* @param order The order in which payments are listed in the response. (optional)
* @param beginTime The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. (optional)
* @param endTime The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. (optional)
* @param limit The maximum number of payments to return in a single response. This value cannot exceed 200. (optional)
* @param batchToken A pagination cursor to retrieve the next set of results for your original query to the endpoint. (optional)
* @param includePartial Indicates whether or not to include partial payments in the response. Partial payments will have the tenders collected so far, but the itemizations will be empty until the payment is completed. (optional)
* @return CompleteResponse<List<V1Payment>>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<List<V1Payment>>listPaymentsWithHttpInfo(String locationId, String order, String beginTime, String endTime, Integer limit, String batchToken, Boolean includePartial) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listPayments");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/payments"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_time", beginTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_time", endTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "batch_token", batchToken));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_partial", includePartial));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1Payment>> localVarReturnType = new GenericType<List<V1Payment>>() {};
return (CompleteResponse<List<V1Payment>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListRefunds
* Provides the details for all refunds initiated by a merchant or any of the merchant's mobile staff during a date range. Date ranges cannot exceed one year in length.
* @param locationId The ID of the location to list refunds for. (required)
* @param order TThe order in which payments are listed in the response. (optional)
* @param beginTime The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. (optional)
* @param endTime The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. (optional)
* @param limit The approximate number of refunds to return in a single response. Default: 100. Max: 200. Response may contain more results than the prescribed limit when refunds are made simultaneously to multiple tenders in a payment or when refunds are generated in an exchange to account for the value of returned goods. (optional)
* @param batchToken A pagination cursor to retrieve the next set of results for your original query to the endpoint. (optional)
* @return List<V1Refund>
* @throws ApiException if fails to make API call
*/
public List<V1Refund> listRefunds(String locationId, String order, String beginTime, String endTime, Integer limit, String batchToken) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listRefunds");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/refunds"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_time", beginTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_time", endTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "batch_token", batchToken));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1Refund>> localVarReturnType = new GenericType<List<V1Refund>>() {};
CompleteResponse<List<V1Refund>> completeResponse = (CompleteResponse<List<V1Refund>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListRefunds
* Provides the details for all refunds initiated by a merchant or any of the merchant's mobile staff during a date range. Date ranges cannot exceed one year in length.
* @param locationId The ID of the location to list refunds for. (required)
* @param order TThe order in which payments are listed in the response. (optional)
* @param beginTime The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. (optional)
* @param endTime The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. (optional)
* @param limit The approximate number of refunds to return in a single response. Default: 100. Max: 200. Response may contain more results than the prescribed limit when refunds are made simultaneously to multiple tenders in a payment or when refunds are generated in an exchange to account for the value of returned goods. (optional)
* @param batchToken A pagination cursor to retrieve the next set of results for your original query to the endpoint. (optional)
* @return CompleteResponse<List<V1Refund>>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<List<V1Refund>>listRefundsWithHttpInfo(String locationId, String order, String beginTime, String endTime, Integer limit, String batchToken) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listRefunds");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/refunds"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_time", beginTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_time", endTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "batch_token", batchToken));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1Refund>> localVarReturnType = new GenericType<List<V1Refund>>() {};
return (CompleteResponse<List<V1Refund>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListSettlements
* Provides summary information for all deposits and withdrawals initiated by Square to a linked bank account during a date range. Date ranges cannot exceed one year in length. *Note**: the ListSettlements endpoint does not provide entry information.
* @param locationId The ID of the location to list settlements for. If you specify me, this endpoint returns payments aggregated from all of the business's locations. (required)
* @param order TThe order in which payments are listed in the response. (optional)
* @param beginTime The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. (optional)
* @param endTime The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. (optional)
* @param limit The maximum number of payments to return in a single response. This value cannot exceed 200. (optional)
* @param status Provide this parameter to retrieve only settlements with a particular status (SENT or FAILED). (optional)
* @param batchToken A pagination cursor to retrieve the next set of results for your original query to the endpoint. (optional)
* @return List<V1Settlement>
* @throws ApiException if fails to make API call
*/
public List<V1Settlement> listSettlements(String locationId, String order, String beginTime, String endTime, Integer limit, String status, String batchToken) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listSettlements");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/settlements"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_time", beginTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_time", endTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "status", status));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "batch_token", batchToken));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1Settlement>> localVarReturnType = new GenericType<List<V1Settlement>>() {};
CompleteResponse<List<V1Settlement>> completeResponse = (CompleteResponse<List<V1Settlement>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListSettlements
* Provides summary information for all deposits and withdrawals initiated by Square to a linked bank account during a date range. Date ranges cannot exceed one year in length. *Note**: the ListSettlements endpoint does not provide entry information.
* @param locationId The ID of the location to list settlements for. If you specify me, this endpoint returns payments aggregated from all of the business's locations. (required)
* @param order TThe order in which payments are listed in the response. (optional)
* @param beginTime The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. (optional)
* @param endTime The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. (optional)
* @param limit The maximum number of payments to return in a single response. This value cannot exceed 200. (optional)
* @param status Provide this parameter to retrieve only settlements with a particular status (SENT or FAILED). (optional)
* @param batchToken A pagination cursor to retrieve the next set of results for your original query to the endpoint. (optional)
* @return CompleteResponse<List<V1Settlement>>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<List<V1Settlement>>listSettlementsWithHttpInfo(String locationId, String order, String beginTime, String endTime, Integer limit, String status, String batchToken) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listSettlements");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/settlements"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_time", beginTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_time", endTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "status", status));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "batch_token", batchToken));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1Settlement>> localVarReturnType = new GenericType<List<V1Settlement>>() {};
return (CompleteResponse<List<V1Settlement>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RetrieveBankAccount
* Provides non-confidential details for a merchant's associated bank account. This endpoint does not provide full bank account numbers, and there is no way to obtain a full bank account number with the Connect API.
* @param locationId The ID of the bank account's associated location. (required)
* @param bankAccountId The bank account's Square-issued ID. You obtain this value from Settlement objects returned. (required)
* @return V1BankAccount
* @throws ApiException if fails to make API call
*/
public V1BankAccount retrieveBankAccount(String locationId, String bankAccountId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling retrieveBankAccount");
}
// verify the required parameter 'bankAccountId' is set
if (bankAccountId == null) {
throw new ApiException(400, "Missing the required parameter 'bankAccountId' when calling retrieveBankAccount");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/bank-accounts/{bank_account_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "bank_account_id" + "\\}", apiClient.escapeString(bankAccountId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1BankAccount> localVarReturnType = new GenericType<V1BankAccount>() {};
CompleteResponse<V1BankAccount> completeResponse = (CompleteResponse<V1BankAccount>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RetrieveBankAccount
* Provides non-confidential details for a merchant's associated bank account. This endpoint does not provide full bank account numbers, and there is no way to obtain a full bank account number with the Connect API.
* @param locationId The ID of the bank account's associated location. (required)
* @param bankAccountId The bank account's Square-issued ID. You obtain this value from Settlement objects returned. (required)
* @return CompleteResponse<V1BankAccount>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1BankAccount>retrieveBankAccountWithHttpInfo(String locationId, String bankAccountId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling retrieveBankAccount");
}
// verify the required parameter 'bankAccountId' is set
if (bankAccountId == null) {
throw new ApiException(400, "Missing the required parameter 'bankAccountId' when calling retrieveBankAccount");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/bank-accounts/{bank_account_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "bank_account_id" + "\\}", apiClient.escapeString(bankAccountId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1BankAccount> localVarReturnType = new GenericType<V1BankAccount>() {};
return (CompleteResponse<V1BankAccount>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RetrieveOrder
* Provides comprehensive information for a single online store order, including the order's history.
* @param locationId The ID of the order's associated location. (required)
* @param orderId The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint (required)
* @return V1Order
* @throws ApiException if fails to make API call
*/
public V1Order retrieveOrder(String locationId, String orderId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling retrieveOrder");
}
// verify the required parameter 'orderId' is set
if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling retrieveOrder");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/orders/{order_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Order> localVarReturnType = new GenericType<V1Order>() {};
CompleteResponse<V1Order> completeResponse = (CompleteResponse<V1Order>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RetrieveOrder
* Provides comprehensive information for a single online store order, including the order's history.
* @param locationId The ID of the order's associated location. (required)
* @param orderId The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint (required)
* @return CompleteResponse<V1Order>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Order>retrieveOrderWithHttpInfo(String locationId, String orderId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling retrieveOrder");
}
// verify the required parameter 'orderId' is set
if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling retrieveOrder");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/orders/{order_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Order> localVarReturnType = new GenericType<V1Order>() {};
return (CompleteResponse<V1Order>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RetrievePayment
* Provides comprehensive information for a single payment.
* @param locationId The ID of the payment's associated location. (required)
* @param paymentId The Square-issued payment ID. payment_id comes from Payment objects returned by the List Payments endpoint, Settlement objects returned by the List Settlements endpoint, or Refund objects returned by the List Refunds endpoint. (required)
* @return V1Payment
* @throws ApiException if fails to make API call
*/
public V1Payment retrievePayment(String locationId, String paymentId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling retrievePayment");
}
// verify the required parameter 'paymentId' is set
if (paymentId == null) {
throw new ApiException(400, "Missing the required parameter 'paymentId' when calling retrievePayment");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/payments/{payment_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "payment_id" + "\\}", apiClient.escapeString(paymentId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Payment> localVarReturnType = new GenericType<V1Payment>() {};
CompleteResponse<V1Payment> completeResponse = (CompleteResponse<V1Payment>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RetrievePayment
* Provides comprehensive information for a single payment.
* @param locationId The ID of the payment's associated location. (required)
* @param paymentId The Square-issued payment ID. payment_id comes from Payment objects returned by the List Payments endpoint, Settlement objects returned by the List Settlements endpoint, or Refund objects returned by the List Refunds endpoint. (required)
* @return CompleteResponse<V1Payment>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Payment>retrievePaymentWithHttpInfo(String locationId, String paymentId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling retrievePayment");
}
// verify the required parameter 'paymentId' is set
if (paymentId == null) {
throw new ApiException(400, "Missing the required parameter 'paymentId' when calling retrievePayment");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/payments/{payment_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "payment_id" + "\\}", apiClient.escapeString(paymentId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Payment> localVarReturnType = new GenericType<V1Payment>() {};
return (CompleteResponse<V1Payment>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RetrieveSettlement
* Provides comprehensive information for a single settlement. The returned `Settlement` objects include an `entries` field that lists the transactions that contribute to the settlement total. Most settlement entries correspond to a payment payout, but settlement entries are also generated for less common events, like refunds, manual adjustments, or chargeback holds. Square initiates its regular deposits as indicated in the [Deposit Options with Square](https://squareup.com/help/us/en/article/3807) help article. Details for a regular deposit are usually not available from Connect API endpoints before 10 p.m. PST the same day. Square does not know when an initiated settlement **completes**, only whether it has failed. A completed settlement is typically reflected in a bank account within 3 business days, but in exceptional cases it may take longer.
* @param locationId The ID of the settlements's associated location. (required)
* @param settlementId The settlement's Square-issued ID. You obtain this value from Settlement objects returned by the List Settlements endpoint. (required)
* @return V1Settlement
* @throws ApiException if fails to make API call
*/
public V1Settlement retrieveSettlement(String locationId, String settlementId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling retrieveSettlement");
}
// verify the required parameter 'settlementId' is set
if (settlementId == null) {
throw new ApiException(400, "Missing the required parameter 'settlementId' when calling retrieveSettlement");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/settlements/{settlement_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "settlement_id" + "\\}", apiClient.escapeString(settlementId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Settlement> localVarReturnType = new GenericType<V1Settlement>() {};
CompleteResponse<V1Settlement> completeResponse = (CompleteResponse<V1Settlement>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RetrieveSettlement
* Provides comprehensive information for a single settlement. The returned `Settlement` objects include an `entries` field that lists the transactions that contribute to the settlement total. Most settlement entries correspond to a payment payout, but settlement entries are also generated for less common events, like refunds, manual adjustments, or chargeback holds. Square initiates its regular deposits as indicated in the [Deposit Options with Square](https://squareup.com/help/us/en/article/3807) help article. Details for a regular deposit are usually not available from Connect API endpoints before 10 p.m. PST the same day. Square does not know when an initiated settlement **completes**, only whether it has failed. A completed settlement is typically reflected in a bank account within 3 business days, but in exceptional cases it may take longer.
* @param locationId The ID of the settlements's associated location. (required)
* @param settlementId The settlement's Square-issued ID. You obtain this value from Settlement objects returned by the List Settlements endpoint. (required)
* @return CompleteResponse<V1Settlement>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Settlement>retrieveSettlementWithHttpInfo(String locationId, String settlementId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling retrieveSettlement");
}
// verify the required parameter 'settlementId' is set
if (settlementId == null) {
throw new ApiException(400, "Missing the required parameter 'settlementId' when calling retrieveSettlement");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/settlements/{settlement_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "settlement_id" + "\\}", apiClient.escapeString(settlementId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Settlement> localVarReturnType = new GenericType<V1Settlement>() {};
return (CompleteResponse<V1Settlement>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* UpdateOrder
* Updates the details of an online store order. Every update you perform on an order corresponds to one of three actions:
* @param locationId The ID of the order's associated location. (required)
* @param orderId The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Order
* @throws ApiException if fails to make API call
*/
public V1Order updateOrder(String locationId, String orderId, V1UpdateOrderRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling updateOrder");
}
// verify the required parameter 'orderId' is set
if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling updateOrder");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateOrder");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/orders/{order_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Order> localVarReturnType = new GenericType<V1Order>() {};
CompleteResponse<V1Order> completeResponse = (CompleteResponse<V1Order>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* UpdateOrder
* Updates the details of an online store order. Every update you perform on an order corresponds to one of three actions:
* @param locationId The ID of the order's associated location. (required)
* @param orderId The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1Order>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Order>updateOrderWithHttpInfo(String locationId, String orderId, V1UpdateOrderRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling updateOrder");
}
// verify the required parameter 'orderId' is set
if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling updateOrder");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateOrder");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/orders/{order_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Order> localVarReturnType = new GenericType<V1Order>() {};
return (CompleteResponse<V1Order>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}
| 5,147 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/api/RefundsApi.java | package com.squareup.connect.api;
import com.squareup.connect.ApiException;
import com.squareup.connect.ApiClient;
import com.squareup.connect.Configuration;
import com.squareup.connect.Pair;
import com.squareup.connect.CompleteResponse;
import javax.ws.rs.core.GenericType;
import com.squareup.connect.models.GetPaymentRefundResponse;
import com.squareup.connect.models.ListPaymentRefundsResponse;
import com.squareup.connect.models.RefundPaymentRequest;
import com.squareup.connect.models.RefundPaymentResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class RefundsApi {
private ApiClient apiClient;
public RefundsApi() {
this(Configuration.getDefaultApiClient());
}
public RefundsApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* GetPaymentRefund
* Retrieves a specific `Refund` using the `refund_id`.
* @param refundId Unique ID for the desired `PaymentRefund`. (required)
* @return GetPaymentRefundResponse
* @throws ApiException if fails to make API call
*/
public GetPaymentRefundResponse getPaymentRefund(String refundId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'refundId' is set
if (refundId == null) {
throw new ApiException(400, "Missing the required parameter 'refundId' when calling getPaymentRefund");
}
// create path and map variables
String localVarPath = "/v2/refunds/{refund_id}"
.replaceAll("\\{" + "refund_id" + "\\}", apiClient.escapeString(refundId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<GetPaymentRefundResponse> localVarReturnType = new GenericType<GetPaymentRefundResponse>() {};
CompleteResponse<GetPaymentRefundResponse> completeResponse = (CompleteResponse<GetPaymentRefundResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* GetPaymentRefund
* Retrieves a specific `Refund` using the `refund_id`.
* @param refundId Unique ID for the desired `PaymentRefund`. (required)
* @return CompleteResponse<GetPaymentRefundResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<GetPaymentRefundResponse>getPaymentRefundWithHttpInfo(String refundId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'refundId' is set
if (refundId == null) {
throw new ApiException(400, "Missing the required parameter 'refundId' when calling getPaymentRefund");
}
// create path and map variables
String localVarPath = "/v2/refunds/{refund_id}"
.replaceAll("\\{" + "refund_id" + "\\}", apiClient.escapeString(refundId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<GetPaymentRefundResponse> localVarReturnType = new GenericType<GetPaymentRefundResponse>() {};
return (CompleteResponse<GetPaymentRefundResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListPaymentRefunds
* Retrieves a list of refunds for the account making the request. Max results per page: 100
* @param beginTime Timestamp for the beginning of the requested reporting period, in RFC 3339 format. Default: The current time minus one year. (optional)
* @param endTime Timestamp for the end of the requested reporting period, in RFC 3339 format. Default: The current time. (optional)
* @param sortOrder The order in which results are listed. - `ASC` - oldest to newest - `DESC` - newest to oldest (default). (optional)
* @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query. See [Pagination](https://developer.squareup.com/docs/basics/api101/pagination) for more information. (optional)
* @param locationId ID of location associated with payment. (optional)
* @param status If provided, only refunds with the given status are returned. For a list of refund status values, see `PaymentRefund`. Default: If omitted refunds are returned regardless of status. (optional)
* @param sourceType If provided, only refunds with the given source type are returned. - `CARD` - List refunds only for payments where card was specified as payment source. Default: If omitted refunds are returned regardless of source type. (optional)
* @return ListPaymentRefundsResponse
* @throws ApiException if fails to make API call
*/
public ListPaymentRefundsResponse listPaymentRefunds(String beginTime, String endTime, String sortOrder, String cursor, String locationId, String status, String sourceType) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v2/refunds";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_time", beginTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_time", endTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort_order", sortOrder));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "location_id", locationId));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "status", status));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "source_type", sourceType));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListPaymentRefundsResponse> localVarReturnType = new GenericType<ListPaymentRefundsResponse>() {};
CompleteResponse<ListPaymentRefundsResponse> completeResponse = (CompleteResponse<ListPaymentRefundsResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListPaymentRefunds
* Retrieves a list of refunds for the account making the request. Max results per page: 100
* @param beginTime Timestamp for the beginning of the requested reporting period, in RFC 3339 format. Default: The current time minus one year. (optional)
* @param endTime Timestamp for the end of the requested reporting period, in RFC 3339 format. Default: The current time. (optional)
* @param sortOrder The order in which results are listed. - `ASC` - oldest to newest - `DESC` - newest to oldest (default). (optional)
* @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query. See [Pagination](https://developer.squareup.com/docs/basics/api101/pagination) for more information. (optional)
* @param locationId ID of location associated with payment. (optional)
* @param status If provided, only refunds with the given status are returned. For a list of refund status values, see `PaymentRefund`. Default: If omitted refunds are returned regardless of status. (optional)
* @param sourceType If provided, only refunds with the given source type are returned. - `CARD` - List refunds only for payments where card was specified as payment source. Default: If omitted refunds are returned regardless of source type. (optional)
* @return CompleteResponse<ListPaymentRefundsResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<ListPaymentRefundsResponse>listPaymentRefundsWithHttpInfo(String beginTime, String endTime, String sortOrder, String cursor, String locationId, String status, String sourceType) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v2/refunds";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_time", beginTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_time", endTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort_order", sortOrder));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "location_id", locationId));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "status", status));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "source_type", sourceType));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListPaymentRefundsResponse> localVarReturnType = new GenericType<ListPaymentRefundsResponse>() {};
return (CompleteResponse<ListPaymentRefundsResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RefundPayment
* Refunds a payment. You can refund the entire payment amount or a portion of it. For more information, see [Payments and Refunds Overview](/payments-api/overview).
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return RefundPaymentResponse
* @throws ApiException if fails to make API call
*/
public RefundPaymentResponse refundPayment(RefundPaymentRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling refundPayment");
}
// create path and map variables
String localVarPath = "/v2/refunds";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RefundPaymentResponse> localVarReturnType = new GenericType<RefundPaymentResponse>() {};
CompleteResponse<RefundPaymentResponse> completeResponse = (CompleteResponse<RefundPaymentResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RefundPayment
* Refunds a payment. You can refund the entire payment amount or a portion of it. For more information, see [Payments and Refunds Overview](/payments-api/overview).
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<RefundPaymentResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<RefundPaymentResponse>refundPaymentWithHttpInfo(RefundPaymentRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling refundPayment");
}
// create path and map variables
String localVarPath = "/v2/refunds";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RefundPaymentResponse> localVarReturnType = new GenericType<RefundPaymentResponse>() {};
return (CompleteResponse<RefundPaymentResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}
| 5,148 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/api/CustomersApi.java | package com.squareup.connect.api;
import com.squareup.connect.ApiException;
import com.squareup.connect.ApiClient;
import com.squareup.connect.Configuration;
import com.squareup.connect.Pair;
import com.squareup.connect.CompleteResponse;
import javax.ws.rs.core.GenericType;
import com.squareup.connect.models.CreateCustomerCardRequest;
import com.squareup.connect.models.CreateCustomerCardResponse;
import com.squareup.connect.models.CreateCustomerRequest;
import com.squareup.connect.models.CreateCustomerResponse;
import com.squareup.connect.models.DeleteCustomerCardResponse;
import com.squareup.connect.models.DeleteCustomerResponse;
import com.squareup.connect.models.ListCustomersResponse;
import com.squareup.connect.models.RetrieveCustomerResponse;
import com.squareup.connect.models.SearchCustomersRequest;
import com.squareup.connect.models.SearchCustomersResponse;
import com.squareup.connect.models.UpdateCustomerRequest;
import com.squareup.connect.models.UpdateCustomerResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CustomersApi {
private ApiClient apiClient;
public CustomersApi() {
this(Configuration.getDefaultApiClient());
}
public CustomersApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* CreateCustomer
* Creates a new customer for a business, which can have associated cards on file. You must provide __at least one__ of the following values in your request to this endpoint: - `given_name` - `family_name` - `company_name` - `email_address` - `phone_number`
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CreateCustomerResponse
* @throws ApiException if fails to make API call
*/
public CreateCustomerResponse createCustomer(CreateCustomerRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createCustomer");
}
// create path and map variables
String localVarPath = "/v2/customers";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CreateCustomerResponse> localVarReturnType = new GenericType<CreateCustomerResponse>() {};
CompleteResponse<CreateCustomerResponse> completeResponse = (CompleteResponse<CreateCustomerResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateCustomer
* Creates a new customer for a business, which can have associated cards on file. You must provide __at least one__ of the following values in your request to this endpoint: - `given_name` - `family_name` - `company_name` - `email_address` - `phone_number`
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<CreateCustomerResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<CreateCustomerResponse>createCustomerWithHttpInfo(CreateCustomerRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createCustomer");
}
// create path and map variables
String localVarPath = "/v2/customers";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CreateCustomerResponse> localVarReturnType = new GenericType<CreateCustomerResponse>() {};
return (CompleteResponse<CreateCustomerResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CreateCustomerCard
* Adds a card on file to an existing customer. As with charges, calls to `CreateCustomerCard` are idempotent. Multiple calls with the same card nonce return the same card record that was created with the provided nonce during the _first_ call.
* @param customerId The Square ID of the customer profile the card is linked to. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CreateCustomerCardResponse
* @throws ApiException if fails to make API call
*/
public CreateCustomerCardResponse createCustomerCard(String customerId, CreateCustomerCardRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'customerId' is set
if (customerId == null) {
throw new ApiException(400, "Missing the required parameter 'customerId' when calling createCustomerCard");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createCustomerCard");
}
// create path and map variables
String localVarPath = "/v2/customers/{customer_id}/cards"
.replaceAll("\\{" + "customer_id" + "\\}", apiClient.escapeString(customerId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CreateCustomerCardResponse> localVarReturnType = new GenericType<CreateCustomerCardResponse>() {};
CompleteResponse<CreateCustomerCardResponse> completeResponse = (CompleteResponse<CreateCustomerCardResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateCustomerCard
* Adds a card on file to an existing customer. As with charges, calls to `CreateCustomerCard` are idempotent. Multiple calls with the same card nonce return the same card record that was created with the provided nonce during the _first_ call.
* @param customerId The Square ID of the customer profile the card is linked to. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<CreateCustomerCardResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<CreateCustomerCardResponse>createCustomerCardWithHttpInfo(String customerId, CreateCustomerCardRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'customerId' is set
if (customerId == null) {
throw new ApiException(400, "Missing the required parameter 'customerId' when calling createCustomerCard");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createCustomerCard");
}
// create path and map variables
String localVarPath = "/v2/customers/{customer_id}/cards"
.replaceAll("\\{" + "customer_id" + "\\}", apiClient.escapeString(customerId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CreateCustomerCardResponse> localVarReturnType = new GenericType<CreateCustomerCardResponse>() {};
return (CompleteResponse<CreateCustomerCardResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* DeleteCustomer
* Deletes a customer from a business, along with any linked cards on file. When two profiles are merged into a single profile, that profile is assigned a new `customer_id`. You must use the new `customer_id` to delete merged profiles.
* @param customerId The ID of the customer to delete. (required)
* @return DeleteCustomerResponse
* @throws ApiException if fails to make API call
*/
public DeleteCustomerResponse deleteCustomer(String customerId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'customerId' is set
if (customerId == null) {
throw new ApiException(400, "Missing the required parameter 'customerId' when calling deleteCustomer");
}
// create path and map variables
String localVarPath = "/v2/customers/{customer_id}"
.replaceAll("\\{" + "customer_id" + "\\}", apiClient.escapeString(customerId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<DeleteCustomerResponse> localVarReturnType = new GenericType<DeleteCustomerResponse>() {};
CompleteResponse<DeleteCustomerResponse> completeResponse = (CompleteResponse<DeleteCustomerResponse>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* DeleteCustomer
* Deletes a customer from a business, along with any linked cards on file. When two profiles are merged into a single profile, that profile is assigned a new `customer_id`. You must use the new `customer_id` to delete merged profiles.
* @param customerId The ID of the customer to delete. (required)
* @return CompleteResponse<DeleteCustomerResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<DeleteCustomerResponse>deleteCustomerWithHttpInfo(String customerId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'customerId' is set
if (customerId == null) {
throw new ApiException(400, "Missing the required parameter 'customerId' when calling deleteCustomer");
}
// create path and map variables
String localVarPath = "/v2/customers/{customer_id}"
.replaceAll("\\{" + "customer_id" + "\\}", apiClient.escapeString(customerId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<DeleteCustomerResponse> localVarReturnType = new GenericType<DeleteCustomerResponse>() {};
return (CompleteResponse<DeleteCustomerResponse>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* DeleteCustomerCard
* Removes a card on file from a customer.
* @param customerId The ID of the customer that the card on file belongs to. (required)
* @param cardId The ID of the card on file to delete. (required)
* @return DeleteCustomerCardResponse
* @throws ApiException if fails to make API call
*/
public DeleteCustomerCardResponse deleteCustomerCard(String customerId, String cardId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'customerId' is set
if (customerId == null) {
throw new ApiException(400, "Missing the required parameter 'customerId' when calling deleteCustomerCard");
}
// verify the required parameter 'cardId' is set
if (cardId == null) {
throw new ApiException(400, "Missing the required parameter 'cardId' when calling deleteCustomerCard");
}
// create path and map variables
String localVarPath = "/v2/customers/{customer_id}/cards/{card_id}"
.replaceAll("\\{" + "customer_id" + "\\}", apiClient.escapeString(customerId.toString()))
.replaceAll("\\{" + "card_id" + "\\}", apiClient.escapeString(cardId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<DeleteCustomerCardResponse> localVarReturnType = new GenericType<DeleteCustomerCardResponse>() {};
CompleteResponse<DeleteCustomerCardResponse> completeResponse = (CompleteResponse<DeleteCustomerCardResponse>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* DeleteCustomerCard
* Removes a card on file from a customer.
* @param customerId The ID of the customer that the card on file belongs to. (required)
* @param cardId The ID of the card on file to delete. (required)
* @return CompleteResponse<DeleteCustomerCardResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<DeleteCustomerCardResponse>deleteCustomerCardWithHttpInfo(String customerId, String cardId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'customerId' is set
if (customerId == null) {
throw new ApiException(400, "Missing the required parameter 'customerId' when calling deleteCustomerCard");
}
// verify the required parameter 'cardId' is set
if (cardId == null) {
throw new ApiException(400, "Missing the required parameter 'cardId' when calling deleteCustomerCard");
}
// create path and map variables
String localVarPath = "/v2/customers/{customer_id}/cards/{card_id}"
.replaceAll("\\{" + "customer_id" + "\\}", apiClient.escapeString(customerId.toString()))
.replaceAll("\\{" + "card_id" + "\\}", apiClient.escapeString(cardId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<DeleteCustomerCardResponse> localVarReturnType = new GenericType<DeleteCustomerCardResponse>() {};
return (CompleteResponse<DeleteCustomerCardResponse>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListCustomers
* Lists a business's customers.
* @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. See the [Pagination guide](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. (optional)
* @param sortField Indicates how Customers should be sorted. Default: `DEFAULT`. (optional)
* @param sortOrder Indicates whether Customers should be sorted in ascending (`ASC`) or descending (`DESC`) order. Default: `ASC`. (optional)
* @return ListCustomersResponse
* @throws ApiException if fails to make API call
*/
public ListCustomersResponse listCustomers(String cursor, String sortField, String sortOrder) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v2/customers";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort_field", sortField));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort_order", sortOrder));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListCustomersResponse> localVarReturnType = new GenericType<ListCustomersResponse>() {};
CompleteResponse<ListCustomersResponse> completeResponse = (CompleteResponse<ListCustomersResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListCustomers
* Lists a business's customers.
* @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. See the [Pagination guide](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. (optional)
* @param sortField Indicates how Customers should be sorted. Default: `DEFAULT`. (optional)
* @param sortOrder Indicates whether Customers should be sorted in ascending (`ASC`) or descending (`DESC`) order. Default: `ASC`. (optional)
* @return CompleteResponse<ListCustomersResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<ListCustomersResponse>listCustomersWithHttpInfo(String cursor, String sortField, String sortOrder) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v2/customers";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort_field", sortField));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort_order", sortOrder));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListCustomersResponse> localVarReturnType = new GenericType<ListCustomersResponse>() {};
return (CompleteResponse<ListCustomersResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RetrieveCustomer
* Returns details for a single customer.
* @param customerId The ID of the customer to retrieve. (required)
* @return RetrieveCustomerResponse
* @throws ApiException if fails to make API call
*/
public RetrieveCustomerResponse retrieveCustomer(String customerId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'customerId' is set
if (customerId == null) {
throw new ApiException(400, "Missing the required parameter 'customerId' when calling retrieveCustomer");
}
// create path and map variables
String localVarPath = "/v2/customers/{customer_id}"
.replaceAll("\\{" + "customer_id" + "\\}", apiClient.escapeString(customerId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RetrieveCustomerResponse> localVarReturnType = new GenericType<RetrieveCustomerResponse>() {};
CompleteResponse<RetrieveCustomerResponse> completeResponse = (CompleteResponse<RetrieveCustomerResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RetrieveCustomer
* Returns details for a single customer.
* @param customerId The ID of the customer to retrieve. (required)
* @return CompleteResponse<RetrieveCustomerResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<RetrieveCustomerResponse>retrieveCustomerWithHttpInfo(String customerId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'customerId' is set
if (customerId == null) {
throw new ApiException(400, "Missing the required parameter 'customerId' when calling retrieveCustomer");
}
// create path and map variables
String localVarPath = "/v2/customers/{customer_id}"
.replaceAll("\\{" + "customer_id" + "\\}", apiClient.escapeString(customerId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RetrieveCustomerResponse> localVarReturnType = new GenericType<RetrieveCustomerResponse>() {};
return (CompleteResponse<RetrieveCustomerResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* SearchCustomers
* Searches the customer profiles associated with a Square account. Calling SearchCustomers without an explicit query parameter returns all customer profiles ordered alphabetically based on `given_name` and `family_name`.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return SearchCustomersResponse
* @throws ApiException if fails to make API call
*/
public SearchCustomersResponse searchCustomers(SearchCustomersRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling searchCustomers");
}
// create path and map variables
String localVarPath = "/v2/customers/search";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<SearchCustomersResponse> localVarReturnType = new GenericType<SearchCustomersResponse>() {};
CompleteResponse<SearchCustomersResponse> completeResponse = (CompleteResponse<SearchCustomersResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* SearchCustomers
* Searches the customer profiles associated with a Square account. Calling SearchCustomers without an explicit query parameter returns all customer profiles ordered alphabetically based on `given_name` and `family_name`.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<SearchCustomersResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<SearchCustomersResponse>searchCustomersWithHttpInfo(SearchCustomersRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling searchCustomers");
}
// create path and map variables
String localVarPath = "/v2/customers/search";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<SearchCustomersResponse> localVarReturnType = new GenericType<SearchCustomersResponse>() {};
return (CompleteResponse<SearchCustomersResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* UpdateCustomer
* Updates the details of an existing customer. When two profiles are merged into a single profile, that profile is assigned a new `customer_id`. You must use the new `customer_id` to update merged profiles. You cannot edit a customer's cards on file with this endpoint. To make changes to a card on file, you must delete the existing card on file with the [DeleteCustomerCard](#endpoint-deletecustomercard) endpoint, then create a new one with the [CreateCustomerCard](#endpoint-createcustomercard) endpoint.
* @param customerId The ID of the customer to update. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return UpdateCustomerResponse
* @throws ApiException if fails to make API call
*/
public UpdateCustomerResponse updateCustomer(String customerId, UpdateCustomerRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'customerId' is set
if (customerId == null) {
throw new ApiException(400, "Missing the required parameter 'customerId' when calling updateCustomer");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateCustomer");
}
// create path and map variables
String localVarPath = "/v2/customers/{customer_id}"
.replaceAll("\\{" + "customer_id" + "\\}", apiClient.escapeString(customerId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<UpdateCustomerResponse> localVarReturnType = new GenericType<UpdateCustomerResponse>() {};
CompleteResponse<UpdateCustomerResponse> completeResponse = (CompleteResponse<UpdateCustomerResponse>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* UpdateCustomer
* Updates the details of an existing customer. When two profiles are merged into a single profile, that profile is assigned a new `customer_id`. You must use the new `customer_id` to update merged profiles. You cannot edit a customer's cards on file with this endpoint. To make changes to a card on file, you must delete the existing card on file with the [DeleteCustomerCard](#endpoint-deletecustomercard) endpoint, then create a new one with the [CreateCustomerCard](#endpoint-createcustomercard) endpoint.
* @param customerId The ID of the customer to update. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<UpdateCustomerResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<UpdateCustomerResponse>updateCustomerWithHttpInfo(String customerId, UpdateCustomerRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'customerId' is set
if (customerId == null) {
throw new ApiException(400, "Missing the required parameter 'customerId' when calling updateCustomer");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateCustomer");
}
// create path and map variables
String localVarPath = "/v2/customers/{customer_id}"
.replaceAll("\\{" + "customer_id" + "\\}", apiClient.escapeString(customerId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<UpdateCustomerResponse> localVarReturnType = new GenericType<UpdateCustomerResponse>() {};
return (CompleteResponse<UpdateCustomerResponse>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}
| 5,149 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/api/MobileAuthorizationApi.java | package com.squareup.connect.api;
import com.squareup.connect.ApiException;
import com.squareup.connect.ApiClient;
import com.squareup.connect.Configuration;
import com.squareup.connect.Pair;
import com.squareup.connect.CompleteResponse;
import javax.ws.rs.core.GenericType;
import com.squareup.connect.models.CreateMobileAuthorizationCodeRequest;
import com.squareup.connect.models.CreateMobileAuthorizationCodeResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MobileAuthorizationApi {
private ApiClient apiClient;
public MobileAuthorizationApi() {
this(Configuration.getDefaultApiClient());
}
public MobileAuthorizationApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* CreateMobileAuthorizationCode
* Generates code to authorize a mobile application to connect to a Square card reader Authorization codes are one-time-use and expire __60 minutes__ after being issued. __Important:__ The `Authorization` header you provide to this endpoint must have the following format: ``` Authorization: Bearer ACCESS_TOKEN ``` Replace `ACCESS_TOKEN` with a [valid production authorization credential](/docs/build-basics/access-tokens).
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CreateMobileAuthorizationCodeResponse
* @throws ApiException if fails to make API call
*/
public CreateMobileAuthorizationCodeResponse createMobileAuthorizationCode(CreateMobileAuthorizationCodeRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createMobileAuthorizationCode");
}
// create path and map variables
String localVarPath = "/mobile/authorization-code";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CreateMobileAuthorizationCodeResponse> localVarReturnType = new GenericType<CreateMobileAuthorizationCodeResponse>() {};
CompleteResponse<CreateMobileAuthorizationCodeResponse> completeResponse = (CompleteResponse<CreateMobileAuthorizationCodeResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateMobileAuthorizationCode
* Generates code to authorize a mobile application to connect to a Square card reader Authorization codes are one-time-use and expire __60 minutes__ after being issued. __Important:__ The `Authorization` header you provide to this endpoint must have the following format: ``` Authorization: Bearer ACCESS_TOKEN ``` Replace `ACCESS_TOKEN` with a [valid production authorization credential](/docs/build-basics/access-tokens).
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<CreateMobileAuthorizationCodeResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<CreateMobileAuthorizationCodeResponse>createMobileAuthorizationCodeWithHttpInfo(CreateMobileAuthorizationCodeRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createMobileAuthorizationCode");
}
// create path and map variables
String localVarPath = "/mobile/authorization-code";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<CreateMobileAuthorizationCodeResponse> localVarReturnType = new GenericType<CreateMobileAuthorizationCodeResponse>() {};
return (CompleteResponse<CreateMobileAuthorizationCodeResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}
| 5,150 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/api/EmployeesApi.java | package com.squareup.connect.api;
import com.squareup.connect.ApiException;
import com.squareup.connect.ApiClient;
import com.squareup.connect.Configuration;
import com.squareup.connect.Pair;
import com.squareup.connect.CompleteResponse;
import javax.ws.rs.core.GenericType;
import com.squareup.connect.models.ListEmployeesResponse;
import com.squareup.connect.models.RetrieveEmployeeResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class EmployeesApi {
private ApiClient apiClient;
public EmployeesApi() {
this(Configuration.getDefaultApiClient());
}
public EmployeesApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* ListEmployees
*
* @param locationId Filter employees returned to only those that are associated with the specified location. (optional)
* @param status Specifies the EmployeeStatus to filter the employee by. (optional)
* @param limit The number of employees to be returned on each page. (optional)
* @param cursor The token required to retrieve the specified page of results. (optional)
* @return ListEmployeesResponse
* @throws ApiException if fails to make API call
*/
public ListEmployeesResponse listEmployees(String locationId, String status, Integer limit, String cursor) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v2/employees";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "location_id", locationId));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "status", status));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListEmployeesResponse> localVarReturnType = new GenericType<ListEmployeesResponse>() {};
CompleteResponse<ListEmployeesResponse> completeResponse = (CompleteResponse<ListEmployeesResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListEmployees
*
* @param locationId Filter employees returned to only those that are associated with the specified location. (optional)
* @param status Specifies the EmployeeStatus to filter the employee by. (optional)
* @param limit The number of employees to be returned on each page. (optional)
* @param cursor The token required to retrieve the specified page of results. (optional)
* @return CompleteResponse<ListEmployeesResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<ListEmployeesResponse>listEmployeesWithHttpInfo(String locationId, String status, Integer limit, String cursor) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v2/employees";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "location_id", locationId));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "status", status));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListEmployeesResponse> localVarReturnType = new GenericType<ListEmployeesResponse>() {};
return (CompleteResponse<ListEmployeesResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RetrieveEmployee
*
* @param id UUID for the employee that was requested. (required)
* @return RetrieveEmployeeResponse
* @throws ApiException if fails to make API call
*/
public RetrieveEmployeeResponse retrieveEmployee(String id) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling retrieveEmployee");
}
// create path and map variables
String localVarPath = "/v2/employees/{id}"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RetrieveEmployeeResponse> localVarReturnType = new GenericType<RetrieveEmployeeResponse>() {};
CompleteResponse<RetrieveEmployeeResponse> completeResponse = (CompleteResponse<RetrieveEmployeeResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RetrieveEmployee
*
* @param id UUID for the employee that was requested. (required)
* @return CompleteResponse<RetrieveEmployeeResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<RetrieveEmployeeResponse>retrieveEmployeeWithHttpInfo(String id) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling retrieveEmployee");
}
// create path and map variables
String localVarPath = "/v2/employees/{id}"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RetrieveEmployeeResponse> localVarReturnType = new GenericType<RetrieveEmployeeResponse>() {};
return (CompleteResponse<RetrieveEmployeeResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}
| 5,151 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/api/V1EmployeesApi.java | package com.squareup.connect.api;
import com.squareup.connect.ApiException;
import com.squareup.connect.ApiClient;
import com.squareup.connect.Configuration;
import com.squareup.connect.Pair;
import com.squareup.connect.CompleteResponse;
import javax.ws.rs.core.GenericType;
import com.squareup.connect.models.V1CashDrawerShift;
import com.squareup.connect.models.V1Employee;
import com.squareup.connect.models.V1EmployeeRole;
import com.squareup.connect.models.V1Timecard;
import com.squareup.connect.models.V1TimecardEvent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class V1EmployeesApi {
private ApiClient apiClient;
public V1EmployeesApi() {
this(Configuration.getDefaultApiClient());
}
public V1EmployeesApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* CreateEmployee
* Use the CreateEmployee endpoint to add an employee to a Square account. Employees created with the Connect API have an initial status of `INACTIVE`. Inactive employees cannot sign in to Square Point of Sale until they are activated from the Square Dashboard. Employee status cannot be changed with the Connect API. <aside class=\"important\"> Employee entities cannot be deleted. To disable employee profiles, set the employee's status to <code>INACTIVE</code> </aside>
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Employee
* @throws ApiException if fails to make API call
*/
public V1Employee createEmployee(V1Employee body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createEmployee");
}
// create path and map variables
String localVarPath = "/v1/me/employees";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Employee> localVarReturnType = new GenericType<V1Employee>() {};
CompleteResponse<V1Employee> completeResponse = (CompleteResponse<V1Employee>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateEmployee
* Use the CreateEmployee endpoint to add an employee to a Square account. Employees created with the Connect API have an initial status of `INACTIVE`. Inactive employees cannot sign in to Square Point of Sale until they are activated from the Square Dashboard. Employee status cannot be changed with the Connect API. <aside class=\"important\"> Employee entities cannot be deleted. To disable employee profiles, set the employee's status to <code>INACTIVE</code> </aside>
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1Employee>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Employee>createEmployeeWithHttpInfo(V1Employee body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createEmployee");
}
// create path and map variables
String localVarPath = "/v1/me/employees";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Employee> localVarReturnType = new GenericType<V1Employee>() {};
return (CompleteResponse<V1Employee>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CreateEmployeeRole
* Creates an employee role you can then assign to employees. Square accounts can include any number of roles that can be assigned to employees. These roles define the actions and permissions granted to an employee with that role. For example, an employee with a \"Shift Manager\" role might be able to issue refunds in Square Point of Sale, whereas an employee with a \"Clerk\" role might not. Roles are assigned with the [V1UpdateEmployee](#endpoint-v1updateemployee) endpoint. An employee can have only one role at a time. If an employee has no role, they have none of the permissions associated with roles. All employees can accept payments with Square Point of Sale.
* @param employeeRole An EmployeeRole object with a name and permissions, and an optional owner flag. (required)
* @return V1EmployeeRole
* @throws ApiException if fails to make API call
*/
public V1EmployeeRole createEmployeeRole(V1EmployeeRole employeeRole) throws ApiException {
Object localVarPostBody = employeeRole;
// verify the required parameter 'employeeRole' is set
if (employeeRole == null) {
throw new ApiException(400, "Missing the required parameter 'employeeRole' when calling createEmployeeRole");
}
// create path and map variables
String localVarPath = "/v1/me/roles";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1EmployeeRole> localVarReturnType = new GenericType<V1EmployeeRole>() {};
CompleteResponse<V1EmployeeRole> completeResponse = (CompleteResponse<V1EmployeeRole>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateEmployeeRole
* Creates an employee role you can then assign to employees. Square accounts can include any number of roles that can be assigned to employees. These roles define the actions and permissions granted to an employee with that role. For example, an employee with a \"Shift Manager\" role might be able to issue refunds in Square Point of Sale, whereas an employee with a \"Clerk\" role might not. Roles are assigned with the [V1UpdateEmployee](#endpoint-v1updateemployee) endpoint. An employee can have only one role at a time. If an employee has no role, they have none of the permissions associated with roles. All employees can accept payments with Square Point of Sale.
* @param employeeRole An EmployeeRole object with a name and permissions, and an optional owner flag. (required)
* @return CompleteResponse<V1EmployeeRole>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1EmployeeRole>createEmployeeRoleWithHttpInfo(V1EmployeeRole employeeRole) throws ApiException {
Object localVarPostBody = employeeRole;
// verify the required parameter 'employeeRole' is set
if (employeeRole == null) {
throw new ApiException(400, "Missing the required parameter 'employeeRole' when calling createEmployeeRole");
}
// create path and map variables
String localVarPath = "/v1/me/roles";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1EmployeeRole> localVarReturnType = new GenericType<V1EmployeeRole>() {};
return (CompleteResponse<V1EmployeeRole>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* CreateTimecard
* Creates a timecard for an employee and clocks them in with an `API_CREATE` event and a `clockin_time` set to the current time unless the request provides a different value. To import timecards from another system (rather than clocking someone in). Specify the `clockin_time` and* `clockout_time` in the request. Timecards correspond to exactly one shift for a given employee, bounded by the `clockin_time` and `clockout_time` fields. An employee is considered clocked in if they have a timecard that doesn't have a `clockout_time` set. An employee that is currently clocked in cannot be clocked in a second time.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Timecard
* @throws ApiException if fails to make API call
*/
public V1Timecard createTimecard(V1Timecard body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createTimecard");
}
// create path and map variables
String localVarPath = "/v1/me/timecards";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Timecard> localVarReturnType = new GenericType<V1Timecard>() {};
CompleteResponse<V1Timecard> completeResponse = (CompleteResponse<V1Timecard>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* CreateTimecard
* Creates a timecard for an employee and clocks them in with an `API_CREATE` event and a `clockin_time` set to the current time unless the request provides a different value. To import timecards from another system (rather than clocking someone in). Specify the `clockin_time` and* `clockout_time` in the request. Timecards correspond to exactly one shift for a given employee, bounded by the `clockin_time` and `clockout_time` fields. An employee is considered clocked in if they have a timecard that doesn't have a `clockout_time` set. An employee that is currently clocked in cannot be clocked in a second time.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1Timecard>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Timecard>createTimecardWithHttpInfo(V1Timecard body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createTimecard");
}
// create path and map variables
String localVarPath = "/v1/me/timecards";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Timecard> localVarReturnType = new GenericType<V1Timecard>() {};
return (CompleteResponse<V1Timecard>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* DeleteTimecard
* Deletes a timecard. Timecards can also be deleted through the Square Dashboard. Deleted timecards are still accessible through Connect API endpoints, but cannot be modified. The `deleted` field of the `Timecard` object indicates whether the timecard has been deleted. *Note**: By default, deleted timecards appear alongside valid timecards in results returned by the [ListTimecards](#endpoint-v1employees-listtimecards) endpoint. To filter deleted timecards, include the `deleted` query parameter in the list request. <aside> Only approved accounts can manage their employees with Square. Unapproved accounts cannot use employee management features with the API. </aside>
* @param timecardId The ID of the timecard to delete. (required)
* @return Object
* @throws ApiException if fails to make API call
*/
public Object deleteTimecard(String timecardId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'timecardId' is set
if (timecardId == null) {
throw new ApiException(400, "Missing the required parameter 'timecardId' when calling deleteTimecard");
}
// create path and map variables
String localVarPath = "/v1/me/timecards/{timecard_id}"
.replaceAll("\\{" + "timecard_id" + "\\}", apiClient.escapeString(timecardId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<Object> localVarReturnType = new GenericType<Object>() {};
CompleteResponse<Object> completeResponse = (CompleteResponse<Object>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* DeleteTimecard
* Deletes a timecard. Timecards can also be deleted through the Square Dashboard. Deleted timecards are still accessible through Connect API endpoints, but cannot be modified. The `deleted` field of the `Timecard` object indicates whether the timecard has been deleted. *Note**: By default, deleted timecards appear alongside valid timecards in results returned by the [ListTimecards](#endpoint-v1employees-listtimecards) endpoint. To filter deleted timecards, include the `deleted` query parameter in the list request. <aside> Only approved accounts can manage their employees with Square. Unapproved accounts cannot use employee management features with the API. </aside>
* @param timecardId The ID of the timecard to delete. (required)
* @return CompleteResponse<Object>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<Object>deleteTimecardWithHttpInfo(String timecardId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'timecardId' is set
if (timecardId == null) {
throw new ApiException(400, "Missing the required parameter 'timecardId' when calling deleteTimecard");
}
// create path and map variables
String localVarPath = "/v1/me/timecards/{timecard_id}"
.replaceAll("\\{" + "timecard_id" + "\\}", apiClient.escapeString(timecardId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<Object> localVarReturnType = new GenericType<Object>() {};
return (CompleteResponse<Object>)apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListCashDrawerShifts
* Provides the details for all of a location's cash drawer shifts during a date range. The date range you specify cannot exceed 90 days.
* @param locationId The ID of the location to list cash drawer shifts for. (required)
* @param order The order in which cash drawer shifts are listed in the response, based on their created_at field. Default value: ASC (optional)
* @param beginTime The beginning of the requested reporting period, in ISO 8601 format. Default value: The current time minus 90 days. (optional)
* @param endTime The beginning of the requested reporting period, in ISO 8601 format. Default value: The current time. (optional)
* @return List<V1CashDrawerShift>
* @throws ApiException if fails to make API call
*/
public List<V1CashDrawerShift> listCashDrawerShifts(String locationId, String order, String beginTime, String endTime) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listCashDrawerShifts");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/cash-drawer-shifts"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_time", beginTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_time", endTime));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1CashDrawerShift>> localVarReturnType = new GenericType<List<V1CashDrawerShift>>() {};
CompleteResponse<List<V1CashDrawerShift>> completeResponse = (CompleteResponse<List<V1CashDrawerShift>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListCashDrawerShifts
* Provides the details for all of a location's cash drawer shifts during a date range. The date range you specify cannot exceed 90 days.
* @param locationId The ID of the location to list cash drawer shifts for. (required)
* @param order The order in which cash drawer shifts are listed in the response, based on their created_at field. Default value: ASC (optional)
* @param beginTime The beginning of the requested reporting period, in ISO 8601 format. Default value: The current time minus 90 days. (optional)
* @param endTime The beginning of the requested reporting period, in ISO 8601 format. Default value: The current time. (optional)
* @return CompleteResponse<List<V1CashDrawerShift>>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<List<V1CashDrawerShift>>listCashDrawerShiftsWithHttpInfo(String locationId, String order, String beginTime, String endTime) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listCashDrawerShifts");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/cash-drawer-shifts"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_time", beginTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_time", endTime));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1CashDrawerShift>> localVarReturnType = new GenericType<List<V1CashDrawerShift>>() {};
return (CompleteResponse<List<V1CashDrawerShift>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListEmployeeRoles
* Provides summary information for all of a business's employee roles.
* @param order The order in which employees are listed in the response, based on their created_at field.Default value: ASC (optional)
* @param limit The maximum integer number of employee entities to return in a single response. Default 100, maximum 200. (optional)
* @param batchToken A pagination cursor to retrieve the next set of results for your original query to the endpoint. (optional)
* @return List<V1EmployeeRole>
* @throws ApiException if fails to make API call
*/
public List<V1EmployeeRole> listEmployeeRoles(String order, Integer limit, String batchToken) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/me/roles";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "batch_token", batchToken));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1EmployeeRole>> localVarReturnType = new GenericType<List<V1EmployeeRole>>() {};
CompleteResponse<List<V1EmployeeRole>> completeResponse = (CompleteResponse<List<V1EmployeeRole>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListEmployeeRoles
* Provides summary information for all of a business's employee roles.
* @param order The order in which employees are listed in the response, based on their created_at field.Default value: ASC (optional)
* @param limit The maximum integer number of employee entities to return in a single response. Default 100, maximum 200. (optional)
* @param batchToken A pagination cursor to retrieve the next set of results for your original query to the endpoint. (optional)
* @return CompleteResponse<List<V1EmployeeRole>>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<List<V1EmployeeRole>>listEmployeeRolesWithHttpInfo(String order, Integer limit, String batchToken) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/me/roles";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "batch_token", batchToken));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1EmployeeRole>> localVarReturnType = new GenericType<List<V1EmployeeRole>>() {};
return (CompleteResponse<List<V1EmployeeRole>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListEmployees
* Provides summary information for all of a business's employees.
* @param order The order in which employees are listed in the response, based on their created_at field. Default value: ASC (optional)
* @param beginUpdatedAt If filtering results by their updated_at field, the beginning of the requested reporting period, in ISO 8601 format (optional)
* @param endUpdatedAt If filtering results by there updated_at field, the end of the requested reporting period, in ISO 8601 format. (optional)
* @param beginCreatedAt If filtering results by their created_at field, the beginning of the requested reporting period, in ISO 8601 format. (optional)
* @param endCreatedAt If filtering results by their created_at field, the end of the requested reporting period, in ISO 8601 format. (optional)
* @param status If provided, the endpoint returns only employee entities with the specified status (ACTIVE or INACTIVE). (optional)
* @param externalId If provided, the endpoint returns only employee entities with the specified external_id. (optional)
* @param limit The maximum integer number of employee entities to return in a single response. Default 100, maximum 200. (optional)
* @param batchToken A pagination cursor to retrieve the next set of results for your original query to the endpoint. (optional)
* @return List<V1Employee>
* @throws ApiException if fails to make API call
*/
public List<V1Employee> listEmployees(String order, String beginUpdatedAt, String endUpdatedAt, String beginCreatedAt, String endCreatedAt, String status, String externalId, Integer limit, String batchToken) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/me/employees";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_updated_at", beginUpdatedAt));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_updated_at", endUpdatedAt));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_created_at", beginCreatedAt));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_created_at", endCreatedAt));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "status", status));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "external_id", externalId));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "batch_token", batchToken));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1Employee>> localVarReturnType = new GenericType<List<V1Employee>>() {};
CompleteResponse<List<V1Employee>> completeResponse = (CompleteResponse<List<V1Employee>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListEmployees
* Provides summary information for all of a business's employees.
* @param order The order in which employees are listed in the response, based on their created_at field. Default value: ASC (optional)
* @param beginUpdatedAt If filtering results by their updated_at field, the beginning of the requested reporting period, in ISO 8601 format (optional)
* @param endUpdatedAt If filtering results by there updated_at field, the end of the requested reporting period, in ISO 8601 format. (optional)
* @param beginCreatedAt If filtering results by their created_at field, the beginning of the requested reporting period, in ISO 8601 format. (optional)
* @param endCreatedAt If filtering results by their created_at field, the end of the requested reporting period, in ISO 8601 format. (optional)
* @param status If provided, the endpoint returns only employee entities with the specified status (ACTIVE or INACTIVE). (optional)
* @param externalId If provided, the endpoint returns only employee entities with the specified external_id. (optional)
* @param limit The maximum integer number of employee entities to return in a single response. Default 100, maximum 200. (optional)
* @param batchToken A pagination cursor to retrieve the next set of results for your original query to the endpoint. (optional)
* @return CompleteResponse<List<V1Employee>>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<List<V1Employee>>listEmployeesWithHttpInfo(String order, String beginUpdatedAt, String endUpdatedAt, String beginCreatedAt, String endCreatedAt, String status, String externalId, Integer limit, String batchToken) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/me/employees";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_updated_at", beginUpdatedAt));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_updated_at", endUpdatedAt));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_created_at", beginCreatedAt));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_created_at", endCreatedAt));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "status", status));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "external_id", externalId));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "batch_token", batchToken));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1Employee>> localVarReturnType = new GenericType<List<V1Employee>>() {};
return (CompleteResponse<List<V1Employee>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListTimecardEvents
* Provides summary information for all events associated with a particular timecard. <aside> Only approved accounts can manage their employees with Square. Unapproved accounts cannot use employee management features with the API. </aside>
* @param timecardId The ID of the timecard to list events for. (required)
* @return List<V1TimecardEvent>
* @throws ApiException if fails to make API call
*/
public List<V1TimecardEvent> listTimecardEvents(String timecardId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'timecardId' is set
if (timecardId == null) {
throw new ApiException(400, "Missing the required parameter 'timecardId' when calling listTimecardEvents");
}
// create path and map variables
String localVarPath = "/v1/me/timecards/{timecard_id}/events"
.replaceAll("\\{" + "timecard_id" + "\\}", apiClient.escapeString(timecardId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1TimecardEvent>> localVarReturnType = new GenericType<List<V1TimecardEvent>>() {};
CompleteResponse<List<V1TimecardEvent>> completeResponse = (CompleteResponse<List<V1TimecardEvent>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListTimecardEvents
* Provides summary information for all events associated with a particular timecard. <aside> Only approved accounts can manage their employees with Square. Unapproved accounts cannot use employee management features with the API. </aside>
* @param timecardId The ID of the timecard to list events for. (required)
* @return CompleteResponse<List<V1TimecardEvent>>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<List<V1TimecardEvent>>listTimecardEventsWithHttpInfo(String timecardId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'timecardId' is set
if (timecardId == null) {
throw new ApiException(400, "Missing the required parameter 'timecardId' when calling listTimecardEvents");
}
// create path and map variables
String localVarPath = "/v1/me/timecards/{timecard_id}/events"
.replaceAll("\\{" + "timecard_id" + "\\}", apiClient.escapeString(timecardId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1TimecardEvent>> localVarReturnType = new GenericType<List<V1TimecardEvent>>() {};
return (CompleteResponse<List<V1TimecardEvent>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListTimecards
* Provides summary information for all of a business's employee timecards.
* @param order The order in which timecards are listed in the response, based on their created_at field. (optional)
* @param employeeId If provided, the endpoint returns only timecards for the employee with the specified ID. (optional)
* @param beginClockinTime If filtering results by their clockin_time field, the beginning of the requested reporting period, in ISO 8601 format. (optional)
* @param endClockinTime If filtering results by their clockin_time field, the end of the requested reporting period, in ISO 8601 format. (optional)
* @param beginClockoutTime If filtering results by their clockout_time field, the beginning of the requested reporting period, in ISO 8601 format. (optional)
* @param endClockoutTime If filtering results by their clockout_time field, the end of the requested reporting period, in ISO 8601 format. (optional)
* @param beginUpdatedAt If filtering results by their updated_at field, the beginning of the requested reporting period, in ISO 8601 format. (optional)
* @param endUpdatedAt If filtering results by their updated_at field, the end of the requested reporting period, in ISO 8601 format. (optional)
* @param deleted If true, only deleted timecards are returned. If false, only valid timecards are returned.If you don't provide this parameter, both valid and deleted timecards are returned. (optional)
* @param limit The maximum integer number of employee entities to return in a single response. Default 100, maximum 200. (optional)
* @param batchToken A pagination cursor to retrieve the next set of results for your original query to the endpoint. (optional)
* @return List<V1Timecard>
* @throws ApiException if fails to make API call
*/
public List<V1Timecard> listTimecards(String order, String employeeId, String beginClockinTime, String endClockinTime, String beginClockoutTime, String endClockoutTime, String beginUpdatedAt, String endUpdatedAt, Boolean deleted, Integer limit, String batchToken) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/me/timecards";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "employee_id", employeeId));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_clockin_time", beginClockinTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_clockin_time", endClockinTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_clockout_time", beginClockoutTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_clockout_time", endClockoutTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_updated_at", beginUpdatedAt));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_updated_at", endUpdatedAt));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "deleted", deleted));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "batch_token", batchToken));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1Timecard>> localVarReturnType = new GenericType<List<V1Timecard>>() {};
CompleteResponse<List<V1Timecard>> completeResponse = (CompleteResponse<List<V1Timecard>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ListTimecards
* Provides summary information for all of a business's employee timecards.
* @param order The order in which timecards are listed in the response, based on their created_at field. (optional)
* @param employeeId If provided, the endpoint returns only timecards for the employee with the specified ID. (optional)
* @param beginClockinTime If filtering results by their clockin_time field, the beginning of the requested reporting period, in ISO 8601 format. (optional)
* @param endClockinTime If filtering results by their clockin_time field, the end of the requested reporting period, in ISO 8601 format. (optional)
* @param beginClockoutTime If filtering results by their clockout_time field, the beginning of the requested reporting period, in ISO 8601 format. (optional)
* @param endClockoutTime If filtering results by their clockout_time field, the end of the requested reporting period, in ISO 8601 format. (optional)
* @param beginUpdatedAt If filtering results by their updated_at field, the beginning of the requested reporting period, in ISO 8601 format. (optional)
* @param endUpdatedAt If filtering results by their updated_at field, the end of the requested reporting period, in ISO 8601 format. (optional)
* @param deleted If true, only deleted timecards are returned. If false, only valid timecards are returned.If you don't provide this parameter, both valid and deleted timecards are returned. (optional)
* @param limit The maximum integer number of employee entities to return in a single response. Default 100, maximum 200. (optional)
* @param batchToken A pagination cursor to retrieve the next set of results for your original query to the endpoint. (optional)
* @return CompleteResponse<List<V1Timecard>>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<List<V1Timecard>>listTimecardsWithHttpInfo(String order, String employeeId, String beginClockinTime, String endClockinTime, String beginClockoutTime, String endClockoutTime, String beginUpdatedAt, String endUpdatedAt, Boolean deleted, Integer limit, String batchToken) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/me/timecards";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "employee_id", employeeId));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_clockin_time", beginClockinTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_clockin_time", endClockinTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_clockout_time", beginClockoutTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_clockout_time", endClockoutTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_updated_at", beginUpdatedAt));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_updated_at", endUpdatedAt));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "deleted", deleted));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "batch_token", batchToken));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<List<V1Timecard>> localVarReturnType = new GenericType<List<V1Timecard>>() {};
return (CompleteResponse<List<V1Timecard>>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RetrieveCashDrawerShift
* Provides the details for a single cash drawer shift, including all events that occurred during the shift.
* @param locationId The ID of the location to list cash drawer shifts for. (required)
* @param shiftId The shift's ID. (required)
* @return V1CashDrawerShift
* @throws ApiException if fails to make API call
*/
public V1CashDrawerShift retrieveCashDrawerShift(String locationId, String shiftId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling retrieveCashDrawerShift");
}
// verify the required parameter 'shiftId' is set
if (shiftId == null) {
throw new ApiException(400, "Missing the required parameter 'shiftId' when calling retrieveCashDrawerShift");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/cash-drawer-shifts/{shift_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "shift_id" + "\\}", apiClient.escapeString(shiftId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1CashDrawerShift> localVarReturnType = new GenericType<V1CashDrawerShift>() {};
CompleteResponse<V1CashDrawerShift> completeResponse = (CompleteResponse<V1CashDrawerShift>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RetrieveCashDrawerShift
* Provides the details for a single cash drawer shift, including all events that occurred during the shift.
* @param locationId The ID of the location to list cash drawer shifts for. (required)
* @param shiftId The shift's ID. (required)
* @return CompleteResponse<V1CashDrawerShift>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1CashDrawerShift>retrieveCashDrawerShiftWithHttpInfo(String locationId, String shiftId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling retrieveCashDrawerShift");
}
// verify the required parameter 'shiftId' is set
if (shiftId == null) {
throw new ApiException(400, "Missing the required parameter 'shiftId' when calling retrieveCashDrawerShift");
}
// create path and map variables
String localVarPath = "/v1/{location_id}/cash-drawer-shifts/{shift_id}"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()))
.replaceAll("\\{" + "shift_id" + "\\}", apiClient.escapeString(shiftId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1CashDrawerShift> localVarReturnType = new GenericType<V1CashDrawerShift>() {};
return (CompleteResponse<V1CashDrawerShift>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RetrieveEmployee
* Provides the details for a single employee.
* @param employeeId The employee's ID. (required)
* @return V1Employee
* @throws ApiException if fails to make API call
*/
public V1Employee retrieveEmployee(String employeeId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'employeeId' is set
if (employeeId == null) {
throw new ApiException(400, "Missing the required parameter 'employeeId' when calling retrieveEmployee");
}
// create path and map variables
String localVarPath = "/v1/me/employees/{employee_id}"
.replaceAll("\\{" + "employee_id" + "\\}", apiClient.escapeString(employeeId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Employee> localVarReturnType = new GenericType<V1Employee>() {};
CompleteResponse<V1Employee> completeResponse = (CompleteResponse<V1Employee>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RetrieveEmployee
* Provides the details for a single employee.
* @param employeeId The employee's ID. (required)
* @return CompleteResponse<V1Employee>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Employee>retrieveEmployeeWithHttpInfo(String employeeId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'employeeId' is set
if (employeeId == null) {
throw new ApiException(400, "Missing the required parameter 'employeeId' when calling retrieveEmployee");
}
// create path and map variables
String localVarPath = "/v1/me/employees/{employee_id}"
.replaceAll("\\{" + "employee_id" + "\\}", apiClient.escapeString(employeeId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Employee> localVarReturnType = new GenericType<V1Employee>() {};
return (CompleteResponse<V1Employee>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RetrieveEmployeeRole
* Provides the details for a single employee role.
* @param roleId The role's ID. (required)
* @return V1EmployeeRole
* @throws ApiException if fails to make API call
*/
public V1EmployeeRole retrieveEmployeeRole(String roleId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'roleId' is set
if (roleId == null) {
throw new ApiException(400, "Missing the required parameter 'roleId' when calling retrieveEmployeeRole");
}
// create path and map variables
String localVarPath = "/v1/me/roles/{role_id}"
.replaceAll("\\{" + "role_id" + "\\}", apiClient.escapeString(roleId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1EmployeeRole> localVarReturnType = new GenericType<V1EmployeeRole>() {};
CompleteResponse<V1EmployeeRole> completeResponse = (CompleteResponse<V1EmployeeRole>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RetrieveEmployeeRole
* Provides the details for a single employee role.
* @param roleId The role's ID. (required)
* @return CompleteResponse<V1EmployeeRole>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1EmployeeRole>retrieveEmployeeRoleWithHttpInfo(String roleId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'roleId' is set
if (roleId == null) {
throw new ApiException(400, "Missing the required parameter 'roleId' when calling retrieveEmployeeRole");
}
// create path and map variables
String localVarPath = "/v1/me/roles/{role_id}"
.replaceAll("\\{" + "role_id" + "\\}", apiClient.escapeString(roleId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1EmployeeRole> localVarReturnType = new GenericType<V1EmployeeRole>() {};
return (CompleteResponse<V1EmployeeRole>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RetrieveTimecard
* Provides the details for a single timecard. <aside> Only approved accounts can manage their employees with Square. Unapproved accounts cannot use employee management features with the API. </aside>
* @param timecardId The timecard's ID. (required)
* @return V1Timecard
* @throws ApiException if fails to make API call
*/
public V1Timecard retrieveTimecard(String timecardId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'timecardId' is set
if (timecardId == null) {
throw new ApiException(400, "Missing the required parameter 'timecardId' when calling retrieveTimecard");
}
// create path and map variables
String localVarPath = "/v1/me/timecards/{timecard_id}"
.replaceAll("\\{" + "timecard_id" + "\\}", apiClient.escapeString(timecardId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Timecard> localVarReturnType = new GenericType<V1Timecard>() {};
CompleteResponse<V1Timecard> completeResponse = (CompleteResponse<V1Timecard>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RetrieveTimecard
* Provides the details for a single timecard. <aside> Only approved accounts can manage their employees with Square. Unapproved accounts cannot use employee management features with the API. </aside>
* @param timecardId The timecard's ID. (required)
* @return CompleteResponse<V1Timecard>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Timecard>retrieveTimecardWithHttpInfo(String timecardId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'timecardId' is set
if (timecardId == null) {
throw new ApiException(400, "Missing the required parameter 'timecardId' when calling retrieveTimecard");
}
// create path and map variables
String localVarPath = "/v1/me/timecards/{timecard_id}"
.replaceAll("\\{" + "timecard_id" + "\\}", apiClient.escapeString(timecardId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Timecard> localVarReturnType = new GenericType<V1Timecard>() {};
return (CompleteResponse<V1Timecard>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* UpdateEmployee
*
* @param employeeId The ID of the role to modify. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Employee
* @throws ApiException if fails to make API call
*/
public V1Employee updateEmployee(String employeeId, V1Employee body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'employeeId' is set
if (employeeId == null) {
throw new ApiException(400, "Missing the required parameter 'employeeId' when calling updateEmployee");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateEmployee");
}
// create path and map variables
String localVarPath = "/v1/me/employees/{employee_id}"
.replaceAll("\\{" + "employee_id" + "\\}", apiClient.escapeString(employeeId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Employee> localVarReturnType = new GenericType<V1Employee>() {};
CompleteResponse<V1Employee> completeResponse = (CompleteResponse<V1Employee>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* UpdateEmployee
*
* @param employeeId The ID of the role to modify. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1Employee>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Employee>updateEmployeeWithHttpInfo(String employeeId, V1Employee body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'employeeId' is set
if (employeeId == null) {
throw new ApiException(400, "Missing the required parameter 'employeeId' when calling updateEmployee");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateEmployee");
}
// create path and map variables
String localVarPath = "/v1/me/employees/{employee_id}"
.replaceAll("\\{" + "employee_id" + "\\}", apiClient.escapeString(employeeId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Employee> localVarReturnType = new GenericType<V1Employee>() {};
return (CompleteResponse<V1Employee>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* UpdateEmployeeRole
* Modifies the details of an employee role.
* @param roleId The ID of the role to modify. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1EmployeeRole
* @throws ApiException if fails to make API call
*/
public V1EmployeeRole updateEmployeeRole(String roleId, V1EmployeeRole body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'roleId' is set
if (roleId == null) {
throw new ApiException(400, "Missing the required parameter 'roleId' when calling updateEmployeeRole");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateEmployeeRole");
}
// create path and map variables
String localVarPath = "/v1/me/roles/{role_id}"
.replaceAll("\\{" + "role_id" + "\\}", apiClient.escapeString(roleId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1EmployeeRole> localVarReturnType = new GenericType<V1EmployeeRole>() {};
CompleteResponse<V1EmployeeRole> completeResponse = (CompleteResponse<V1EmployeeRole>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* UpdateEmployeeRole
* Modifies the details of an employee role.
* @param roleId The ID of the role to modify. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1EmployeeRole>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1EmployeeRole>updateEmployeeRoleWithHttpInfo(String roleId, V1EmployeeRole body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'roleId' is set
if (roleId == null) {
throw new ApiException(400, "Missing the required parameter 'roleId' when calling updateEmployeeRole");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateEmployeeRole");
}
// create path and map variables
String localVarPath = "/v1/me/roles/{role_id}"
.replaceAll("\\{" + "role_id" + "\\}", apiClient.escapeString(roleId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1EmployeeRole> localVarReturnType = new GenericType<V1EmployeeRole>() {};
return (CompleteResponse<V1EmployeeRole>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* UpdateTimecard
* Modifies the details of a timecard with an `API_EDIT` event for the timecard. Updating an active timecard with a `clockout_time` clocks the employee out.
* @param timecardId TThe ID of the timecard to modify. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return V1Timecard
* @throws ApiException if fails to make API call
*/
public V1Timecard updateTimecard(String timecardId, V1Timecard body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'timecardId' is set
if (timecardId == null) {
throw new ApiException(400, "Missing the required parameter 'timecardId' when calling updateTimecard");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateTimecard");
}
// create path and map variables
String localVarPath = "/v1/me/timecards/{timecard_id}"
.replaceAll("\\{" + "timecard_id" + "\\}", apiClient.escapeString(timecardId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Timecard> localVarReturnType = new GenericType<V1Timecard>() {};
CompleteResponse<V1Timecard> completeResponse = (CompleteResponse<V1Timecard>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* UpdateTimecard
* Modifies the details of a timecard with an `API_EDIT` event for the timecard. Updating an active timecard with a `clockout_time` clocks the employee out.
* @param timecardId TThe ID of the timecard to modify. (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<V1Timecard>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<V1Timecard>updateTimecardWithHttpInfo(String timecardId, V1Timecard body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'timecardId' is set
if (timecardId == null) {
throw new ApiException(400, "Missing the required parameter 'timecardId' when calling updateTimecard");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateTimecard");
}
// create path and map variables
String localVarPath = "/v1/me/timecards/{timecard_id}"
.replaceAll("\\{" + "timecard_id" + "\\}", apiClient.escapeString(timecardId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<V1Timecard> localVarReturnType = new GenericType<V1Timecard>() {};
return (CompleteResponse<V1Timecard>)apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}
| 5,152 |
0 | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect | Create_ds/connect-java-sdk/src/main/java/com/squareup/connect/api/OAuthApi.java | package com.squareup.connect.api;
import com.squareup.connect.ApiException;
import com.squareup.connect.ApiClient;
import com.squareup.connect.Configuration;
import com.squareup.connect.Pair;
import com.squareup.connect.CompleteResponse;
import javax.ws.rs.core.GenericType;
import com.squareup.connect.models.ObtainTokenRequest;
import com.squareup.connect.models.ObtainTokenResponse;
import com.squareup.connect.models.RenewTokenRequest;
import com.squareup.connect.models.RenewTokenResponse;
import com.squareup.connect.models.RevokeTokenRequest;
import com.squareup.connect.models.RevokeTokenResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class OAuthApi {
private ApiClient apiClient;
public OAuthApi() {
this(Configuration.getDefaultApiClient());
}
public OAuthApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* ObtainToken
* Returns an OAuth access token. The endpoint supports distinct methods of obtaining OAuth access tokens. Applications specify a method by adding the `grant_type` parameter in the request and also provide relevant information. For more information, see [OAuth access token management](/authz/oauth/how-it-works#oauth-access-token-management). __Note:__ Regardless of the method application specified, the endpoint always returns two items; an OAuth access token and a refresh token in the response. __OAuth tokens should only live on secure servers. Application clients should never interact directly with OAuth tokens__.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return ObtainTokenResponse
* @throws ApiException if fails to make API call
*/
public ObtainTokenResponse obtainToken(ObtainTokenRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling obtainToken");
}
// create path and map variables
String localVarPath = "/oauth2/token";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
GenericType<ObtainTokenResponse> localVarReturnType = new GenericType<ObtainTokenResponse>() {};
CompleteResponse<ObtainTokenResponse> completeResponse = (CompleteResponse<ObtainTokenResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* ObtainToken
* Returns an OAuth access token. The endpoint supports distinct methods of obtaining OAuth access tokens. Applications specify a method by adding the `grant_type` parameter in the request and also provide relevant information. For more information, see [OAuth access token management](/authz/oauth/how-it-works#oauth-access-token-management). __Note:__ Regardless of the method application specified, the endpoint always returns two items; an OAuth access token and a refresh token in the response. __OAuth tokens should only live on secure servers. Application clients should never interact directly with OAuth tokens__.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<ObtainTokenResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<ObtainTokenResponse>obtainTokenWithHttpInfo(ObtainTokenRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling obtainToken");
}
// create path and map variables
String localVarPath = "/oauth2/token";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
GenericType<ObtainTokenResponse> localVarReturnType = new GenericType<ObtainTokenResponse>() {};
return (CompleteResponse<ObtainTokenResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RenewToken
* `RenewToken` is deprecated. For information about refreshing OAuth access tokens, see [Renew OAuth Token](https://developer.squareup.com/docs/oauth-api/cookbook/renew-oauth-tokens). Renews an OAuth access token before it expires. OAuth access tokens besides your application's personal access token expire after __30 days__. You can also renew expired tokens within __15 days__ of their expiration. You cannot renew an access token that has been expired for more than 15 days. Instead, the associated user must re-complete the OAuth flow from the beginning. __Important:__ The `Authorization` header for this endpoint must have the following format: ``` Authorization: Client APPLICATION_SECRET ``` Replace `APPLICATION_SECRET` with the application secret on the Credentials page in the [application dashboard](https://connect.squareup.com/apps).
* @param clientId Your application ID, available from the [application dashboard](https://connect.squareup.com/apps). (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return RenewTokenResponse
* @throws ApiException if fails to make API call
*/
@Deprecated
public RenewTokenResponse renewToken(String clientId, RenewTokenRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'clientId' is set
if (clientId == null) {
throw new ApiException(400, "Missing the required parameter 'clientId' when calling renewToken");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling renewToken");
}
// create path and map variables
String localVarPath = "/oauth2/clients/{client_id}/access-token/renew"
.replaceAll("\\{" + "client_id" + "\\}", apiClient.escapeString(clientId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2ClientSecret" };
GenericType<RenewTokenResponse> localVarReturnType = new GenericType<RenewTokenResponse>() {};
CompleteResponse<RenewTokenResponse> completeResponse = (CompleteResponse<RenewTokenResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RenewToken
* `RenewToken` is deprecated. For information about refreshing OAuth access tokens, see [Renew OAuth Token](https://developer.squareup.com/docs/oauth-api/cookbook/renew-oauth-tokens). Renews an OAuth access token before it expires. OAuth access tokens besides your application's personal access token expire after __30 days__. You can also renew expired tokens within __15 days__ of their expiration. You cannot renew an access token that has been expired for more than 15 days. Instead, the associated user must re-complete the OAuth flow from the beginning. __Important:__ The `Authorization` header for this endpoint must have the following format: ``` Authorization: Client APPLICATION_SECRET ``` Replace `APPLICATION_SECRET` with the application secret on the Credentials page in the [application dashboard](https://connect.squareup.com/apps).
* @param clientId Your application ID, available from the [application dashboard](https://connect.squareup.com/apps). (required)
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<RenewTokenResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<RenewTokenResponse>renewTokenWithHttpInfo(String clientId, RenewTokenRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'clientId' is set
if (clientId == null) {
throw new ApiException(400, "Missing the required parameter 'clientId' when calling renewToken");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling renewToken");
}
// create path and map variables
String localVarPath = "/oauth2/clients/{client_id}/access-token/renew"
.replaceAll("\\{" + "client_id" + "\\}", apiClient.escapeString(clientId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2ClientSecret" };
GenericType<RenewTokenResponse> localVarReturnType = new GenericType<RenewTokenResponse>() {};
return (CompleteResponse<RenewTokenResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* RevokeToken
* Revokes an access token generated with the OAuth flow. If an account has more than one OAuth access token for your application, this endpoint revokes all of them, regardless of which token you specify. When an OAuth access token is revoked, all of the active subscriptions associated with that OAuth token are canceled immediately. __Important:__ The `Authorization` header for this endpoint must have the following format: ``` Authorization: Client APPLICATION_SECRET ``` Replace `APPLICATION_SECRET` with the application secret on the Credentials page in the [application dashboard](https://connect.squareup.com/apps).
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return RevokeTokenResponse
* @throws ApiException if fails to make API call
*/
public RevokeTokenResponse revokeToken(RevokeTokenRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling revokeToken");
}
// create path and map variables
String localVarPath = "/oauth2/revoke";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2ClientSecret" };
GenericType<RevokeTokenResponse> localVarReturnType = new GenericType<RevokeTokenResponse>() {};
CompleteResponse<RevokeTokenResponse> completeResponse = (CompleteResponse<RevokeTokenResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* RevokeToken
* Revokes an access token generated with the OAuth flow. If an account has more than one OAuth access token for your application, this endpoint revokes all of them, regardless of which token you specify. When an OAuth access token is revoked, all of the active subscriptions associated with that OAuth token are canceled immediately. __Important:__ The `Authorization` header for this endpoint must have the following format: ``` Authorization: Client APPLICATION_SECRET ``` Replace `APPLICATION_SECRET` with the application secret on the Credentials page in the [application dashboard](https://connect.squareup.com/apps).
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<RevokeTokenResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<RevokeTokenResponse>revokeTokenWithHttpInfo(RevokeTokenRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling revokeToken");
}
// create path and map variables
String localVarPath = "/oauth2/revoke";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2ClientSecret" };
GenericType<RevokeTokenResponse> localVarReturnType = new GenericType<RevokeTokenResponse>() {};
return (CompleteResponse<RevokeTokenResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}
| 5,153 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/echo/EchoServiceTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.echo;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.extension.ExtensionLoader;
import org.apache.dubbo.rpc.Exporter;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.Protocol;
import org.apache.dubbo.rpc.ProxyFactory;
import org.apache.dubbo.rpc.service.EchoService;
import org.apache.dubbo.service.DemoService;
import org.apache.dubbo.service.DemoServiceImpl;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
class EchoServiceTest {
@Test
void testEcho() {
DemoService server = new DemoServiceImpl();
ProxyFactory proxyFactory =
ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension();
Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension();
URL url = URL.valueOf("dubbo://127.0.0.1:5342/" + DemoService.class.getName() + "?version=1.0.0");
Exporter<DemoService> exporter = protocol.export(proxyFactory.getInvoker(server, DemoService.class, url));
Invoker<DemoService> invoker = protocol.refer(DemoService.class, url);
EchoService client = (EchoService) proxyFactory.getProxy(invoker);
Object result = client.$echo("haha");
Assertions.assertEquals("haha", result);
org.apache.dubbo.rpc.service.EchoService newClient =
(org.apache.dubbo.rpc.service.EchoService) proxyFactory.getProxy(invoker);
Object res = newClient.$echo("hehe");
Assertions.assertEquals("hehe", res);
invoker.destroy();
exporter.unexport();
}
}
| 5,154 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/cache/MyCache.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.cache;
import java.util.HashMap;
import java.util.Map;
import com.alibaba.dubbo.cache.Cache;
import com.alibaba.dubbo.common.URL;
public class MyCache implements Cache {
private Map<Object, Object> map = new HashMap<Object, Object>();
public MyCache(URL url) {}
@Override
public void put(Object key, Object value) {
map.put(key, value);
}
@Override
public Object get(Object key) {
return map.get(key);
}
}
| 5,155 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/cache/MyCacheFactory.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.cache;
import com.alibaba.dubbo.cache.Cache;
import com.alibaba.dubbo.cache.support.AbstractCacheFactory;
import com.alibaba.dubbo.common.URL;
public class MyCacheFactory extends AbstractCacheFactory {
@Override
protected Cache createCache(URL url) {
return new MyCache(url);
}
}
| 5,156 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/cache/CacheTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.cache;
import org.apache.dubbo.rpc.RpcInvocation;
import java.util.List;
import java.util.Map;
import com.alibaba.dubbo.cache.Cache;
import com.alibaba.dubbo.cache.CacheFactory;
import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.rpc.Invocation;
import com.alibaba.dubbo.rpc.Invoker;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
class CacheTest {
@Test
void testCacheFactory() {
URL url = URL.valueOf("test://test:11/test?cache=jacache&.cache.write.expire=1");
CacheFactory cacheFactory = new MyCacheFactory();
Invocation invocation = new NullInvocation();
Cache cache = cacheFactory.getCache(url, invocation);
cache.put("testKey", "testValue");
org.apache.dubbo.cache.CacheFactory factory = cacheFactory;
org.apache.dubbo.common.URL u =
org.apache.dubbo.common.URL.valueOf("test://test:11/test?cache=jacache&.cache.write.expire=1");
org.apache.dubbo.rpc.Invocation inv = new RpcInvocation();
org.apache.dubbo.cache.Cache c = factory.getCache(u, inv);
String v = (String) c.get("testKey");
Assertions.assertEquals("testValue", v);
}
static class NullInvocation implements Invocation {
@Override
public String getTargetServiceUniqueName() {
return null;
}
@Override
public String getProtocolServiceKey() {
return null;
}
@Override
public String getMethodName() {
return null;
}
@Override
public Class<?>[] getParameterTypes() {
return new Class[0];
}
@Override
public Object[] getArguments() {
return new Object[0];
}
@Override
public Map<String, String> getAttachments() {
return null;
}
@Override
public String getAttachment(String key) {
return null;
}
@Override
public String getAttachment(String key, String defaultValue) {
return null;
}
@Override
public Invoker<?> getInvoker() {
return null;
}
@Override
public Object put(Object key, Object value) {
return null;
}
@Override
public Object get(Object key) {
return null;
}
@Override
public Map<Object, Object> getAttributes() {
return null;
}
@Override
public void addInvokedInvoker(org.apache.dubbo.rpc.Invoker<?> invoker) {}
@Override
public List<org.apache.dubbo.rpc.Invoker<?>> getInvokedInvokers() {
return null;
}
}
}
| 5,157 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/ArgumentConfigTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config;
import java.util.HashMap;
import java.util.Map;
import com.alibaba.dubbo.config.ArgumentConfig;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.is;
class ArgumentConfigTest {
@Test
void testIndex() {
ArgumentConfig argument = new ArgumentConfig();
argument.setIndex(1);
assertThat(argument.getIndex(), is(1));
}
@Test
void testType() {
ArgumentConfig argument = new ArgumentConfig();
argument.setType("int");
assertThat(argument.getType(), equalTo("int"));
}
@Test
void testCallback() {
ArgumentConfig argument = new ArgumentConfig();
argument.setCallback(true);
assertThat(argument.isCallback(), is(true));
}
@Test
void testArguments() {
ArgumentConfig argument = new ArgumentConfig();
argument.setIndex(1);
argument.setType("int");
argument.setCallback(true);
Map<String, String> parameters = new HashMap<String, String>();
AbstractServiceConfig.appendParameters(parameters, argument);
assertThat(parameters, hasEntry("callback", "true"));
assertThat(parameters.size(), is(1));
}
}
| 5,158 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/ApplicationConfigTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import com.alibaba.dubbo.config.ApplicationConfig;
import com.alibaba.dubbo.config.MonitorConfig;
import com.alibaba.dubbo.config.RegistryConfig;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import static org.apache.dubbo.common.constants.CommonConstants.APPLICATION_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.DUMP_DIRECTORY;
import static org.apache.dubbo.common.constants.QosConstants.ACCEPT_FOREIGN_IP;
import static org.apache.dubbo.common.constants.QosConstants.QOS_ENABLE;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.sameInstance;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
class ApplicationConfigTest {
@Test
void testName() {
ApplicationConfig application = new ApplicationConfig();
application.setName("app");
assertThat(application.getName(), equalTo("app"));
application = new ApplicationConfig("app2");
assertThat(application.getName(), equalTo("app2"));
Map<String, String> parameters = new HashMap<String, String>();
ApplicationConfig.appendParameters(parameters, application);
assertThat(parameters, hasEntry(APPLICATION_KEY, "app2"));
}
@Test
void testVersion() {
ApplicationConfig application = new ApplicationConfig("app");
application.setVersion("1.0.0");
assertThat(application.getVersion(), equalTo("1.0.0"));
Map<String, String> parameters = new HashMap<String, String>();
ApplicationConfig.appendParameters(parameters, application);
assertThat(parameters, hasEntry("application.version", "1.0.0"));
}
@Test
void testOwner() {
ApplicationConfig application = new ApplicationConfig("app");
application.setOwner("owner");
assertThat(application.getOwner(), equalTo("owner"));
}
@Test
void testOrganization() {
ApplicationConfig application = new ApplicationConfig("app");
application.setOrganization("org");
assertThat(application.getOrganization(), equalTo("org"));
}
@Test
void testArchitecture() {
ApplicationConfig application = new ApplicationConfig("app");
application.setArchitecture("arch");
assertThat(application.getArchitecture(), equalTo("arch"));
}
@Test
void testEnvironment1() {
ApplicationConfig application = new ApplicationConfig("app");
application.setEnvironment("develop");
assertThat(application.getEnvironment(), equalTo("develop"));
application.setEnvironment("test");
assertThat(application.getEnvironment(), equalTo("test"));
application.setEnvironment("product");
assertThat(application.getEnvironment(), equalTo("product"));
}
@Test
void testEnvironment2() {
Assertions.assertThrows(IllegalStateException.class, () -> {
ApplicationConfig application = new ApplicationConfig("app");
application.setEnvironment("illegal-env");
});
}
@Test
void testRegistry() {
ApplicationConfig application = new ApplicationConfig("app");
RegistryConfig registry = new RegistryConfig();
application.setRegistry(registry);
assertThat(application.getRegistry(), sameInstance(registry));
application.setRegistries(Collections.singletonList(registry));
assertThat(application.getRegistries(), contains(registry));
assertThat(application.getRegistries(), hasSize(1));
}
@Test
void testMonitor() {
ApplicationConfig application = new ApplicationConfig("app");
application.setMonitor(new MonitorConfig("monitor-addr"));
assertThat(application.getMonitor().getAddress(), equalTo("monitor-addr"));
application.setMonitor("monitor-addr");
assertThat(application.getMonitor().getAddress(), equalTo("monitor-addr"));
}
@Test
void testLogger() {
ApplicationConfig application = new ApplicationConfig("app");
application.setLogger("log4j");
assertThat(application.getLogger(), equalTo("log4j"));
}
@Test
void testDefault() {
ApplicationConfig application = new ApplicationConfig("app");
application.setDefault(true);
assertThat(application.isDefault(), is(true));
}
@Test
void testDumpDirectory() {
ApplicationConfig application = new ApplicationConfig("app");
application.setDumpDirectory("/dump");
assertThat(application.getDumpDirectory(), equalTo("/dump"));
Map<String, String> parameters = new HashMap<String, String>();
ApplicationConfig.appendParameters(parameters, application);
assertThat(parameters, hasEntry(DUMP_DIRECTORY, "/dump"));
}
@Test
void testQosEnable() {
ApplicationConfig application = new ApplicationConfig("app");
application.setQosEnable(true);
assertThat(application.getQosEnable(), is(true));
Map<String, String> parameters = new HashMap<String, String>();
ApplicationConfig.appendParameters(parameters, application);
assertThat(parameters, hasEntry(QOS_ENABLE, "true"));
}
@Test
void testQosPort() {
ApplicationConfig application = new ApplicationConfig("app");
application.setQosPort(8080);
assertThat(application.getQosPort(), equalTo(8080));
}
@Test
void testQosAcceptForeignIp() {
ApplicationConfig application = new ApplicationConfig("app");
application.setQosAcceptForeignIp(true);
assertThat(application.getQosAcceptForeignIp(), is(true));
Map<String, String> parameters = new HashMap<String, String>();
ApplicationConfig.appendParameters(parameters, application);
assertThat(parameters, hasEntry(ACCEPT_FOREIGN_IP, "true"));
}
@Test
void testParameters() {
ApplicationConfig application = new ApplicationConfig("app");
application.setQosAcceptForeignIp(true);
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("k1", "v1");
ApplicationConfig.appendParameters(parameters, application);
assertThat(parameters, hasEntry("k1", "v1"));
assertThat(parameters, hasEntry(ACCEPT_FOREIGN_IP, "true"));
}
}
| 5,159 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/SignatureTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config;
import org.apache.dubbo.common.utils.IOUtils;
import org.apache.dubbo.common.utils.StringUtils;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Set;
import java.util.stream.Collectors;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
public class SignatureTest {
@ParameterizedTest
@ValueSource(
classes = {
com.alibaba.dubbo.config.ApplicationConfig.class,
com.alibaba.dubbo.config.ArgumentConfig.class,
com.alibaba.dubbo.config.ConsumerConfig.class,
com.alibaba.dubbo.config.MethodConfig.class,
com.alibaba.dubbo.config.ModuleConfig.class,
com.alibaba.dubbo.config.MonitorConfig.class,
com.alibaba.dubbo.config.ProtocolConfig.class,
com.alibaba.dubbo.config.ProviderConfig.class,
com.alibaba.dubbo.config.ReferenceConfig.class,
com.alibaba.dubbo.config.RegistryConfig.class,
com.alibaba.dubbo.config.ServiceConfig.class
})
void test(Class<?> targetClass) throws IOException {
String[] lines = IOUtils.readLines(
this.getClass().getClassLoader().getResourceAsStream("definition/" + targetClass.getName()));
// only compare setter now.
// getter cannot make it compatible with the old version.
Set<String> setters = Arrays.stream(lines)
.filter(StringUtils::isNotEmpty)
.filter(s -> !s.startsWith("//"))
.filter(s -> s.contains("set"))
.collect(Collectors.toSet());
for (Method method : targetClass.getMethods()) {
setters.remove(
method.toString().replace(method.getDeclaringClass().getName() + ".", targetClass.getName() + "."));
}
assertThat(setters.toString(), setters, hasSize(0));
}
}
| 5,160 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/ReferenceConfigTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config;
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
import org.apache.dubbo.service.DemoService;
import org.apache.dubbo.service.DemoServiceImpl;
import com.alibaba.dubbo.config.ApplicationConfig;
import com.alibaba.dubbo.config.ProtocolConfig;
import com.alibaba.dubbo.config.ReferenceConfig;
import com.alibaba.dubbo.config.RegistryConfig;
import com.alibaba.dubbo.config.ServiceConfig;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
class ReferenceConfigTest {
private ApplicationConfig application = new ApplicationConfig();
private RegistryConfig registry = new RegistryConfig();
private ProtocolConfig protocol = new ProtocolConfig();
@BeforeEach
public void setUp() {
DubboBootstrap.reset();
}
@AfterEach
public void tearDown() {
DubboBootstrap.reset();
}
@Test
void testInjvm() throws Exception {
application.setName("test-protocol-random-port");
registry.setAddress("multicast://224.5.6.7:1234");
protocol.setName("dubbo");
ServiceConfig<DemoService> demoService;
demoService = new ServiceConfig<DemoService>();
demoService.setInterface(DemoService.class);
demoService.setRef(new DemoServiceImpl());
demoService.setApplication(application);
demoService.setRegistry(registry);
demoService.setProtocol(protocol);
ReferenceConfig<DemoService> rc = new ReferenceConfig<DemoService>();
rc.setApplication(application);
rc.setRegistry(registry);
rc.setInterface(DemoService.class.getName());
rc.setInjvm(false);
DubboBootstrap bootstrap = DubboBootstrap.getInstance()
.application(application)
.registry(registry)
.protocol(protocol)
.service(demoService)
.reference(rc);
try {
bootstrap.start();
} finally {
bootstrap.stop();
}
}
}
| 5,161 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/ConfigTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config;
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
import org.apache.dubbo.service.DemoService;
import org.apache.dubbo.service.DemoServiceImpl;
import com.alibaba.dubbo.config.ReferenceConfig;
import com.alibaba.dubbo.config.ServiceConfig;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
class ConfigTest {
private com.alibaba.dubbo.config.ApplicationConfig applicationConfig =
new com.alibaba.dubbo.config.ApplicationConfig("first-dubbo-test");
private com.alibaba.dubbo.config.RegistryConfig registryConfig =
new com.alibaba.dubbo.config.RegistryConfig("multicast://224.5.6.7:1234");
@AfterEach
public void tearDown() {
DubboBootstrap.reset();
}
@BeforeEach
public void setup() {
// In IDE env, make sure adding the following argument to VM options
System.setProperty("java.net.preferIPv4Stack", "true");
DubboBootstrap.reset();
}
@Test
void testConfig() {
com.alibaba.dubbo.config.ServiceConfig<DemoService> service = new ServiceConfig<>();
service.setApplication(applicationConfig);
service.setRegistry(registryConfig);
service.setInterface(DemoService.class);
service.setRef(new DemoServiceImpl());
com.alibaba.dubbo.config.ReferenceConfig<DemoService> reference = new ReferenceConfig<>();
reference.setApplication(applicationConfig);
reference.setRegistry(registryConfig);
reference.setInterface(DemoService.class);
DubboBootstrap bootstrap = DubboBootstrap.getInstance()
.application(applicationConfig)
.registry(registryConfig)
.service(service)
.reference(reference)
.start();
DemoService demoService = bootstrap.getCache().get(reference);
String message = demoService.sayHello("dubbo");
Assertions.assertEquals("hello dubbo", message);
}
}
| 5,162 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/ConsumerConfigTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config;
import com.alibaba.dubbo.config.ConsumerConfig;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
class ConsumerConfigTest {
@Test
void testTimeout() throws Exception {
try {
System.clearProperty("sun.rmi.transport.tcp.responseTimeout");
ConsumerConfig consumer = new ConsumerConfig();
consumer.setTimeout(10);
assertThat(consumer.getTimeout(), is(10));
assertThat(System.getProperty("sun.rmi.transport.tcp.responseTimeout"), equalTo("10"));
} finally {
System.clearProperty("sun.rmi.transport.tcp.responseTimeout");
}
}
@Test
void testDefault() throws Exception {
ConsumerConfig consumer = new ConsumerConfig();
consumer.setDefault(true);
assertThat(consumer.isDefault(), is(true));
}
@Test
void testClient() throws Exception {
ConsumerConfig consumer = new ConsumerConfig();
consumer.setClient("client");
assertThat(consumer.getClient(), equalTo("client"));
}
}
| 5,163 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/RegistryConfigTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import com.alibaba.dubbo.config.RegistryConfig;
import org.junit.jupiter.api.Test;
import static org.apache.dubbo.common.constants.CommonConstants.SHUTDOWN_WAIT_KEY;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.hasKey;
import static org.hamcrest.Matchers.not;
class RegistryConfigTest {
@Test
void testProtocol() throws Exception {
RegistryConfig registry = new RegistryConfig();
registry.setProtocol("protocol");
assertThat(registry.getProtocol(), equalTo(registry.getProtocol()));
}
@Test
void testAddress() throws Exception {
RegistryConfig registry = new RegistryConfig();
registry.setAddress("localhost");
assertThat(registry.getAddress(), equalTo("localhost"));
Map<String, String> parameters = new HashMap<String, String>();
RegistryConfig.appendParameters(parameters, registry);
assertThat(parameters, not(hasKey("address")));
}
@Test
void testUsername() throws Exception {
RegistryConfig registry = new RegistryConfig();
registry.setUsername("username");
assertThat(registry.getUsername(), equalTo("username"));
}
@Test
void testPassword() throws Exception {
RegistryConfig registry = new RegistryConfig();
registry.setPassword("password");
assertThat(registry.getPassword(), equalTo("password"));
}
@Test
void testWait() throws Exception {
RegistryConfig registry = new RegistryConfig();
registry.setWait(10);
assertThat(registry.getWait(), is(10));
assertThat(System.getProperty(SHUTDOWN_WAIT_KEY), equalTo("10"));
}
@Test
void testCheck() throws Exception {
RegistryConfig registry = new RegistryConfig();
registry.setCheck(true);
assertThat(registry.isCheck(), is(true));
}
@Test
void testFile() throws Exception {
RegistryConfig registry = new RegistryConfig();
registry.setFile("file");
assertThat(registry.getFile(), equalTo("file"));
}
@Test
void testTransporter() throws Exception {
RegistryConfig registry = new RegistryConfig();
registry.setTransporter("transporter");
assertThat(registry.getTransporter(), equalTo("transporter"));
}
@Test
void testClient() throws Exception {
RegistryConfig registry = new RegistryConfig();
registry.setClient("client");
assertThat(registry.getClient(), equalTo("client"));
}
@Test
void testTimeout() throws Exception {
RegistryConfig registry = new RegistryConfig();
registry.setTimeout(10);
assertThat(registry.getTimeout(), is(10));
}
@Test
void testSession() throws Exception {
RegistryConfig registry = new RegistryConfig();
registry.setSession(10);
assertThat(registry.getSession(), is(10));
}
@Test
void testDynamic() throws Exception {
RegistryConfig registry = new RegistryConfig();
registry.setDynamic(true);
assertThat(registry.isDynamic(), is(true));
}
@Test
void testRegister() throws Exception {
RegistryConfig registry = new RegistryConfig();
registry.setRegister(true);
assertThat(registry.isRegister(), is(true));
}
@Test
void testSubscribe() throws Exception {
RegistryConfig registry = new RegistryConfig();
registry.setSubscribe(true);
assertThat(registry.isSubscribe(), is(true));
}
@Test
void testCluster() throws Exception {
RegistryConfig registry = new RegistryConfig();
registry.setCluster("cluster");
assertThat(registry.getCluster(), equalTo("cluster"));
}
@Test
void testGroup() throws Exception {
RegistryConfig registry = new RegistryConfig();
registry.setGroup("group");
assertThat(registry.getGroup(), equalTo("group"));
}
@Test
void testVersion() throws Exception {
RegistryConfig registry = new RegistryConfig();
registry.setVersion("1.0.0");
assertThat(registry.getVersion(), equalTo("1.0.0"));
}
@Test
void testParameters() throws Exception {
RegistryConfig registry = new RegistryConfig();
registry.setParameters(Collections.singletonMap("k1", "v1"));
assertThat(registry.getParameters(), hasEntry("k1", "v1"));
Map<String, String> parameters = new HashMap<String, String>();
RegistryConfig.appendParameters(parameters, registry);
assertThat(parameters, hasEntry("k1", "v1"));
}
@Test
void testDefault() throws Exception {
RegistryConfig registry = new RegistryConfig();
registry.setDefault(true);
assertThat(registry.isDefault(), is(true));
}
}
| 5,164 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/MethodConfigTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config;
import org.apache.dubbo.rpc.model.AsyncMethodInfo;
import org.apache.dubbo.service.Person;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import com.alibaba.dubbo.config.ArgumentConfig;
import com.alibaba.dubbo.config.MethodConfig;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import static org.apache.dubbo.config.Constants.ON_INVOKE_INSTANCE_ATTRIBUTE_KEY;
import static org.apache.dubbo.config.Constants.ON_INVOKE_METHOD_ATTRIBUTE_KEY;
import static org.apache.dubbo.config.Constants.ON_RETURN_INSTANCE_ATTRIBUTE_KEY;
import static org.apache.dubbo.config.Constants.ON_RETURN_METHOD_ATTRIBUTE_KEY;
import static org.apache.dubbo.config.Constants.ON_THROW_INSTANCE_ATTRIBUTE_KEY;
import static org.apache.dubbo.config.Constants.ON_THROW_METHOD_ATTRIBUTE_KEY;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.hasKey;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.junit.jupiter.api.Assertions.assertEquals;
class MethodConfigTest {
@Test
void testName() {
MethodConfig method = new MethodConfig();
method.setName("hello");
assertThat(method.getName(), equalTo("hello"));
Map<String, String> parameters = new HashMap<String, String>();
MethodConfig.appendParameters(parameters, method);
assertThat(parameters, not(hasKey("name")));
}
@Test
void testStat() {
MethodConfig method = new MethodConfig();
method.setStat(10);
assertThat(method.getStat(), equalTo(10));
}
@Test
void testRetry() {
MethodConfig method = new MethodConfig();
method.setRetry(true);
assertThat(method.isRetry(), is(true));
}
@Test
void testReliable() {
MethodConfig method = new MethodConfig();
method.setReliable(true);
assertThat(method.isReliable(), is(true));
}
@Test
void testExecutes() {
MethodConfig method = new MethodConfig();
method.setExecutes(10);
assertThat(method.getExecutes(), equalTo(10));
}
@Test
void testDeprecated() {
MethodConfig method = new MethodConfig();
method.setDeprecated(true);
assertThat(method.getDeprecated(), is(true));
}
@Test
void testArguments() {
MethodConfig method = new MethodConfig();
ArgumentConfig argument = new ArgumentConfig();
method.setArguments(Collections.singletonList(argument));
assertThat(method.getArguments(), contains(argument));
assertThat(method.getArguments(), Matchers.<org.apache.dubbo.config.ArgumentConfig>hasSize(1));
}
@Test
void testSticky() {
MethodConfig method = new MethodConfig();
method.setSticky(true);
assertThat(method.getSticky(), is(true));
}
@Test
void testConvertMethodConfig2AsyncInfo() throws Exception {
MethodConfig methodConfig = new MethodConfig();
String methodName = "setName";
methodConfig.setOninvokeMethod(methodName);
methodConfig.setOnthrowMethod(methodName);
methodConfig.setOnreturnMethod(methodName);
methodConfig.setOninvoke(new Person());
methodConfig.setOnthrow(new Person());
methodConfig.setOnreturn(new Person());
AsyncMethodInfo methodInfo = methodConfig.convertMethodConfig2AsyncInfo();
assertEquals(methodInfo.getOninvokeMethod(), Person.class.getMethod(methodName, String.class));
assertEquals(methodInfo.getOnthrowMethod(), Person.class.getMethod(methodName, String.class));
assertEquals(methodInfo.getOnreturnMethod(), Person.class.getMethod(methodName, String.class));
}
// @Test
void testOnreturn() {
MethodConfig method = new MethodConfig();
method.setOnreturn("on-return-object");
assertThat(method.getOnreturn(), equalTo("on-return-object"));
Map<String, String> attributes = new HashMap<>();
MethodConfig.appendAttributes(attributes, method);
assertThat(attributes, hasEntry(ON_RETURN_INSTANCE_ATTRIBUTE_KEY, "on-return-object"));
Map<String, String> parameters = new HashMap<String, String>();
MethodConfig.appendParameters(parameters, method);
assertThat(parameters.size(), is(0));
}
@Test
void testOnreturnMethod() {
MethodConfig method = new MethodConfig();
method.setOnreturnMethod("on-return-method");
assertThat(method.getOnreturnMethod(), equalTo("on-return-method"));
Map<String, String> attributes = new HashMap<>();
MethodConfig.appendAttributes(attributes, method);
assertThat(attributes, hasEntry(ON_RETURN_METHOD_ATTRIBUTE_KEY, "on-return-method"));
Map<String, String> parameters = new HashMap<String, String>();
MethodConfig.appendParameters(parameters, method);
assertThat(parameters.size(), is(0));
}
// @Test
void testOnthrow() {
MethodConfig method = new MethodConfig();
method.setOnthrow("on-throw-object");
assertThat(method.getOnthrow(), equalTo("on-throw-object"));
Map<String, String> attributes = new HashMap<>();
MethodConfig.appendAttributes(attributes, method);
assertThat(attributes, hasEntry(ON_THROW_INSTANCE_ATTRIBUTE_KEY, "on-throw-object"));
Map<String, String> parameters = new HashMap<String, String>();
MethodConfig.appendParameters(parameters, method);
assertThat(parameters.size(), is(0));
}
@Test
void testOnthrowMethod() {
MethodConfig method = new MethodConfig();
method.setOnthrowMethod("on-throw-method");
assertThat(method.getOnthrowMethod(), equalTo("on-throw-method"));
Map<String, String> attributes = new HashMap<>();
MethodConfig.appendAttributes(attributes, method);
assertThat(attributes, hasEntry(ON_THROW_METHOD_ATTRIBUTE_KEY, "on-throw-method"));
Map<String, String> parameters = new HashMap<String, String>();
MethodConfig.appendParameters(parameters, method);
assertThat(parameters.size(), is(0));
}
// @Test
void testOninvoke() {
MethodConfig method = new MethodConfig();
method.setOninvoke("on-invoke-object");
assertThat(method.getOninvoke(), equalTo("on-invoke-object"));
Map<String, String> attributes = new HashMap<>();
MethodConfig.appendAttributes(attributes, method);
assertThat(attributes, hasEntry(ON_INVOKE_INSTANCE_ATTRIBUTE_KEY, "on-invoke-object"));
Map<String, String> parameters = new HashMap<String, String>();
MethodConfig.appendParameters(parameters, method);
assertThat(parameters.size(), is(0));
}
@Test
void testOninvokeMethod() {
MethodConfig method = new MethodConfig();
method.setOninvokeMethod("on-invoke-method");
assertThat(method.getOninvokeMethod(), equalTo("on-invoke-method"));
Map<String, String> attributes = new HashMap<>();
MethodConfig.appendAttributes(attributes, method);
assertThat(attributes, hasEntry(ON_INVOKE_METHOD_ATTRIBUTE_KEY, "on-invoke-method"));
Map<String, String> parameters = new HashMap<String, String>();
MethodConfig.appendParameters(parameters, method);
assertThat(parameters.size(), is(0));
}
@Test
void testReturn() {
MethodConfig method = new MethodConfig();
method.setReturn(true);
assertThat(method.isReturn(), is(true));
}
}
| 5,165 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/ProtocolConfigTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import com.alibaba.dubbo.config.ProtocolConfig;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.is;
class ProtocolConfigTest {
@Test
void testName() throws Exception {
ProtocolConfig protocol = new ProtocolConfig();
protocol.setName("name");
Map<String, String> parameters = new HashMap<String, String>();
ProtocolConfig.appendParameters(parameters, protocol);
assertThat(protocol.getName(), equalTo("name"));
assertThat(protocol.getId(), equalTo(null));
assertThat(parameters.isEmpty(), is(true));
}
@Test
void testHost() throws Exception {
ProtocolConfig protocol = new ProtocolConfig();
protocol.setHost("host");
Map<String, String> parameters = new HashMap<String, String>();
ProtocolConfig.appendParameters(parameters, protocol);
assertThat(protocol.getHost(), equalTo("host"));
assertThat(parameters.isEmpty(), is(true));
}
@Test
void testPort() throws Exception {
ProtocolConfig protocol = new ProtocolConfig();
protocol.setPort(8080);
Map<String, String> parameters = new HashMap<String, String>();
ProtocolConfig.appendParameters(parameters, protocol);
assertThat(protocol.getPort(), equalTo(8080));
assertThat(parameters.isEmpty(), is(true));
}
@Test
void testPath() throws Exception {
ProtocolConfig protocol = new ProtocolConfig();
protocol.setContextpath("context-path");
Map<String, String> parameters = new HashMap<String, String>();
ProtocolConfig.appendParameters(parameters, protocol);
assertThat(protocol.getPath(), equalTo("context-path"));
assertThat(protocol.getContextpath(), equalTo("context-path"));
assertThat(parameters.isEmpty(), is(true));
protocol.setPath("path");
assertThat(protocol.getPath(), equalTo("path"));
assertThat(protocol.getContextpath(), equalTo("path"));
}
@Test
void testThreads() throws Exception {
ProtocolConfig protocol = new ProtocolConfig();
protocol.setThreads(10);
assertThat(protocol.getThreads(), is(10));
}
@Test
void testIothreads() throws Exception {
ProtocolConfig protocol = new ProtocolConfig();
protocol.setIothreads(10);
assertThat(protocol.getIothreads(), is(10));
}
@Test
void testQueues() throws Exception {
ProtocolConfig protocol = new ProtocolConfig();
protocol.setQueues(10);
assertThat(protocol.getQueues(), is(10));
}
@Test
void testAccepts() throws Exception {
ProtocolConfig protocol = new ProtocolConfig();
protocol.setAccepts(10);
assertThat(protocol.getAccepts(), is(10));
}
@Test
void testAccesslog() throws Exception {
ProtocolConfig protocol = new ProtocolConfig();
protocol.setAccesslog("access.log");
assertThat(protocol.getAccesslog(), equalTo("access.log"));
}
@Test
void testRegister() throws Exception {
ProtocolConfig protocol = new ProtocolConfig();
protocol.setRegister(true);
assertThat(protocol.isRegister(), is(true));
}
@Test
void testParameters() throws Exception {
ProtocolConfig protocol = new ProtocolConfig();
protocol.setParameters(Collections.singletonMap("k1", "v1"));
assertThat(protocol.getParameters(), hasEntry("k1", "v1"));
}
@Test
void testDefault() throws Exception {
ProtocolConfig protocol = new ProtocolConfig();
protocol.setDefault(true);
assertThat(protocol.isDefault(), is(true));
}
@Test
void testKeepAlive() throws Exception {
ProtocolConfig protocol = new ProtocolConfig();
protocol.setKeepAlive(true);
assertThat(protocol.getKeepAlive(), is(true));
}
@Test
void testOptimizer() throws Exception {
ProtocolConfig protocol = new ProtocolConfig();
protocol.setOptimizer("optimizer");
assertThat(protocol.getOptimizer(), equalTo("optimizer"));
}
@Test
void testExtension() throws Exception {
ProtocolConfig protocol = new ProtocolConfig();
protocol.setExtension("extension");
assertThat(protocol.getExtension(), equalTo("extension"));
}
}
| 5,166 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/ModuleConfigTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import com.alibaba.dubbo.config.ModuleConfig;
import com.alibaba.dubbo.config.MonitorConfig;
import com.alibaba.dubbo.config.RegistryConfig;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.sameInstance;
class ModuleConfigTest {
@Test
void testName2() throws Exception {
ModuleConfig module = new ModuleConfig();
module.setName("module-name");
assertThat(module.getName(), equalTo("module-name"));
assertThat(module.getId(), equalTo(null));
Map<String, String> parameters = new HashMap<String, String>();
ModuleConfig.appendParameters(parameters, module);
assertThat(parameters, hasEntry("module", "module-name"));
}
@Test
void testVersion() throws Exception {
ModuleConfig module = new ModuleConfig();
module.setName("module-name");
module.setVersion("1.0.0");
assertThat(module.getVersion(), equalTo("1.0.0"));
Map<String, String> parameters = new HashMap<String, String>();
ModuleConfig.appendParameters(parameters, module);
assertThat(parameters, hasEntry("module.version", "1.0.0"));
}
@Test
void testOwner() throws Exception {
ModuleConfig module = new ModuleConfig();
module.setOwner("owner");
assertThat(module.getOwner(), equalTo("owner"));
}
@Test
void testOrganization() throws Exception {
ModuleConfig module = new ModuleConfig();
module.setOrganization("org");
assertThat(module.getOrganization(), equalTo("org"));
}
@Test
void testRegistry() throws Exception {
ModuleConfig module = new ModuleConfig();
RegistryConfig registry = new RegistryConfig();
module.setRegistry(registry);
assertThat(module.getRegistry(), sameInstance(registry));
}
@Test
void testRegistries() throws Exception {
ModuleConfig module = new ModuleConfig();
RegistryConfig registry = new RegistryConfig();
module.setRegistries(Collections.singletonList(registry));
assertThat(module.getRegistries(), Matchers.<org.apache.dubbo.config.RegistryConfig>hasSize(1));
assertThat(module.getRegistries(), contains(registry));
}
@Test
void testMonitor() throws Exception {
ModuleConfig module = new ModuleConfig();
module.setMonitor("monitor-addr1");
assertThat(module.getMonitor().getAddress(), equalTo("monitor-addr1"));
module.setMonitor(new MonitorConfig("monitor-addr2"));
assertThat(module.getMonitor().getAddress(), equalTo("monitor-addr2"));
}
@Test
void testDefault() throws Exception {
ModuleConfig module = new ModuleConfig();
module.setDefault(true);
assertThat(module.isDefault(), is(true));
}
}
| 5,167 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/ProviderConfigTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config;
import java.util.HashMap;
import java.util.Map;
import com.alibaba.dubbo.config.ProviderConfig;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.hasKey;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
class ProviderConfigTest {
@Test
void testProtocol() throws Exception {
ProviderConfig provider = new ProviderConfig();
provider.setProtocol("protocol");
assertThat(provider.getProtocol().getName(), equalTo("protocol"));
}
@Test
void testDefault() throws Exception {
ProviderConfig provider = new ProviderConfig();
provider.setDefault(true);
Map<String, String> parameters = new HashMap<String, String>();
ProviderConfig.appendParameters(parameters, provider);
assertThat(provider.isDefault(), is(true));
assertThat(parameters, not(hasKey("default")));
}
@Test
void testHost() throws Exception {
ProviderConfig provider = new ProviderConfig();
provider.setHost("demo-host");
Map<String, String> parameters = new HashMap<String, String>();
ProviderConfig.appendParameters(parameters, provider);
assertThat(provider.getHost(), equalTo("demo-host"));
assertThat(parameters, not(hasKey("host")));
}
@Test
void testPort() throws Exception {
ProviderConfig provider = new ProviderConfig();
provider.setPort(8080);
Map<String, String> parameters = new HashMap<String, String>();
ProviderConfig.appendParameters(parameters, provider);
assertThat(provider.getPort(), is(8080));
assertThat(parameters, not(hasKey("port")));
}
@Test
void testPath() throws Exception {
ProviderConfig provider = new ProviderConfig();
provider.setPath("/path");
Map<String, String> parameters = new HashMap<String, String>();
ProviderConfig.appendParameters(parameters, provider);
assertThat(provider.getPath(), equalTo("/path"));
assertThat(provider.getContextpath(), equalTo("/path"));
assertThat(parameters, not(hasKey("path")));
}
@Test
void testContextPath() throws Exception {
ProviderConfig provider = new ProviderConfig();
provider.setContextpath("/context-path");
Map<String, String> parameters = new HashMap<String, String>();
ProviderConfig.appendParameters(parameters, provider);
assertThat(provider.getContextpath(), equalTo("/context-path"));
assertThat(parameters, not(hasKey("/context-path")));
}
@Test
void testThreads() throws Exception {
ProviderConfig provider = new ProviderConfig();
provider.setThreads(10);
assertThat(provider.getThreads(), is(10));
}
@Test
void testIothreads() throws Exception {
ProviderConfig provider = new ProviderConfig();
provider.setIothreads(10);
assertThat(provider.getIothreads(), is(10));
}
@Test
void testQueues() throws Exception {
ProviderConfig provider = new ProviderConfig();
provider.setQueues(10);
assertThat(provider.getQueues(), is(10));
}
@Test
void testAccepts() throws Exception {
ProviderConfig provider = new ProviderConfig();
provider.setAccepts(10);
assertThat(provider.getAccepts(), is(10));
}
@Test
void testCharset() throws Exception {
ProviderConfig provider = new ProviderConfig();
provider.setCharset("utf-8");
assertThat(provider.getCharset(), equalTo("utf-8"));
}
@Test
void testPayload() throws Exception {
ProviderConfig provider = new ProviderConfig();
provider.setPayload(10);
assertThat(provider.getPayload(), is(10));
}
@Test
void testBuffer() throws Exception {
ProviderConfig provider = new ProviderConfig();
provider.setBuffer(10);
assertThat(provider.getBuffer(), is(10));
}
@Test
void testServer() throws Exception {
ProviderConfig provider = new ProviderConfig();
provider.setServer("demo-server");
assertThat(provider.getServer(), equalTo("demo-server"));
}
@Test
void testClient() throws Exception {
ProviderConfig provider = new ProviderConfig();
provider.setClient("client");
assertThat(provider.getClient(), equalTo("client"));
}
@Test
void testPrompt() throws Exception {
ProviderConfig provider = new ProviderConfig();
provider.setPrompt("#");
Map<String, String> parameters = new HashMap<String, String>();
ProviderConfig.appendParameters(parameters, provider);
assertThat(provider.getPrompt(), equalTo("#"));
assertThat(parameters, hasEntry("prompt", "%23"));
}
@Test
void testDispatcher() throws Exception {
ProviderConfig provider = new ProviderConfig();
provider.setDispatcher("mockdispatcher");
assertThat(provider.getDispatcher(), equalTo("mockdispatcher"));
}
@Test
void testNetworker() throws Exception {
ProviderConfig provider = new ProviderConfig();
provider.setNetworker("networker");
assertThat(provider.getNetworker(), equalTo("networker"));
}
@Test
void testWait() throws Exception {
ProviderConfig provider = new ProviderConfig();
provider.setWait(10);
assertThat(provider.getWait(), equalTo(10));
}
}
| 5,168 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/context | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/context/annotation/EnableDubboTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config.spring.context.annotation;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
import org.apache.dubbo.config.spring.api.DemoService;
import org.apache.dubbo.config.spring.beans.factory.annotation.ServiceAnnotationTestConfiguration;
import org.apache.dubbo.config.spring.context.annotation.consumer.test.TestConsumerConfiguration;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.PropertySource;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionException;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* {@link EnableDubbo} Test
*
* @since 2.5.8
*/
class EnableDubboTest {
private AnnotationConfigApplicationContext context;
@BeforeEach
public void setUp() {
context = new AnnotationConfigApplicationContext();
DubboBootstrap.reset();
}
@AfterEach
public void tearDown() {
context.close();
DubboBootstrap.reset();
}
@Test
void testConsumer() {
context.register(TestProviderConfiguration.class, TestConsumerConfiguration.class);
context.refresh();
TestConsumerConfiguration consumerConfiguration = context.getBean(TestConsumerConfiguration.class);
DemoService demoService = consumerConfiguration.getDemoService();
String value = demoService.sayName("Mercy");
Assertions.assertEquals("Hello,Mercy", value);
DemoService autowiredDemoService = consumerConfiguration.getAutowiredDemoService();
Assertions.assertEquals("Hello,Mercy", autowiredDemoService.sayName("Mercy"));
DemoService autowiredReferDemoService = consumerConfiguration.getAutowiredReferDemoService();
Assertions.assertEquals("Hello,Mercy", autowiredReferDemoService.sayName("Mercy"));
TestConsumerConfiguration.Child child = context.getBean(TestConsumerConfiguration.Child.class);
// From Child
demoService = child.getDemoServiceFromChild();
Assertions.assertNotNull(demoService);
value = demoService.sayName("Mercy");
Assertions.assertEquals("Hello,Mercy", value);
// From Parent
demoService = child.getDemoServiceFromParent();
Assertions.assertNotNull(demoService);
value = demoService.sayName("Mercy");
Assertions.assertEquals("Hello,Mercy", value);
// From Ancestor
demoService = child.getDemoServiceFromAncestor();
Assertions.assertNotNull(demoService);
value = demoService.sayName("Mercy");
Assertions.assertEquals("Hello,Mercy", value);
// Test my-registry2 bean presentation
RegistryConfig registryConfig = context.getBean("my-registry", RegistryConfig.class);
// Test multiple binding
Assertions.assertEquals("N/A", registryConfig.getAddress());
}
@EnableDubbo(scanBasePackages = "org.apache.dubbo.config.spring.context.annotation.provider")
@ComponentScan(basePackages = "org.apache.dubbo.config.spring.context.annotation.provider")
@PropertySource("classpath:/META-INF/dubbo-provider.properties")
@Import(ServiceAnnotationTestConfiguration.class)
@EnableTransactionManagement
public static class TestProviderConfiguration {
@Primary
@Bean
public PlatformTransactionManager platformTransactionManager() {
return new PlatformTransactionManager() {
@Override
public TransactionStatus getTransaction(TransactionDefinition definition) throws TransactionException {
return null;
}
@Override
public void commit(TransactionStatus status) throws TransactionException {}
@Override
public void rollback(TransactionStatus status) throws TransactionException {}
};
}
}
}
| 5,169 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/context | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/context/annotation/DubboComponentScanRegistrarTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config.spring.context.annotation;
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
import org.apache.dubbo.config.spring.api.DemoService;
import org.apache.dubbo.config.spring.context.annotation.consumer.ConsumerConfiguration;
import org.apache.dubbo.config.spring.context.annotation.provider.DemoServiceImpl;
import org.apache.dubbo.config.spring.context.annotation.provider.ProviderConfiguration;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.aop.support.AopUtils;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.transaction.annotation.Transactional;
import static org.springframework.core.annotation.AnnotationUtils.findAnnotation;
/**
* {@link DubboComponentScanRegistrar} Test
*
* @since 2.5.8
*/
class DubboComponentScanRegistrarTest {
@BeforeEach
public void setUp() {
DubboBootstrap.reset();
}
@AfterEach
public void tearDown() {}
@Test
void test() {
AnnotationConfigApplicationContext providerContext = new AnnotationConfigApplicationContext();
providerContext.register(ProviderConfiguration.class);
providerContext.refresh();
DemoService demoService = providerContext.getBean(DemoService.class);
String value = demoService.sayName("Mercy");
Assertions.assertEquals("Hello,Mercy", value);
Class<?> beanClass = AopUtils.getTargetClass(demoService);
// DemoServiceImpl with @Transactional
Assertions.assertEquals(DemoServiceImpl.class, beanClass);
// Test @Transactional is present or not
Assertions.assertNotNull(findAnnotation(beanClass, Transactional.class));
// consumer app
AnnotationConfigApplicationContext consumerContext = new AnnotationConfigApplicationContext();
consumerContext.register(ConsumerConfiguration.class);
consumerContext.refresh();
ConsumerConfiguration consumerConfiguration = consumerContext.getBean(ConsumerConfiguration.class);
demoService = consumerConfiguration.getDemoService();
value = demoService.sayName("Mercy");
Assertions.assertEquals("Hello,Mercy", value);
ConsumerConfiguration.Child child = consumerContext.getBean(ConsumerConfiguration.Child.class);
// From Child
demoService = child.getDemoServiceFromChild();
Assertions.assertNotNull(demoService);
value = demoService.sayName("Mercy");
Assertions.assertEquals("Hello,Mercy", value);
// From Parent
demoService = child.getDemoServiceFromParent();
Assertions.assertNotNull(demoService);
value = demoService.sayName("Mercy");
Assertions.assertEquals("Hello,Mercy", value);
// From Ancestor
demoService = child.getDemoServiceFromAncestor();
Assertions.assertNotNull(demoService);
value = demoService.sayName("Mercy");
Assertions.assertEquals("Hello,Mercy", value);
providerContext.close();
consumerContext.close();
}
}
| 5,170 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/context | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/context/annotation/EnableDubboConfigTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config.spring.context.annotation;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.ConsumerConfig;
import org.apache.dubbo.config.ModuleConfig;
import org.apache.dubbo.config.MonitorConfig;
import org.apache.dubbo.config.ProtocolConfig;
import org.apache.dubbo.config.ProviderConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
import org.apache.dubbo.config.context.ConfigManager;
import org.apache.dubbo.rpc.model.ApplicationModel;
import java.util.Collection;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.PropertySource;
import static com.alibaba.spring.util.BeanRegistrar.hasAlias;
import static org.junit.jupiter.api.Assertions.assertFalse;
/**
* {@link EnableDubboConfig} Test
*
* @since 2.5.8
*/
class EnableDubboConfigTest {
@BeforeEach
public void setUp() {
DubboBootstrap.reset();
}
@AfterEach
public void tearDown() {
DubboBootstrap.reset();
}
// @Test
public void testSingle() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.register(TestConfig.class);
context.refresh();
// application
ApplicationConfig applicationConfig = context.getBean("applicationBean", ApplicationConfig.class);
Assertions.assertEquals("dubbo-demo-application", applicationConfig.getName());
// module
ModuleConfig moduleConfig = context.getBean("moduleBean", ModuleConfig.class);
Assertions.assertEquals("dubbo-demo-module", moduleConfig.getName());
// registry
RegistryConfig registryConfig = context.getBean(RegistryConfig.class);
Assertions.assertEquals("zookeeper://192.168.99.100:32770", registryConfig.getAddress());
// protocol
ProtocolConfig protocolConfig = context.getBean(ProtocolConfig.class);
Assertions.assertEquals("dubbo", protocolConfig.getName());
Assertions.assertEquals(Integer.valueOf(20880), protocolConfig.getPort());
// monitor
MonitorConfig monitorConfig = context.getBean(MonitorConfig.class);
Assertions.assertEquals("zookeeper://127.0.0.1:32770", monitorConfig.getAddress());
// provider
ProviderConfig providerConfig = context.getBean(ProviderConfig.class);
Assertions.assertEquals("127.0.0.1", providerConfig.getHost());
// consumer
ConsumerConfig consumerConfig = context.getBean(ConsumerConfig.class);
Assertions.assertEquals("netty", consumerConfig.getClient());
// asserts aliases
assertFalse(hasAlias(context, "org.apache.dubbo.config.RegistryConfig#0", "zookeeper"));
assertFalse(hasAlias(context, "org.apache.dubbo.config.MonitorConfig#0", "zookeeper"));
}
// @Test
public void testMultiple() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.register(TestMultipleConfig.class);
context.refresh();
RegistryConfig registry1 = context.getBean("registry1", RegistryConfig.class);
Assertions.assertEquals(2181, registry1.getPort());
RegistryConfig registry2 = context.getBean("registry2", RegistryConfig.class);
Assertions.assertEquals(2182, registry2.getPort());
ConfigManager configManager = ApplicationModel.defaultModel().getApplicationConfigManager();
Collection<ProtocolConfig> protocolConfigs = configManager.getProtocols();
Assertions.assertEquals(3, protocolConfigs.size());
configManager.getProtocol("dubbo").get();
configManager.getProtocol("rest").get();
configManager.getProtocol("thrift").get();
// asserts aliases
// assertTrue(hasAlias(context, "applicationBean2", "dubbo-demo-application2"));
// assertTrue(hasAlias(context, "applicationBean3", "dubbo-demo-application3"));
}
@EnableDubboConfig
@PropertySource("META-INF/config.properties")
private static class TestMultipleConfig {}
@EnableDubboConfig(multiple = false)
@PropertySource("META-INF/config.properties")
private static class TestConfig {}
}
| 5,171 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/context | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/context/annotation/DubboConfigConfigurationTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config.spring.context.annotation;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.ModuleConfig;
import org.apache.dubbo.config.ProtocolConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
import java.io.IOException;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.core.io.support.ResourcePropertySource;
/**
* {@link DubboConfigConfiguration} Test
*
* @since 2.5.8
*/
class DubboConfigConfigurationTest {
private AnnotationConfigApplicationContext context;
@BeforeEach
public void before() throws IOException {
DubboBootstrap.reset();
context = new AnnotationConfigApplicationContext();
ResourcePropertySource propertySource = new ResourcePropertySource("META-INF/config.properties");
context.getEnvironment().getPropertySources().addFirst(propertySource);
}
@AfterEach
public void after() {
context.close();
}
@Test
void testSingle() throws IOException {
context.register(DubboConfigConfiguration.Single.class);
context.refresh();
// application
ApplicationConfig applicationConfig = context.getBean("applicationBean", ApplicationConfig.class);
Assertions.assertEquals("dubbo-demo-application", applicationConfig.getName());
// module
ModuleConfig moduleConfig = context.getBean("moduleBean", ModuleConfig.class);
Assertions.assertEquals("dubbo-demo-module", moduleConfig.getName());
// registry
RegistryConfig registryConfig = context.getBean(RegistryConfig.class);
Assertions.assertEquals("zookeeper://192.168.99.100:32770", registryConfig.getAddress());
// protocol
ProtocolConfig protocolConfig = context.getBean(ProtocolConfig.class);
Assertions.assertEquals("dubbo", protocolConfig.getName());
Assertions.assertEquals(Integer.valueOf(20880), protocolConfig.getPort());
}
@Test
void testMultiple() {
context.register(DubboConfigConfiguration.Multiple.class);
context.refresh();
RegistryConfig registry1 = context.getBean("registry1", RegistryConfig.class);
Assertions.assertEquals(2181, registry1.getPort());
RegistryConfig registry2 = context.getBean("registry2", RegistryConfig.class);
Assertions.assertEquals(2182, registry2.getPort());
}
}
| 5,172 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/context/annotation | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/context/annotation/provider/DefaultHelloService.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config.spring.context.annotation.provider;
import org.apache.dubbo.config.annotation.DubboService;
import org.apache.dubbo.config.spring.api.HelloService;
import org.springframework.stereotype.Service;
/**
* Default {@link HelloService} annotation with Spring's {@link Service}
* and Dubbo's {@link org.apache.dubbo.config.annotation.Service}
*
*/
@Service
@DubboService
public class DefaultHelloService implements HelloService {
@Override
public String sayHello(String name) {
return "Greeting, " + name;
}
}
| 5,173 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/context/annotation | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/context/annotation/provider/HelloServiceImpl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config.spring.context.annotation.provider;
import org.apache.dubbo.config.spring.api.HelloService;
import com.alibaba.dubbo.config.annotation.Service;
/**
* {@link HelloService} Implementation just annotating Dubbo's {@link Service}
*
* @since 2.5.9
*/
@Service(interfaceName = "org.apache.dubbo.config.spring.api.HelloService", version = "2")
public class HelloServiceImpl implements HelloService {
@Override
public String sayHello(String name) {
return "Hello, " + name;
}
}
| 5,174 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/context/annotation | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/context/annotation/provider/DemoServiceImpl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config.spring.context.annotation.provider;
import org.apache.dubbo.config.annotation.Method;
import org.apache.dubbo.config.spring.api.Box;
import org.apache.dubbo.config.spring.api.DemoService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* {@link DemoService} Service implementation
*
* @since 2.5.8
*/
@org.apache.dubbo.config.annotation.Service(
version = "2.5.7",
application = "${demo.service.application}",
protocol = "${demo.service.protocol}",
registry = "${demo.service.registry}",
methods = @Method(timeout = 100, name = "sayName"))
@Service
@Transactional
public class DemoServiceImpl implements DemoService {
@Override
public String sayName(String name) {
return "Hello," + name;
}
@Override
public Box getBox() {
throw new UnsupportedOperationException("For Purposes!");
}
}
| 5,175 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/context/annotation | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/context/annotation/provider/ProviderConfiguration.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config.spring.context.annotation.provider;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.ProtocolConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.spring.context.annotation.DubboComponentScan;
import java.util.UUID;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.PropertySource;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionException;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.transaction.support.AbstractPlatformTransactionManager;
import org.springframework.transaction.support.DefaultTransactionStatus;
@DubboComponentScan(basePackages = "org.apache.dubbo.config.spring.context.annotation.provider")
@PropertySource("classpath:/META-INF/default.properties")
@EnableTransactionManagement
public class ProviderConfiguration {
/**
* Current application configuration, to replace XML config:
* <prev>
* <dubbo:application name="dubbo-demo-application"/>
* </prev>
*
* @return {@link ApplicationConfig} Bean
*/
@Bean("dubbo-demo-application")
public ApplicationConfig applicationConfig() {
ApplicationConfig applicationConfig = new ApplicationConfig();
applicationConfig.setName("dubbo-demo-application");
return applicationConfig;
}
/**
* Current registry center configuration, to replace XML config:
* <prev>
* <dubbo:registry id="my-registry" address="N/A"/>
* </prev>
*
* @return {@link RegistryConfig} Bean
*/
@Bean("my-registry")
public RegistryConfig registryConfig() {
RegistryConfig registryConfig = new RegistryConfig();
registryConfig.setAddress("N/A");
return registryConfig;
}
/**
* Current protocol configuration, to replace XML config:
* <prev>
* <dubbo:protocol name="dubbo" port="12345"/>
* </prev>
*
* @return {@link ProtocolConfig} Bean
*/
@Bean("dubbo")
public ProtocolConfig protocolConfig() {
ProtocolConfig protocolConfig = new ProtocolConfig();
protocolConfig.setName("dubbo");
protocolConfig.setPort(12345);
return protocolConfig;
}
@Primary
@Bean
public PlatformTransactionManager platformTransactionManager() {
return new AbstractPlatformTransactionManager() {
private Logger logger = LoggerFactory.getLogger("TestPlatformTransactionManager");
@Override
protected Object doGetTransaction() throws TransactionException {
String transaction = "transaction_" + UUID.randomUUID().toString();
logger.info("Create transaction: " + transaction);
return transaction;
}
@Override
protected void doBegin(Object transaction, TransactionDefinition definition) throws TransactionException {
logger.info("Begin transaction: " + transaction);
}
@Override
protected void doCommit(DefaultTransactionStatus status) throws TransactionException {
logger.info("Commit transaction: " + status.getTransaction());
}
@Override
protected void doRollback(DefaultTransactionStatus status) throws TransactionException {
logger.info("Rollback transaction: " + status.getTransaction());
}
};
}
}
| 5,176 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/context/annotation | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/context/annotation/consumer/ConsumerConfiguration.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config.spring.context.annotation.consumer;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.annotation.Reference;
import org.apache.dubbo.config.spring.api.DemoService;
import org.apache.dubbo.config.spring.context.annotation.DubboComponentScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
@Configuration("consumerConfiguration")
@DubboComponentScan(basePackageClasses = ConsumerConfiguration.class)
@PropertySource("META-INF/default.properties")
public class ConsumerConfiguration {
private static final String remoteURL = "dubbo://127.0.0.1:12345?version=2.5.7";
/**
* Current application configuration, to replace XML config:
* <prev>
* <dubbo:application name="dubbo-demo-application"/>
* </prev>
*
* @return {@link ApplicationConfig} Bean
*/
@Bean("dubbo-demo-application")
public ApplicationConfig applicationConfig() {
ApplicationConfig applicationConfig = new ApplicationConfig();
applicationConfig.setName("dubbo-demo-application");
return applicationConfig;
}
/**
* Current registry center configuration, to replace XML config:
* <prev>
* <dubbo:registry address="N/A"/>
* </prev>
*
* @return {@link RegistryConfig} Bean
*/
@Bean
public RegistryConfig registryConfig() {
RegistryConfig registryConfig = new RegistryConfig();
registryConfig.setAddress("N/A");
return registryConfig;
}
@Autowired
private DemoService demoServiceFromAncestor;
@Reference(version = "2.5.7", url = remoteURL)
private DemoService demoService;
public DemoService getDemoService() {
return demoService;
}
public void setDemoService(DemoService demoService) {
this.demoService = demoService;
}
@Bean
public Child c() {
return new Child();
}
public abstract static class Ancestor {
@Reference(version = "2.5.7", url = remoteURL)
private DemoService demoServiceFromAncestor;
public DemoService getDemoServiceFromAncestor() {
return demoServiceFromAncestor;
}
public void setDemoServiceFromAncestor(DemoService demoServiceFromAncestor) {
this.demoServiceFromAncestor = demoServiceFromAncestor;
}
}
public abstract static class Parent extends Ancestor {
private DemoService demoServiceFromParent;
public DemoService getDemoServiceFromParent() {
return demoServiceFromParent;
}
@Reference(version = "2.5.7", url = remoteURL)
public void setDemoServiceFromParent(DemoService demoServiceFromParent) {
this.demoServiceFromParent = demoServiceFromParent;
}
}
public static class Child extends Parent {
@Autowired
private DemoService demoService;
@Reference(version = "2.5.7", url = remoteURL)
private DemoService demoServiceFromChild;
public DemoService getDemoService() {
return demoService;
}
public DemoService getDemoServiceFromChild() {
return demoServiceFromChild;
}
public void setDemoServiceFromChild(DemoService demoServiceFromChild) {
this.demoServiceFromChild = demoServiceFromChild;
}
}
}
| 5,177 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/context/annotation/consumer | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/context/annotation/consumer/test/TestConsumerConfiguration.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config.spring.context.annotation.consumer.test;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.Reference;
import org.apache.dubbo.config.spring.api.DemoService;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* Test Consumer Configuration
*
* @since 2.5.7
*/
@EnableDubbo(scanBasePackageClasses = TestConsumerConfiguration.class)
@PropertySource("classpath:/META-INF/dubbb-consumer.properties")
@EnableTransactionManagement
public class TestConsumerConfiguration {
private static final String remoteURL = "dubbo://127.0.0.1:12345?version=2.5.7";
@Reference(
id = "demoService",
version = "2.5.7",
url = remoteURL,
application = "dubbo-demo-application",
filter = "mymock")
private DemoService demoService;
@Autowired
@Qualifier("demoServiceImpl")
private DemoService autowiredDemoService;
@Autowired
@Qualifier("demoService")
private DemoService autowiredReferDemoService;
public DemoService getAutowiredDemoService() {
return autowiredDemoService;
}
public DemoService getAutowiredReferDemoService() {
return autowiredReferDemoService;
}
public DemoService getDemoService() {
return demoService;
}
public void setDemoService(DemoService demoService) {
this.demoService = demoService;
}
@Bean
public Child c() {
return new Child();
}
public abstract static class Ancestor {
@DubboReference(version = "2.5.7", url = remoteURL, filter = "mymock", application = "dubbo-demo-application")
private DemoService demoServiceFromAncestor;
public DemoService getDemoServiceFromAncestor() {
return demoServiceFromAncestor;
}
public void setDemoServiceFromAncestor(DemoService demoServiceFromAncestor) {
this.demoServiceFromAncestor = demoServiceFromAncestor;
}
}
public abstract static class Parent extends Ancestor {
private DemoService demoServiceFromParent;
public DemoService getDemoServiceFromParent() {
return demoServiceFromParent;
}
@com.alibaba.dubbo.config.annotation.Reference(
version = "2.5.7",
url = remoteURL,
filter = "mymock",
application = "dubbo-demo-application")
public void setDemoServiceFromParent(DemoService demoServiceFromParent) {
this.demoServiceFromParent = demoServiceFromParent;
}
}
public static class Child extends Parent {
@Reference(version = "2.5.7", url = remoteURL, filter = "mymock", application = "dubbo-demo-application")
private DemoService demoServiceFromChild;
public DemoService getDemoServiceFromChild() {
return demoServiceFromChild;
}
public void setDemoServiceFromChild(DemoService demoServiceFromChild) {
this.demoServiceFromChild = demoServiceFromChild;
}
}
}
| 5,178 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/beans/factory | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/ServiceAnnotationTestConfiguration.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config.spring.beans.factory.annotation;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.ProtocolConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.PropertySource;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionException;
import org.springframework.transaction.TransactionStatus;
/**
* {@link Service} Bean
*
* @since 2.6.5
*/
@PropertySource("classpath:/META-INF/default.properties")
public class ServiceAnnotationTestConfiguration {
/**
* Current application configuration, to replace XML config:
* <prev>
* <dubbo:application name="dubbo-demo-application"/>
* </prev>
*
* @return {@link ApplicationConfig} Bean
*/
@Bean("dubbo-demo-application")
public ApplicationConfig applicationConfig() {
ApplicationConfig applicationConfig = new ApplicationConfig();
applicationConfig.setName("dubbo-demo-application");
return applicationConfig;
}
/**
* Current registry center configuration, to replace XML config:
* <prev>
* <dubbo:registry id="my-registry" address="N/A"/>
* </prev>
*
* @return {@link RegistryConfig} Bean
*/
@Bean("my-registry")
public RegistryConfig registryConfig() {
RegistryConfig registryConfig = new RegistryConfig();
registryConfig.setAddress("N/A");
return registryConfig;
}
/**
* Current protocol configuration, to replace XML config:
* <prev>
* <dubbo:protocol name="dubbo" port="12345"/>
* </prev>
*
* @return {@link ProtocolConfig} Bean
*/
@Bean // ("dubbo")
public ProtocolConfig protocolConfig() {
ProtocolConfig protocolConfig = new ProtocolConfig();
protocolConfig.setName("dubbo");
protocolConfig.setPort(12345);
return protocolConfig;
}
@Primary
@Bean
public PlatformTransactionManager platformTransactionManager() {
return new PlatformTransactionManager() {
@Override
public TransactionStatus getTransaction(TransactionDefinition definition) throws TransactionException {
return null;
}
@Override
public void commit(TransactionStatus status) throws TransactionException {}
@Override
public void rollback(TransactionStatus status) throws TransactionException {}
};
}
}
| 5,179 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/api/DemoService.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config.spring.api;
/**
* DemoService
*/
public interface DemoService {
String sayName(String name);
Box getBox();
}
| 5,180 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/api/Box.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config.spring.api;
public interface Box {
String getName();
}
| 5,181 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/api/HelloService.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config.spring.api;
public interface HelloService {
String sayHello(String name);
}
| 5,182 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/filter/MockDaoImpl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config.spring.filter;
/**
* MockDaoImpl
*/
public class MockDaoImpl implements MockDao {}
| 5,183 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/filter/MockDao.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config.spring.filter;
/**
* MockDao
*/
public interface MockDao {}
| 5,184 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/config/spring/filter/MockFilter.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.config.spring.filter;
import org.apache.dubbo.rpc.Filter;
import org.apache.dubbo.rpc.Invocation;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.Protocol;
import org.apache.dubbo.rpc.Result;
import org.apache.dubbo.rpc.RpcException;
import org.apache.dubbo.rpc.cluster.LoadBalance;
/**
* MockFilter
*/
public class MockFilter implements Filter {
private LoadBalance loadBalance;
private Protocol protocol;
private MockDao mockDao;
public MockDao getMockDao() {
return mockDao;
}
public void setMockDao(MockDao mockDao) {
this.mockDao = mockDao;
}
public LoadBalance getLoadBalance() {
return loadBalance;
}
public void setLoadBalance(LoadBalance loadBalance) {
this.loadBalance = loadBalance;
}
public Protocol getProtocol() {
return protocol;
}
public void setProtocol(Protocol protocol) {
this.protocol = protocol;
}
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
return invoker.invoke(invocation);
}
}
| 5,185 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/serialization/MySerialization.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.serialization;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.common.serialize.ObjectInput;
import com.alibaba.dubbo.common.serialize.ObjectOutput;
import com.alibaba.dubbo.common.serialize.Serialization;
public class MySerialization implements Serialization {
@Override
public ObjectOutput serialize(URL url, OutputStream output) throws IOException {
return new MyObjectOutput(output);
}
@Override
public ObjectInput deserialize(URL url, InputStream input) throws IOException {
return new MyObjectInput(input);
}
@Override
public byte getContentTypeId() {
return 101;
}
@Override
public String getContentType() {
return "x-application/my";
}
}
| 5,186 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/serialization/MyObjectOutput.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.serialization;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import com.alibaba.dubbo.common.serialize.ObjectOutput;
public class MyObjectOutput implements ObjectOutput {
private final BufferedWriter writer;
public MyObjectOutput(OutputStream outputStream) {
writer = new BufferedWriter(new OutputStreamWriter(outputStream));
}
@Override
public void writeObject(Object obj) throws IOException {}
@Override
public void writeBool(boolean v) throws IOException {}
@Override
public void writeByte(byte v) throws IOException {}
@Override
public void writeShort(short v) throws IOException {}
@Override
public void writeInt(int v) throws IOException {}
@Override
public void writeLong(long v) throws IOException {}
@Override
public void writeFloat(float v) throws IOException {}
@Override
public void writeDouble(double v) throws IOException {}
@Override
public void writeUTF(String v) throws IOException {
writer.write(v);
writer.write('\n');
}
@Override
public void writeBytes(byte[] v) throws IOException {}
@Override
public void writeBytes(byte[] v, int off, int len) throws IOException {}
@Override
public void flushBuffer() throws IOException {
writer.flush();
}
}
| 5,187 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/serialization/MyObjectInput.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.serialization;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Type;
import com.alibaba.dubbo.common.serialize.ObjectInput;
public class MyObjectInput implements ObjectInput {
private final BufferedReader reader;
public MyObjectInput(InputStream inputStream) {
this.reader = new BufferedReader(new InputStreamReader(inputStream));
}
@Override
public Object readObject() throws IOException, ClassNotFoundException {
return null;
}
@Override
public <T> T readObject(Class<T> cls) throws IOException, ClassNotFoundException {
return null;
}
@Override
public <T> T readObject(Class<T> cls, Type type) throws IOException, ClassNotFoundException {
return null;
}
@Override
public boolean readBool() throws IOException {
return false;
}
@Override
public byte readByte() throws IOException {
return 0;
}
@Override
public short readShort() throws IOException {
return 0;
}
@Override
public int readInt() throws IOException {
return 0;
}
@Override
public long readLong() throws IOException {
return 0;
}
@Override
public float readFloat() throws IOException {
return 0;
}
@Override
public double readDouble() throws IOException {
return 0;
}
@Override
public String readUTF() throws IOException {
return reader.readLine();
}
@Override
public byte[] readBytes() throws IOException {
return new byte[0];
}
}
| 5,188 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/serialization/SerializationTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.serialization;
import org.apache.dubbo.common.serialize.ObjectInput;
import org.apache.dubbo.common.serialize.ObjectOutput;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.hamcrest.CoreMatchers;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.mockito.Mockito.mock;
class SerializationTest {
private MySerialization mySerialization;
private MyObjectOutput myObjectOutput;
private MyObjectInput myObjectInput;
private ByteArrayOutputStream byteArrayOutputStream;
private ByteArrayInputStream byteArrayInputStream;
@BeforeEach
public void setUp() throws Exception {
this.mySerialization = new MySerialization();
this.byteArrayOutputStream = new ByteArrayOutputStream();
this.myObjectOutput = new MyObjectOutput(byteArrayOutputStream);
}
@Test
void testContentType() {
assertThat(mySerialization.getContentType(), is("x-application/my"));
}
@Test
void testContentTypeId() {
assertThat(mySerialization.getContentTypeId(), is((byte) 101));
}
@Test
void testObjectOutput() throws IOException {
ObjectOutput objectOutput = mySerialization.serialize(null, mock(OutputStream.class));
assertThat(objectOutput, Matchers.<ObjectOutput>instanceOf(MyObjectOutput.class));
}
@Test
void testObjectInput() throws IOException {
ObjectInput objectInput = mySerialization.deserialize(null, mock(InputStream.class));
assertThat(objectInput, Matchers.<ObjectInput>instanceOf(MyObjectInput.class));
}
@Test
void testWriteUTF() throws IOException {
myObjectOutput.writeUTF("Pace");
myObjectOutput.writeUTF("和平");
myObjectOutput.writeUTF(" Мир");
flushToInput();
assertThat(myObjectInput.readUTF(), CoreMatchers.is("Pace"));
assertThat(myObjectInput.readUTF(), CoreMatchers.is("和平"));
assertThat(myObjectInput.readUTF(), CoreMatchers.is(" Мир"));
}
private void flushToInput() throws IOException {
this.myObjectOutput.flushBuffer();
this.byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
this.myObjectInput = new MyObjectInput(byteArrayInputStream);
}
}
| 5,189 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/common | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension/MyExtensionFactory.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.common.extension;
import com.alibaba.dubbo.common.extension.ExtensionFactory;
public class MyExtensionFactory implements ExtensionFactory {
@Override
public <T> T getExtension(final Class<T> type, final String name) {
if (type == InjectObject.class) {
return (T) new InjectObject(name);
}
return null;
}
public static class InjectObject {
private final String name;
public InjectObject(final String name) {
this.name = name;
}
}
}
| 5,190 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/common | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension/MockDispatcher.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.common.extension;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.remoting.ChannelHandler;
import org.apache.dubbo.remoting.Dispatcher;
public class MockDispatcher implements Dispatcher {
@Override
public ChannelHandler dispatch(ChannelHandler handler, URL url) {
return null;
}
}
| 5,191 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/common | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension/ExtensionTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.common.extension;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.extension.activate.ActivateExt1;
import org.apache.dubbo.common.extension.activate.impl.OldActivateExt1Impl2;
import org.apache.dubbo.common.extension.activate.impl.OldActivateExt1Impl3;
import org.apache.dubbo.rpc.model.ApplicationModel;
import java.util.List;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import static org.apache.dubbo.common.constants.CommonConstants.GROUP_KEY;
import static org.junit.jupiter.api.Assertions.fail;
class ExtensionTest {
@Test
void testExtensionFactory() {
try {
ExtensionInjector myfactory =
ExtensionLoader.getExtensionLoader(ExtensionInjector.class).getExtension("myfactory");
Assertions.assertTrue(myfactory instanceof ExtensionInjector);
Assertions.assertTrue(myfactory instanceof ExtensionFactory);
Assertions.assertTrue(myfactory instanceof com.alibaba.dubbo.common.extension.ExtensionFactory);
Assertions.assertTrue(myfactory instanceof MyExtensionFactory);
ExtensionInjector spring =
ExtensionLoader.getExtensionLoader(ExtensionInjector.class).getExtension("spring");
Assertions.assertTrue(spring instanceof ExtensionInjector);
Assertions.assertFalse(spring instanceof ExtensionFactory);
Assertions.assertFalse(spring instanceof com.alibaba.dubbo.common.extension.ExtensionFactory);
} catch (IllegalArgumentException expected) {
fail();
}
}
private <T> ExtensionLoader<T> getExtensionLoader(Class<T> type) {
return ApplicationModel.defaultModel().getExtensionDirector().getExtensionLoader(type);
}
@Test
void testLoadActivateExtension() {
// test default
URL url = URL.valueOf("test://localhost/test").addParameter(GROUP_KEY, "old_group");
List<ActivateExt1> list =
getExtensionLoader(ActivateExt1.class).getActivateExtension(url, new String[] {}, "old_group");
Assertions.assertEquals(2, list.size());
Assertions.assertTrue(list.get(0).getClass() == OldActivateExt1Impl2.class
|| list.get(0).getClass() == OldActivateExt1Impl3.class);
}
}
| 5,192 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension/support/OldFilter5.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.common.extension.support;
import com.alibaba.dubbo.common.extension.Activate;
@Activate(after = "_4")
public class OldFilter5 implements OldFilter0 {}
| 5,193 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension/support/Order0Filter1.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.common.extension.support;
import org.apache.dubbo.common.extension.Activate;
@Activate
public class Order0Filter1 implements Order0Filter0 {}
| 5,194 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension/support/Filter1.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.common.extension.support;
import org.apache.dubbo.common.extension.Activate;
@Activate
public class Filter1 implements Filter0 {}
| 5,195 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension/support/Filter0.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.common.extension.support;
import org.apache.dubbo.common.extension.SPI;
@SPI
public interface Filter0 {}
| 5,196 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension/support/Order0Filter0.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.common.extension.support;
import org.apache.dubbo.common.extension.SPI;
@SPI
public interface Order0Filter0 {}
| 5,197 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension/support/ActivateComparatorTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.common.extension.support;
import org.apache.dubbo.rpc.model.ApplicationModel;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
class ActivateComparatorTest {
private ActivateComparator activateComparator;
@BeforeEach
public void setup() {
activateComparator =
new ActivateComparator(ApplicationModel.defaultModel().getExtensionDirector());
}
@Test
void testActivateComparator() {
Filter1 f1 = new Filter1();
Filter2 f2 = new Filter2();
Filter3 f3 = new Filter3();
Filter4 f4 = new Filter4();
OldFilter5 f5 = new OldFilter5();
List<Class<?>> filters = new ArrayList<>();
filters.add(f1.getClass());
filters.add(f2.getClass());
filters.add(f3.getClass());
filters.add(f4.getClass());
filters.add(f5.getClass());
Collections.sort(filters, activateComparator);
Assertions.assertEquals(f4.getClass(), filters.get(0));
Assertions.assertEquals(f5.getClass(), filters.get(1));
Assertions.assertEquals(f3.getClass(), filters.get(2));
Assertions.assertEquals(f2.getClass(), filters.get(3));
Assertions.assertEquals(f1.getClass(), filters.get(4));
}
}
| 5,198 |
0 | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension | Create_ds/dubbo/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension/support/OldFilter0.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.common.extension.support;
public interface OldFilter0 extends Filter0 {}
| 5,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.