diff --git a/csharp/Svix/Message.cs b/csharp/Svix/Message.cs index f85c4bbba..9a0a36e8e 100644 --- a/csharp/Svix/Message.cs +++ b/csharp/Svix/Message.cs @@ -23,16 +23,18 @@ public Message(ISvixClient svixClient, IMessageApi messageApi) _messageApi = messageApi ?? throw new ArgumentException(nameof(messageApi)); } - - /// Creates a [MessageIn] with the payload already being serialized. + /// Creates a [MessageIn] with a pre-serialized payload. /// - /// The payload is not normalized on the server (usually whitespace outside - /// of string literals, unnecessarily escaped characters in string and such - /// are fixed up by the server), and is not even required to be JSON. + /// The payload is not normalized on the server. Normally, payloads are + /// required to be JSON, and Svix will minify the payload before sending the + /// webhooks (for example, by removing extraneous whitespace or unnecessarily + /// escaped characters in strings). With this function, the payload will be + /// sent "as is", without any minification or other processing. /// /// /// Serialized message payload - /// Content type of the payload to send as a header. Defaults to `application/json`. + /// The `content-type` header of the webhook sent by Svix, + /// overwriting the default of `application/json` if specified public static MessageIn messageInRaw( string eventType, string payload, diff --git a/java/lib/src/main/java/com/svix/Message.java b/java/lib/src/main/java/com/svix/Message.java index d224be2dd..8338b0ce4 100644 --- a/java/lib/src/main/java/com/svix/Message.java +++ b/java/lib/src/main/java/com/svix/Message.java @@ -25,12 +25,13 @@ private static MessageIn messageInEmptyPayload() { } /** - * Creates a MessageIn with the payload already being serialized. + * Creates a MessageIn with a pre-serialized payload. * - * The payload is not normalized on the server (usually whitespace outside - * of string literals, unnecessarily escaped characters in string and such - * are fixed up by the server). The default Content-Type of application/json - * is used. See the other overload if you want to send non-JSON payloads. + * The payload is not normalized on the server. Normally, payloads are + * required to be JSON, and Svix will minify the payload before sending the + * webhooks (for example, by removing extraneous whitespace or unnecessarily + * escaped characters in strings). With this function, the payload will be + * sent "as is", without any minification or other processing. * * @param payload Serialized message payload */ @@ -41,12 +42,12 @@ public static MessageIn messageInRaw(final String payload) { } /** - * Creates a MessageIn with the payload already being serialized. + * Creates a MessageIn with a pre-serialized payload. * * This overload is intended for non-JSON payloads. * * @param payload Serialized message payload - * @param contentType The value to use for the Content-Type header + * @param contentType The value to use for the Content-Type header of the webhook sent by Svix */ public static MessageIn messageInRaw(final String payload, final String contentType) { HashMap trParam = new HashMap<>(); diff --git a/javascript/src/index.ts b/javascript/src/index.ts index ed96af0be..dcec4cc97 100644 --- a/javascript/src/index.ts +++ b/javascript/src/index.ts @@ -700,14 +700,16 @@ class Message { } /** - * Creates a `MessageIn` with the payload already being serialized. + * Creates a `MessageIn` with a pre-serialized payload. * - * The payload is not normalized on the server (usually whitespace outside - * of string literals, unnecessarily escaped characters in string and such - * are fixed up by the server), and is not even required to be JSON. + * The payload is not normalized on the server. Normally, payloads are + * required to be JSON, and Svix will minify the payload before sending the + * webhooks (for example, by removing extraneous whitespace or unnecessarily + * escaped characters in strings). With this function, the payload will be + * sent "as is", without any minification or other processing. * * @param payload Serialized message payload - * @param contentType Content type of the payload to send as a header. Defaults to `application/json`. + * @param contentType The value to use for the Content-Type header of the webhook sent by Svix, overwriting the default of `application/json` if specified * * See the class documentation for details about the other parameters. */ diff --git a/kotlin/lib/src/main/kotlin/Message.kt b/kotlin/lib/src/main/kotlin/Message.kt index f343b6a21..923e76cf1 100644 --- a/kotlin/lib/src/main/kotlin/Message.kt +++ b/kotlin/lib/src/main/kotlin/Message.kt @@ -74,17 +74,18 @@ class Message internal constructor(token: String, options: SvixOptions) { } /** - * Creates a [MessageIn] with the payload already being serialized. + * Creates a [MessageIn] with a pre-serialized payload. * - * The payload is not normalized on the server (usually whitespace outside - * of string literals, unnecessarily escaped characters in string and such - * are fixed up by the server), and is not even required to be JSON. + * The payload is not normalized on the server. Normally, payloads are + * required to be JSON, and Svix will minify the payload before sending the + * webhooks (for example, by removing extraneous whitespace or unnecessarily + * escaped characters in strings). With this function, the payload will be + * sent "as is", without any minification or other processing. * * @param payload Serialized message payload - * @param contentType Content type of the payload to send as a header. Defaults to `application/json`. + * @param contentType The value to use for the Content-Type header of the webhook sent by Svix, overwriting the default of `application/json` if specified * * See the class documentation for details about the other parameters. - * */ fun messageInRaw( eventType: String, diff --git a/python/svix/api.py b/python/svix/api.py index a4e3e4d84..53c01f3ea 100644 --- a/python/svix/api.py +++ b/python/svix/api.py @@ -1166,7 +1166,7 @@ def message_in_raw( event_type: str, payload: str, content_type: t.Optional[str] = None ) -> MessageIn: """ - Creates a `MessageIn` with the payload already being serialized. + Creates a `MessageIn` with a pre-serialized payload. The payload is not normalized on the server. Normally, payloads are required to be JSON, and Svix will minify the payload before sending the webhook @@ -1177,8 +1177,9 @@ def message_in_raw( Args: event_type (str): The event type's name Example: `user.signup`. payload (str): Serialized message payload. - content_type (str?): The `content-type` header value Svix uses for - the webhook request. If not specified, `application/json` is used. + content_type (str?): The value to use for the Content-Type header of the + webhook sent by Svix, overwriting the default of `application/json` + if specified. """ transformations_params: t.Dict[str, t.Any] = { "rawPayload": payload, diff --git a/ruby/lib/svix/message_api.rb b/ruby/lib/svix/message_api.rb index af316dde4..10aecfee4 100644 --- a/ruby/lib/svix/message_api.rb +++ b/ruby/lib/svix/message_api.rb @@ -25,7 +25,7 @@ def expunge_content(app_id, msg_id) end end - # Creates a [`MessageIn`] with the payload already being serialized. + # Creates a [`MessageIn`] with a pre-serialized payload. # # The payload is not normalized on the server. Normally, payloads are required # to be JSON, and Svix will minify the payload before sending the webhook @@ -34,9 +34,9 @@ def expunge_content(app_id, msg_id) # "as is", without any minification or other processing. # # `attributes[:payload]` must be a string. An extra attribute `content_type` - # is accepted that sets the `content-type` header of the webhook, overwriting - # the default of `application/json` if specified. Other than that, the - # attributes are forwarded [`MessageIn.new`], so all the same ones are + # is accepted that sets the `content-type` header of the webhook sent by Svix, + # overwriting the default of `application/json` if specified. Other than that, + # the attributes are forwarded [`MessageIn.new`], so all the same ones are # accepted. def message_in_raw(attributes = {}) attributes[:transformations_params] ||= {} diff --git a/rust/src/model_ext.rs b/rust/src/model_ext.rs index 4e6bf0dc9..632bfc76c 100644 --- a/rust/src/model_ext.rs +++ b/rust/src/model_ext.rs @@ -7,12 +7,16 @@ use crate::models::MessageIn; impl MessageIn { /// Create a new message with a pre-serialized payload. /// - /// The payload is not normalized on the server (usually whitespace outside - /// of string literals, unnecessarily escaped characters in string and such - /// are fixed up by the server), and is not even required to be JSON. + /// The payload is not normalized on the server. Normally, payloads are + /// required to be JSON, and Svix will minify the payload before sending + /// the webhook (for example, by removing extraneous whitespace or + /// unnecessarily escaped characters in strings). With this constructor, + /// the payload will be sent "as is", without any minification or other + /// processing. /// - /// The default `content-type` of `application/json` will still be used, - /// unless overwritten with [`with_content_type`][Self::with_content_type]. + /// The default `content-type` of `application/json` will still be used for + /// the webhook sent by Svix, unless overwritten with + /// [`with_content_type`][Self::with_content_type]. pub fn new_raw_payload(event_type: String, payload: String) -> Self { Self { transformations_params: Some(json!({ "rawPayload": payload })), @@ -20,7 +24,7 @@ impl MessageIn { } } - /// Set the `content-type` header to use for the message. + /// Set the `content-type` header to use for the webhook sent by Svix. pub fn with_content_type(mut self, content_type: String) -> Self { let transformations_params = self.transformations_params.get_or_insert_with(|| json!({}));