jellyseerr: start API client

Currently uses an API key (Seems simpler for the user than importing the
jfa-go user and granting perms). Strategy as follows:
* MustGetUser(jfID) function checks the cache for user, if not, calls
  Jellyseerr's importer passing jfID. From either, the user object is
  returned, which (in later commits) can be used to update the user's
  email (and potentially other info).

My API key is in there rn but its for a local testing instance, who
cares.
This commit is contained in:
Harvey Tindall
2024-07-29 16:46:37 +01:00
parent dabef831d7
commit 9c34192b4f
4 changed files with 335 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
package jellyseerr
import "time"
type User struct {
Permissions int `json:"permissions"`
Warnings []any `json:"warnings"`
ID int `json:"id"`
Email string `json:"email"`
PlexUsername string `json:"plexUsername"`
JellyfinUsername string `json:"jellyfinUsername"`
Username string `json:"username"`
RecoveryLinkExpirationDate any `json:"recoveryLinkExpirationDate"`
UserType int `json:"userType"`
PlexID string `json:"plexId"`
JellyfinUserID string `json:"jellyfinUserId"`
JellyfinDeviceID string `json:"jellyfinDeviceId"`
JellyfinAuthToken string `json:"jellyfinAuthToken"`
PlexToken string `json:"plexToken"`
Avatar string `json:"avatar"`
MovieQuotaLimit any `json:"movieQuotaLimit"`
MovieQuotaDays any `json:"movieQuotaDays"`
TvQuotaLimit any `json:"tvQuotaLimit"`
TvQuotaDays any `json:"tvQuotaDays"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
RequestCount int `json:"requestCount"`
DisplayName string `json:"displayName"`
}
type PageInfo struct {
Pages int `json:"pages"`
PageSize int `json:"pageSize"`
Results int `json:"results"`
Page int `json:"page"`
}
type GetUsersDTO struct {
Page PageInfo `json:"pageInfo"`
Results []User `json:"results"`
}