612 lines
21 KiB
Go
612 lines
21 KiB
Go
// Code generated by protoc-gen-microweb. DO NOT EDIT.
|
|
// source: proto.proto
|
|
|
|
package proto
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"github.com/go-chi/chi"
|
|
"github.com/go-chi/render"
|
|
"github.com/golang/protobuf/jsonpb"
|
|
)
|
|
|
|
type webBundleServiceHandler struct {
|
|
r chi.Router
|
|
h BundleServiceHandler
|
|
}
|
|
|
|
func (h *webBundleServiceHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|
h.r.ServeHTTP(w, r)
|
|
}
|
|
|
|
func (h *webBundleServiceHandler) CreateSettingsBundle(w http.ResponseWriter, r *http.Request) {
|
|
|
|
req := &CreateSettingsBundleRequest{}
|
|
|
|
resp := &CreateSettingsBundleResponse{}
|
|
|
|
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
|
|
http.Error(w, err.Error(), http.StatusPreconditionFailed)
|
|
return
|
|
}
|
|
|
|
if err := h.h.CreateSettingsBundle(
|
|
context.Background(),
|
|
req,
|
|
resp,
|
|
); err != nil {
|
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
|
return
|
|
}
|
|
|
|
render.Status(r, http.StatusCreated)
|
|
render.JSON(w, r, resp)
|
|
}
|
|
|
|
func (h *webBundleServiceHandler) GetSettingsBundle(w http.ResponseWriter, r *http.Request) {
|
|
|
|
req := &GetSettingsBundleRequest{}
|
|
|
|
resp := &GetSettingsBundleResponse{}
|
|
|
|
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
|
|
http.Error(w, err.Error(), http.StatusPreconditionFailed)
|
|
return
|
|
}
|
|
|
|
if err := h.h.GetSettingsBundle(
|
|
context.Background(),
|
|
req,
|
|
resp,
|
|
); err != nil {
|
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
|
return
|
|
}
|
|
|
|
render.Status(r, http.StatusOK)
|
|
render.JSON(w, r, resp)
|
|
}
|
|
|
|
func (h *webBundleServiceHandler) ListSettingsBundles(w http.ResponseWriter, r *http.Request) {
|
|
|
|
req := &ListSettingsBundlesRequest{}
|
|
|
|
resp := &ListSettingsBundlesResponse{}
|
|
|
|
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
|
|
http.Error(w, err.Error(), http.StatusPreconditionFailed)
|
|
return
|
|
}
|
|
|
|
if err := h.h.ListSettingsBundles(
|
|
context.Background(),
|
|
req,
|
|
resp,
|
|
); err != nil {
|
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
|
return
|
|
}
|
|
|
|
render.Status(r, http.StatusOK)
|
|
render.JSON(w, r, resp)
|
|
}
|
|
|
|
func RegisterBundleServiceWeb(r chi.Router, i BundleServiceHandler, middlewares ...func(http.Handler) http.Handler) {
|
|
handler := &webBundleServiceHandler{
|
|
r: r,
|
|
h: i,
|
|
}
|
|
|
|
r.MethodFunc("POST", "/api/v0/bundles", handler.CreateSettingsBundle)
|
|
r.MethodFunc("GET", "/api/v0/bundles/{extension}/{key}", handler.GetSettingsBundle)
|
|
r.MethodFunc("GET", "/api/v0/bundles", handler.ListSettingsBundles)
|
|
}
|
|
|
|
// CreateSettingsBundleRequestJSONMarshaler describes the default jsonpb.Marshaler used by all
|
|
// instances of CreateSettingsBundleRequest. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var CreateSettingsBundleRequestJSONMarshaler = new(jsonpb.Marshaler)
|
|
|
|
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly marshal the message.
|
|
func (m *CreateSettingsBundleRequest) MarshalJSON() ([]byte, error) {
|
|
if m == nil {
|
|
return json.Marshal(nil)
|
|
}
|
|
|
|
buf := &bytes.Buffer{}
|
|
|
|
if err := CreateSettingsBundleRequestJSONMarshaler.Marshal(buf, m); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return buf.Bytes(), nil
|
|
}
|
|
|
|
var _ json.Marshaler = (*CreateSettingsBundleRequest)(nil)
|
|
|
|
// CreateSettingsBundleRequestJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
|
|
// instances of CreateSettingsBundleRequest. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var CreateSettingsBundleRequestJSONUnmarshaler = new(jsonpb.Unmarshaler)
|
|
|
|
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly unmarshal the message.
|
|
func (m *CreateSettingsBundleRequest) UnmarshalJSON(b []byte) error {
|
|
return CreateSettingsBundleRequestJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
|
|
}
|
|
|
|
var _ json.Unmarshaler = (*CreateSettingsBundleRequest)(nil)
|
|
|
|
// CreateSettingsBundleResponseJSONMarshaler describes the default jsonpb.Marshaler used by all
|
|
// instances of CreateSettingsBundleResponse. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var CreateSettingsBundleResponseJSONMarshaler = new(jsonpb.Marshaler)
|
|
|
|
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly marshal the message.
|
|
func (m *CreateSettingsBundleResponse) MarshalJSON() ([]byte, error) {
|
|
if m == nil {
|
|
return json.Marshal(nil)
|
|
}
|
|
|
|
buf := &bytes.Buffer{}
|
|
|
|
if err := CreateSettingsBundleResponseJSONMarshaler.Marshal(buf, m); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return buf.Bytes(), nil
|
|
}
|
|
|
|
var _ json.Marshaler = (*CreateSettingsBundleResponse)(nil)
|
|
|
|
// CreateSettingsBundleResponseJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
|
|
// instances of CreateSettingsBundleResponse. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var CreateSettingsBundleResponseJSONUnmarshaler = new(jsonpb.Unmarshaler)
|
|
|
|
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly unmarshal the message.
|
|
func (m *CreateSettingsBundleResponse) UnmarshalJSON(b []byte) error {
|
|
return CreateSettingsBundleResponseJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
|
|
}
|
|
|
|
var _ json.Unmarshaler = (*CreateSettingsBundleResponse)(nil)
|
|
|
|
// GetSettingsBundleRequestJSONMarshaler describes the default jsonpb.Marshaler used by all
|
|
// instances of GetSettingsBundleRequest. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var GetSettingsBundleRequestJSONMarshaler = new(jsonpb.Marshaler)
|
|
|
|
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly marshal the message.
|
|
func (m *GetSettingsBundleRequest) MarshalJSON() ([]byte, error) {
|
|
if m == nil {
|
|
return json.Marshal(nil)
|
|
}
|
|
|
|
buf := &bytes.Buffer{}
|
|
|
|
if err := GetSettingsBundleRequestJSONMarshaler.Marshal(buf, m); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return buf.Bytes(), nil
|
|
}
|
|
|
|
var _ json.Marshaler = (*GetSettingsBundleRequest)(nil)
|
|
|
|
// GetSettingsBundleRequestJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
|
|
// instances of GetSettingsBundleRequest. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var GetSettingsBundleRequestJSONUnmarshaler = new(jsonpb.Unmarshaler)
|
|
|
|
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly unmarshal the message.
|
|
func (m *GetSettingsBundleRequest) UnmarshalJSON(b []byte) error {
|
|
return GetSettingsBundleRequestJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
|
|
}
|
|
|
|
var _ json.Unmarshaler = (*GetSettingsBundleRequest)(nil)
|
|
|
|
// GetSettingsBundleResponseJSONMarshaler describes the default jsonpb.Marshaler used by all
|
|
// instances of GetSettingsBundleResponse. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var GetSettingsBundleResponseJSONMarshaler = new(jsonpb.Marshaler)
|
|
|
|
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly marshal the message.
|
|
func (m *GetSettingsBundleResponse) MarshalJSON() ([]byte, error) {
|
|
if m == nil {
|
|
return json.Marshal(nil)
|
|
}
|
|
|
|
buf := &bytes.Buffer{}
|
|
|
|
if err := GetSettingsBundleResponseJSONMarshaler.Marshal(buf, m); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return buf.Bytes(), nil
|
|
}
|
|
|
|
var _ json.Marshaler = (*GetSettingsBundleResponse)(nil)
|
|
|
|
// GetSettingsBundleResponseJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
|
|
// instances of GetSettingsBundleResponse. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var GetSettingsBundleResponseJSONUnmarshaler = new(jsonpb.Unmarshaler)
|
|
|
|
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly unmarshal the message.
|
|
func (m *GetSettingsBundleResponse) UnmarshalJSON(b []byte) error {
|
|
return GetSettingsBundleResponseJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
|
|
}
|
|
|
|
var _ json.Unmarshaler = (*GetSettingsBundleResponse)(nil)
|
|
|
|
// ListSettingsBundlesRequestJSONMarshaler describes the default jsonpb.Marshaler used by all
|
|
// instances of ListSettingsBundlesRequest. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var ListSettingsBundlesRequestJSONMarshaler = new(jsonpb.Marshaler)
|
|
|
|
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly marshal the message.
|
|
func (m *ListSettingsBundlesRequest) MarshalJSON() ([]byte, error) {
|
|
if m == nil {
|
|
return json.Marshal(nil)
|
|
}
|
|
|
|
buf := &bytes.Buffer{}
|
|
|
|
if err := ListSettingsBundlesRequestJSONMarshaler.Marshal(buf, m); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return buf.Bytes(), nil
|
|
}
|
|
|
|
var _ json.Marshaler = (*ListSettingsBundlesRequest)(nil)
|
|
|
|
// ListSettingsBundlesRequestJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
|
|
// instances of ListSettingsBundlesRequest. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var ListSettingsBundlesRequestJSONUnmarshaler = new(jsonpb.Unmarshaler)
|
|
|
|
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly unmarshal the message.
|
|
func (m *ListSettingsBundlesRequest) UnmarshalJSON(b []byte) error {
|
|
return ListSettingsBundlesRequestJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
|
|
}
|
|
|
|
var _ json.Unmarshaler = (*ListSettingsBundlesRequest)(nil)
|
|
|
|
// ListSettingsBundlesResponseJSONMarshaler describes the default jsonpb.Marshaler used by all
|
|
// instances of ListSettingsBundlesResponse. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var ListSettingsBundlesResponseJSONMarshaler = new(jsonpb.Marshaler)
|
|
|
|
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly marshal the message.
|
|
func (m *ListSettingsBundlesResponse) MarshalJSON() ([]byte, error) {
|
|
if m == nil {
|
|
return json.Marshal(nil)
|
|
}
|
|
|
|
buf := &bytes.Buffer{}
|
|
|
|
if err := ListSettingsBundlesResponseJSONMarshaler.Marshal(buf, m); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return buf.Bytes(), nil
|
|
}
|
|
|
|
var _ json.Marshaler = (*ListSettingsBundlesResponse)(nil)
|
|
|
|
// ListSettingsBundlesResponseJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
|
|
// instances of ListSettingsBundlesResponse. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var ListSettingsBundlesResponseJSONUnmarshaler = new(jsonpb.Unmarshaler)
|
|
|
|
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly unmarshal the message.
|
|
func (m *ListSettingsBundlesResponse) UnmarshalJSON(b []byte) error {
|
|
return ListSettingsBundlesResponseJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
|
|
}
|
|
|
|
var _ json.Unmarshaler = (*ListSettingsBundlesResponse)(nil)
|
|
|
|
// SettingsBundleJSONMarshaler describes the default jsonpb.Marshaler used by all
|
|
// instances of SettingsBundle. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var SettingsBundleJSONMarshaler = new(jsonpb.Marshaler)
|
|
|
|
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly marshal the message.
|
|
func (m *SettingsBundle) MarshalJSON() ([]byte, error) {
|
|
if m == nil {
|
|
return json.Marshal(nil)
|
|
}
|
|
|
|
buf := &bytes.Buffer{}
|
|
|
|
if err := SettingsBundleJSONMarshaler.Marshal(buf, m); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return buf.Bytes(), nil
|
|
}
|
|
|
|
var _ json.Marshaler = (*SettingsBundle)(nil)
|
|
|
|
// SettingsBundleJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
|
|
// instances of SettingsBundle. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var SettingsBundleJSONUnmarshaler = new(jsonpb.Unmarshaler)
|
|
|
|
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly unmarshal the message.
|
|
func (m *SettingsBundle) UnmarshalJSON(b []byte) error {
|
|
return SettingsBundleJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
|
|
}
|
|
|
|
var _ json.Unmarshaler = (*SettingsBundle)(nil)
|
|
|
|
// SettingJSONMarshaler describes the default jsonpb.Marshaler used by all
|
|
// instances of Setting. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var SettingJSONMarshaler = new(jsonpb.Marshaler)
|
|
|
|
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly marshal the message.
|
|
func (m *Setting) MarshalJSON() ([]byte, error) {
|
|
if m == nil {
|
|
return json.Marshal(nil)
|
|
}
|
|
|
|
buf := &bytes.Buffer{}
|
|
|
|
if err := SettingJSONMarshaler.Marshal(buf, m); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return buf.Bytes(), nil
|
|
}
|
|
|
|
var _ json.Marshaler = (*Setting)(nil)
|
|
|
|
// SettingJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
|
|
// instances of Setting. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var SettingJSONUnmarshaler = new(jsonpb.Unmarshaler)
|
|
|
|
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly unmarshal the message.
|
|
func (m *Setting) UnmarshalJSON(b []byte) error {
|
|
return SettingJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
|
|
}
|
|
|
|
var _ json.Unmarshaler = (*Setting)(nil)
|
|
|
|
// IntSettingJSONMarshaler describes the default jsonpb.Marshaler used by all
|
|
// instances of IntSetting. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var IntSettingJSONMarshaler = new(jsonpb.Marshaler)
|
|
|
|
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly marshal the message.
|
|
func (m *IntSetting) MarshalJSON() ([]byte, error) {
|
|
if m == nil {
|
|
return json.Marshal(nil)
|
|
}
|
|
|
|
buf := &bytes.Buffer{}
|
|
|
|
if err := IntSettingJSONMarshaler.Marshal(buf, m); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return buf.Bytes(), nil
|
|
}
|
|
|
|
var _ json.Marshaler = (*IntSetting)(nil)
|
|
|
|
// IntSettingJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
|
|
// instances of IntSetting. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var IntSettingJSONUnmarshaler = new(jsonpb.Unmarshaler)
|
|
|
|
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly unmarshal the message.
|
|
func (m *IntSetting) UnmarshalJSON(b []byte) error {
|
|
return IntSettingJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
|
|
}
|
|
|
|
var _ json.Unmarshaler = (*IntSetting)(nil)
|
|
|
|
// StringSettingJSONMarshaler describes the default jsonpb.Marshaler used by all
|
|
// instances of StringSetting. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var StringSettingJSONMarshaler = new(jsonpb.Marshaler)
|
|
|
|
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly marshal the message.
|
|
func (m *StringSetting) MarshalJSON() ([]byte, error) {
|
|
if m == nil {
|
|
return json.Marshal(nil)
|
|
}
|
|
|
|
buf := &bytes.Buffer{}
|
|
|
|
if err := StringSettingJSONMarshaler.Marshal(buf, m); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return buf.Bytes(), nil
|
|
}
|
|
|
|
var _ json.Marshaler = (*StringSetting)(nil)
|
|
|
|
// StringSettingJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
|
|
// instances of StringSetting. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var StringSettingJSONUnmarshaler = new(jsonpb.Unmarshaler)
|
|
|
|
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly unmarshal the message.
|
|
func (m *StringSetting) UnmarshalJSON(b []byte) error {
|
|
return StringSettingJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
|
|
}
|
|
|
|
var _ json.Unmarshaler = (*StringSetting)(nil)
|
|
|
|
// BoolSettingJSONMarshaler describes the default jsonpb.Marshaler used by all
|
|
// instances of BoolSetting. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var BoolSettingJSONMarshaler = new(jsonpb.Marshaler)
|
|
|
|
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly marshal the message.
|
|
func (m *BoolSetting) MarshalJSON() ([]byte, error) {
|
|
if m == nil {
|
|
return json.Marshal(nil)
|
|
}
|
|
|
|
buf := &bytes.Buffer{}
|
|
|
|
if err := BoolSettingJSONMarshaler.Marshal(buf, m); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return buf.Bytes(), nil
|
|
}
|
|
|
|
var _ json.Marshaler = (*BoolSetting)(nil)
|
|
|
|
// BoolSettingJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
|
|
// instances of BoolSetting. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var BoolSettingJSONUnmarshaler = new(jsonpb.Unmarshaler)
|
|
|
|
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly unmarshal the message.
|
|
func (m *BoolSetting) UnmarshalJSON(b []byte) error {
|
|
return BoolSettingJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
|
|
}
|
|
|
|
var _ json.Unmarshaler = (*BoolSetting)(nil)
|
|
|
|
// SingleChoiceListSettingJSONMarshaler describes the default jsonpb.Marshaler used by all
|
|
// instances of SingleChoiceListSetting. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var SingleChoiceListSettingJSONMarshaler = new(jsonpb.Marshaler)
|
|
|
|
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly marshal the message.
|
|
func (m *SingleChoiceListSetting) MarshalJSON() ([]byte, error) {
|
|
if m == nil {
|
|
return json.Marshal(nil)
|
|
}
|
|
|
|
buf := &bytes.Buffer{}
|
|
|
|
if err := SingleChoiceListSettingJSONMarshaler.Marshal(buf, m); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return buf.Bytes(), nil
|
|
}
|
|
|
|
var _ json.Marshaler = (*SingleChoiceListSetting)(nil)
|
|
|
|
// SingleChoiceListSettingJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
|
|
// instances of SingleChoiceListSetting. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var SingleChoiceListSettingJSONUnmarshaler = new(jsonpb.Unmarshaler)
|
|
|
|
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly unmarshal the message.
|
|
func (m *SingleChoiceListSetting) UnmarshalJSON(b []byte) error {
|
|
return SingleChoiceListSettingJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
|
|
}
|
|
|
|
var _ json.Unmarshaler = (*SingleChoiceListSetting)(nil)
|
|
|
|
// MultiChoiceListSettingJSONMarshaler describes the default jsonpb.Marshaler used by all
|
|
// instances of MultiChoiceListSetting. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var MultiChoiceListSettingJSONMarshaler = new(jsonpb.Marshaler)
|
|
|
|
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly marshal the message.
|
|
func (m *MultiChoiceListSetting) MarshalJSON() ([]byte, error) {
|
|
if m == nil {
|
|
return json.Marshal(nil)
|
|
}
|
|
|
|
buf := &bytes.Buffer{}
|
|
|
|
if err := MultiChoiceListSettingJSONMarshaler.Marshal(buf, m); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return buf.Bytes(), nil
|
|
}
|
|
|
|
var _ json.Marshaler = (*MultiChoiceListSetting)(nil)
|
|
|
|
// MultiChoiceListSettingJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
|
|
// instances of MultiChoiceListSetting. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var MultiChoiceListSettingJSONUnmarshaler = new(jsonpb.Unmarshaler)
|
|
|
|
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly unmarshal the message.
|
|
func (m *MultiChoiceListSetting) UnmarshalJSON(b []byte) error {
|
|
return MultiChoiceListSettingJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
|
|
}
|
|
|
|
var _ json.Unmarshaler = (*MultiChoiceListSetting)(nil)
|
|
|
|
// ListOptionJSONMarshaler describes the default jsonpb.Marshaler used by all
|
|
// instances of ListOption. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var ListOptionJSONMarshaler = new(jsonpb.Marshaler)
|
|
|
|
// MarshalJSON satisfies the encoding/json Marshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly marshal the message.
|
|
func (m *ListOption) MarshalJSON() ([]byte, error) {
|
|
if m == nil {
|
|
return json.Marshal(nil)
|
|
}
|
|
|
|
buf := &bytes.Buffer{}
|
|
|
|
if err := ListOptionJSONMarshaler.Marshal(buf, m); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return buf.Bytes(), nil
|
|
}
|
|
|
|
var _ json.Marshaler = (*ListOption)(nil)
|
|
|
|
// ListOptionJSONUnmarshaler describes the default jsonpb.Unmarshaler used by all
|
|
// instances of ListOption. This struct is safe to replace or modify but
|
|
// should not be done so concurrently.
|
|
var ListOptionJSONUnmarshaler = new(jsonpb.Unmarshaler)
|
|
|
|
// UnmarshalJSON satisfies the encoding/json Unmarshaler interface. This method
|
|
// uses the more correct jsonpb package to correctly unmarshal the message.
|
|
func (m *ListOption) UnmarshalJSON(b []byte) error {
|
|
return ListOptionJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)
|
|
}
|
|
|
|
var _ json.Unmarshaler = (*ListOption)(nil)
|