publicapi

package
v0.0.0-...-27ce2ab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2025 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidProject = rerror.NewE(i18n.T("invalid project"))

Functions

func AttachController

func AttachController(ctx context.Context, c *Controller) context.Context

func Echo

func Echo(e *echo.Group)

func PublicApiAsset

func PublicApiAsset() echo.HandlerFunc

func PublicApiItemOrAsset

func PublicApiItemOrAsset() echo.HandlerFunc

func PublicApiItemOrAssetList

func PublicApiItemOrAssetList() echo.HandlerFunc

Types

type Asset

type Asset struct {
	Type        string   `json:"type"`
	ID          string   `json:"id,omitempty"`
	URL         string   `json:"url,omitempty"`
	ContentType string   `json:"contentType,omitempty"`
	Files       []string `json:"files,omitempty"`
}

func NewAsset

func NewAsset(a *asset.Asset, f *asset.File, urlResolver asset.URLResolver) Asset

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func GetController

func GetController(ctx context.Context) *Controller

func NewController

func NewController(project repo.Project, usecases *interfaces.Container, aur asset.URLResolver) *Controller

func (*Controller) GetAsset

func (c *Controller) GetAsset(ctx context.Context, prj, i string) (Asset, error)

func (*Controller) GetAssets

func (c *Controller) GetAssets(ctx context.Context, pKey string, p ListParam) (ListResult[Asset], error)

func (*Controller) GetItem

func (c *Controller) GetItem(ctx context.Context, prj, mkey, i string) (Item, error)

func (*Controller) GetItems

func (c *Controller) GetItems(ctx context.Context, prj, model string, p ListParam) (ListResult[Item], *schema.Schema, error)

func (*Controller) GetSchemaJSON

func (c *Controller) GetSchemaJSON(ctx context.Context, pKey, mKey string) (SchemaJSON, error)

func (*Controller) GetVersionedItems

func (c *Controller) GetVersionedItems(ctx context.Context, prj, model string, p ListParam) (item.VersionedList, *schema.Schema, error)

type Feature

type Feature struct {
	Geometry   *Geometry              `json:"geometry,omitempty"`
	Id         *string                `json:"id,omitempty"`
	Properties *orderedmap.OrderedMap `json:"properties,omitempty"`
	Type       *FeatureType           `json:"type,omitempty"`
}

type FeatureCollection

type FeatureCollection struct {
	Features *[]Feature             `json:"features,omitempty"`
	Type     *FeatureCollectionType `json:"type,omitempty"`
}

type FeatureCollectionType

type FeatureCollectionType string
const FeatureCollectionTypeFeatureCollection FeatureCollectionType = "FeatureCollection"

type FeatureType

type FeatureType string
const FeatureTypeFeature FeatureType = "Feature"

type GeoJSON

type GeoJSON = FeatureCollection

GeoJSON

type Geometry

type Geometry struct {
	Coordinates *Geometry_Coordinates `json:"coordinates,omitempty"`
	Geometries  *[]Geometry           `json:"geometries,omitempty"`
	Type        *GeometryType         `json:"type,omitempty"`
}

type GeometryCollection

type GeometryCollection struct {
	Geometries *[]Geometry             `json:"geometries,omitempty"`
	Type       *GeometryCollectionType `json:"type,omitempty"`
}

type GeometryCollectionType

type GeometryCollectionType string
const GeometryCollectionTypeGeometryCollection GeometryCollectionType = "GeometryCollection"

type GeometryType

type GeometryType string
const (
	GeometryTypeGeometryCollection GeometryType = "GeometryCollection"
	GeometryTypeLineString         GeometryType = "LineString"
	GeometryTypeMultiLineString    GeometryType = "MultiLineString"
	GeometryTypeMultiPoint         GeometryType = "MultiPoint"
	GeometryTypeMultiPolygon       GeometryType = "MultiPolygon"
	GeometryTypePoint              GeometryType = "Point"
	GeometryTypePolygon            GeometryType = "Polygon"
)

