firebase

package module
v1.0.0-beta.14 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: MIT Imports: 6 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIToken

type APIToken struct {
	CreatedAt string `firestore:"createdAt" json:"createdAt"`
	ExpiredAt string `firestore:"expiredAt" json:"expiredAt"`
	Token     string `firestore:"token" json:"token"`
	ExpiresIn int    `firestore:"expiresIn" json:"expiresIn"`
}

APIToken contains the access token and the time in which it expires

type FirestoreAppleDevJWT

type FirestoreAppleDevJWT struct {
	ExpiresAt int64  `json:"expiresAt"`
	IssuedAt  int64  `json:"issuedAt"`
	Token     string `json:"token"`
}

FirestoreAppleDevJWT rerpresents the JWT object that is needed for calling Apple Music API stuff

func GetAppleDeveloperToken

func GetAppleDeveloperToken() (*FirestoreAppleDevJWT, error)

GetAppleDeveloperToken will go to Firestore and grab developer token if it exists and will refresh it if expired

type FirestoreEvent

type FirestoreEvent struct {
	OldValue   FirestoreValue `json:"oldValue"`
	Value      FirestoreValue `json:"value"`
	UpdateMask struct {
		FieldPaths []string `json:"fieldPaths"`
	} `json:"updateMask"`
}

FirestoreEvent implements the Firestore event from a trigger function

type FirestoreEventMedia

type FirestoreEventMedia struct {
	ID stringValue `json:"id"`
	// Technically images should be here, but I don't think we need it.
	URL stringValue `json:"url"`
}

FirestoreEventMedia implements the data per provider for a firestore song

type FirestoreEventProfileImage

type FirestoreEventProfileImage struct {
	Width  integerValue `json:"width,omitempty"`
	Height integerValue `json:"height,omitempty"`
	URL    stringValue  `json:"url,omitempty"`
}

FirestoreEventProfileImage implements data needed for firestore image

type FirestoreEventSong

type FirestoreEventSong struct {
	Fields struct {
		ID      stringValue   `json:"id"`
		Album   stringValue   `json:"album"`
		Creator stringValue   `json:"creator"`
		Name    stringValue   `json:"name"`
		Type    stringValue   `json:"type"`
		Apple   MediaMapValue `json:"apple"`
		Spotify MediaMapValue `json:"spotify"`
		YouTube MediaMapValue `json:"youtube"`
	} `json:"fields"`
	Name       string `json:"name"`
	UpdateTime string `json:"updateTime"`
}

FirestoreEventSong implements the data in the song document

type FirestoreEventSongs

type FirestoreEventSongs struct {
	OldValue   FirestoreEventSong `json:"oldValue"`
	Value      FirestoreEventSong `json:"value"`
	UpdateMask struct {
		FieldPaths []string `json:"fieldPaths"`
	} `json:"updateMask"`
}

FirestoreEventSongs implements the values that come from a trigger event based on the songs collection

type FirestoreEventUser

type FirestoreEventUser struct {
	ID           stringValue          `json:"id"`
	Email        stringValue          `json:"email"`
	ProfileImage profileImageMapValue `json:"profileImage"`
	DisplayName  stringValue          `json:"displayName"`
	Username     stringValue          `json:"username"`
}

FirestoreEventUser implements the values that are recevied from a firestore trigger

type FirestoreMedia

type FirestoreMedia struct {
	ID      string                     `firestore:"id" json:"id"`
	Name    string                     `firestore:"name" json:"name"`
	Album   string                     `firestore:"album,omitempty" json:"album,omitempty"`
	Type    string                     `firestore:"type" json:"type"`
	Creator string                     `firestore:"creator" json:"creator"`
	Apple   FirestoreMediaPlatformData `firestore:"apple,omitempty" json:"apple,omitempty"`
	Spotify FirestoreMediaPlatformData `firestore:"spotify,omitempty" json:"spotify,omitempty"`
	YouTube FirestoreMediaPlatformData `firestore:"youtube,omitempty" json:"youtube,omitempty"`
}

FirestoreMedia represents the "song" item stored in the songs collection. We use media because techincally this doens't have to be just a song

