ValidateUnfollowNewsletter (validations/newsletter_validation.go)

go-whatsapp-web-multidevice · src/validations/newsletter_validation.go · go · MIT
email

Validates newsletter-related API requests for correctness and required fields.

// Source: https://github.com/aldinokemal/go-whatsapp-web-multidevice | License: MIT
// Provided via justclaw.it.com; keep this notice with the code.
package validations

import (
	"context"
	"errors"
	"math"
	"strings"

	"github.com/aldinokemal/go-whatsapp-web-multidevice/config"
	domainNewsletter "github.com/aldinokemal/go-whatsapp-web-multidevice/domains/newsletter"
	pkgError "github.com/aldinokemal/go-whatsapp-web-multidevice/pkg/error"
	validation "github.com/go-ozzo/ozzo-validation/v4"
)

func ValidateUnfollowNewsletter(ctx context.Context, request domainNewsletter.UnfollowRequest) error {
	err := validation.ValidateStructWithContext(ctx, &request,
		validation.Field(&request.NewsletterID, validation.Required),
	)

	if err != nil {
		return pkgError.ValidationError(err.Error())
	}

	

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key