// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.

package components

import (
	"encoding/json"
	"fmt"
)

type Accepts string

const (
	AcceptsApplicationJSON Accepts = "application/json"
	AcceptsApplicationXML  Accepts = "application/xml"
)

func (e Accepts) ToPointer() *Accepts {
	return &e
}
func (e *Accepts) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "application/json":
		fallthrough
	case "application/xml":
		*e = Accepts(v)
		return nil
	default:
		return fmt.Errorf("invalid value for Accepts: %v", v)
	}
}
