Beispiel #1
0
        public static async Task <QueryRetrieveMasterInformationByUser_Output> TestQueryRetrieveRecentChats()
        {
            IMGTExchangeClient clientMGT = new MGTExchangeClient();
            string             _url      = "http://10.18.24.67:8082/";
            string             _token    = "token";

            // This is to be used as master List, to show recent chats, and recent message of each chat (seen or unseen).
            // After that the user can click in an specific chat to check more information
            QueryRetrieveMasterInformationByUser_Input input = new QueryRetrieveMasterInformationByUser_Input
            {
                UserApp = new userApp {
                    userAppId = "10d3ed1e-ae7d-4d0c-80e0-aa360d76025b"
                },
                chatsRecentTake          = 5,
                commentsSeenTake         = 0,
                commentsUnseenTake       = 0,
                commentsNewestTake       = 1,
                commentsBeforeUnseenTake = 0,
                findSpecificChatId       = 0, // 0 means no, any number means ChatId
                url   = _url,
                token = _token
            };

            QueryRetrieveMasterInformationByUser_Output output = await clientMGT.QueryRetrieveRecentChats(input : input);

            return(output);
        }
Beispiel #2
0
        public static async Task <QueryRetrieveMasterInformationByUser_Output> TestQueryRetrieveChatComments()
        {
            IMGTExchangeClient clientMGT = new MGTExchangeClient();
            string             _url      = "http://10.18.24.67:8082/";
            string             _token    = "token";

            // This is to be used when a user clicks any Chat from the master chats list
            // The app must show unseen comments if any, if none, wold show newest comments
            // Logic in FrontEnd must be
            // IF commentsUnseen is null THEN show only commentsNewest
            // ELSE show commentsUnseen   (Note: In the transaction the beforeUnsee and Unseen are joined)
            // Pending mark as seen all the commentsUnseen Retrieved, create a variable to decidi if mark as seen or not
            QueryRetrieveMasterInformationByUser_Input input = new QueryRetrieveMasterInformationByUser_Input
            {
                UserApp = new userApp {
                    userAppId = "127b0df2-d732-478e-bf84-0b673c48d145"
                },                                                                            //10d3ed1e-ae7d-4d0c-80e0-aa360d76025b" },
                chatsRecentTake          = 1,
                commentsSeenTake         = 0,
                commentsBeforeUnseenTake = 5,
                commentsUnseenTake       = 10,
                commentsNewestTake       = 10,
                findSpecificChatId       = 2, // 0 means no, any number means ChatId
                url   = _url,
                token = _token
            };

            QueryRetrieveMasterInformationByUser_Output output = await clientMGT.QueryRetrieveRecentChats(input : input);

            return(output);
        }
Beispiel #3
0
        public async Task <IEnumerable <Item> > GetItemsAsync(bool forceRefresh = false)
        {
            IMGTExchangeClient clientMGT = new MGTExchangeClient();
            string             _url      = "http://10.18.7.169:8082/";
            string             _token    = "token";

            QueryAllUsersByCompany_Input input = new QueryAllUsersByCompany_Input
            {
                company = new company {
                    companyId = "cb276c74-5f89-4362-9645-10f4b07be7be"
                },
                url   = _url,
                token = _token
            };

            QueryAllUsersByCompany_Output output = await clientMGT.QueryAllUsersByCompany(input : input);

            List <Item> newItems = new List <Item>();

            if (output.ResultConfirmation.resultPassed)
            {
                foreach (var user in output.company.users.OrderBy(x => x.nickname))
                {
                    newItems.Add(new Item {
                        Id = user.userAppId, Description = user.nickname, Text = user.firstName
                    });
                }
            }

            return(await Task.FromResult(newItems));

            //return await Task.FromResult(items);
        }
Beispiel #4
0
        public static async Task <MutationCreateCompanyAndXUsersTxn_Output> TestMutationCreateCompanyAndXUsersTxn()
        {
            IMGTExchangeClient clientMGT = new MGTExchangeClient();
            string             _url      = "http://10.18.24.67:8082/";
            string             _token    = "token";

            MutationCreateCompanyAndXUsersTxn_Input input = new MutationCreateCompanyAndXUsersTxn_Input
            {
                company = new company
                {
                    name        = "company10",
                    description = "one",
                    email       = "*****@*****.**",
                    password    = "******"
                },
                userstocreate = 10,
                url           = _url,
                token         = _token
            };

            MutationCreateCompanyAndXUsersTxn_Output output =
                await clientMGT.MutationCreateCompanyAndXUsersTxn(input : input);

            return(output);
        }
Beispiel #5
0
        public static async Task <MutationCreateChatTxn_Output> TestMutationCreateChatTxn()
        {
            IMGTExchangeClient clientMGT = new MGTExchangeClient();
            string             _url      = "http://10.18.24.67:8082/";
            string             _token    = "token";

            // Pending, when the user is not from this company return: Inner Exception

            MutationCreateChatTxn_Input input = new MutationCreateChatTxn_Input
            {
                chat = new chat
                {
                    chatId       = 0,
                    name         = "Chat 1",
                    companyId    = "04c6b67c-6f4d-455f-a472-d6206dd769df",
                    participants = new List <participant>
                    {
                        new participant
                        {
                            participantId = 0,
                            chatId        = 0,
                            isAdmin       = true,
                            userAppId     = "10d3ed1e-ae7d-4d0c-80e0-aa360d76025b"
                        },
                        new participant
                        {
                            participantId = 0,
                            chatId        = 0,
                            isAdmin       = false,
                            userAppId     = "127b0df2-d732-478e-bf84-0b673c48d145"
                        },
                        new participant
                        {
                            participantId = 0,
                            chatId        = 0,
                            isAdmin       = false,
                            userAppId     = "3982349d-289d-4f3a-ab29-f3f6bb3893f4"
                        }
                    },
                },
                url   = _url,
                token = _token
            };

            MutationCreateChatTxn_Output output =
                await clientMGT.MutationCreateChatTxn(input : input);

            return(output);
        }
Beispiel #6
0
        public static async Task <QueryAllUsersByCompany_Output> TestQueryAllUsersByCompany()
        {
            IMGTExchangeClient clientMGT = new MGTExchangeClient();
            string             _url      = "http://10.18.24.67:8082/";
            string             _token    = "token";

            QueryAllUsersByCompany_Input input = new QueryAllUsersByCompany_Input
            {
                company = new company {
                    companyId = "04c6b67c-6f4d-455f-a472-d6206dd769df"
                },
                url   = _url,
                token = _token
            };

            QueryAllUsersByCompany_Output output = await clientMGT.QueryAllUsersByCompany(input : input);

            return(output);
        }
Beispiel #7
0
        public static async Task <MutationAddCommentToChatTxn_Output> TestMutationAddCommentToChatTxn()
        {
            IMGTExchangeClient clientMGT = new MGTExchangeClient();
            string             _url      = "http://10.18.24.67:8082/";
            string             _token    = "token";

            MutationAddCommentToChatTxn_Input input = new MutationAddCommentToChatTxn_Input
            {
                comment = new comment
                {
                    chatId    = 3,
                    message   = "Hello There",
                    userAppId = "10d3ed1e-ae7d-4d0c-80e0-aa360d76025b"
                },
                url   = _url,
                token = _token
            };

            MutationAddCommentToChatTxn_Output output =
                await clientMGT.MutationAddCommentToChatTxn(input : input);

            return(output);
        }