Exemplo n.º 1
0
        /// <summary>
        /// List organizations of the authenticated user.
        /// </summary>
        /// <returns></returns>
        public List <Organization> GetAllOrganizations()
        {
            var request = new Request("organizations");
            var task    = _restApi.ExecuteAsync <List <Organization> >(request);

            task.Wait();
            return(task.Result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// List all users visible to the authenticated user, i.e. a combined set of users from all the organizations of the authenticated user.
        /// </summary>
        /// <returns>If the authenticated user is an admin in an organization, all of that organization’s users are returned. Otherwise, only users that are in the same flows as the authenticated user are returned.</returns>
        public List <User> GetAllUsers()
        {
            var request = new Request("users");
            var task    = _restApi.ExecuteAsync <List <User> >(request);

            task.Wait();
            return(task.Result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Send a chat message.
        /// </summary>
        /// <param name="organization">The parameterized name of the organization.</param>
        /// <param name="flow">The parameterized name of the flow.</param>
        /// <param name="options"></param>
        public Message SendMessage(string organization, string flow, SendMessageOptions options)
        {
            var request  = new Request($"flows/{organization}/{flow}/messages", RestMethod.POST);
            var jsonBody = JsonSerializer.SerializeObject(options, SerializationStrategy.SnakeCaseIgnoreNull);

            request.AddJsonParameter(jsonBody);

            var task = _restApi.ExecuteAsync <Message>(request);

            task.Wait();
            return(task.Result);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Lists the flows that the authenticated user is a member of.
        /// </summary>
        public async Task <IList <Flow> > GetSubscribedFlowsAsync()
        {
            var request = new Request("flows");

            return(await _restApi.ExecuteAsync <List <Flow> >(request));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Lists the open (not yet accepted) invitations of a flow.
        /// </summary>
        /// <param name="organization">The parameterized name of the organization.</param>
        /// <param name="flow">The parameterized name of the flow.</param>
        public async Task <IList <Invitation> > GetInvitationsAsync(string organization, string flow)
        {
            var request = new Request($"flows/{organization}/{flow}/invitations");

            return(await _restApi.ExecuteAsync <List <Invitation> >(request));
        }