type FirestoreMediaPlatformData

type FirestoreMediaPlatformData struct {
	ID     string      `firestore:"id" json:"id"`
	URL    string      `firestore:"url" json:"url"`
	Images interface{} `firestore:"images" json:"images"`
}

FirestoreMediaPlatformData includes the specific data for the current media based on platform

type FirestorePlaylist

type FirestorePlaylist struct {
	ID        string                   `firestore:"id" json:"id"`
	Name      string                   `firestore:"name" json:"name"`
	CreatedBy *firestore.DocumentRef   `firestore:"createdBy" json:"createdBy"`
	Members   []*firestore.DocumentRef `firestore:"members" json:"members"`
	Songs     PlaylistSongs            `firestore:"songs" json:"songs"`
	Comments  interface{}              `firestore:"comments" json:"comments"` // This will actually need be an object with key:value pair of songId:[Comments]
	CoverArt  string                   `firestore:"coverArt" json:"coverArt"`
}

FirestorePlaylist represents the data for a playlist store in Firestore

type FirestoreSocialPlatform

type FirestoreSocialPlatform struct {
	APIToken           APIToken     `firestore:"apiToken" json:"apiToken"`
	RefreshToken       string       `firestore:"refreshToken" json:"refreshToken"`
	Email              string       `firestore:"email" json:"email"`
	ID                 string       `firestore:"id" json:"id"`
	IsPreferredService bool         `firestore:"isPreferredService" json:"isPreferredService"`
	IsPremium          bool         `firestore:"isPremium" json:"isPremium"`
	PlatformName       string       `firestore:"platformName" json:"platformName"`
	ProfileImage       SpotifyImage `firestore:"profileImage" json:"profileImage"`
	Username           string       `firestore:"username" json:"username"`
}

FirestoreSocialPlatform represents the data for a social platform stored in Firestore

type FirestoreSpotifyAuthToken

type FirestoreSpotifyAuthToken struct {
	ExpiredAt string `json:"expiredAt"`
	ExpiresIn int    `json:"expiresIn"`
	IssuedAt  string `json:"issuedAt"`
	Token     string `json:"token"`
}

FirestoreSpotifyAuthToken represents the auth token object needed for calling Spotify APIs

type FirestoreUser

type FirestoreUser struct {
	Email                   string                   `firestore:"email" json:"email"`
	ID                      string                   `firestore:"id" json:"id"`
	Playlists               []*firestore.DocumentRef `firestore:"playlists" json:"playlists"`
	PreferredSocialPlatform *firestore.DocumentRef   `firestore:"preferredSocialPlatform" json:"preferredSocialPlatform"`
	ProfileImage            *SpotifyImage            `firestore:"profileImage" json:"profileImage"`
	SocialPlatforms         []*firestore.DocumentRef `firestore:"socialPlatforms" json:"socialPlatforms"`
	DisplayName             string                   `firestore:"displayName" json:"displayName"`
	Username                string                   `firestore:"username" json:"username"`
}

FirestoreUser respresents the data stored in Firestore for an user

type FirestoreValue

type FirestoreValue struct {
	CreateTime time.Time          `json:"createTime"`
	Fields     FirestoreEventUser `json:"fields"`
	Name       string             `json:"name"`
	UpdateTime time.Time          `json:"updateTime"`
}

FirestoreValue implements the values that come from a Firestore event

type MediaMapValue

type MediaMapValue struct {
	MapValue struct {
		Fields FirestoreEventMedia `json:"fields"`
	} `json:"mapValue"`
}

MediaMapValue implements the provider nested object value for a Firestore Song Event.

type PlaylistSongs

type PlaylistSongs struct {
	AddedBy  map[string][]string      `firestore:"addedBy" json:"addedBy"`
	AllSongs []*firestore.DocumentRef `firestore:"allSongs" json:"allSongs"`
}

PlaylistSongs represents the songs object in a playlist which includes an AddedBy object and AllSongs DocRef Array

type SpotifyImage

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

SpotifyImage includes data for any image returned in Spotify

Jump to

Keyboard shortcuts

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