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

stripe / stripe-java / #16493

03 Oct 2024 07:15PM UTC coverage: 12.942% (+0.08%) from 12.864%
#16493

push

github

web-flow
Merge Stripe-java v27.0.0 to beta branch (#1888)

409 of 1651 new or added lines in 88 files covered. (24.77%)

31 existing lines in 7 files now uncovered.

18773 of 145050 relevant lines covered (12.94%)

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
  /** <strong>Required.</strong> The title of the alert. */
32
  @SerializedName("title")
33
  String title;
34

35
  /** The configuration of the usage threshold. */
36
  @SerializedName("usage_threshold")
37
  UsageThreshold usageThreshold;
38

39
  private AlertCreateParams(
40
      AlertType alertType,
41
      List<String> expand,
42
      Map<String, Object> extraParams,
43
      String title,
NEW
44
      UsageThreshold usageThreshold) {
×
45
    this.alertType = alertType;
×
46
    this.expand = expand;
×
47
    this.extraParams = extraParams;
×
48
    this.title = title;
×
NEW
49
    this.usageThreshold = usageThreshold;
×
50
  }
×
51

52
  public static Builder builder() {
53
    return new Builder();
×
54
  }
55

56
  public static class Builder {
×
57
    private AlertType alertType;
58

59
    private List<String> expand;
60

61
    private Map<String, Object> extraParams;
62

63
    private String title;
64

65
    private UsageThreshold usageThreshold;
66

67
    /** Finalize and obtain parameter instance from this builder. */
68
    public AlertCreateParams build() {
69
      return new AlertCreateParams(
×
70
          this.alertType, this.expand, this.extraParams, this.title, this.usageThreshold);
71
    }
72

73
    /** <strong>Required.</strong> The type of alert to create. */
74
    public Builder setAlertType(AlertCreateParams.AlertType alertType) {
75
      this.alertType = alertType;
×
76
      return this;
×
77
    }
78

79
    /**
80
     * Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and
81
     * subsequent calls adds additional elements to the original list. See {@link
82
     * AlertCreateParams#expand} for the field documentation.
83
     */
84
    public Builder addExpand(String element) {
85
      if (this.expand == null) {
×
86
        this.expand = new ArrayList<>();
×
87
      }
88
      this.expand.add(element);
×
89
      return this;
×
90
    }
91

92
    /**
93
     * Add all elements 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 addAllExpand(List<String> elements) {
98
      if (this.expand == null) {
×
99
        this.expand = new ArrayList<>();
×
100
      }
101
      this.expand.addAll(elements);
×
102
      return this;
×
103
    }
104

105
    /**
106
     * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
107
     * call, and subsequent calls add additional key/value pairs to the original map. See {@link
108
     * AlertCreateParams#extraParams} for the field documentation.
109
     */
110
    public Builder putExtraParam(String key, Object value) {
111
      if (this.extraParams == null) {
×
112
        this.extraParams = new HashMap<>();
×
113
      }
114
      this.extraParams.put(key, value);
×
115
      return this;
×
116
    }
117

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

131
    /** <strong>Required.</strong> The title of the alert. */
132
    public Builder setTitle(String title) {
133
      this.title = title;
×
134
      return this;
×
135
    }
136

137
    /** The configuration of the usage threshold. */
138
    public Builder setUsageThreshold(AlertCreateParams.UsageThreshold usageThreshold) {
NEW
139
      this.usageThreshold = usageThreshold;
×
UNCOV
140
      return this;
×
141
    }
142
  }
143

144
  @Getter
145
  public static class UsageThreshold {
146
    /**
147
     * Map of extra parameters for custom features not available in this client library. The content
148
     * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
149
     * key/value pair is serialized as if the key is a root-level field (serialized) name in this
150
     * param object. Effectively, this map is flattened to its parent instance.
151
     */
152
    @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
153
    Map<String, Object> extraParams;
154

155
    /**
156
     * The filters allows limiting the scope of this usage alert. You can only specify up to one
157
     * filter at this time.
158
     */
159
    @SerializedName("filters")
160
    List<AlertCreateParams.UsageThreshold.Filter> filters;
161

162
    /** <strong>Required.</strong> Defines at which value the alert will fire. */
163
    @SerializedName("gte")
164
    Long gte;
165

166
    /**
167
     * The <a href="https://stripe.com/api/billing/meter">Billing Meter</a> ID whose usage is
168
     * monitored.
169
     */
170
    @SerializedName("meter")
171
    String meter;
172

173
    /**
174
     * <strong>Required.</strong> Whether the alert should only fire only once, or once per billing
175
     * cycle.
176
     */
177
    @SerializedName("recurrence")
178
    Recurrence recurrence;
179

180
    private UsageThreshold(
181
        Map<String, Object> extraParams,
182
        List<AlertCreateParams.UsageThreshold.Filter> filters,
183
        Long gte,
184
        String meter,
NEW
185
        Recurrence recurrence) {
×
186
      this.extraParams = extraParams;
×
NEW
187
      this.filters = filters;
×
188
      this.gte = gte;
×
189
      this.meter = meter;
×
190
      this.recurrence = recurrence;
×
191
    }
×
192

193
    public static Builder builder() {
194
      return new Builder();
×
195
    }
196

197
    public static class Builder {
×
198
      private Map<String, Object> extraParams;
199

200
      private List<AlertCreateParams.UsageThreshold.Filter> filters;
201

202
      private Long gte;
203

204
      private String meter;
205

206
      private Recurrence recurrence;
207

208
      /** Finalize and obtain parameter instance from this builder. */
209
      public AlertCreateParams.UsageThreshold build() {
NEW
210
        return new AlertCreateParams.UsageThreshold(
×
211
            this.extraParams, this.filters, this.gte, this.meter, this.recurrence);
212
      }
213

214
      /**
215
       * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
216
       * call, and subsequent calls add additional key/value pairs to the original map. See {@link
217
       * AlertCreateParams.UsageThreshold#extraParams} for the field documentation.
218
       */
219
      public Builder putExtraParam(String key, Object value) {
220
        if (this.extraParams == null) {
×
221
          this.extraParams = new HashMap<>();
×
222
        }
223
        this.extraParams.put(key, value);
×
224
        return this;
×
225
      }
226

227
      /**
228
       * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
229
       * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
230
       * See {@link AlertCreateParams.UsageThreshold#extraParams} for the field documentation.
231
       */
232
      public Builder putAllExtraParam(Map<String, Object> map) {
233
        if (this.extraParams == null) {
×
234
          this.extraParams = new HashMap<>();
×
235
        }
236
        this.extraParams.putAll(map);
×
237
        return this;
×
238
      }
239

240
      /**
241
       * Add an element to `filters` list. A list is initialized for the first `add/addAll` call,
242
       * and subsequent calls adds additional elements to the original list. See {@link
243
       * AlertCreateParams.UsageThreshold#filters} for the field documentation.
244
       */
245
      public Builder addFilter(AlertCreateParams.UsageThreshold.Filter element) {
NEW
246
        if (this.filters == null) {
×
NEW
247
          this.filters = new ArrayList<>();
×
248
        }
NEW
249
        this.filters.add(element);
×
NEW
250
        return this;
×
251
      }
252

253
      /**
254
       * Add all elements to `filters` list. A list is initialized for the first `add/addAll` call,
255
       * and subsequent calls adds additional elements to the original list. See {@link
256
       * AlertCreateParams.UsageThreshold#filters} for the field documentation.
257
       */
258
      public Builder addAllFilter(List<AlertCreateParams.UsageThreshold.Filter> elements) {
NEW
259
        if (this.filters == null) {
×
NEW
260
          this.filters = new ArrayList<>();
×
261
        }
NEW
262
        this.filters.addAll(elements);
×
NEW
263
        return this;
×
264
      }
265

266
      /** <strong>Required.</strong> Defines at which value the alert will fire. */
267
      public Builder setGte(Long gte) {
268
        this.gte = gte;
×
269
        return this;
×
270
      }
271

272
      /**
273
       * The <a href="https://stripe.com/api/billing/meter">Billing Meter</a> ID whose usage is
274
       * monitored.
275
       */
276
      public Builder setMeter(String meter) {
277
        this.meter = meter;
×
278
        return this;
×
279
      }
280

281
      /**
282
       * <strong>Required.</strong> Whether the alert should only fire only once, or once per
283
       * billing cycle.
284
       */
285
      public Builder setRecurrence(AlertCreateParams.UsageThreshold.Recurrence recurrence) {
286
        this.recurrence = recurrence;
×
287
        return this;
×
288
      }
289
    }
290

291
    @Getter
292
    public static class Filter {
293
      /** Limit the scope to this usage alert only to this customer. */
294
      @SerializedName("customer")
295
      String customer;
296

297
      /**
298
       * Map of extra parameters for custom features not available in this client library. The
299
       * content in this map is not serialized under this field's {@code @SerializedName} value.
300
       * Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
301
       * name in this param object. Effectively, this map is flattened to its parent instance.
302
       */
303
      @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
304
      Map<String, Object> extraParams;
305

306
      /** <strong>Required.</strong> What type of filter is being applied to this usage alert. */
307
      @SerializedName("type")
308
      Type type;
309

NEW
310
      private Filter(String customer, Map<String, Object> extraParams, Type type) {
×
NEW
311
        this.customer = customer;
×
NEW
312
        this.extraParams = extraParams;
×
NEW
313
        this.type = type;
×
NEW
314
      }
×
315

316
      public static Builder builder() {
NEW
317
        return new Builder();
×
318
      }
319

NEW
320
      public static class Builder {
×
321
        private String customer;
322

323
        private Map<String, Object> extraParams;
324

325
        private Type type;
326

327
        /** Finalize and obtain parameter instance from this builder. */
328
        public AlertCreateParams.UsageThreshold.Filter build() {
NEW
329
          return new AlertCreateParams.UsageThreshold.Filter(
×
330
              this.customer, this.extraParams, this.type);
331
        }
332

333
        /** Limit the scope to this usage alert only to this customer. */
334
        public Builder setCustomer(String customer) {
NEW
335
          this.customer = customer;
×
NEW
336
          return this;
×
337
        }
338

339
        /**
340
         * Add a key/value pair to `extraParams` map. A map is initialized for the first
341
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
342
         * map. See {@link AlertCreateParams.UsageThreshold.Filter#extraParams} for the field
343
         * documentation.
344
         */
345
        public Builder putExtraParam(String key, Object value) {
NEW
346
          if (this.extraParams == null) {
×
NEW
347
            this.extraParams = new HashMap<>();
×
348
          }
NEW
349
          this.extraParams.put(key, value);
×
NEW
350
          return this;
×
351
        }
352

353
        /**
354
         * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
355
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
356
         * map. See {@link AlertCreateParams.UsageThreshold.Filter#extraParams} for the field
357
         * documentation.
358
         */
359
        public Builder putAllExtraParam(Map<String, Object> map) {
NEW
360
          if (this.extraParams == null) {
×
NEW
361
            this.extraParams = new HashMap<>();
×
362
          }
NEW
363
          this.extraParams.putAll(map);
×
NEW
364
          return this;
×
365
        }
366

367
        /** <strong>Required.</strong> What type of filter is being applied to this usage alert. */
368
        public Builder setType(AlertCreateParams.UsageThreshold.Filter.Type type) {
NEW
369
          this.type = type;
×
NEW
370
          return this;
×
371
        }
372
      }
373

NEW
374
      public enum Type implements ApiRequestParams.EnumParam {
×
NEW
375
        @SerializedName("customer")
×
376
        CUSTOMER("customer");
377

378
        @Getter(onMethod_ = {@Override})
379
        private final String value;
380

NEW
381
        Type(String value) {
×
NEW
382
          this.value = value;
×
NEW
383
        }
×
384
      }
385
    }
386

387
    public enum Recurrence implements ApiRequestParams.EnumParam {
×
388
      @SerializedName("one_time")
×
389
      ONE_TIME("one_time");
390

391
      @Getter(onMethod_ = {@Override})
392
      private final String value;
393

394
      Recurrence(String value) {
×
395
        this.value = value;
×
396
      }
×
397
    }
398
  }
399

400
  public enum AlertType implements ApiRequestParams.EnumParam {
×
401
    @SerializedName("usage_threshold")
×
402
    USAGE_THRESHOLD("usage_threshold");
403

404
    @Getter(onMethod_ = {@Override})
405
    private final String value;
406

407
    AlertType(String value) {
×
408
      this.value = value;
×
409
    }
×
410
  }
411
}
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