• 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/v2/billing/MeterEventStreamCreateParams.java
1
// File generated from our OpenAPI spec
2
package com.stripe.param.v2.billing;
3

4
import com.google.gson.annotations.SerializedName;
5
import com.stripe.net.ApiRequestParams;
6
import java.time.Instant;
7
import java.util.ArrayList;
8
import java.util.HashMap;
9
import java.util.List;
10
import java.util.Map;
11
import lombok.Getter;
12

13
@Getter
14
public class MeterEventStreamCreateParams extends ApiRequestParams {
15
  /** <strong>Required.</strong> List of meter events to include in the request. */
16
  @SerializedName("events")
17
  List<MeterEventStreamCreateParams.Event> events;
18

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

28
  private MeterEventStreamCreateParams(
NEW
29
      List<MeterEventStreamCreateParams.Event> events, Map<String, Object> extraParams) {
×
NEW
30
    this.events = events;
×
NEW
31
    this.extraParams = extraParams;
×
NEW
32
  }
×
33

34
  public static Builder builder() {
NEW
35
    return new Builder();
×
36
  }
37

NEW
38
  public static class Builder {
×
39
    private List<MeterEventStreamCreateParams.Event> events;
40

41
    private Map<String, Object> extraParams;
42

43
    /** Finalize and obtain parameter instance from this builder. */
44
    public MeterEventStreamCreateParams build() {
NEW
45
      return new MeterEventStreamCreateParams(this.events, this.extraParams);
×
46
    }
47

48
    /**
49
     * Add an element to `events` list. A list is initialized for the first `add/addAll` call, and
50
     * subsequent calls adds additional elements to the original list. See {@link
51
     * MeterEventStreamCreateParams#events} for the field documentation.
52
     */
53
    public Builder addEvent(MeterEventStreamCreateParams.Event element) {
NEW
54
      if (this.events == null) {
×
NEW
55
        this.events = new ArrayList<>();
×
56
      }
NEW
57
      this.events.add(element);
×
NEW
58
      return this;
×
59
    }
60

61
    /**
62
     * Add all elements to `events` list. A list is initialized for the first `add/addAll` call, and
63
     * subsequent calls adds additional elements to the original list. See {@link
64
     * MeterEventStreamCreateParams#events} for the field documentation.
65
     */
66
    public Builder addAllEvent(List<MeterEventStreamCreateParams.Event> elements) {
NEW
67
      if (this.events == null) {
×
NEW
68
        this.events = new ArrayList<>();
×
69
      }
NEW
70
      this.events.addAll(elements);
×
NEW
71
      return this;
×
72
    }
73

74
    /**
75
     * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
76
     * call, and subsequent calls add additional key/value pairs to the original map. See {@link
77
     * MeterEventStreamCreateParams#extraParams} for the field documentation.
78
     */
79
    public Builder putExtraParam(String key, Object value) {
NEW
80
      if (this.extraParams == null) {
×
NEW
81
        this.extraParams = new HashMap<>();
×
82
      }
NEW
83
      this.extraParams.put(key, value);
×
NEW
84
      return this;
×
85
    }
86

87
    /**
88
     * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
89
     * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
90
     * See {@link MeterEventStreamCreateParams#extraParams} for the field documentation.
91
     */
92
    public Builder putAllExtraParam(Map<String, Object> map) {
NEW
93
      if (this.extraParams == null) {
×
NEW
94
        this.extraParams = new HashMap<>();
×
95
      }
NEW
96
      this.extraParams.putAll(map);
×
NEW
97
      return this;
×
98
    }
99
  }
100

101
  @Getter
102
  public static class Event {
103
    /**
104
     * <strong>Required.</strong> The name of the meter event. Corresponds with the {@code
105
     * event_name} field on a meter.
106
     */
107
    @SerializedName("event_name")
108
    String eventName;
109

110
    /**
111
     * Map of extra parameters for custom features not available in this client library. The content
112
     * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
113
     * key/value pair is serialized as if the key is a root-level field (serialized) name in this
114
     * param object. Effectively, this map is flattened to its parent instance.
115
     */
116
    @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
117
    Map<String, Object> extraParams;
118

119
    /**
120
     * A unique identifier for the event. If not provided, one will be generated. We recommend using
121
     * a globally unique identifier for this. We’ll enforce uniqueness within a rolling 24 hour
122
     * period.
123
     */
124
    @SerializedName("identifier")
125
    String identifier;
126

127
    /**
128
     * <strong>Required.</strong> The payload of the event. This must contain the fields
129
     * corresponding to a meter’s {@code customer_mapping.event_payload_key} (default is {@code
130
     * stripe_customer_id}) and {@code value_settings.event_payload_key} (default is {@code value}).
131
     * Read more about the <a
132
     * href="https://docs.stripe.com/billing/subscriptions/usage-based/recording-usage#payload-key-overrides">payload</a>.
133
     */
134
    @SerializedName("payload")
135
    Map<String, String> payload;
136

137
    /**
138
     * The time of the event. Must be within the past 35 calendar days or up to 5 minutes in the
139
     * future. Defaults to current timestamp if not specified.
140
     */
141
    @SerializedName("timestamp")
142
    Instant timestamp;
143

144
    private Event(
145
        String eventName,
146
        Map<String, Object> extraParams,
147
        String identifier,
148
        Map<String, String> payload,
NEW
149
        Instant timestamp) {
×
NEW
150
      this.eventName = eventName;
×
NEW
151
      this.extraParams = extraParams;
×
NEW
152
      this.identifier = identifier;
×
NEW
153
      this.payload = payload;
×
NEW
154
      this.timestamp = timestamp;
×
NEW
155
    }
×
156

157
    public static Builder builder() {
NEW
158
      return new Builder();
×
159
    }
160

NEW
161
    public static class Builder {
×
162
      private String eventName;
163

164
      private Map<String, Object> extraParams;
165

166
      private String identifier;
167

168
      private Map<String, String> payload;
169

170
      private Instant timestamp;
171

172
      /** Finalize and obtain parameter instance from this builder. */
173
      public MeterEventStreamCreateParams.Event build() {
NEW
174
        return new MeterEventStreamCreateParams.Event(
×
175
            this.eventName, this.extraParams, this.identifier, this.payload, this.timestamp);
176
      }
177

178
      /**
179
       * <strong>Required.</strong> The name of the meter event. Corresponds with the {@code
180
       * event_name} field on a meter.
181
       */
182
      public Builder setEventName(String eventName) {
NEW
183
        this.eventName = eventName;
×
NEW
184
        return this;
×
185
      }
186

187
      /**
188
       * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
189
       * call, and subsequent calls add additional key/value pairs to the original map. See {@link
190
       * MeterEventStreamCreateParams.Event#extraParams} for the field documentation.
191
       */
192
      public Builder putExtraParam(String key, Object value) {
NEW
193
        if (this.extraParams == null) {
×
NEW
194
          this.extraParams = new HashMap<>();
×
195
        }
NEW
196
        this.extraParams.put(key, value);
×
NEW
197
        return this;
×
198
      }
199

200
      /**
201
       * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
202
       * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
203
       * See {@link MeterEventStreamCreateParams.Event#extraParams} for the field documentation.
204
       */
205
      public Builder putAllExtraParam(Map<String, Object> map) {
NEW
206
        if (this.extraParams == null) {
×
NEW
207
          this.extraParams = new HashMap<>();
×
208
        }
NEW
209
        this.extraParams.putAll(map);
×
NEW
210
        return this;
×
211
      }
212

213
      /**
214
       * A unique identifier for the event. If not provided, one will be generated. We recommend
215
       * using a globally unique identifier for this. We’ll enforce uniqueness within a rolling 24
216
       * hour period.
217
       */
218
      public Builder setIdentifier(String identifier) {
NEW
219
        this.identifier = identifier;
×
NEW
220
        return this;
×
221
      }
222

223
      /**
224
       * Add a key/value pair to `payload` 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
       * MeterEventStreamCreateParams.Event#payload} for the field documentation.
227
       */
228
      public Builder putPayload(String key, String value) {
NEW
229
        if (this.payload == null) {
×
NEW
230
          this.payload = new HashMap<>();
×
231
        }
NEW
232
        this.payload.put(key, value);
×
NEW
233
        return this;
×
234
      }
235

236
      /**
237
       * Add all map key/value pairs to `payload` 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 MeterEventStreamCreateParams.Event#payload} for the field documentation.
240
       */
241
      public Builder putAllPayload(Map<String, String> map) {
NEW
242
        if (this.payload == null) {
×
NEW
243
          this.payload = new HashMap<>();
×
244
        }
NEW
245
        this.payload.putAll(map);
×
NEW
246
        return this;
×
247
      }
248

249
      /**
250
       * The time of the event. Must be within the past 35 calendar days or up to 5 minutes in the
251
       * future. Defaults to current timestamp if not specified.
252
       */
253
      public Builder setTimestamp(Instant timestamp) {
NEW
254
        this.timestamp = timestamp;
×
NEW
255
        return this;
×
256
      }
257
    }
258
  }
259
}
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