type Geometry_Coordinates

type Geometry_Coordinates struct {
	// contains filtered or unexported fields
}

func (Geometry_Coordinates) AsLineString

func (t Geometry_Coordinates) AsLineString() (LineString, error)

func (Geometry_Coordinates) AsMultiLineString

func (t Geometry_Coordinates) AsMultiLineString() (MultiLineString, error)

func (Geometry_Coordinates) AsMultiPoint

func (t Geometry_Coordinates) AsMultiPoint() (MultiPoint, error)

func (Geometry_Coordinates) AsMultiPolygon

func (t Geometry_Coordinates) AsMultiPolygon() (MultiPolygon, error)

func (Geometry_Coordinates) AsPoint

func (t Geometry_Coordinates) AsPoint() (Point, error)

func (Geometry_Coordinates) AsPolygon

func (t Geometry_Coordinates) AsPolygon() (Polygon, error)

func (Geometry_Coordinates) MarshalJSON

func (t Geometry_Coordinates) MarshalJSON() ([]byte, error)

func (*Geometry_Coordinates) UnmarshalJSON

func (t *Geometry_Coordinates) UnmarshalJSON(b []byte) error

type Item

type Item struct {
	ID     string
	Fields ItemFields
}

func NewItem

func NewItem(i *item.Item, sp *schema.Package, assets asset.List, urlResolver asset.URLResolver, refItems []Item) Item

func (Item) MarshalJSON

func (i Item) MarshalJSON() ([]byte, error)

type ItemAsset

type ItemAsset struct {
	Type string `json:"type"`
	ID   string `json:"id,omitempty"`
	URL  string `json:"url,omitempty"`
}

func NewItemAsset

func NewItemAsset(a *asset.Asset, urlResolver asset.URLResolver) ItemAsset

type ItemFields

type ItemFields map[string]any

func NewItemFields

func NewItemFields(fields item.Fields, sfields schema.FieldList, groupFields schema.FieldList, refItems []Item, assets asset.List, urlResolver asset.URLResolver) ItemFields

func (ItemFields) DropEmptyFields

func (i ItemFields) DropEmptyFields() ItemFields

type LineString

type LineString = []Point

type ListParam

type ListParam struct {
	Pagination *usecasex.Pagination
}

type ListResult

type ListResult[T any] struct {
	Results    []T   `json:"results"`
	TotalCount int64 `json:"totalCount"`
	HasMore    *bool `json:"hasMore,omitempty"`
	// offset base
	Limit  *int64 `json:"limit,omitempty"`
	Offset *int64 `json:"offset,omitempty"`
	Page   *int64 `json:"page,omitempty"`
	// cursor base
	NextCursor *string `json:"nextCursor,omitempty"`
}

func NewListResult

func NewListResult[T any](results []T, pi *usecasex.PageInfo, p *usecasex.Pagination) ListResult[T]

type MultiLineString

type MultiLineString = []LineString

type MultiPoint

type MultiPoint = []Point

type MultiPolygon

type MultiPolygon = []Polygon

type Point

type Point = []float64

type Polygon

type Polygon = [][]Point

type SchemaJSON

type SchemaJSON struct {
	Id          *string                         `json:"$id,omitempty"`
	Schema      *string                         `json:"$schema,omitempty"`
	Description *string                         `json:"description,omitempty"`
	Properties  map[string]SchemaJSONProperties `json:"properties"`
	Title       *string                         `json:"title,omitempty"`
	Type        string                          `json:"type"`
}

type SchemaJSONProperties

type SchemaJSONProperties struct {
	Description *string     `json:"description,omitempty"`
	Format      *string     `json:"format,omitempty"`
	Items       *SchemaJSON `json:"items,omitempty"`
	MaxLength   *int        `json:"maxLength,omitempty"`
	Maximum     *float64    `json:"maximum,omitempty"`
	Minimum     *float64    `json:"minimum,omitempty"`
	Title       *string     `json:"title,omitempty"`
	Type        string      `json:"type"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL