/// <inheritdoc /> /// <summary> /// Add a flag <b>Permissions Needed:</b> ANY /// </summary> /// <param name="flagResource">The flag resource object</param> public void AddFlag(FlagResource flagResource) { mWebCallEvent.WebPath = "/moderation/flags"; if (!string.IsNullOrEmpty(mWebCallEvent.WebPath)) { mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json"); } mWebCallEvent.HeaderParams.Clear(); mWebCallEvent.QueryParams.Clear(); mWebCallEvent.AuthSettings.Clear(); mWebCallEvent.PostBody = null; mWebCallEvent.PostBody = KnetikClient.Serialize(flagResource); // http body (model) parameter // authentication settings mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant"); // authentication settings mWebCallEvent.AuthSettings.Add("oauth2_password_grant"); // make the HTTP request mAddFlagStartTime = DateTime.Now; mWebCallEvent.Context = mAddFlagResponseContext; mWebCallEvent.RequestType = KnetikRequestType.POST; KnetikLogger.LogRequest(mAddFlagStartTime, "AddFlag", "Sending server request..."); KnetikGlobalEventSystem.Publish(mWebCallEvent); }
/// <summary> /// Add a flag <b>Permissions Needed:</b> ANY /// </summary> /// <exception cref="com.knetikcloud.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="flagResource">The flag resource object (optional)</param> /// <returns>ApiResponse of FlagResource</returns> public ApiResponse <FlagResource> AddFlagWithHttpInfo(FlagResource flagResource = null) { var localVarPath = "/moderation/flags"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new List <KeyValuePair <String, String> >(); var localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new Dictionary <String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { "application/json" }; String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (flagResource != null && flagResource.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(flagResource); // http body (model) parameter } else { localVarPostBody = flagResource; // byte array } // authentication (oauth2_client_credentials_grant) required // oauth required if (!String.IsNullOrEmpty(Configuration.AccessToken)) { localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; } // authentication (oauth2_password_grant) required // oauth required if (!String.IsNullOrEmpty(Configuration.AccessToken)) { localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)Configuration.ApiClient.CallApi(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("AddFlag", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <FlagResource>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (FlagResource)Configuration.ApiClient.Deserialize(localVarResponse, typeof(FlagResource)))); }
/// <summary> /// Add a flag <b>Permissions Needed:</b> ANY /// </summary> /// <exception cref="com.knetikcloud.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="flagResource">The flag resource object (optional)</param> /// <returns>FlagResource</returns> public FlagResource AddFlag(FlagResource flagResource = null) { ApiResponse <FlagResource> localVarResponse = AddFlagWithHttpInfo(flagResource); return(localVarResponse.Data); }