@@ -96,3 +96,31 @@ func (m *Message) ExpungeContent(ctx context.Context, appId string, msgId string
96
96
res , err := req .Execute ()
97
97
return wrapError (err , res )
98
98
}
99
+
100
+ // Instantiates a new MessageIn object with a pre-serialized payload.
101
+ //
102
+ // The payload is not normalized on the server. Normally, payloads are required
103
+ // to be JSON, and Svix will minify the payload before sending the webhook
104
+ // (for example, by removing extraneous whitespace or unnecessarily escaped
105
+ // characters in strings). With this function, the payload will be sent
106
+ // "as is", without any minification or other processing.
107
+ //
108
+ // The `contentType` parameter can be used to change the `content-type` header
109
+ // of the webhook sent by Svix overriding the default of `application/json`.
110
+ //
111
+ // See the class documentation for details about the other parameters.
112
+ func NewMessageInRaw (eventType string , payload string , contentType openapi.NullableString ) * MessageIn {
113
+ msgIn := openapi .NewMessageIn (eventType , make (map [string ]interface {}))
114
+
115
+ transformationsParams := map [string ]interface {}{
116
+ "rawPayload" : payload ,
117
+ }
118
+ if contentType .IsSet () {
119
+ transformationsParams ["headers" ] = map [string ]string {
120
+ "content-type" : * contentType .Get (),
121
+ }
122
+ }
123
+ msgIn .SetTransformationsParams (transformationsParams )
124
+
125
+ return msgIn
126
+ }
0 commit comments