private void Post(string roomId, string toPersonId, string toPersonEmail, string text, string files, Action <SparkApiEventArgs <Message> > completionHandler) { ServiceRequest request = BuildRequest(); request.Method = HttpMethod.POST; if (roomId != null) { request.AddBodyParameters("roomId", roomId); } if (toPersonId != null) { request.AddBodyParameters("toPersonId", toPersonId); } if (toPersonEmail != null) { request.AddBodyParameters("toPersonEmail", toPersonEmail); } if (text != null) { request.AddBodyParameters("text", text); } if (files != null) { request.AddBodyParameters("files", files); } request.Execute <Message>(completionHandler); }
/// <summary> /// Creates a room. The authenticated user is automatically added as a member of the room. See the Memberships API to learn how to add more people to the room. /// </summary> /// <param name="title">A user-friendly name for the room.</param> /// <param name="teamId">If not null, this room will be associated with the team by team id. Otherwise, this room 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 <SparkApiEventArgs <Room> > completionHandler) { ServiceRequest request = BuildRequest(); request.Method = HttpMethod.POST; if (title != null) { request.AddBodyParameters("title", title); } if (teamId != null) { request.AddBodyParameters("teamId", teamId); } request.Execute <Room>(completionHandler); }
public void FetchTokenFromJWTAsync(string jwt, Action <SparkApiEventArgs <JWTAccessTokenInfo> > completionHandler) { var request = new ServiceRequest(); request.Method = HttpMethod.POST; request.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.Execute <JWTAccessTokenInfo>((response) => { completionHandler(response); }); }
/// <summary> /// Adds a person to a room by email address; optionally making the person a moderator. /// </summary> /// <param name="roomId">The identifier of the room 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 room]. The default is false.</param> /// <param name="completionHandler">The completion handler.</param> /// <remarks>Since: 0.1.0</remarks> public void CreateByPersonEmail(string roomId, string personEmail, bool?isModerator = false, Action <SparkApiEventArgs <Membership> > completionHandler = null) { ServiceRequest request = BuildRequest(); request.Method = HttpMethod.POST; if (roomId != null) { request.AddBodyParameters("roomId", roomId); } if (personEmail != null) { request.AddBodyParameters("personEmail", personEmail); } if (isModerator != null) { request.AddBodyParameters("isModerator", isModerator); } request.Execute <Membership>(completionHandler); }
/// <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 <SparkApiEventArgs <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); } request.Execute <TeamMembership>(completionHandler); }
/// <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 <SparkApiEventArgs <Team> > completionHandler) { ServiceRequest request = BuildRequest(); request.Method = HttpMethod.POST; if (name != null) { request.AddBodyParameters("name", name); } request.Execute <Team>(completionHandler); }
/// <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 <SparkApiEventArgs <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); }