/// <inheritdoc /> /// <summary> /// Create a user relationship <b>Permissions Needed:</b> RELATIONSHIPS_ADMIN /// </summary> /// <param name="relationship">The new relationship</param> public void CreateUserRelationship(UserRelationshipResource relationship) { mWebCallEvent.WebPath = "/users/relationships"; 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(relationship); // 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 mCreateUserRelationshipStartTime = DateTime.Now; mWebCallEvent.Context = mCreateUserRelationshipResponseContext; mWebCallEvent.RequestType = KnetikRequestType.POST; KnetikLogger.LogRequest(mCreateUserRelationshipStartTime, "CreateUserRelationship", "Sending server request..."); KnetikGlobalEventSystem.Publish(mWebCallEvent); }
private void OnUpdateUserRelationshipResponse(KnetikRestResponse response) { if (!string.IsNullOrEmpty(response.Error)) { throw new KnetikException("Error calling UpdateUserRelationship: " + response.Error); } UpdateUserRelationshipData = (UserRelationshipResource)KnetikClient.Deserialize(response.Content, typeof(UserRelationshipResource), response.Headers); KnetikLogger.LogResponse(mUpdateUserRelationshipStartTime, "UpdateUserRelationship", string.Format("Response received successfully:\n{0}", UpdateUserRelationshipData)); if (UpdateUserRelationshipComplete != null) { UpdateUserRelationshipComplete(response.ResponseCode, UpdateUserRelationshipData); } }
/// <inheritdoc /> /// <summary> /// Update a user relationship <b>Permissions Needed:</b> RELATIONSHIPS_ADMIN /// </summary> /// <param name="id">The id of the relationship</param> /// <param name="relationship">The new relationship</param> public void UpdateUserRelationship(long?id, UserRelationshipResource relationship) { // verify the required parameter 'id' is set if (id == null) { throw new KnetikException(400, "Missing required parameter 'id' when calling UpdateUserRelationship"); } mWebCallEvent.WebPath = "/users/relationships/{id}"; if (!string.IsNullOrEmpty(mWebCallEvent.WebPath)) { mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json"); } mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "id" + "}", KnetikClient.ParameterToString(id)); mWebCallEvent.HeaderParams.Clear(); mWebCallEvent.QueryParams.Clear(); mWebCallEvent.AuthSettings.Clear(); mWebCallEvent.PostBody = null; mWebCallEvent.PostBody = KnetikClient.Serialize(relationship); // 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 mUpdateUserRelationshipStartTime = DateTime.Now; mWebCallEvent.Context = mUpdateUserRelationshipResponseContext; mWebCallEvent.RequestType = KnetikRequestType.PUT; KnetikLogger.LogRequest(mUpdateUserRelationshipStartTime, "UpdateUserRelationship", "Sending server request..."); KnetikGlobalEventSystem.Publish(mWebCallEvent); }
/// <summary> /// Update a user relationship <b>Permissions Needed:</b> RELATIONSHIPS_ADMIN /// </summary> /// <exception cref="com.knetikcloud.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id">The id of the relationship</param> /// <param name="relationship">The new relationship (optional)</param> /// <returns>ApiResponse of UserRelationshipResource</returns> public ApiResponse <UserRelationshipResource> UpdateUserRelationshipWithHttpInfo(long?id, UserRelationshipResource relationship = null) { // verify the required parameter 'id' is set if (id == null) { throw new ApiException(400, "Missing required parameter 'id' when calling Users_RelationshipsApi->UpdateUserRelationship"); } var localVarPath = "/users/relationships/{id}"; 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 (id != null) { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } if (relationship != null && relationship.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(relationship); // http body (model) parameter } else { localVarPostBody = relationship; // 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.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("UpdateUserRelationship", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <UserRelationshipResource>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (UserRelationshipResource)Configuration.ApiClient.Deserialize(localVarResponse, typeof(UserRelationshipResource)))); }
/// <summary> /// Update a user relationship <b>Permissions Needed:</b> RELATIONSHIPS_ADMIN /// </summary> /// <exception cref="com.knetikcloud.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id">The id of the relationship</param> /// <param name="relationship">The new relationship (optional)</param> /// <returns>UserRelationshipResource</returns> public UserRelationshipResource UpdateUserRelationship(long?id, UserRelationshipResource relationship = null) { ApiResponse <UserRelationshipResource> localVarResponse = UpdateUserRelationshipWithHttpInfo(id, relationship); return(localVarResponse.Data); }
/// <summary> /// Create a user relationship <b>Permissions Needed:</b> RELATIONSHIPS_ADMIN /// </summary> /// <exception cref="com.knetikcloud.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="relationship">The new relationship (optional)</param> /// <returns>UserRelationshipResource</returns> public UserRelationshipResource CreateUserRelationship(UserRelationshipResource relationship = null) { ApiResponse <UserRelationshipResource> localVarResponse = CreateUserRelationshipWithHttpInfo(relationship); return(localVarResponse.Data); }