Simple messenger server for Data Structure course written in F# + ServiceStack.
-
Registration
-
Authentication
-
User profile with image
-
Contact list
-
Private chats
-
Message sending
Register new user.
Request
{"UserName": "String", "Password": "String"}
and response
{"UserId":"String","SessionId":"String","UserName":"String","ReferrerUrl":"String","ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String"}]}}
or request
<Registration xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
<UserName>String</UserName>
<Password>String</Password>
</Registration>
and response
<RegistrationResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
<UserId>String</UserId>
<SessionId>String</SessionId>
<UserName>String</UserName>
<ReferrerUrl>String</ReferrerUrl>
<ResponseStatus>
<ErrorCode>String</ErrorCode>
<Message>String</Message>
<StackTrace>String</StackTrace>
<Errors>
<ResponseError>
<ErrorCode>String</ErrorCode>
<FieldName>String</FieldName>
<Message>String</Message>
</ResponseError>
</Errors>
</ResponseStatus>
</RegistrationResponse>
Authenticate user with login and password.
Request
{"UserName":"String","Password":"String","RememberMe":false}
and response
{"SessionId":"String","UserName":"String","ReferrerUrl":"String","ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String"}]}}
or request
<Auth xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
<UserName>String</UserName>
<Password>String</Password>
<RememberMe>false</RememberMe>
</Auth>
and response
<AuthResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
<SessionId>String</SessionId>
<UserName>String</UserName>
<ReferrerUrl>String</ReferrerUrl>
<ResponseStatus>
<ErrorCode>String</ErrorCode>
<Message>String</Message>
<StackTrace>String</StackTrace>
<Errors>
<ResponseError>
<ErrorCode>String</ErrorCode>
<FieldName>String</FieldName>
<Message>String</Message>
</ResponseError>
</Errors>
</ResponseStatus>
</AuthResponse>
Logout user.
Response
{"SessionId":"String","UserName":"String","ReferrerUrl":"String","ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String"}]}}
or response
<AuthResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
<SessionId>String</SessionId>
<UserName>String</UserName>
<ReferrerUrl>String</ReferrerUrl>
<ResponseStatus>
<ErrorCode>String</ErrorCode>
<Message>String</Message>
<StackTrace>String</StackTrace>
<Errors>
<ResponseError>
<ErrorCode>String</ErrorCode>
<FieldName>String</FieldName>
<Message>String</Message>
</ResponseError>
</Errors>
</ResponseStatus>
</AuthResponse>
Get image url and full name of user.
Response
{"Image":"String","FullName":"String"}
or response
<ProfileResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/">
<FullName>String</FullName>
<Image>String</Image>
</ProfileResponse>
Set user full name.
Request
{"FullName":"String"}
or
<Profile xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/">
<FullName>String</FullName>
</Profile>
and response HTTP status 200 Ok
Upload image as form-data.
Request with image as multipart/form-data. Make sure you provide correct image name.
Response is HTTP status 200 Ok. Otherwise can be 417 Expectation Failed HTTP status if there is no attached image file or attached multiple files.
Get contact list.
Response
{"Contacts":[{"Id":0,"Image":"String","FullName":"String","LastMessage":"String","LastMessageDateTime":"\/Date(-62135596800000-0000)\/"}]}
or response
<ContactsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/">
<Contacts>
<ContactModel>
<FullName>String</FullName>
<Id>0</Id>
<Image>String</Image>
<LastMessage>String</LastMessage>
<LastMessageDateTime>0001-01-01T00:00:00</LastMessageDateTime>
</ContactModel>
</Contacts>
</ContactsResponse>
Get messages for chat with user.
Request
{"UserId":0}
or request
<Chat xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/">
<UserId>0</UserId>
</Chat>
response
{"Messages":[{"FullName":"String","Image":"String","Text":"String","DateTime":"\/Date(-62135596800000-0000)\/"}]}
or response
<ChatResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/">
<Messages>
<MessageModel>
<DateTime>0001-01-01T00:00:00</DateTime>
<FullName>String</FullName>
<Image>String</Image>
<Text>String</Text>
</MessageModel>
</Messages>
</ChatResponse>
Send message to chat with user.
Request
{"UserId":0,"Message":"String"}
or request
<Chat xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/">
<Message>String</Message>
<UserId>0</UserId>
</Chat>
and response HTTP status 200 Ok
- Push notifications
The MIT License (MIT) Copyright (c) 2016 Artem Ustimov
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.