|
| 1 | +// File generated from our OpenAPI spec |
| 2 | +package com.stripe.param; |
| 3 | + |
| 4 | +import com.google.gson.annotations.SerializedName; |
| 5 | +import com.stripe.net.ApiRequestParams; |
| 6 | +import java.util.ArrayList; |
| 7 | +import java.util.HashMap; |
| 8 | +import java.util.List; |
| 9 | +import java.util.Map; |
| 10 | +import lombok.EqualsAndHashCode; |
| 11 | +import lombok.Getter; |
| 12 | + |
| 13 | +@Getter |
| 14 | +@EqualsAndHashCode(callSuper = false) |
| 15 | +public class SubscriptionAttachCadenceParams extends ApiRequestParams { |
| 16 | + /** |
| 17 | + * <strong>Required.</strong> The Billing Cadence which controls the timing of recurring invoice |
| 18 | + * generation for this subscription. If unset, the subscription will bill according to its own |
| 19 | + * configured schedule and create its own invoices. If set, this subscription will be billed by |
| 20 | + * the cadence instead, potentially sharing invoices with the other subscriptions linked to that |
| 21 | + * Cadence. |
| 22 | + */ |
| 23 | + @SerializedName("billing_cadence") |
| 24 | + String billingCadence; |
| 25 | + |
| 26 | + /** Specifies which fields in the response should be expanded. */ |
| 27 | + @SerializedName("expand") |
| 28 | + List<String> expand; |
| 29 | + |
| 30 | + /** |
| 31 | + * Map of extra parameters for custom features not available in this client library. The content |
| 32 | + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each |
| 33 | + * key/value pair is serialized as if the key is a root-level field (serialized) name in this |
| 34 | + * param object. Effectively, this map is flattened to its parent instance. |
| 35 | + */ |
| 36 | + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) |
| 37 | + Map<String, Object> extraParams; |
| 38 | + |
| 39 | + private SubscriptionAttachCadenceParams( |
| 40 | + String billingCadence, List<String> expand, Map<String, Object> extraParams) { |
| 41 | + this.billingCadence = billingCadence; |
| 42 | + this.expand = expand; |
| 43 | + this.extraParams = extraParams; |
| 44 | + } |
| 45 | + |
| 46 | + public static Builder builder() { |
| 47 | + return new Builder(); |
| 48 | + } |
| 49 | + |
| 50 | + public static class Builder { |
| 51 | + private String billingCadence; |
| 52 | + |
| 53 | + private List<String> expand; |
| 54 | + |
| 55 | + private Map<String, Object> extraParams; |
| 56 | + |
| 57 | + /** Finalize and obtain parameter instance from this builder. */ |
| 58 | + public SubscriptionAttachCadenceParams build() { |
| 59 | + return new SubscriptionAttachCadenceParams( |
| 60 | + this.billingCadence, this.expand, this.extraParams); |
| 61 | + } |
| 62 | + |
| 63 | + /** |
| 64 | + * <strong>Required.</strong> The Billing Cadence which controls the timing of recurring invoice |
| 65 | + * generation for this subscription. If unset, the subscription will bill according to its own |
| 66 | + * configured schedule and create its own invoices. If set, this subscription will be billed by |
| 67 | + * the cadence instead, potentially sharing invoices with the other subscriptions linked to that |
| 68 | + * Cadence. |
| 69 | + */ |
| 70 | + public Builder setBillingCadence(String billingCadence) { |
| 71 | + this.billingCadence = billingCadence; |
| 72 | + return this; |
| 73 | + } |
| 74 | + |
| 75 | + /** |
| 76 | + * Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and |
| 77 | + * subsequent calls adds additional elements to the original list. See {@link |
| 78 | + * SubscriptionAttachCadenceParams#expand} for the field documentation. |
| 79 | + */ |
| 80 | + public Builder addExpand(String element) { |
| 81 | + if (this.expand == null) { |
| 82 | + this.expand = new ArrayList<>(); |
| 83 | + } |
| 84 | + this.expand.add(element); |
| 85 | + return this; |
| 86 | + } |
| 87 | + |
| 88 | + /** |
| 89 | + * Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and |
| 90 | + * subsequent calls adds additional elements to the original list. See {@link |
| 91 | + * SubscriptionAttachCadenceParams#expand} for the field documentation. |
| 92 | + */ |
| 93 | + public Builder addAllExpand(List<String> elements) { |
| 94 | + if (this.expand == null) { |
| 95 | + this.expand = new ArrayList<>(); |
| 96 | + } |
| 97 | + this.expand.addAll(elements); |
| 98 | + return this; |
| 99 | + } |
| 100 | + |
| 101 | + /** |
| 102 | + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` |
| 103 | + * call, and subsequent calls add additional key/value pairs to the original map. See {@link |
| 104 | + * SubscriptionAttachCadenceParams#extraParams} for the field documentation. |
| 105 | + */ |
| 106 | + public Builder putExtraParam(String key, Object value) { |
| 107 | + if (this.extraParams == null) { |
| 108 | + this.extraParams = new HashMap<>(); |
| 109 | + } |
| 110 | + this.extraParams.put(key, value); |
| 111 | + return this; |
| 112 | + } |
| 113 | + |
| 114 | + /** |
| 115 | + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first |
| 116 | + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. |
| 117 | + * See {@link SubscriptionAttachCadenceParams#extraParams} for the field documentation. |
| 118 | + */ |
| 119 | + public Builder putAllExtraParam(Map<String, Object> map) { |
| 120 | + if (this.extraParams == null) { |
| 121 | + this.extraParams = new HashMap<>(); |
| 122 | + } |
| 123 | + this.extraParams.putAll(map); |
| 124 | + return this; |
| 125 | + } |
| 126 | + } |
| 127 | +} |
0 commit comments