Giter Club home page Giter Club logo

threadripper-chat-api's Introduction

THREADRIPPER CHAT API:

WEBSOCKET API:

ENDPOINT /ws

SEND /queue/sendMessage

request:

{
    "token": "CHAT eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiI3NzlkZjNkOC03NGQwLTQ4M2YtODlmNy05ZmY4ZTE5NTQwN2QiLCJzdWIiOiJhIiwiaWF0IjoxNTM5NDQ3NDM5LCJleHAiOjE1NDAwNTIyMzl9.RoxXnb38achZ6EjRwYKiYIcd35pac96w3NvFwQfZkhbqYh6C1z-9iqcuqLl_nDmF_I54soNPXSGZ16MMOHhsmA",
    "type": "JOIN"
}
{  
    "content": "test",
    "conversationId": "1",
    "type": "TEXT",
    "token": "CHAT eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiI3NzlkZjNkOC03NGQwLTQ4M2YtODlmNy05ZmY4ZTE5NTQwN2QiLCJzdWIiOiJhIiwiaWF0IjoxNTM5NDQ3NDM5LCJleHAiOjE1NDAwNTIyMzl9.RoxXnb38achZ6EjRwYKiYIcd35pac96w3NvFwQfZkhbqYh6C1z-9iqcuqLl_nDmF_I54soNPXSGZ16MMOHhsmA"
}

SUBCRIBE /topic/{username}

response: token attribute is not used

{
    "messageId":null,
    "type":"JOIN",
    "content":null,
    "datetime":null,
    "conversationId":null,
    "username":"a",
    "token":""}
{
    "messageId":null,
    "type":"LEAVE",
    "content":null,
    "datetime":null,
    "conversationId":null,
    "username":"b",
    "token":null
}
{  
    "messageId":"23",
    "type":"TEXT",
    "content":"fsd",
    "datetime":"2018-10-22 03:10:34",
    "conversationId":"1",
    "username":"b",
    "token":""
}

REST API:

POST /api/login?username=&password=

->  token in header
    Authorization: CHAT eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiI3NzlkZjNkOC03NGQwLTQ4M2YtODlmNy05ZmY4ZTE5NTQwN2QiLCJzdWIiOiJhIiwiaWF0IjoxNTM5NDQ3NDM5LCJleHAiOjE1NDAwNTIyMzl9.RoxXnb38achZ6EjRwYKiYIcd35pac96w3NvFwQfZkhbqYh6C1z-9iqcuqLl_nDmF_I54soNPXSGZ16MMOHhsmA

    {
        "active": true, 
        "user": 
            {
            "displayName": "userA",
            "avatarUrl": "http://localhost:8083/api/avatar/default.jpg",
            "username": "a",
            "email": "[email protected]"
            }
    }
    

POST /api/signup?username=&password=&displayName=&email=

->  {"success": "true"}

->  {
        "timestamp": 1539447546025,
        "status": 409,
        "error": "Conflict",
        "message": "Username has been used",
        "path": "/api/signup"
    }

->  {
        "timestamp": 1539447546025,
        "status": 520,
        "error": "Unknown Error",
        "message": "Some error has occurred",
        "path": "/api/signup"
    }

POST /api/signup2?username=&password=&displayName=&email=&avatarUrl=

->  {"success": "true"}

->  {
        "timestamp": 1539447546025,
        "status": 409,
        "error": "Conflict",
        "message": "Username has been used",
        "path": "/api/signup"
    }

->  {
        "timestamp": 1539447546025,
        "status": 520,
        "error": "Unknown Error",
        "message": "Some error has occurred",
        "path": "/api/signup"
    }

GET /api/verify/{username}/{hash}

Email will be sent automatically if user is not active

GET /api/verify/resend/{username}

GET /api/forgot/{username}

PUT /api/password?oldPassword=&newPassword=

input:  token in Authorization header
->  {
        "timestamp": 1539520526152,
        "status": 400,
        "error": "Bad Request",
        "message": "Incorrect password",
        "path": "/api/changePassword"
    }

->  {"result":"success"}

GET /api/user

For test only

->  [
        {
            "username": "a",
            "password": "$2a$10$gj4OtbyETCraxaVKBg5CXuyIxjOy93vo83nJCgnytwkv5BUHpjmi.",
            "displayName": "displayD",
            "email": "[email protected]"
        }
    ]

GET /api/user?search=

input:  token in Authorization header
->  [
        {
            "username": "huynhha12798",
            "displayName": "Huynh Ha",
            "email": "[email protected]",
            "avatarUrl": "http://localhost:8083/api/avatar/default.jpg",
            "online": false
        }
    ]

GET /api/user?search=&offset=&limit=

