sacagawea

package module
v0.0.0-...-f3c5e4c Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

README

sacagawea

Library to generate go clients for exploring google APIs

Usage

  • look at the tests for usage

TODO

  • push necessary modifications to googleapis/gnostic for renderer (see glickbot/gnostic)
  • add more docs/examples

Documentation

Overview

Copyright 2017 Google Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const APIsListServiceURL = "https://www.googleapis.com/discovery/v1/apis"

APIsListServiceURL is the URL for the Google APIs Discovery Service

Variables

This section is empty.

Functions

func GenServiceClient

func GenServiceClient(discoveryRestURL string, path string) error

func GetFiles

func GetFiles(apiBytes []byte, path string) error

func OpenAPIv3

func OpenAPIv3(api *discovery.Document) (*openapi3.Document, error)

OpenAPIv3 returns an OpenAPI v3 representation of a Discovery document

Types

type API

type API struct {
	Kind              string            `json:"kind"`
	ID                string            `json:"id"`
	Name              string            `json:"name"`
	Version           string            `json:"version"`
	Title             string            `json:"title"`
	Description       string            `json:"description"`
	DiscoveryRestURL  string            `json:"discoveryRestUrl"`
	DiscoveryLink     string            `json:"discoveryLink"`
	Icons             map[string]string `json:"icons"`
	DocumentationLink string            `json:"documentationLink"`
	Labels            []string          `json:"labels"`
	Preferred         bool              `json:"preferred"`
}

An API represents the an API description returned by the apis/list API.

type List

type List struct {
	Kind             string `json:"kind"`
	DiscoveryVersion string `json:"discoveryVersion"`
	APIs             []*API `json:"items"`
}

A List represents the results of a call to the apis/list API. https://developers.google.com/discovery/v1/reference/apis/list

func ListServices

func ListServices() (*List, error)

func NewList

func NewList(bytes []byte) (*List, error)

NewList unmarshals the bytes into a Document.

func (*List) APIWithNameAndVersion

func (a *List) APIWithNameAndVersion(name string, version string) (*API, error)

APIWithNameAndVersion returns the API with a specified name and version. If version is the empty string, the API name must be unique.

type ServiceRenderer

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

func NewServiceRenderer

func NewServiceRenderer(discoveryRestURL string, packageName string, output string) (*ServiceRenderer, error)

func (*ServiceRenderer) RenderAll

func (s *ServiceRenderer) RenderAll() error

func (*ServiceRenderer) RenderClient

func (s *ServiceRenderer) RenderClient(filename string) error

func (*ServiceRenderer) RenderConstants

func (s *ServiceRenderer) RenderConstants(filename string) error

func (*ServiceRenderer) RenderModel

func (s *ServiceRenderer) RenderModel(filename string) error

func (*ServiceRenderer) RenderProvider

func (s *ServiceRenderer) RenderProvider(filename string) error

func (*ServiceRenderer) RenderServer

func (s *ServiceRenderer) RenderServer(filename string) error

func (*ServiceRenderer) RenderTypes

func (s *ServiceRenderer) RenderTypes(filename string) error

Jump to

Keyboard shortcuts

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