gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

emoji.go (3599B)


      1 // GoToSocial
      2 // Copyright (C) GoToSocial Authors admin@gotosocial.org
      3 // SPDX-License-Identifier: AGPL-3.0-or-later
      4 //
      5 // This program is free software: you can redistribute it and/or modify
      6 // it under the terms of the GNU Affero General Public License as published by
      7 // the Free Software Foundation, either version 3 of the License, or
      8 // (at your option) any later version.
      9 //
     10 // This program is distributed in the hope that it will be useful,
     11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13 // GNU Affero General Public License for more details.
     14 //
     15 // You should have received a copy of the GNU Affero General Public License
     16 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
     17 
     18 package db
     19 
     20 import (
     21 	"context"
     22 
     23 	"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
     24 )
     25 
     26 // EmojiAllDomains can be used as the `domain` value in a GetEmojis
     27 // query to indicate that emojis from all domains should be returned.
     28 const EmojiAllDomains string = "all"
     29 
     30 // Emoji contains functions for getting emoji in the database.
     31 type Emoji interface {
     32 	// PutEmoji puts one emoji in the database.
     33 	PutEmoji(ctx context.Context, emoji *gtsmodel.Emoji) Error
     34 	// UpdateEmoji updates the given columns of one emoji.
     35 	// If no columns are specified, every column is updated.
     36 	UpdateEmoji(ctx context.Context, emoji *gtsmodel.Emoji, columns ...string) (*gtsmodel.Emoji, Error)
     37 	// DeleteEmojiByID deletes one emoji by its database ID.
     38 	DeleteEmojiByID(ctx context.Context, id string) Error
     39 	// GetEmojisByIDs gets emojis for the given IDs.
     40 	GetEmojisByIDs(ctx context.Context, ids []string) ([]*gtsmodel.Emoji, Error)
     41 	// GetUseableEmojis gets all emojis which are useable by accounts on this instance.
     42 	GetUseableEmojis(ctx context.Context) ([]*gtsmodel.Emoji, Error)
     43 	// GetEmojis gets emojis based on given parameters. Useful for admin actions.
     44 	GetEmojis(ctx context.Context, domain string, includeDisabled bool, includeEnabled bool, shortcode string, maxShortcodeDomain string, minShortcodeDomain string, limit int) ([]*gtsmodel.Emoji, Error)
     45 	// GetEmojiByID gets a specific emoji by its database ID.
     46 	GetEmojiByID(ctx context.Context, id string) (*gtsmodel.Emoji, Error)
     47 	// GetEmojiByShortcodeDomain gets an emoji based on its shortcode and domain.
     48 	// For local emoji, domain should be an empty string.
     49 	GetEmojiByShortcodeDomain(ctx context.Context, shortcode string, domain string) (*gtsmodel.Emoji, Error)
     50 	// GetEmojiByURI returns one emoji based on its ActivityPub URI.
     51 	GetEmojiByURI(ctx context.Context, uri string) (*gtsmodel.Emoji, Error)
     52 	// GetEmojiByStaticURL gets an emoji using the URL of the static version of the emoji image.
     53 	GetEmojiByStaticURL(ctx context.Context, imageStaticURL string) (*gtsmodel.Emoji, Error)
     54 	// PutEmojiCategory puts one new emoji category in the database.
     55 	PutEmojiCategory(ctx context.Context, emojiCategory *gtsmodel.EmojiCategory) Error
     56 	// GetEmojiCategoriesByIDs gets emoji categories for given IDs.
     57 	GetEmojiCategoriesByIDs(ctx context.Context, ids []string) ([]*gtsmodel.EmojiCategory, Error)
     58 	// GetEmojiCategories gets a slice of the names of all existing emoji categories.
     59 	GetEmojiCategories(ctx context.Context) ([]*gtsmodel.EmojiCategory, Error)
     60 	// GetEmojiCategory gets one emoji category by its id.
     61 	GetEmojiCategory(ctx context.Context, id string) (*gtsmodel.EmojiCategory, Error)
     62 	// GetEmojiCategoryByName gets one emoji category by its name.
     63 	GetEmojiCategoryByName(ctx context.Context, name string) (*gtsmodel.EmojiCategory, Error)
     64 }