api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package api is the base for all aep rest functions.

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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticationConfig

type AuthenticationConfig struct {
	Cache            bool
	DryRun           bool
	Server           string
	Organization     string
	TechnicalAccount string
	Audience         string
	ClientID         string
	ClientSecret     string
	Key              string
	Sandbox          string
	LoadToken        func() (*BearerToken, error)
	SaveToken        func(token *BearerToken) error
}

AuthenticationConfig contains the configuraion for getting the bearer token

func (*AuthenticationConfig) DeleteRequest

func (o *AuthenticationConfig) DeleteRequest(ctx context.Context, url string, a ...interface{}) (interface{}, error)

DeleteRequest sends a http delete request to the passed url

func (*AuthenticationConfig) FullRequest

func (o *AuthenticationConfig) FullRequest(ctx context.Context, verb string, header map[string]string, body io.Reader, url string, a ...interface{}) (interface{}, error)

FullRequest sends a http request with the passed verb to the passed url

func (*AuthenticationConfig) GetRequest

func (o *AuthenticationConfig) GetRequest(ctx context.Context, url string, a ...interface{}) (interface{}, error)

GetRequest sends a http get request to the passed url

func (*AuthenticationConfig) GetToken

func (o *AuthenticationConfig) GetToken() (*BearerToken, error)

GetToken uses JWT to get a bearer token

func (*AuthenticationConfig) PatchRequest

func (o *AuthenticationConfig) PatchRequest(ctx context.Context, header map[string]string, data []byte, url string, a ...interface{}) (interface{}, error)

PatchRequest sends a http patch request to the passed url

func (*AuthenticationConfig) PostJSONRequest

func (o *AuthenticationConfig) PostJSONRequest(ctx context.Context, obj interface{}, url string, a ...interface{}) (interface{}, error)

PostJSONRequest serializes the passed object to JSON and sends a httep post request to the passed url

func (*AuthenticationConfig) PostRequest

func (o *AuthenticationConfig) PostRequest(ctx context.Context, header map[string]string, data []byte, url string, a ...interface{}) (interface{}, error)

PostRequest sends a http post request to the passed url

func (*AuthenticationConfig) Request

func (o *AuthenticationConfig) Request(ctx context.Context, verb, url string, a ...interface{}) (interface{}, error)

Request sends a http request with the passed verb to the passed url

func (*AuthenticationConfig) UpdateHeader

func (o *AuthenticationConfig) UpdateHeader(req *http.Request) error

UpdateHeader adds the authentication headers to the passed http request

type BearerToken

type BearerToken struct {
	Token   string
	Expires time.Time
}

BearerToken contains a token and an expiration date

func (*BearerToken) LocalTime

func (t *BearerToken) LocalTime() string

LocalTime returns the expiry date as string in the local time zone

func (*BearerToken) ValidIn

func (t *BearerToken) ValidIn(d time.Duration) bool

ValidIn in checks if the token is still valid for passed duration

Directories

Path Synopsis
Package acl consists of access control list functions.
Package acl consists of access control list functions.
Package od contains offer decisiong related functions.
Package od contains offer decisiong related functions.
Package sandbox contains all sandbox related functions.
Package sandbox contains all sandbox related functions.

Jump to

Keyboard shortcuts

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