• 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/MeterEventCreateParams.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.HashMap;
8
import java.util.Map;
9
import lombok.Getter;
10

11
@Getter
12
public class MeterEventCreateParams extends ApiRequestParams {
13
  /**
14
   * <strong>Required.</strong> The name of the meter event. Corresponds with the {@code event_name}
15
   * field on a meter.
16
   */
17
  @SerializedName("event_name")
18
  String eventName;
19

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

29
  /**
30
   * A unique identifier for the event. If not provided, one will be generated. We recommend using a
31
   * globally unique identifier for this. We’ll enforce uniqueness within a rolling 24 hour period.
32
   */
33
  @SerializedName("identifier")
34
  String identifier;
35

36
  /**
37
   * <strong>Required.</strong> The payload of the event. This must contain the fields corresponding
38
   * to a meter’s {@code customer_mapping.event_payload_key} (default is {@code stripe_customer_id})
39
   * and {@code value_settings.event_payload_key} (default is {@code value}). Read more about the <a
40
   * href="https://docs.stripe.com/billing/subscriptions/usage-based/recording-usage#payload-key-overrides">payload</a>.
41
   */
42
  @SerializedName("payload")
43
  Map<String, String> payload;
44

45
  /**
46
   * The time of the event. Must be within the past 35 calendar days or up to 5 minutes in the
47
   * future. Defaults to current timestamp if not specified.
48
   */
49
  @SerializedName("timestamp")
50
  Instant timestamp;
51

52
  private MeterEventCreateParams(
53
      String eventName,
54
      Map<String, Object> extraParams,
55
      String identifier,
56
      Map<String, String> payload,
NEW
57
      Instant timestamp) {
×
NEW
58
    this.eventName = eventName;
×
NEW
59
    this.extraParams = extraParams;
×
NEW
60
    this.identifier = identifier;
×
NEW
61
    this.payload = payload;
×
NEW
62
    this.timestamp = timestamp;
×
NEW
63
  }
×
64

65
  public static Builder builder() {
NEW
66
    return new Builder();
×
67
  }
68

NEW
69
  public static class Builder {
×
70
    private String eventName;
71

72
    private Map<String, Object> extraParams;
73

74
    private String identifier;
75

76
    private Map<String, String> payload;
77

78
    private Instant timestamp;
79

80
    /** Finalize and obtain parameter instance from this builder. */
81
    public MeterEventCreateParams build() {
NEW
82
      return new MeterEventCreateParams(
×
83
          this.eventName, this.extraParams, this.identifier, this.payload, this.timestamp);
84
    }
85

86
    /**
87
     * <strong>Required.</strong> The name of the meter event. Corresponds with the {@code
88
     * event_name} field on a meter.
89
     */
90
    public Builder setEventName(String eventName) {
NEW
91
      this.eventName = eventName;
×
NEW
92
      return this;
×
93
    }
94

95
    /**
96
     * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
97
     * call, and subsequent calls add additional key/value pairs to the original map. See {@link
98
     * MeterEventCreateParams#extraParams} for the field documentation.
99
     */
100
    public Builder putExtraParam(String key, Object value) {
NEW
101
      if (this.extraParams == null) {
×
NEW
102
        this.extraParams = new HashMap<>();
×
103
      }
NEW
104
      this.extraParams.put(key, value);
×
NEW
105
      return this;
×
106
    }
107

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

121
    /**
122
     * A unique identifier for the event. If not provided, one will be generated. We recommend using
123
     * a globally unique identifier for this. We’ll enforce uniqueness within a rolling 24 hour
124
     * period.
125
     */
126
    public Builder setIdentifier(String identifier) {
NEW
127
      this.identifier = identifier;
×
NEW
128
      return this;
×
129
    }
130

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

144
    /**
145
     * Add all map key/value pairs to `payload` map. A map is initialized for the first `put/putAll`
146
     * call, and subsequent calls add additional key/value pairs to the original map. See {@link
147
     * MeterEventCreateParams#payload} for the field documentation.
148
     */
149
    public Builder putAllPayload(Map<String, String> map) {
NEW
150
      if (this.payload == null) {
×
NEW
151
        this.payload = new HashMap<>();
×
152
      }
NEW
153
      this.payload.putAll(map);
×
NEW
154
      return this;
×
155
    }
156

157
    /**
158
     * The time of the event. Must be within the past 35 calendar days or up to 5 minutes in the
159
     * future. Defaults to current timestamp if not specified.
160
     */
161
    public Builder setTimestamp(Instant timestamp) {
NEW
162
      this.timestamp = timestamp;
×
NEW
163
      return this;
×
164
    }
165
  }
166
}
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