Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .spec-sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1c648bd5dd3dab534723d1cb26e19fdbfcc7359cd8a33a1f8d99e5688e4ba54f
8c6a3b8bfecad67daa21d1361057c24f2e063b17c13afdcc93e7f71806011003
29 changes: 29 additions & 0 deletions src/main/java/com/controlresell/sdk/ControlResell.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
import com.controlresell.sdk.generated.ApiException;
import com.controlresell.sdk.generated.api.AccountsApi;
import com.controlresell.sdk.generated.api.ConversationsApi;
import com.controlresell.sdk.generated.api.CustomersApi;
import com.controlresell.sdk.generated.api.ItemsApi;
import com.controlresell.sdk.generated.api.MeApi;
import com.controlresell.sdk.generated.api.OrdersApi;
import com.controlresell.sdk.generated.model.Account;
import com.controlresell.sdk.generated.model.AccountPage;
import com.controlresell.sdk.generated.model.Conversation;
import com.controlresell.sdk.generated.model.ConversationPage;
import com.controlresell.sdk.generated.model.Customer;
import com.controlresell.sdk.generated.model.CustomerPage;
import com.controlresell.sdk.generated.model.Item;
import com.controlresell.sdk.generated.model.ItemCreateRequest;
import com.controlresell.sdk.generated.model.ItemPage;
Expand Down Expand Up @@ -143,6 +146,9 @@ public <T> T call(boolean write, HttpCall<T> call) {
/** The seller's sales and purchases. */
public Orders orders() { return new Orders(); }

/** The other parties of the seller's sales and purchases (needs the {@code customers:read} scope). */
public Customers customers() { return new Customers(); }

/** The seller the API key acts for. */
public final class MeResource {
private final MeApi api = new MeApi(apiClient);
Expand Down Expand Up @@ -336,6 +342,29 @@ public Iterable<Order> listAll(Integer limit, String bucket, String platform, UU
}
}

/** The other parties of the seller's sales and purchases. */
public final class Customers {
private final CustomersApi api = new CustomersApi(apiClient);

private Customers() {}

/**
* One page of customers, the most recently created first; every argument may be {@code null}. {@code from} is
* inclusive and {@code to} exclusive, on the creation date.
*/
public CustomerPage list(Integer limit, String cursor, UUID accountId, OffsetDateTime from, OffsetDateTime to) {
return call(false, h -> api.listCustomers(limit, cursor, from, to, accountId, h));
}

public Customer get(UUID id) { return call(false, h -> api.getCustomer(id, h)); }

/** Every customer, page after page, with the same filters. */
public Iterable<Customer> listAll(Integer limit, UUID accountId, OffsetDateTime from, OffsetDateTime to) {
return new Paginator<>(cursor -> list(limit, cursor, accountId, from, to),
p -> page(p.getData(), p.getNextCursor()));
}
}

/**
* The {@code Idempotency-Key} of a write: the caller's, else a random one. It is chosen once, outside the retries, so
* every attempt of the call sends the same key (the typed methods take the key as an argument, not through the retrier).
Expand Down
439 changes: 439 additions & 0 deletions src/main/java/com/controlresell/sdk/generated/api/CustomersApi.java

Large diffs are not rendered by default.

331 changes: 331 additions & 0 deletions src/main/java/com/controlresell/sdk/generated/model/Customer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,331 @@
/*
* ControlResell public API
* The public API of ControlResell. Every error answers `{\"error\": {\"code\", \"message\", \"params\", \"requestId\"}}`; a `POST` takes an `Idempotency-Key` header.
*
* The version of the OpenAPI document: 1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/


package com.controlresell.sdk.generated.model;

import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import com.controlresell.sdk.generated.model.CustomerAddress;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.time.OffsetDateTime;
import java.util.Arrays;
import java.util.UUID;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;


import com.controlresell.sdk.generated.ApiClient;
/**
* Customer
*/
@JsonPropertyOrder({
Customer.JSON_PROPERTY_ID,
Customer.JSON_PROPERTY_FIRST_NAME,
Customer.JSON_PROPERTY_LAST_NAME,
Customer.JSON_PROPERTY_EMAIL,
Customer.JSON_PROPERTY_ADDRESS,
Customer.JSON_PROPERTY_CREATED_AT
})
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0")
public class Customer {
public static final String JSON_PROPERTY_ID = "id";
@jakarta.annotation.Nonnull
private UUID id;

public static final String JSON_PROPERTY_FIRST_NAME = "firstName";
@jakarta.annotation.Nonnull
private String firstName;

public static final String JSON_PROPERTY_LAST_NAME = "lastName";
@jakarta.annotation.Nonnull
private String lastName;

public static final String JSON_PROPERTY_EMAIL = "email";
@jakarta.annotation.Nullable
private String email;

public static final String JSON_PROPERTY_ADDRESS = "address";
@jakarta.annotation.Nonnull
private CustomerAddress address;

public static final String JSON_PROPERTY_CREATED_AT = "createdAt";
@jakarta.annotation.Nonnull
private OffsetDateTime createdAt;

public Customer() {
}

public Customer id(@jakarta.annotation.Nonnull UUID id) {
this.id = id;
return this;
}

/**
* Get id
* @return id
*/
@jakarta.annotation.Nonnull
@JsonProperty(value = JSON_PROPERTY_ID, required = true)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public UUID getId() {
return id;
}


@JsonProperty(value = JSON_PROPERTY_ID, required = true)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setId(@jakarta.annotation.Nonnull UUID id) {
this.id = id;
}


public Customer firstName(@jakarta.annotation.Nonnull String firstName) {
this.firstName = firstName;
return this;
}

/**
* Get firstName
* @return firstName
*/
@jakarta.annotation.Nonnull
@JsonProperty(value = JSON_PROPERTY_FIRST_NAME, required = true)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getFirstName() {
return firstName;
}


@JsonProperty(value = JSON_PROPERTY_FIRST_NAME, required = true)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setFirstName(@jakarta.annotation.Nonnull String firstName) {
this.firstName = firstName;
}


public Customer lastName(@jakarta.annotation.Nonnull String lastName) {
this.lastName = lastName;
return this;
}

/**
* Get lastName
* @return lastName
*/
@jakarta.annotation.Nonnull
@JsonProperty(value = JSON_PROPERTY_LAST_NAME, required = true)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getLastName() {
return lastName;
}


@JsonProperty(value = JSON_PROPERTY_LAST_NAME, required = true)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setLastName(@jakarta.annotation.Nonnull String lastName) {
this.lastName = lastName;
}


public Customer email(@jakarta.annotation.Nullable String email) {
this.email = email;
return this;
}

/**
* Get email
* @return email
*/
@jakarta.annotation.Nullable
@JsonProperty(value = JSON_PROPERTY_EMAIL, required = false)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getEmail() {
return email;
}


@JsonProperty(value = JSON_PROPERTY_EMAIL, required = false)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setEmail(@jakarta.annotation.Nullable String email) {
this.email = email;
}


public Customer address(@jakarta.annotation.Nonnull CustomerAddress address) {
this.address = address;
return this;
}

/**
* Get address
* @return address
*/
@jakarta.annotation.Nonnull
@JsonProperty(value = JSON_PROPERTY_ADDRESS, required = true)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public CustomerAddress getAddress() {
return address;
}


@JsonProperty(value = JSON_PROPERTY_ADDRESS, required = true)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setAddress(@jakarta.annotation.Nonnull CustomerAddress address) {
this.address = address;
}


public Customer createdAt(@jakarta.annotation.Nonnull OffsetDateTime createdAt) {
this.createdAt = createdAt;
return this;
}

/**
* Get createdAt
* @return createdAt
*/
@jakarta.annotation.Nonnull
@JsonProperty(value = JSON_PROPERTY_CREATED_AT, required = true)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public OffsetDateTime getCreatedAt() {
return createdAt;
}


@JsonProperty(value = JSON_PROPERTY_CREATED_AT, required = true)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setCreatedAt(@jakarta.annotation.Nonnull OffsetDateTime createdAt) {
this.createdAt = createdAt;
}


/**
* Return true if this Customer object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Customer customer = (Customer) o;
return Objects.equals(this.id, customer.id) &&
Objects.equals(this.firstName, customer.firstName) &&
Objects.equals(this.lastName, customer.lastName) &&
Objects.equals(this.email, customer.email) &&
Objects.equals(this.address, customer.address) &&
Objects.equals(this.createdAt, customer.createdAt);
}

@Override
public int hashCode() {
return Objects.hash(id, firstName, lastName, email, address, createdAt);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Customer {\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(" address: ").append(toIndentedString(address)).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(Object o) {
return o == null ? "null" : o.toString().replace("\n", "\n ");
}

/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}

/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}

StringJoiner joiner = new StringJoiner("&");

// add `id` to the URL query string
if (getId() != null) {
joiner.add(String.format(java.util.Locale.ROOT, "%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId()))));
}

// add `firstName` to the URL query string
if (getFirstName() != null) {
joiner.add(String.format(java.util.Locale.ROOT, "%sfirstName%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getFirstName()))));
}

// add `lastName` to the URL query string
if (getLastName() != null) {
joiner.add(String.format(java.util.Locale.ROOT, "%slastName%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getLastName()))));
}

// add `email` to the URL query string
if (getEmail() != null) {
joiner.add(String.format(java.util.Locale.ROOT, "%semail%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getEmail()))));
}

// add `address` to the URL query string
if (getAddress() != null) {
joiner.add(getAddress().toUrlQueryString(prefix + "address" + suffix));
}

// add `createdAt` to the URL query string
if (getCreatedAt() != null) {
joiner.add(String.format(java.util.Locale.ROOT, "%screatedAt%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getCreatedAt()))));
}

return joiner.toString();
}
}

Loading
Loading