You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
277 lines
11 KiB
277 lines
11 KiB
package altvr
|
|
|
|
import "time"
|
|
|
|
// Friendships json structure for the complete friends data
|
|
// URL: https://account.altvr.com/api/friendships/friends?include_users=true&per=50&page=1
|
|
// https://account.altvr.com/api/friendships/outgoing_friend_requests?include_users=false&per=50&page=1
|
|
// https://account.altvr.com/api/friendships/incoming_friend_requests?include_users=false&per=50&page=1
|
|
type Friendships struct {
|
|
Friendships []Friendship `json:"friendships"`
|
|
Pagination struct {
|
|
Page int `json:"page"`
|
|
Pages int `json:"pages"`
|
|
Count int `json:"count"`
|
|
} `json:"pagination"`
|
|
}
|
|
|
|
// Friendship json structure
|
|
// POST https://account.altvr.com/api/friendships/1653976580206100692/accept
|
|
// DELETE https://account.altvr.com/api/friendships/1653976580206100692 (empty content)
|
|
type Friendship struct {
|
|
AasmState string `json:"aasm_state"` // accepted, removed, requested
|
|
FriendshipID string `json:"friendship_id"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
UserID string `json:"user_id"`
|
|
FriendID string `json:"friend_id"`
|
|
//Friend User `json:"friend,omitempty"`
|
|
Friend User `json:"-"`
|
|
User User `json:"-"`
|
|
}
|
|
|
|
// FriendshipRequestAccept return for accepting a frienship request
|
|
type FriendshipRequestAccept struct {
|
|
AasmState string `json:"aasm_state"` // accepted, removed, requested
|
|
FriendshipID uint64 `json:"friendship_id"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
UserID uint64 `json:"user_id"`
|
|
FriendID uint64 `json:"friend_id"`
|
|
//Friend User `json:"friend,omitempty"`
|
|
Friend User `json:"-"`
|
|
User User `json:"-"`
|
|
}
|
|
|
|
// Conversations json structure
|
|
// /api/conversations
|
|
type Conversations struct {
|
|
Conversations []Conversation `json:"conversations"`
|
|
Pagination struct {
|
|
Page uint `json:"page"`
|
|
Pages uint `json:"pages"`
|
|
Count uint `json:"count"`
|
|
} `json:"pagination"`
|
|
}
|
|
|
|
// Conversation structure for a single conversation
|
|
type Conversation struct {
|
|
Subject string `json:"subject"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
ID string `json:"id"`
|
|
IsRead bool `json:"is_read"`
|
|
SenderID string `json:"sender_id"`
|
|
ReceiverID string `json:"receiver_id"`
|
|
}
|
|
|
|
// ConversationsMarkAsRead json structure
|
|
// POST https://account.altvr.com/api/conversations/3394100/mark_as_read
|
|
type ConversationsMarkAsRead struct {
|
|
Subject string `json:"subject"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
ID string `json:"id"`
|
|
IsRead bool `json:"is_read"`
|
|
SenderID string `json:"sender_id"`
|
|
ReceiverID string `json:"receiver_id"`
|
|
}
|
|
|
|
// ConversationNewMessageOutgoing json structure
|
|
// POST https://account.altvr.com/api/conversations.json
|
|
type ConversationNewMessageOutgoing struct {
|
|
Conversation ConversationNewMessage `json:"conversation"`
|
|
}
|
|
|
|
// ConversationNewMessage content of a new conversation message
|
|
type ConversationNewMessage struct {
|
|
UserID uint64 `json:"user_id"`
|
|
Subject string `json:"subject"`
|
|
}
|
|
|
|
// ConversationNewMessageReturn json structure
|
|
type ConversationNewMessageReturn struct {
|
|
Subject string `json:"subject"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
ID string `json:"id"`
|
|
IsRead bool `json:"is_read"`
|
|
SenderID string `json:"sender_id"`
|
|
ReceiverID string `json:"receiver_id"`
|
|
}
|
|
|
|
// Users json struct
|
|
// https://account.altvr.com/api/users/802051693414973874
|
|
// https://account.altvr.com/api/users/1647701242857652976.json
|
|
type Users struct {
|
|
Users []User `json:"users"`
|
|
}
|
|
|
|
// User json struct
|
|
type User struct {
|
|
AdvancedAvatars bool `json:"advanced_avatars"`
|
|
PreferredIdentifier string `json:"preferred_identifier"`
|
|
NeedsToSetExtendedProfile bool `json:"needs_to_set_extended_profile"`
|
|
Roles []string `json:"roles"`
|
|
PlatformRoles []string `json:"platform_roles"`
|
|
Username string `json:"username"`
|
|
FirstName string `json:"first_name"`
|
|
Mementos string `json:"mementos,omitempty"`
|
|
Bio string `json:"bio,omitempty"`
|
|
Guest bool `json:"guest"`
|
|
EmailOptIn bool `json:"email_opt_in"`
|
|
NeedsToSetBasicProfile bool `json:"needs_to_set_basic_profile"`
|
|
LockedAt time.Time `json:"locked_at,omitempty"`
|
|
NeedsToSetPassword bool `json:"needs_to_set_password"`
|
|
OpusCodecApplication string `json:"opus_codec_application"`
|
|
CallButton bool `json:"call_button,omitempty"`
|
|
AasmState string `json:"aasm_state"`
|
|
Azuread bool `json:"azuread,omitempty"`
|
|
TwitterIdentifier string `json:"twitter_identifier,omitempty"`
|
|
DiscordIdentifier string `json:"discord_identifier,omitempty"`
|
|
StatusMessage string `json:"status_message,omitempty"`
|
|
OnlineStatus string `json:"online_status,omitempty"` // Offline, Available
|
|
Email string `json:"email,omitempty"`
|
|
UnconfirmedEmail bool `json:"unconfirmed_email,omitempty"`
|
|
CreatedAt time.Time `json:"created_at,omitempty"`
|
|
UpdatedAt time.Time `json:"updated_at,omitempty"`
|
|
Birthday time.Time `json:"birthday,omitempty"`
|
|
Country string `json:"country,omitempty"`
|
|
EarlyAccess bool `json:"early_access,omitempty"`
|
|
OptIntoDiagnosticData bool `json:"opt_into_diagnostic_data,omitempty"`
|
|
LastName string `json:"last_name,omitempty"`
|
|
CurrentSpace struct {
|
|
SpaceSid string `json:"space_sid"`
|
|
Name string `json:"name"`
|
|
SpaceNumber string `json:"space_number,omitempty"`
|
|
EventID string `json:"event_id"`
|
|
SpaceID string `json:"space_id"`
|
|
EntryDeniedBecauseFull bool `json:"entry_denied_because_full"`
|
|
EntryDeniedBecauseRole bool `json:"entry_denied_because_role"`
|
|
} `json:"current_space,omitempty"`
|
|
DisplayName string `json:"display_name"`
|
|
Streaming bool `json:"streaming"`
|
|
UserAvatar struct {
|
|
Config struct {
|
|
Avatar struct {
|
|
AvatarSid string `json:"avatar_sid"`
|
|
PrimaryColor []string `json:"primary-color"`
|
|
HighlightColor []int `json:"highlight-color"`
|
|
} `json:"avatar"`
|
|
} `json:"config"`
|
|
} `json:"user_avatar,omitempty"`
|
|
HomeSpaceID string `json:"home_space_id,omitempty"`
|
|
HomeSpaceSid string `json:"home_space_sid,omitempty"`
|
|
HomeSpaceVisibility string `json:"home_space_visibility,omitempty"`
|
|
Linked bool `json:"linked,omitempty"`
|
|
InitialSpaceSid string `json:"initial_space_sid,omitempty"`
|
|
ProfileImage string `json:"profile_image,omitempty"`
|
|
ProfileImageThumbnail string `json:"profile_image_thumbnail,omitempty"`
|
|
Admin bool `json:"admin"`
|
|
Online bool `json:"online"`
|
|
UserID string `json:"user_id"`
|
|
AvatarCustomizationID string `json:"avatar_customization_id"`
|
|
}
|
|
|
|
// GetDisplayName returns a user's prefered display name
|
|
func (u *User) GetDisplayName() string {
|
|
if u.PreferredIdentifier == "display_name" {
|
|
return u.DisplayName
|
|
}
|
|
if u.PreferredIdentifier == "last_name" {
|
|
return u.LastName
|
|
}
|
|
if u.PreferredIdentifier == "first_name" {
|
|
return u.FirstName
|
|
}
|
|
return u.Username
|
|
}
|
|
|
|
// Identity json struct
|
|
// https://account.altvr.com/api/users/identity.json
|
|
// DO NOT USE!!
|
|
type Identity struct {
|
|
Users []User `json:"users"`
|
|
Settings struct {
|
|
MinVersion struct {
|
|
MinVersionCheckEnabled bool `json:"min_version_check_enabled"`
|
|
MinVersionCheckAltspacevr string `json:"min_version_check_altspacevr"`
|
|
} `json:"min_version"`
|
|
} `json:"settings,omitempty"`
|
|
}
|
|
|
|
// Spaces json struct
|
|
//
|
|
type Spaces struct {
|
|
Spaces []struct {
|
|
SpaceSid string `json:"space_sid"`
|
|
IsFeatured bool `json:"is_featured"`
|
|
AltspaceURL string `json:"altspace_url"`
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
Layout struct {
|
|
} `json:"layout"`
|
|
PresenterOnly bool `json:"presenter_only"`
|
|
VipOnly bool `json:"vip_only"`
|
|
Platform string `json:"platform,omitempty"`
|
|
SpaceTag string `json:"space_tag"`
|
|
Instructions string `json:"instructions,omitempty"`
|
|
TagList []string `json:"tag_list,omitempty"`
|
|
SpaceNumber string `json:"space_number,omitempty"`
|
|
SoloVisitorShouldResetLayout bool `json:"solo_visitor_should_reset_layout"`
|
|
Mementos string `json:"mementos,omitempty"`
|
|
FavoriteCount int `json:"favorite_count"`
|
|
SpaceID string `json:"space_id"`
|
|
SpaceTemplateID string `json:"space_template_id"`
|
|
UserID string `json:"user_id"`
|
|
Skybox string `json:"skybox,omitempty"`
|
|
SpaceTemplateSid string `json:"space_template_sid"`
|
|
AssetBundleScenes []struct {
|
|
AasmState string `json:"aasm_state"`
|
|
Name string `json:"name"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
AssetBundleSceneID string `json:"asset_bundle_scene_id"`
|
|
UserID string `json:"user_id"`
|
|
AssetBundles []struct {
|
|
GameEngine string `json:"game_engine"`
|
|
GameEngineVersion int `json:"game_engine_version"`
|
|
Platform string `json:"platform"`
|
|
URL string `json:"url"`
|
|
Description string `json:"description,omitempty"`
|
|
AasmState string `json:"aasm_state"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
Layout interface{} `json:"layout"`
|
|
Crc string `json:"crc"`
|
|
ClientCacheKey string `json:"client_cache_key"`
|
|
Name string `json:"name"`
|
|
StereoRenderMode bool `json:"stereo_render_mode,omitempty"`
|
|
AssetBundleID string `json:"asset_bundle_id"`
|
|
UserID string `json:"user_id"`
|
|
AssetBundleSceneID string `json:"asset_bundle_scene_id"`
|
|
AvatarID string `json:"avatar_id"`
|
|
} `json:"asset_bundles"`
|
|
} `json:"asset_bundle_scenes"`
|
|
WorldID string `json:"world_id"`
|
|
AllowsEntry bool `json:"allows_entry"`
|
|
Author string `json:"author"`
|
|
Favorited bool `json:"favorited"`
|
|
DesktopCapacity int `json:"desktop_capacity"`
|
|
UgcWarning bool `json:"ugc_warning"`
|
|
EntryDeniedBecauseFull bool `json:"entry_denied_because_full"`
|
|
EntryDeniedBecauseRole bool `json:"entry_denied_because_role"`
|
|
PassphraseRequired bool `json:"passphrase_required,omitempty"`
|
|
ImageLarge string `json:"image_large"`
|
|
ImageMedium string `json:"image_medium"`
|
|
ImageSmall string `json:"image_small"`
|
|
ImageThumbnail string `json:"image_thumbnail"`
|
|
BannerImageLarge string `json:"banner_image_large"`
|
|
BannerImageMedium string `json:"banner_image_medium"`
|
|
BannerImageSmall string `json:"banner_image_small"`
|
|
} `json:"spaces"`
|
|
}
|
|
|
|
// ClientIP json struct
|
|
// https://account.altvr.com/api/client_ip.json
|
|
type ClientIP struct {
|
|
ClientIP string `json:"client_ip"`
|
|
}
|