-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
* Add new query list objects * Add attachment Resource with fetch requests * Change naming, readmes etc. accordingly
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import java.net.URI | ||
|
||
version = "0.1" | ||
version = "0.2.0" | ||
|
||
java { | ||
withJavadocJar() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package io.github.bolzer.easybill_java_sdk.models; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import java.time.LocalDate; | ||
import org.checkerframework.checker.nullness.qual.NonNull; | ||
import org.checkerframework.checker.nullness.qual.Nullable; | ||
|
||
public record Attachment( | ||
@JsonProperty("id") long id, | ||
@JsonProperty("size") long size, | ||
@JsonProperty("customer_id") @Nullable Long customerId, | ||
@JsonProperty("project_id") @Nullable Long projectId, | ||
@JsonProperty("document_id") @Nullable Long documentId, | ||
@JsonProperty("file_name") @NonNull String fileName, | ||
@JsonProperty("created_at") | ||
@NonNull | ||
@JsonFormat(pattern = "yyyy-MM-dd") | ||
LocalDate createdAt | ||
) {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package io.github.bolzer.easybill_java_sdk.requests; | ||
|
||
import io.github.bolzer.easybill_java_sdk.contracts.QueryRequest; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.Singular; | ||
import org.checkerframework.checker.index.qual.Positive; | ||
import org.checkerframework.checker.initialization.qual.Initialized; | ||
import org.checkerframework.checker.nullness.qual.NonNull; | ||
import org.checkerframework.common.value.qual.IntRange; | ||
|
||
@Builder | ||
@Getter | ||
public final class DiscountListQueryRequest implements QueryRequest { | ||
|
||
@Builder.Default | ||
@Positive | ||
private int page = 1; | ||
|
||
@Builder.Default | ||
@IntRange(from = 100, to = 1000) | ||
private int limit = 100; | ||
|
||
@Singular | ||
@NonNull | ||
private List<@NonNull Long> customerIds; | ||
|
||
@Override | ||
public @Initialized @NonNull Map<@NonNull String, @NonNull String> toStringMap() { | ||
final Map<String, String> map = new HashMap<>(); | ||
map.put("page", String.valueOf(page)); | ||
map.put("limit", String.valueOf(limit)); | ||
|
||
if (!customerIds.isEmpty()) { | ||
map.put( | ||
"customer_id", | ||
String.join( | ||
",", | ||
this.customerIds.stream().map(String::valueOf).toList() | ||
) | ||
); | ||
} | ||
|
||
return map; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
package io.github.bolzer.easybill_java_sdk.requests; | ||
|
||
import io.github.bolzer.easybill_java_sdk.contracts.QueryRequest; | ||
import java.time.LocalDate; | ||
import java.time.format.DateTimeFormatter; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Objects; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.Singular; | ||
import org.checkerframework.checker.index.qual.Positive; | ||
import org.checkerframework.checker.initialization.qual.Initialized; | ||
import org.checkerframework.checker.nullness.qual.NonNull; | ||
import org.checkerframework.checker.nullness.qual.Nullable; | ||
import org.checkerframework.common.value.qual.IntRange; | ||
import org.javatuples.Pair; | ||
|
||
@Builder | ||
@Getter | ||
public final class DocumentPaymentListQueryRequest implements QueryRequest { | ||
|
||
@Builder.Default | ||
@Positive | ||
private int page = 1; | ||
|
||
@Builder.Default | ||
@IntRange(from = 100, to = 1000) | ||
private int limit = 100; | ||
|
||
@Builder.Default | ||
@Nullable | ||
private LocalDate paymentAt = null; | ||
|
||
@Builder.Default | ||
@Nullable | ||
private Pair<@NonNull LocalDate, @NonNull LocalDate> paymentBetween = null; | ||
|
||
@Singular | ||
@NonNull | ||
private List<@NonNull Long> documentIds; | ||
|
||
@Singular | ||
@NonNull | ||
private List<@NonNull String> references; | ||
|
||
@Override | ||
public @Initialized @NonNull Map<@NonNull String, @NonNull String> toStringMap() { | ||
final Map<String, String> map = new HashMap<>(); | ||
map.put("page", String.valueOf(page)); | ||
map.put("limit", String.valueOf(limit)); | ||
|
||
if (!documentIds.isEmpty()) { | ||
map.put( | ||
"document_id", | ||
String.join( | ||
",", | ||
this.documentIds.stream().map(String::valueOf).toList() | ||
) | ||
); | ||
} | ||
|
||
if (!references.isEmpty()) { | ||
map.put("references", String.join(",", this.references)); | ||
} | ||
|
||
if (Objects.nonNull(paymentAt)) { | ||
map.put( | ||
"payment_at", | ||
paymentAt.format(DateTimeFormatter.ISO_LOCAL_DATE) | ||
); | ||
} | ||
|
||
if (Objects.nonNull(paymentBetween)) { | ||
Pair<@NonNull LocalDate, @NonNull LocalDate> paymentBetween = | ||
Objects.requireNonNull(this.paymentBetween); | ||
|
||
map.put( | ||
"created_at", | ||
String.join( | ||
",", | ||
paymentBetween | ||
.getValue0() | ||
.format(DateTimeFormatter.ISO_LOCAL_DATE), | ||
paymentBetween | ||
.getValue1() | ||
.format(DateTimeFormatter.ISO_LOCAL_DATE) | ||
) | ||
); | ||
} | ||
|
||
return map; | ||
} | ||
} |