• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stripe / stripe-java / #16398

05 Sep 2024 09:03PM UTC coverage: 12.874% (-0.003%) from 12.877%
#16398

push

github

web-flow
Merge pull request #1859 from stripe/latest-codegen-beta

Update generated code for beta

1 of 49 new or added lines in 6 files covered. (2.04%)

4 existing lines in 4 files now uncovered.

18461 of 143399 relevant lines covered (12.87%)

0.13 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/com/stripe/param/billing/AlertCreateParams.java
1
// File generated from our OpenAPI spec
2
package com.stripe.param.billing;
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.Getter;
11

12
@Getter
13
public class AlertCreateParams extends ApiRequestParams {
14
  /** <strong>Required.</strong> The type of alert to create. */
15
  @SerializedName("alert_type")
16
  AlertType alertType;
17

18
  /** Specifies which fields in the response should be expanded. */
19
  @SerializedName("expand")
20
  List<String> expand;
21

22
  /**
23
   * Map of extra parameters for custom features not available in this client library. The content
24
   * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
25
   * key/value pair is serialized as if the key is a root-level field (serialized) name in this
26
   * param object. Effectively, this map is flattened to its parent instance.
27
   */
28
  @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
29
  Map<String, Object> extraParams;
30

31
  /** Filters to limit the scope of an alert. */
32
  @SerializedName("filter")
33
  Filter filter;
34

35
  /** <strong>Required.</strong> The title of the alert. */
36
  @SerializedName("title")
37
  String title;
38

39
  /** The configuration of the usage threshold. */
40
  @SerializedName("usage_threshold_config")
41
  UsageThresholdConfig usageThresholdConfig;
42

43
  private AlertCreateParams(
44
      AlertType alertType,
45
      List<String> expand,
46
      Map<String, Object> extraParams,
47
      Filter filter,
48
      String title,
49
      UsageThresholdConfig usageThresholdConfig) {
×
50
    this.alertType = alertType;
×
51
    this.expand = expand;
×
52
    this.extraParams = extraParams;
×
53
    this.filter = filter;
×
54
    this.title = title;
×
55
    this.usageThresholdConfig = usageThresholdConfig;
×
56
  }
×
57

58
  public static Builder builder() {
59
    return new Builder();
×
60
  }
61

62
  public static class Builder {
×
63
    private AlertType alertType;
64

65
    private List<String> expand;
66

67
    private Map<String, Object> extraParams;
68

69
    private Filter filter;
70

71
    private String title;
72

73
    private UsageThresholdConfig usageThresholdConfig;
74

75
    /** Finalize and obtain parameter instance from this builder. */
76
    public AlertCreateParams build() {
77
      return new AlertCreateParams(
×
78
          this.alertType,
79
          this.expand,
80
          this.extraParams,
81
          this.filter,
82
          this.title,
83
          this.usageThresholdConfig);
84
    }
85

86
    /** <strong>Required.</strong> The type of alert to create. */
87
    public Builder setAlertType(AlertCreateParams.AlertType alertType) {
88
      this.alertType = alertType;
×
89
      return this;
×
90
    }
91

92
    /**
93
     * Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and
94
     * subsequent calls adds additional elements to the original list. See {@link
95
     * AlertCreateParams#expand} for the field documentation.
96
     */
97
    public Builder addExpand(String element) {
98
      if (this.expand == null) {
×
99
        this.expand = new ArrayList<>();
×
100
      }
101
      this.expand.add(element);
×
102
      return this;
×
103
    }
104

105
    /**
106
     * Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and
107
     * subsequent calls adds additional elements to the original list. See {@link
108
     * AlertCreateParams#expand} for the field documentation.
109
     */
110
    public Builder addAllExpand(List<String> elements) {
111
      if (this.expand == null) {
×
112
        this.expand = new ArrayList<>();
×
113
      }
114
      this.expand.addAll(elements);
×
115
      return this;
×
116
    }
117

118
    /**
119
     * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
120
     * call, and subsequent calls add additional key/value pairs to the original map. See {@link
121
     * AlertCreateParams#extraParams} for the field documentation.
122
     */
123
    public Builder putExtraParam(String key, Object value) {
124
      if (this.extraParams == null) {
×
125
        this.extraParams = new HashMap<>();
×
126
      }
127
      this.extraParams.put(key, value);
×
128
      return this;
×
129
    }
130

131
    /**
132
     * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
133
     * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
134
     * See {@link AlertCreateParams#extraParams} for the field documentation.
135
     */
136
    public Builder putAllExtraParam(Map<String, Object> map) {
137
      if (this.extraParams == null) {
×
138
        this.extraParams = new HashMap<>();
×
139
      }
140
      this.extraParams.putAll(map);
×
141
      return this;
×
142
    }
143

144
    /** Filters to limit the scope of an alert. */
145
    public Builder setFilter(AlertCreateParams.Filter filter) {
146
      this.filter = filter;
×
147
      return this;
×
148
    }
149

150
    /** <strong>Required.</strong> The title of the alert. */
151
    public Builder setTitle(String title) {
152
      this.title = title;
×
153
      return this;
×
154
    }
155

156
    /** The configuration of the usage threshold. */
157
    public Builder setUsageThresholdConfig(
158
        AlertCreateParams.UsageThresholdConfig usageThresholdConfig) {
159
      this.usageThresholdConfig = usageThresholdConfig;
×
160
      return this;
×
161
    }
162
  }
163

164
  @Getter
165
  public static class Filter {
166
    /** Limit the scope to this alert only to this customer. */
167
    @SerializedName("customer")
168
    String customer;
169

170
    /**
171
     * Map of extra parameters for custom features not available in this client library. The content
172
     * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
173
     * key/value pair is serialized as if the key is a root-level field (serialized) name in this
174
     * param object. Effectively, this map is flattened to its parent instance.
175
     */
176
    @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
177
    Map<String, Object> extraParams;
178

179
    /** Limit the scope of this rated usage alert to this subscription. */
180
    @SerializedName("subscription")
181
    String subscription;
182

183
    /** Limit the scope of this rated usage alert to this subscription item. */
184
    @SerializedName("subscription_item")
185
    String subscriptionItem;
186

187
    private Filter(
188
        String customer,
189
        Map<String, Object> extraParams,
190
        String subscription,
NEW
191
        String subscriptionItem) {
×
192
      this.customer = customer;
×
193
      this.extraParams = extraParams;
×
NEW
194
      this.subscription = subscription;
×
NEW
195
      this.subscriptionItem = subscriptionItem;
×
UNCOV
196
    }
×
197

198
    public static Builder builder() {
199
      return new Builder();
×
200
    }
201

202
    public static class Builder {
×
203
      private String customer;
204

205
      private Map<String, Object> extraParams;
206

207
      private String subscription;
208

209
      private String subscriptionItem;
210

211
      /** Finalize and obtain parameter instance from this builder. */
212
      public AlertCreateParams.Filter build() {
NEW
213
        return new AlertCreateParams.Filter(
×
214
            this.customer, this.extraParams, this.subscription, this.subscriptionItem);
215
      }
216

217
      /** Limit the scope to this alert only to this customer. */
218
      public Builder setCustomer(String customer) {
219
        this.customer = customer;
×
220
        return this;
×
221
      }
222

223
      /**
224
       * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
225
       * call, and subsequent calls add additional key/value pairs to the original map. See {@link
226
       * AlertCreateParams.Filter#extraParams} for the field documentation.
227
       */
228
      public Builder putExtraParam(String key, Object value) {
229
        if (this.extraParams == null) {
×
230
          this.extraParams = new HashMap<>();
×
231
        }
232
        this.extraParams.put(key, value);
×
233
        return this;
×
234
      }
235

236
      /**
237
       * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
238
       * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
239
       * See {@link AlertCreateParams.Filter#extraParams} for the field documentation.
240
       */
241
      public Builder putAllExtraParam(Map<String, Object> map) {
242
        if (this.extraParams == null) {
×
243
          this.extraParams = new HashMap<>();
×
244
        }
245
        this.extraParams.putAll(map);
×
246
        return this;
×
247
      }
248

249
      /** Limit the scope of this rated usage alert to this subscription. */
250
      public Builder setSubscription(String subscription) {
NEW
251
        this.subscription = subscription;
×
NEW
252
        return this;
×
253
      }
254

255
      /** Limit the scope of this rated usage alert to this subscription item. */
256
      public Builder setSubscriptionItem(String subscriptionItem) {
NEW
257
        this.subscriptionItem = subscriptionItem;
×
NEW
258
        return this;
×
259
      }
260
    }
261
  }
262

263
  @Getter
264
  public static class UsageThresholdConfig {
265
    /**
266
     * Map of extra parameters for custom features not available in this client library. The content
267
     * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
268
     * key/value pair is serialized as if the key is a root-level field (serialized) name in this
269
     * param object. Effectively, this map is flattened to its parent instance.
270
     */
271
    @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
272
    Map<String, Object> extraParams;
273

274
    /** <strong>Required.</strong> Defines at which value the alert will fire. */
275
    @SerializedName("gte")
276
    Long gte;
277

278
    /**
279
     * The <a href="https://stripe.com/api/billing/meter">Billing Meter</a> ID whose usage is
280
     * monitored.
281
     */
282
    @SerializedName("meter")
283
    String meter;
284

285
    /**
286
     * <strong>Required.</strong> Whether the alert should only fire only once, or once per billing
287
     * cycle.
288
     */
289
    @SerializedName("recurrence")
290
    Recurrence recurrence;
291

292
    private UsageThresholdConfig(
293
        Map<String, Object> extraParams, Long gte, String meter, Recurrence recurrence) {
×
294
      this.extraParams = extraParams;
×
295
      this.gte = gte;
×
296
      this.meter = meter;
×
297
      this.recurrence = recurrence;
×
298
    }
×
299

300
    public static Builder builder() {
301
      return new Builder();
×
302
    }
303

304
    public static class Builder {
×
305
      private Map<String, Object> extraParams;
306

307
      private Long gte;
308

309
      private String meter;
310

311
      private Recurrence recurrence;
312

313
      /** Finalize and obtain parameter instance from this builder. */
314
      public AlertCreateParams.UsageThresholdConfig build() {
315
        return new AlertCreateParams.UsageThresholdConfig(
×
316
            this.extraParams, this.gte, this.meter, this.recurrence);
317
      }
318

319
      /**
320
       * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
321
       * call, and subsequent calls add additional key/value pairs to the original map. See {@link
322
       * AlertCreateParams.UsageThresholdConfig#extraParams} for the field documentation.
323
       */
324
      public Builder putExtraParam(String key, Object value) {
325
        if (this.extraParams == null) {
×
326
          this.extraParams = new HashMap<>();
×
327
        }
328
        this.extraParams.put(key, value);
×
329
        return this;
×
330
      }
331

332
      /**
333
       * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
334
       * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
335
       * See {@link AlertCreateParams.UsageThresholdConfig#extraParams} for the field documentation.
336
       */
337
      public Builder putAllExtraParam(Map<String, Object> map) {
338
        if (this.extraParams == null) {
×
339
          this.extraParams = new HashMap<>();
×
340
        }
341
        this.extraParams.putAll(map);
×
342
        return this;
×
343
      }
344

345
      /** <strong>Required.</strong> Defines at which value the alert will fire. */
346
      public Builder setGte(Long gte) {
347
        this.gte = gte;
×
348
        return this;
×
349
      }
350

351
      /**
352
       * The <a href="https://stripe.com/api/billing/meter">Billing Meter</a> ID whose usage is
353
       * monitored.
354
       */
355
      public Builder setMeter(String meter) {
356
        this.meter = meter;
×
357
        return this;
×
358
      }
359

360
      /**
361
       * <strong>Required.</strong> Whether the alert should only fire only once, or once per
362
       * billing cycle.
363
       */
364
      public Builder setRecurrence(AlertCreateParams.UsageThresholdConfig.Recurrence recurrence) {
365
        this.recurrence = recurrence;
×
366
        return this;
×
367
      }
368
    }
369

370
    public enum Recurrence implements ApiRequestParams.EnumParam {
×
371
      @SerializedName("one_time")
×
372
      ONE_TIME("one_time");
373

374
      @Getter(onMethod_ = {@Override})
375
      private final String value;
376

377
      Recurrence(String value) {
×
378
        this.value = value;
×
379
      }
×
380
    }
381
  }
382

383
  public enum AlertType implements ApiRequestParams.EnumParam {
×
384
    @SerializedName("usage_threshold")
×
385
    USAGE_THRESHOLD("usage_threshold");
386

387
    @Getter(onMethod_ = {@Override})
388
    private final String value;
389

390
    AlertType(String value) {
×
391
      this.value = value;
×
392
    }
×
393
  }
394
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc