images

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 8 Imported by: 4

Documentation

Index

Constants

View Source
const (
	ConverterTopicID string = "image-converter"
	GeneratorTopicID string = "image-generator"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(
	cPubSub *cloudpubsub.Client,
	converterDstEndpoint string,
	converterDstAuthToken string,
) *Client

func NewClientWithOption

func NewClientWithOption(
	cPubSub *cloudpubsub.Client,
	converterDstEndpoint string,
	converterDstAuthToken string,
	reqOption *ClientOption,
) *Client

func (*Client) SendConvertRequest

func (c *Client) SendConvertRequest(
	ctx context.Context,
	key string,
	sourceID string,
	sources []*Object,
	dstFilePath string,
) error

画像変換リクエストを送信する

func (*Client) SendGenerateRequest

func (c *Client) SendGenerateRequest(
	ctx context.Context,
	key string,
	sourceID string,
	sourceURL string,
	width int,
	height int,
	dstFilePath string,
) error

画像作成リクエストを送信する

type ClientOption

type ClientOption struct {
	ConverterTopicID string
	GeneratorTopicID string
}

type ConvertRequest

type ConvertRequest struct {
	Key                  string   `json:"key"`
	SourceID             string   `json:"source_id"`
	SourceURLs           []string `json:"source_urls"`
	DstFilePath          string   `json:"dst_file_path"`
	DstEndpoint          string   `json:"dst_endpoint"`
	DstEndpointAuthToken string   `json:"dst_endpoint_auth_token"`
}

画像変換リクエスト

type GenerateRequest

type GenerateRequest struct {
	Key         string `json:"key"`
	SourceID    string `json:"source_id"`
	SourceURL   string `json:"source_url"`
	Width       int    `json:"width"`
	Height      int    `json:"height"`
	DstFilePath string `json:"dst_file_path"`
}

画像作成リクエスト

type Handler

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

func NewHandler

func NewHandler(repo Repository) *Handler

func (*Handler) UpdateByConvertObjects

func (h *Handler) UpdateByConvertObjects(w http.ResponseWriter, r *http.Request)

変換後の画像をアップデートする

func (*Handler) UpdateByGenerateURL

func (h *Handler) UpdateByGenerateURL(w http.ResponseWriter, r *http.Request)

作成したOGPをアップデートする

type Object

type Object struct {
	ID            string           `firestore:"id"             json:"id"`
	OriginalURL   string           `firestore:"original_url"   json:"original_url"`
	URL           string           `firestore:"url"            json:"url"`
	Filename      string           `firestore:"filename"       json:"filename"`
	ContentType   string           `firestore:"content_type"   json:"content_type"`
	DominantColor string           `firestore:"dominant_color" json:"dominant_color"`
	Sizes         map[string]*Size `firestore:"sizes"          json:"sizes"`
	IsDefault     bool             `firestore:"is_default"     json:"is_default"`
}

画像オブジェクト

type Repository

type Repository interface {
	UpdateByConvertObjects(
		ctx context.Context,
		key string,
		objects []*Object,
	) error

	UpdateByGenerateURL(
		ctx context.Context,
		key string,
		id string,
		url string,
	) error
}

type Size

type Size struct {
	URL    string `firestore:"url"    json:"url"`
	Width  int    `firestore:"width"  json:"width"`
	Height int    `firestore:"height" json:"height"`
}

サイズ

Jump to

Keyboard shortcuts

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