Esempio n. 1
0
        /// <summary>
        /// Patch a role Partially update a role by providing only the fields you want to update. Omitted fields will not be updated. The fields that can be updated are defined in the request body, all other provided fields will be ignored.  ##### Permissions &#x60;manage_system&#x60; permission is required.  __Minimum server version__: 4.9
        /// </summary>
        /// <exception cref="ApiException">Thrown when fails to make API call</exception>
        /// <param name="roleId">Role GUID</param>
        /// <param name="body"></param>
        /// <returns>Task of ApiResponse (Role)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <Role> > RolesRoleIdPatchPutAsyncWithHttpInfo(string roleId, InlineObject57 body)
        {
            // verify the required parameter 'roleId' is set
            if (roleId == null)
            {
                throw new ApiException(400, "Missing required parameter 'roleId' when calling RolesApi->RolesRoleIdPatchPut");
            }

            // verify the required parameter 'body' is set
            if (body == null)
            {
                throw new ApiException(400, "Missing required parameter 'body' when calling RolesApi->RolesRoleIdPatchPut");
            }


            var requestOptions = new RequestOptions();

            string[] @contentTypes = new string[] {
                "application/json"
            };

            // to determine the Accept header
            string[] @accepts = new string[] {
                "application/json"
            };

            foreach (var contentType in @contentTypes)
            {
                requestOptions.HeaderParameters.Add("Content-Type", contentType);
            }

            foreach (var accept in @accepts)
            {
                requestOptions.HeaderParameters.Add("Accept", accept);
            }

            if (roleId != null)
            {
                requestOptions.PathParameters.Add("role_id", Sdcb.Mattermost.DotNetSdk.Client.ClientUtils.ParameterToString(roleId)); // path parameter
            }
            requestOptions.Data = body;


            // make the HTTP request

            var response = await this.AsynchronousClient.PutAsync <Role>("/roles/{role_id}/patch", requestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception exception = this.ExceptionFactory("RolesRoleIdPatchPut", response);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(response);
        }
Esempio n. 2
0
        /// <summary>
        /// Patch a role Partially update a role by providing only the fields you want to update. Omitted fields will not be updated. The fields that can be updated are defined in the request body, all other provided fields will be ignored.  ##### Permissions &#x60;manage_system&#x60; permission is required.  __Minimum server version__: 4.9
        /// </summary>
        /// <exception cref="ApiException">Thrown when fails to make API call</exception>
        /// <param name="roleId">Role GUID</param>
        /// <param name="body"></param>
        /// <returns>ApiResponse of Role</returns>
        public ApiResponse <Role> RolesRoleIdPatchPutWithHttpInfo(string roleId, InlineObject57 body)
        {
            // verify the required parameter 'roleId' is set
            if (roleId == null)
            {
                throw new ApiException(400, "Missing required parameter 'roleId' when calling RolesApi->RolesRoleIdPatchPut");
            }

            // verify the required parameter 'body' is set
            if (body == null)
            {
                throw new ApiException(400, "Missing required parameter 'body' when calling RolesApi->RolesRoleIdPatchPut");
            }

            var requestOptions = new RequestOptions();

            string[] @contentTypes = new string[] {
                "application/json"
            };

            // to determine the Accept header
            string[] @accepts = new string[] {
                "application/json"
            };

            var localVarContentType = Sdcb.Mattermost.DotNetSdk.Client.ClientUtils.SelectHeaderContentType(@contentTypes);

            if (localVarContentType != null)
            {
                requestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = Sdcb.Mattermost.DotNetSdk.Client.ClientUtils.SelectHeaderAccept(@accepts);

            if (localVarAccept != null)
            {
                requestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            if (roleId != null)
            {
                requestOptions.PathParameters.Add("role_id", Sdcb.Mattermost.DotNetSdk.Client.ClientUtils.ParameterToString(roleId)); // path parameter
            }
            requestOptions.Data = body;


            // make the HTTP request

            var response = this.Client.Put <Role>("/roles/{role_id}/patch", requestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception exception = this.ExceptionFactory("RolesRoleIdPatchPut", response);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(response);
        }
Esempio n. 3
0
        /// <summary>
        /// Patch a role Partially update a role by providing only the fields you want to update. Omitted fields will not be updated. The fields that can be updated are defined in the request body, all other provided fields will be ignored.  ##### Permissions &#x60;manage_system&#x60; permission is required.  __Minimum server version__: 4.9
        /// </summary>
        /// <exception cref="ApiException">Thrown when fails to make API call</exception>
        /// <param name="roleId">Role GUID</param>
        /// <param name="body"></param>
        /// <returns>Task of Role</returns>
        public async System.Threading.Tasks.Task <Role> RolesRoleIdPatchPutAsync(string roleId, InlineObject57 body)
        {
            ApiResponse <Role> localVarResponse = await RolesRoleIdPatchPutAsyncWithHttpInfo(roleId, body);

            return(localVarResponse.Data);
        }
Esempio n. 4
0
        /// <summary>
        /// Patch a role Partially update a role by providing only the fields you want to update. Omitted fields will not be updated. The fields that can be updated are defined in the request body, all other provided fields will be ignored.  ##### Permissions &#x60;manage_system&#x60; permission is required.  __Minimum server version__: 4.9
        /// </summary>
        /// <exception cref="ApiException">Thrown when fails to make API call</exception>
        /// <param name="roleId">Role GUID</param>
        /// <param name="body"></param>
        /// <returns>Role</returns>
        public Role RolesRoleIdPatchPut(string roleId, InlineObject57 body)
        {
            ApiResponse <Role> localVarResponse = RolesRoleIdPatchPutWithHttpInfo(roleId, body);

            return(localVarResponse.Data);
        }