ResponsesModels - adkuba/TL-backend GitHub Wiki


Responses

Jwt response

Example

{
    "token": "sydhaget",
    "date": 2020-12-21,
    "user": Object - UserResponse
}

UserResponse


User response

Example

{
    "username": "kuba",
    "email": "[email protected]",
    "fullName": "Jakub Adamski",
    "creationTime": 2020-01-23,
    "followers": List of InteractionEvent,
    "roles": [
        "ROLE_ADMIN",
        "ROLE_USER"
    ],
    "likes": [
        "kubatl",
        "tline",
    ],
    "subscriptionEnd": "2020-01-21", #string
    "subscriptionID": "deffrgrg", #Stripe ID
    "card": "visa4242",
    "blocked": true,
    "profileViewsNumber": 45 #Long
}

Interaction Event


Timeline response

{
    "id": "kubatl",
    "user": Object, #userRespnse
    "description": "my timeline desc",
    "descriptionTitle": "My projects",
    "event": "defggrt", #not null if sub-timeline
    "views": 3345, #long
    "trendingViews": 23, #views last 2 days
    "premiumViews": 343, #views from premium section
    "creationDate" 2020-09-12, #localDate
    "active": true, #2 timelines limit for free users
    "category": "TRENDING" #homepage category
    "likes": [], #list of InteractionEvent
    "pictures": [], #list of mapped URLs to images in Google Storage
    "numberOfReports" 0 #long
}

UserResponse, InteractionEvent


Full timeline response

{
    "id": "kubatl",
    "user": Object, #User
    "premium": false,
    "active": true, #2 timelines limit for free users
    "description": "my timeline desc",
    "descriptionTitle": "My projects",
    "eventId": "defggrt", #not null if sub-timeline
    "pictures": [], #list of mapped URLs to images in Google Storage
    "viewsDetails": Object, #Map<LocalDate, Map<String, Long>> desc below
    "views": 3345, #long
    "trendingViews": 23, #views last 2 days
    "reported": false,
    "numberOfReports" 0, #long
    "premiumViews": 343, #views from premium section
    "creationDate" 2020-09-12, #localDate
    "likes": [], #list of InteractionEvent
}

User, InteractionEvent viewsDetails = date, ( object -> deviceid, number-of-views)


Models

Interaction event

Example

{
    "date": 2020-12-31,
    "follow": "kuba",
    "like": null, #string
    "timelineId": null, #string
    "deviceId": "Chrome Android"
}

File resource

Example

{
    "id": "dedefjsa73bd", #autogenerated
    "contentId": "homePicture",
    "contentLength" 3421, #long
    "mimeType": "png"
}

Device Info

{
    "id": "ddeg456sbyh", #autogenerated
    "location": "Poland",
    "deviceDetails": "Chrome 84, Windows 10",
    "ip": "36.29.27.97",
    "username": "kuba", #optional
    "lastLogged": 2020-09-16 #optional 
}

User

{
    "id": "deff456s", #autogenerated
    "username": "akuba",
    "fullName": "Jakub Adamski",
    "followers": null, #list of InteractionEvent
    "subscriptionID": "defht43d", #Stripe
    "blocked": false,
    "creationTime": 2020-09-21, #localDate
    "refreshToken": "ddswwc24", #jwt refresh token
    "passwordResetToken": Object,
    "email": "[email protected]",
    "likes": [
        "kubatl",
        "timeline2"
    ],
    "password": "dddee333", #encrypted
    "notification": Object,
    "roles": [ #set
        "ROLE_ADMIN"
    ],
    "stripeID": "defgg45",
    "subscriptionEnd": 2020-09-16, #localDate
    "card": "visa4242",
    "myViews": [], #list of InteractionEvent
    "profileViews": Object, #Map<LocalDate, Map<String, Long>> desc below
    "profileViewsNumber": 3445, #long
    ""
}

InteractionEvent, PasswordResetToken, Notification profileViews = date, ( object -> deviceid, number-of-views)


Notification

{
    "read": false,
    "messages": [] #list of NotificationMessage
}

NotificationMessage


Notification message

{
    "username": "tline",
    "text": "liked your timeline",
    "date": 2020-09-16, #localDate
}

Password reset token

{
    "token": "dfgrerg45",
    "expiryDate": 2020-09-16, #localDate
}