main

mattermost/focalboard

Last updated at: 29/12/2023 09:48

app_api.go

TLDR

This file provides an interface called AppAPI that defines various methods for interacting with notification subscriptions and other related operations.

Methods

GetBlockHistory

This method retrieves the history of blocks based on the provided block ID and query options.

GetBlockHistoryNewestChildren

This method retrieves the newest children blocks of the parent block ID, along with the specified query options.

GetBoardAndCardByID

This method fetches the board and card details based on the provided block ID.

GetUserByID

This method retrieves a user's details based on the provided user ID.

CreateSubscription

This method creates a new subscription based on the provided subscription details.

GetSubscribersForBlock

This method retrieves the subscribers for a given block ID.

UpdateSubscribersNotifiedAt

This method updates the notified timestamp for the subscribers of a specific block ID.

UpsertNotificationHint

This method either inserts or updates notification hints based on the provided hint details and notification frequency.

GetNextNotificationHint

This method retrieves the next notification hint and optionally removes it from the collection.

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

package notifysubscriptions

import (
	"time"

	"github.com/mattermost/focalboard/server/model"
)

type AppAPI interface {
	GetBlockHistory(blockID string, opts model.QueryBlockHistoryOptions) ([]*model.Block, error)
	GetBlockHistoryNewestChildren(parentID string, opts model.QueryBlockHistoryChildOptions) ([]*model.Block, bool, error)
	GetBoardAndCardByID(blockID string) (board *model.Board, card *model.Block, err error)

	GetUserByID(userID string) (*model.User, error)

	CreateSubscription(sub *model.Subscription) (*model.Subscription, error)
	GetSubscribersForBlock(blockID string) ([]*model.Subscriber, error)
	UpdateSubscribersNotifiedAt(blockID string, notifyAt int64) error

	UpsertNotificationHint(hint *model.NotificationHint, notificationFreq time.Duration) (*model.NotificationHint, error)
	GetNextNotificationHint(remove bool) (*model.NotificationHint, error)
}