table_field_optional_values.go 1.2 KB
package bytelib

import (
	"context"
	"net/http"
)

func (gateway *ByteMetadataService) TableFieldOptionalValues(ctx context.Context, request *TableFieldOptionalValuesRequest) (TableFieldOptionalValuesResponse, error) {
	var result TableFieldOptionalValuesResponse
	if err := gateway.Do(ctx, "/data/field-optional-values", http.MethodPost, request, &result); err != nil {
		return result, err
	}
	return result, nil
}

type TableFieldOptionalValuesRequest struct {
	Token      string           `header:"x-mmm-accesstoken"`
	ObjectType string           `json:"objectType" valid:"Required"` // 对象类型
	ObjectId   int              `json:"objectId" valid:"Required"`   // 对象Id标识
	Field      Field            `json:"field" valid:"Required"`      // 选择列
	Match      string           `json:"match"`                       // 模糊匹配
	PageNumber int              `json:"pageNumber"`                  // 页吗
	PageSize   int              `json:"pageSize"`                    // 页
	Where      *TableQueryWhere `json:"where"`
}

type TableFieldOptionalValuesResponse struct {
	Values []string `json:"values"`
	Total  int64    `json:"total"`
}

//type Where struct {
//	Conditions []TableQueryCondition `json:"conditions"`
//}