Help us shape the future of Go! Take the 2026 Go Developer Survey

querystring

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

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

Go to latest
Published: Oct 6, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

README

Marvel API martian querystring modifier

This package is a martian modifier for authentication against the Marvel comics API.

The procedure extracted from the Marvel API documentation: https://developer.marvel.com/documentation/authorization

Authentication for Server-Side Applications
Server-side applications must pass two parameters in addition to the apikey parameter:
ts - a timestamp (or other long string which can change on a request-by-request basis)
hash - a md5 digest of the ts parameter, your private key and your public key (e.g. md5(ts+privateKey+publicKey)
For example, a user with a public key of "1234" and a private key of "abcd" could construct a valid call as follows: http://gateway.marvel.com/v1/public/comics?ts=1&apikey=1234&hash=ffd275c5130566a2916217b101f26150 (the hash value is the md5 digest of 1abcd1234)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check()

func GetMD5Hash

func GetMD5Hash(text string) string

GetMD5Hash returns the md5 hash from a string

func MarvelNewModifier

func MarvelNewModifier(public, private string) martian.RequestModifier

MarvelNewModifier returns a request modifier that will set the query string at key with the given value. If the query string key already exists all values will be overwritten.

Types

type MarvelModifier

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

MarvelModifier contains the private and public Marvel API key

func (*MarvelModifier) ModifyRequest

func (m *MarvelModifier) ModifyRequest(req *http.Request) error

ModifyRequest modifies the query string of the request with the given key and value.

type MarvelModifierJSON

type MarvelModifierJSON struct {
	Public  string               `json:"public"`
	Private string               `json:"private"`
	Scope   []parse.ModifierType `json:"scope"`
}

MarvelModifierJSON to Unmarshal the JSON configuration

type SsoData

type SsoData struct {
	LoginEmail  string `json:"LoginEmail"`
	AccountGuid string `json:"AccountGuid"`
	DisplayName string `json:"DisplayName"`
}

type SsoTicketUserInfoResponse

type SsoTicketUserInfoResponse struct {
	ErrorCode int      `json:"errorCode"`
	Data      *SsoData `json:"data"`
	Message   string   `json:"message"`
}

Jump to

Keyboard shortcuts

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