70 lines
1.9 KiB
Go
70 lines
1.9 KiB
Go
// Code generated by ogen, DO NOT EDIT.
|
|
|
|
package gsn
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
// Handler handles operations described by OpenAPI v3 specification.
|
|
type Handler interface {
|
|
// GetSatellites implements GetSatellites operation.
|
|
//
|
|
// Get available satellites.
|
|
//
|
|
// GET /satellite
|
|
GetSatellites(ctx context.Context) (*GetSatellitesOK, error)
|
|
// GetStations implements GetStations operation.
|
|
//
|
|
// Get available stations.
|
|
//
|
|
// GET /station
|
|
GetStations(ctx context.Context) (*GetStationsOK, error)
|
|
// GetSubscriptions implements GetSubscriptions operation.
|
|
//
|
|
// Get current subscriptions.
|
|
//
|
|
// GET /subscription
|
|
GetSubscriptions(ctx context.Context) (*GetSubscriptionsOK, error)
|
|
// SubscribeSatellite implements SubscribeSatellite operation.
|
|
//
|
|
// Subscribe to a given station.
|
|
//
|
|
// POST /satellite/subscribe
|
|
SubscribeSatellite(ctx context.Context, req *SubscribeSatelliteReq) (*SubscribeSatelliteOK, error)
|
|
// SubscribeStation implements SubscribeStation operation.
|
|
//
|
|
// Subscribe to a given station.
|
|
//
|
|
// POST /station/subscribe
|
|
SubscribeStation(ctx context.Context, req *SubscribeStationReq) (*SubscribeStationOK, error)
|
|
// Unsubscribe implements Unsubscribe operation.
|
|
//
|
|
// Remove subscription by subscription ID.
|
|
//
|
|
// DELETE /subscription
|
|
Unsubscribe(ctx context.Context, params UnsubscribeParams) error
|
|
// NewError creates *ErrorStatusCode from error returned by handler.
|
|
//
|
|
// Used for common default response.
|
|
NewError(ctx context.Context, err error) *ErrorStatusCode
|
|
}
|
|
|
|
// Server implements http server based on OpenAPI v3 specification and
|
|
// calls Handler to handle requests.
|
|
type Server struct {
|
|
h Handler
|
|
baseServer
|
|
}
|
|
|
|
// NewServer creates new Server.
|
|
func NewServer(h Handler, opts ...ServerOption) (*Server, error) {
|
|
s, err := newServerConfig(opts...).baseServer()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &Server{
|
|
h: h,
|
|
baseServer: s,
|
|
}, nil
|
|
}
|