images

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// ConverterTopicID ... 画像変換のPubSubトピックID
	ConverterTopicID string = "image-converter"
	// GeneratorTopicID ... 画像作成のPubSubトピックID
	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
}

Client ... クライアント

func NewClient

func NewClient(cPubSub *cloudpubsub.Client) *Client

NewClient ... クライアントを作成する

func NewClientWithOption

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

NewClientWithOption ... オプションを指定してクライアントを作成する

func (*Client) SendConvertRequest

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

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

func (*Client) SendGenerateRequest

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

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

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"`
}

ConvertRequest ... 画像変換リクエスト

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"`
}

GenerateRequest ... 画像作成リクエスト

type Handler

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

Handler ... スポットのハンドラ

func NewHandler

func NewHandler(repo Repository) *Handler

NewHandler ... ハンドラを作成する

func (*Handler) UpdateByConvertObjects

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

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

func (*Handler) UpdateByGenerateURL

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

UpdateByGenerateURL ... 作成した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"`
}

Object ... 画像オブジェクト

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
}

Repository ... リポジトリ

type Size

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

Size ... サイズ

Jump to

Keyboard shortcuts

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