resolver

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package resolver provides helpers for resolving user-facing references into Microsoft Graph resource IDs. It supports caching of resolved IDs to improve performance and reduce API calls.

Resources that can be resolved: teams, channels, channel-members, one-on-one chats, group chats and chat-members.

Sometimes resolver cannot unambiguously resolve a reference (e.g., multiple chats with the same topic). In such cases, it returns an error indicating the ambiguity.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChannelResolver

type ChannelResolver interface {

	// If the reference already appears to be an channel ID,
	// it may be returned directly.
	ResolveChannelRefToID(ctx context.Context, teamID, channelRef string) (string, error)

	// ResolveChannelMemberRefToID resolves a user reference (email or ID)
	// to a channel member ID within the specified channel.
	ResolveChannelMemberRefToID(
		ctx context.Context,
		teamID, channelID, userRef string,
	) (string, error)
}

ChannelResolver defines methods for resolving channel and channel-member references into their corresponding Microsoft Graph IDs.

func GetChannelResolver

func GetChannelResolver(channelAPI api.ChannelAPI, cacheHandler *cacher.CacheHandler) ChannelResolver

func NewChannelResolverCacheable

func NewChannelResolverCacheable(
	channelAPI api.ChannelAPI,
	cacheHandler *cacher.CacheHandler,
) ChannelResolver

NewChannelResolverCacheable creates a new ChannelResolverCacheable.

type ChannelResolverCacheable

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

ChannelResolverCacheable resolves channel references using the graph API and optionally caches successful resolutions.

func (*ChannelResolverCacheable) ResolveChannelMemberRefToID

func (res *ChannelResolverCacheable) ResolveChannelMemberRefToID(
	ctx context.Context,
	teamID, channelID, userRef string,
) (string, error)

ResolveChannelMemberRefToID implements ChannelResolver.

func (*ChannelResolverCacheable) ResolveChannelRefToID

func (res *ChannelResolverCacheable) ResolveChannelRefToID(
	ctx context.Context,
	teamID, channelRef string,
) (string, error)

ResolveChannelRefToID implements ChannelResolver.

type ChatResolver

type ChatResolver interface {
	// ResolveOneOnOneChatRefToID resolves a one-on-one chat reference (user email or ID)
	// to a chat ID.
	//
	// If the reference already appears to be an one-on-one chat ID,
	// it may be returned directly.
	ResolveOneOnOneChatRefToID(ctx context.Context, userRef string) (string, error)

	// ResolveGroupChatRefToID resolves a group chat reference (topic or ID)
	// to a chat ID.
	//
	// If the reference already appears to be an group chat ID,
	// it may be returned directly.
	ResolveGroupChatRefToID(ctx context.Context, topic string) (string, error)

	// ResolveChatMemberRefToID resolves a user reference (email or ID)
	// to a chat member ID within the specified chat.
	ResolveChatMemberRefToID(ctx context.Context, chatID, userRef string) (string, error)
}

ChatResolver defines methods to resolve chat and chat-member references into their corresponding Microsoft Graph IDs.

It supports resolving both one-on-one chats and group chats.

func GetChatResolver

func GetChatResolver(chatAPI api.ChatAPI, cacheHandler *cacher.CacheHandler) ChatResolver

func NewChatResolverCacheable

func NewChatResolverCacheable(
	chatsAPI api.ChatAPI,
	cacheHandler *cacher.CacheHandler,
) ChatResolver

NewChatResolverCacheable creates a new ChatResolverCacheable.

type ChatResolverCacheable

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

ChatResolverCacheable resolves chat references using the graph API and optionally caches successful resolutions.

func (*ChatResolverCacheable) ResolveChatMemberRefToID

func (m *ChatResolverCacheable) ResolveChatMemberRefToID(
	ctx context.Context,
	chatID, userRef string,
) (string, error)

ResolveChatMemberRefToID implements ChatResolver.

func (*ChatResolverCacheable) ResolveGroupChatRefToID

func (m *ChatResolverCacheable) ResolveGroupChatRefToID(
	ctx context.Context,
	chatRef string,
) (string, error)

ResolveGroupChatRefToID implements ChatResolver.

func (*ChatResolverCacheable) ResolveOneOnOneChatRefToID

func (m *ChatResolverCacheable) ResolveOneOnOneChatRefToID(
	ctx context.Context,
	userRef string,
) (string, error)

ResolveOneOnOneChatRefToID implements ChatResolver.

type TeamResolver

type TeamResolver interface {
	// ResolveTeamRefToID resolves  a team reference (name or ID) to a team ID.
	//
	// If the reference already appears to be an team ID,
	// it may be returned directly.
	ResolveTeamRefToID(ctx context.Context, teamRef string) (string, error)

	// ResolveTeamMemberRefToID resolves a user reference (email or ID) to a member ID within the specified team.
	//
	// If the reference already appears to be a member ID,
	// it may be returned directly.
	ResolveTeamMemberRefToID(
		ctx context.Context,
		teamID, userRef string,
	) (string, error)
}

TeamResolver defines methods to resolve team references into their corresponding Microsoft Graph IDs.

func GetTeamResolver

func GetTeamResolver(teamAPI api.TeamAPI, cacheHandler *cacher.CacheHandler) TeamResolver

func NewTeamResolverCacheable

func NewTeamResolverCacheable(
	teamsAPI api.TeamAPI,
	cacheHandler *cacher.CacheHandler,
) TeamResolver

NewTeamResolverCacheable creates a new TeamResolverCacheable.

type TeamResolverCacheable

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

TeamResolverCacheable resolves team references using the graph API and optionally caches successful resolutions.

func (*TeamResolverCacheable) ResolveTeamMemberRefToID

func (r *TeamResolverCacheable) ResolveTeamMemberRefToID(
	ctx context.Context,
	teamID, userRef string,
) (string, error)

ResolveTeamMemberRefToID implements TeamResolver.

func (*TeamResolverCacheable) ResolveTeamRefToID

func (r *TeamResolverCacheable) ResolveTeamRefToID(
	ctx context.Context,
	teamRef string,
) (string, error)

ResolveTeamRefToID implements TeamResolver.

Jump to

Keyboard shortcuts

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