`GET /api/user/{username}

input:  token in Authorization header
->  {
        "username": "a",
        "displayName": "userA",
        "email": "[email protected]",
        "avatarUrl": "vre.hcmut.edu.vn/threadripper/api/avatar/default.jpg",
        "online": false
    }
    
->  {
        "timestamp": 1540779604010,
        "status": 404,
        "error": "Not Found",
        "message": "User doesn't exist",
        "path": "/api/user/e"
    }

PUT /api/displayName?newDisplayName=

    "success": true

POST /api/conversation

input:  token in Authorization header
{
    "listUsername": [
        "username1",
        "username2",
        "username2"
    ]
}
->  {
        "conversationId": "12345"
    }

GET /api/conversation

input: token in Authorization header
[
    {
        "conversationId": "3",
        "conversationName": "NameOfABC",
        "lastMessage": null,
        "listUser": [
            {
                "displayName": "userA",
                "username": "a",
                "nickname": null,
                "avatarUrl": "vre.hcmut.edu.vn/threadripper/api/avatar/default.jpg",
                "online": false
            },
            {
                "displayName": "userB",
                "username": "b",
                "nickname": null,
                "avatarUrl": "vre.hcmut.edu.vn/threadripper/api/avatar/default.jpg",
                "online": false
            },
            {
                "displayName": "userC",
                "username": "c",
                "nickname": null,
                "avatarUrl": "vre.hcmut.edu.vn/threadripper/api/avatar/default.jpg",
                "online": false
            }
        ],
        "notiCount": 0
    }
]

GET /api/friend

input: token in Authorization header
[
    {
        "conversationId": "1",
        "conversationName": "NameOfAB",
        "lastMessage": null,
        "listUser": [
            {
                "displayName": "userA",
                "username": "a",
                "nickname": null,
                "avatarUrl": "vre.hcmut.edu.vn/threadripper/api/avatar/default.jpg",
                "online": false
            },
            {
                "displayName": "userB",
                "username": "b",
                "nickname": null,
                "avatarUrl": "vre.hcmut.edu.vn/threadripper/api/avatar/default.jpg",
                "online": false
            }
        ],
        "notiCount": 0
    },
    {
        "conversationId": "2",
        "conversationName": "NameOfBC",
        "lastMessage": null,
        "listUser": [
            {
                "displayName": "userB",
                "username": "b",
                "nickname": null,
                "avatarUrl": "vre.hcmut.edu.vn/threadripper/api/avatar/default.jpg",
                "online": false
            },
            {
                "displayName": "userC",
                "username": "c",
                "nickname": null,
                "avatarUrl": "vre.hcmut.edu.vn/threadripper/api/avatar/default.jpg",
                "online": false
            }
        ],
        "notiCount": 0
    }
]

GET /api/conversation/{conversationId}

input: token in Authorization header
{
    "conversationId": "2",
    "conversationName": null,
    "lastMessage": {
        "messageId": "2",
        "type": "TEXT",
        "content": "2",
        "datetime": "2018-10-19 14:22:18",
        "conversationId": "2",
        "username": "b",
    },
    "listUser": [
        {
            "displayName": "displayD",
            "username": "a",
            "nickname": null,
            "avatarUrl": "http://localhost:8083/api/avatar/10.bmp",
            "online": false
        },
        {
            "displayName": "b",
            "username": "c",
            "nickname": null,
            "avatarUrl": "http://localhost:8083/api/avatar/default.jpg",
            "online": false
        }
    ],
    "notiCount": 1
}

DELETE /api/conversation/{conversationId}

input: token in Authorization header
->  {
        "result": "success"
    }

GET /api/message/{conversationId}

input: token in Authorization header
->  {
        "timestamp": 1539943510009,
        "status": 520,
        "error": "Http Status 520",
        "message": "User does not have access privileges",
        "path": "/api/message"
    }

->  [
        {
            "messageId": "2",
            "type": "TEXT",
            "content": "2",
            "datetime": "2018-10-19",
            "conversationId": "2",
            "username": "b"
        },
        {
            "messageId": "1",
            "type": "TEXT",
            "content": "1",
            "datetime": "2018-10-19",
            "conversationId": "2",
            "username": "a"
        }
    ]

GET /api/message/{conversationId}?offset=?&limit=?

GET /api/avatar/{filename}.{ext}

Support all format

->  Header:
    Content-Type: image/png (image/jpeg OR image/gif OR image/bmp ...)
    Content-Disposition: attachment; filename="{filename}.{ext}"

GET /api/image/{filename}.{ext}

Support all format

->  Header:
    Content-Type: image/png (image/jpeg OR image/gif OR image/bmp ...)
    Content-Disposition: attachment; filename="{filename}.{ext}"

GET /api/file/**

Support all format

->  Header:
    Content-Disposition: attachment; filename="{filename.ext}"

POST /api/avatar

Support all format

input: token in Authorization header
param:
    file: File type Object,
    ext: file extension ("jpg"/"png"/"gif"/"bmp"/...)
{
    "avatarUrl": "http://localhost:8083/api/avatar/10.bmp"
}

POST /api/image

Support all format

input: token in Authorization header
param:
    file: File type Object,
    ext: file extension ("jpg"/"png"/"gif"/"bmp"/...)
{
    "imageUrl": "http://localhost:8083/api/image/10.jpg"
}

POST /api/file

Support all format

input: token in Authorization header
param:
    file: File type Object,
    ext: file extension ("cpp"/"png"/"py"/"exe"/...)
{
    "fileUrl": "http://localhost:8083/api/file/10.exe"
}

threadripper-chat-api's People

Contributors

ititandev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.