예제 #1
0
        /// <summary>
        /// Create a workspace. The capacity and type parameters are optional, and omitting them will result in the creation of a workspace without a capacity and/or type set.
        /// The orgId parameter can only be used by admin users of another organization(such as partners).
        /// </summary>
        /// <param name="displayName">A friendly name for the workspace.</param>
        /// <param name="orgId">OrgId associated with the workspace. Only admin users of another organization (such as partners) may use this parameter.</param>
        /// <param name="capacity">How many people the workspace is suitable for. If set, must be 0 or higher.</param>
        /// <param name="type">The type that best describes the workspace.</param>
        /// <param name="calling">Calling types supported on create are freeCalling and webexEdgeForDevices. Default is freeCalling.</param>
        /// <param name="calendar">Workspace calendar configuration. Provide a type (microsoft, google or none) and an emailAddress. Default is none.</param>
        /// <param name="notes">Notes associated to the workspace.</param>
        /// <returns>The newly created Workspace object.</returns>
        public async Task <Workspace> CreateWorkspaceAsync(string displayName, string orgId = null, int?capacity               = null, string type  = null,
                                                           WorkspaceCallingType calling     = null, WorkspaceCalendar calendar = null, string notes = null)
        {
            var postBody = new Dictionary <string, object>();

            postBody.Add("displayName", displayName);
            if (orgId != null)
            {
                postBody.Add("orgId", orgId);
            }
            if (capacity != null)
            {
                postBody.Add("capacity", System.Math.Max((int)capacity, 0));
            }
            if (type != null)
            {
                postBody.Add("type", type);
            }
            if (calling != null)
            {
                postBody.Add("calling", calling);
            }
            if (calendar != null)
            {
                postBody.Add("calendar", calendar);
            }
            if (notes != null)
            {
                postBody.Add("notes", notes);
            }

            return(await PostItemAsync <Workspace>(workspacesBase, postBody));
        }
예제 #2
0
        /// <summary>
        /// Updates details for a workspace, by ID.
        /// Specify the workspace ID in the workspaceId parameter in the URI.
        /// Include all details for the workspace that are present in a GET request for the workspace details.Not including an optional field (that is, the capacity or the type field) will result in the field no longer being defined for the workspace.
        /// </summary>
        /// <param name="workspaceId">A unique identifier for the workspace.</param>
        /// <param name="displayName">A friendly name for the workspace.</param>
        /// <param name="capacity">How many people the workspace is suitable for. If set, must be 0 or higher.</param>
        /// <param name="type">The type that best describes the workspace.</param>
        /// <param name="calendar">An empty/null calendar field will not cause any changes. Provide a type (microsoft, google or none) and an emailAddress. Removing calendar is done by setting the none type, and setting none type does not require an emailAddress.</param>
        /// <param name="notes">Notes associated to the workspace.</param>
        /// <returns>The updated workspace object</returns>
        public async Task <Workspace> UpdateWorkspaceAsync(string workspaceId, string displayName, int?capacity = null, string type = null, WorkspaceCalendar calendar = null, string notes = null)
        {
            var putBody = new Dictionary <string, object>();

            putBody.Add("displayName", displayName);
            if (capacity != null)
            {
                putBody.Add("capacity", System.Math.Max((int)capacity, 0));
            }
            if (type != null)
            {
                putBody.Add("type", type);
            }
            if (calendar != null)
            {
                putBody.Add("calendar", calendar);
            }
            if (notes != null)
            {
                putBody.Add("notes", notes);
            }
            var path = $"{workspacesBase}/{workspaceId}";

            return(await UpdateItemAsync <Workspace>(path, putBody));
        }