Ejemplo n.º 1
0
        /// <summary>
        /// Adds a person to a space by email address; optionally making the person a moderator.
        /// </summary>
        /// <param name="spaceId">The identifier of the space where the person is to be added.</param>
        /// <param name="personEmail">The email address of the person to be added.</param>
        /// <param name="isModerator">if set to <c>true</c> [is moderator of the space]. The default is false.</param>
        /// <param name="completionHandler">The completion handler.</param>
        /// <remarks>Since: 0.1.0</remarks>
        public void CreateByPersonEmail(string spaceId, string personEmail, bool?isModerator = false, Action <WebexApiEventArgs <Membership> > completionHandler = null)
        {
            ServiceRequest request = BuildRequest();

            request.Method = HttpMethod.POST;
            if (spaceId != null)
            {
                request.AddBodyParameters("roomId", spaceId);
            }
            if (personEmail != null)
            {
                request.AddBodyParameters("personEmail", personEmail);
            }
            if (isModerator != null)
            {
                request.AddBodyParameters("isModerator", isModerator.ToString());
            }

            request.Execute <InternalMembership>(r =>
            {
                Membership m = null;
                if (r.IsSuccess)
                {
                    m = ConvertToMembership(r.Data);
                }
                completionHandler?.Invoke(new WebexApiEventArgs <Membership>(r.IsSuccess, r.Error, m));
            });
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a space. The authenticated user is automatically added as a member of the space. See the Memberships API to learn how to add more people to the space.
        /// </summary>
        /// <param name="title">A user-friendly name for the space.</param>
        /// <param name="teamId">If not null, this space will be associated with the team by team id. Otherwise, this space is not associated with any team.</param>
        /// <param name="completionHandler">The completion event handler.</param>
        /// <remarks>Since: 0.1.0</remarks>
        public void Create(string title, string teamId, Action <WebexApiEventArgs <Space> > completionHandler)
        {
            ServiceRequest request = BuildRequest();

            request.Method = HttpMethod.POST;
            if (title != null)
            {
                request.AddBodyParameters("title", title);
            }
            if (teamId != null)
            {
                request.AddBodyParameters("teamId", teamId);
            }

            request.Execute <Space>(completionHandler);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Updates a webhook by id.
        /// </summary>
        /// <param name="webhookId">The identifier of  the webhook.</param>
        /// <param name="name">A user-friendly name for this webhook.</param>
        /// <param name="targetUrl">The URL that receives POST requests for each event.</param>
        /// <param name="completionHandler">The completion event handler.</param>
        /// <remarks>Since: 0.1.0</remarks>
        public void Update(string webhookId, string name, string targetUrl, Action <WebexApiEventArgs <Webhook> > completionHandler)
        {
            ServiceRequest request = BuildRequest();

            request.Method   = HttpMethod.PUT;
            request.Resource = webhookId;
            if (name != null)
            {
                request.AddBodyParameters("name", name);
            }
            if (targetUrl != null)
            {
                request.AddBodyParameters("targetUrl", targetUrl);
            }

            request.Execute <Webhook>(completionHandler);
        }
        public void FetchTokenFromJWTAsync(string jwt, IAuthenticator authenticator, Action <WebexApiEventArgs <JWTAccessTokenInfo> > completionHandler)
        {
            var request = new ServiceRequest(authenticator)
            {
                Method   = HttpMethod.POST,
                Resource = "jwt/login"
            };

            request.AddHeaders("Authorization", jwt);
            request.AddBodyParameters("Content-Type", "text/plain");
            request.AddBodyParameters("Cache-Control", "no-cache");
            request.AddBodyParameters("Accept-Encoding", "none");

            request.ExecuteAuth <JWTAccessTokenInfo>((response) =>
            {
                completionHandler(response);
            });
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Adds a person to a team by person id; optionally making the person a moderator of the team.
        /// </summary>
        /// <param name="teamId">The identifier of the team.</param>
        /// <param name="personId">The identifier of the person.</param>
        /// <param name="isModerator">if set to <c>true</c> [is moderator of the team]. The default is false.</param>
        /// <param name="completionHandler">The completion event handler.</param>
        /// <remarks>Since: 0.1.0</remarks>
        public void CreateById(string teamId, string personId, bool?isModerator = false, Action <WebexApiEventArgs <TeamMembership> > completionHandler = null)
        {
            ServiceRequest request = BuildRequest();

            request.Method = HttpMethod.POST;
            if (teamId != null)
            {
                request.AddBodyParameters("teamId", teamId);
            }
            if (personId != null)
            {
                request.AddBodyParameters("personId", personId);
            }
            if (isModerator != null)
            {
                request.AddBodyParameters("isModerator", isModerator.ToString());
            }

            request.Execute <TeamMembership>(completionHandler);
        }
        /// <summary>
        /// Adds a person to a space by email address; optionally making the person a moderator.
        /// </summary>
        /// <param name="spaceId">The identifier of the space where the person is to be added.</param>
        /// <param name="personEmail">The email address of the person to be added.</param>
        /// <param name="isModerator">if set to <c>true</c> [is moderator of the space]. The default is false.</param>
        /// <param name="completionHandler">The completion handler.</param>
        /// <remarks>Since: 0.1.0</remarks>
        public void CreateByPersonEmail(string spaceId, string personEmail, bool?isModerator = false, Action <WebexApiEventArgs <Membership> > completionHandler = null)
        {
            ServiceRequest request = BuildRequest();

            request.Method = HttpMethod.POST;
            if (spaceId != null)
            {
                request.AddBodyParameters("roomId", spaceId);
            }
            if (personEmail != null)
            {
                request.AddBodyParameters("personEmail", personEmail);
            }
            if (isModerator != null)
            {
                request.AddBodyParameters("isModerator", isModerator);
            }

            request.Execute <Membership>(completionHandler);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Creates a team. The authenticated user is automatically added as a member of the team.
        /// See the Team Memberships API to learn how to add more people to the team.
        /// </summary>
        /// <param name="name">A user-friendly name for the team.</param>
        /// <param name="completionHandler">The completion event handler.</param>
        /// <remarks>Since: 0.1.0</remarks>
        public void Create(string name, Action <WebexApiEventArgs <Team> > completionHandler)
        {
            ServiceRequest request = BuildRequest();

            request.Method = HttpMethod.POST;
            if (name != null)
            {
                request.AddBodyParameters("name", name);
            }

            request.Execute <Team>(completionHandler);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Posts a webhook for the authenticated user.
        /// </summary>
        /// <param name="name">A user-friendly name for this webhook.</param>
        /// <param name="targetUrl">The URL that receives POST requests for each event.</param>
        /// <param name="resource">The resource type for the webhook.</param>
        /// <param name="eventType">The event type for the webhook.</param>
        /// <param name="filter">The filter that defines the webhook scope.</param>
        /// <param name="secret">Secret use to generate payload signiture</param>
        /// <param name="completionHandler">The completion event handler.</param>
        /// <remarks>Since: 0.1.0</remarks>
        public void Create(string name, string targetUrl, string resource, string eventType, string filter, string secret, Action <WebexApiEventArgs <Webhook> > completionHandler)
        {
            ServiceRequest request = BuildRequest();

            request.Method = HttpMethod.POST;
            if (name != null)
            {
                request.AddBodyParameters("name", name);
            }
            if (targetUrl != null)
            {
                request.AddBodyParameters("targetUrl", targetUrl);
            }
            if (resource != null)
            {
                request.AddBodyParameters("resource", resource);
            }
            if (eventType != null)
            {
                request.AddBodyParameters("event", eventType);
            }
            if (filter != null)
            {
                request.AddBodyParameters("filter", filter);
            }
            if (secret != null)
            {
                request.AddBodyParameters("secret", secret);
            }

            request.Execute <Webhook>(completionHandler);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Updates the details for a membership by id.
        /// </summary>
        /// <param name="membershipId">The identifier of the membership.</param>
        /// <param name="isModerator">if set to <c>true</c> [is moderator of the team]. The default is false.</param>
        /// <param name="completionHandler">The completion event handler.</param>
        /// <remarks>Since: 0.1.0</remarks>
        public void Update(string membershipId, bool?isModerator, Action <WebexApiEventArgs <TeamMembership> > completionHandler)
        {
            ServiceRequest request = BuildRequest();

            request.Method   = HttpMethod.PUT;
            request.Resource = membershipId;
            if (isModerator != null)
            {
                request.AddBodyParameters("isModerator", isModerator.ToString());
            }

            request.Execute <TeamMembership>(completionHandler);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Updates the details for a space by id.
        /// </summary>
        /// <param name="spaceId">The identifier of the space.</param>
        /// <param name="title">A user-friendly name for the space.</param>
        /// <param name="completionHandler">The completion event handler.</param>
        /// <remarks>Since: 0.1.0</remarks>
        public void Update(string spaceId, string title, Action <WebexApiEventArgs <Space> > completionHandler)
        {
            ServiceRequest request = BuildRequest();

            request.Method   = HttpMethod.PUT;
            request.Resource = spaceId;
            if (title != null)
            {
                request.AddBodyParameters("title", title);
            }

            request.Execute <Space>(completionHandler);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Updates the properties of a membership by membership id.
        /// </summary>
        /// <param name="membershipId">The identifier of the membership.</param>
        /// <param name="isModerator">if set to <c>true</c> [is moderator of the space]. The default is false.</param>
        /// <param name="completionHandler">The completion event handler.</param>
        /// <remarks>Since: 0.1.0</remarks>
        public void Update(string membershipId, bool?isModerator, Action <WebexApiEventArgs <Membership> > completionHandler)
        {
            ServiceRequest request = BuildRequest();

            request.Method   = HttpMethod.PUT;
            request.Resource = membershipId;
            if (isModerator != null)
            {
                request.AddBodyParameters("isModerator", isModerator.ToString());
            }

            request.Execute <InternalMembership>(r =>
            {
                Membership m = null;
                if (r.IsSuccess)
                {
                    m = ConvertToMembership(r.Data);
                }
                completionHandler?.Invoke(new WebexApiEventArgs <Membership>(r.IsSuccess, r.Error, m));
            });
        }