model

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2025 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

Copyright 2025 The Pastiche Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Copyright 2023 The Pastiche Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Copyright 2025 The Pastiche Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	Name        string
	Description string
	Method      string
	Headers     map[string][]string
	Links       []Link
	Body        string
	RawBody     string
}

type Expander

type Expander = expr.Expander
type Link struct {
	HRef     string
	Audience string
	Rel      string
	Title    string
}

type Model

type Model struct {
	Services map[string]*Service
}

func New

func New(c *config.Config) *Model

func (*Model) Resolve

func (c *Model) Resolve(s ServiceSpec, server string, method string) (ResolvedResource, error)

func (*Model) Service

func (c *Model) Service(name string) (*Service, bool)

type ResolvedResource

type ResolvedResource interface {
	Service() *Service
	Resource() *Resource
	Endpoint() *Endpoint
	Server() *Server

	URL(baseURL *url.URL, vars uritemplates.Vars) (*url.URL, error)
	Body(vars uritemplates.Vars) io.ReadCloser
}

type Resource

type Resource struct {
	Name        string
	Description string
	Resources   []*Resource
	Endpoints   []*Endpoint
	URITemplate *uritemplates.URITemplate
	Headers     map[string][]string
	Links       []Link
	Command     []string
	Body        string
	RawBody     string
}

func (*Resource) Endpoint

func (r *Resource) Endpoint(m string) (*Endpoint, bool)

func (*Resource) Resource

func (r *Resource) Resource(name string) (*Resource, bool)

type Server

type Server struct {
	Name    string
	BaseURL string
	Headers map[string][]string
	Links   []Link
}

type Service

type Service struct {
	Name        string
	Title       string
	Description string
	Servers     []*Server
	Links       []Link

	Resource *Resource
}

func (*Service) Server

func (s *Service) Server(name string) (*Server, bool)

type ServiceSpec

type ServiceSpec []string

func (ServiceSpec) NewCounter

func (s ServiceSpec) NewCounter() cli.ArgCounter

func (ServiceSpec) Path

func (s ServiceSpec) Path() string

func (ServiceSpec) ServiceName

func (s ServiceSpec) ServiceName() string

func (*ServiceSpec) Set

func (s *ServiceSpec) Set(arg string) error

func (ServiceSpec) String

func (s ServiceSpec) String() string

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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