myshoes

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 11 Imported by: 0

README

myshoes-sdk-go

The Go SDK for myshoes

Usage

package main

import (
	"context"
	"fmt"
	"io"
	"log"
	"net/http"
	
	"github.com/whywaita/myshoes/api/myshoes"
)

func main()  {
	// Set customized HTTP Client
	customHTTPClient := http.DefaultClient
	// Set customized logger
	customLogger := log.New(io.Discard, "", log.LstdFlags)
	
	client, err := myshoes.NewClient("https://example.com", customHTTPClient, customLogger)
	if err != nil {
		// ...
	}
	
	targets, err := client.ListTarget(context.Background())
	if err != nil {
		// ...
	}
	
	fmt.Println(targets)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	HTTPClient http.Client
	URL        *url.URL

	UserAgent string
	Logger    *log.Logger
}

Client is a client for myshoes

func NewClient

func NewClient(endpoint string, client *http.Client, logger *log.Logger) (*Client, error)

NewClient create a Client

func (*Client) CreateTarget

func (c *Client) CreateTarget(ctx context.Context, param web.TargetCreateParam) (*web.UserTarget, error)

CreateTarget create a target

func (*Client) DeleteTarget

func (c *Client) DeleteTarget(ctx context.Context, targetID string) error

DeleteTarget delete a target

func (*Client) GetTarget

func (c *Client) GetTarget(ctx context.Context, targetID string) (*web.UserTarget, error)

GetTarget get a target

func (*Client) ListTarget

func (c *Client) ListTarget(ctx context.Context) ([]web.UserTarget, error)

ListTarget get a list of target

func (*Client) UpdateTarget

func (c *Client) UpdateTarget(ctx context.Context, targetID string, param web.TargetCreateParam) (*web.UserTarget, error)

UpdateTarget update a target

Jump to

Keyboard shortcuts

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