/// <summary> /// Update metadata about a mail Update metadata about a mail - -- Alternate route: `/dev/characters/{character_id}/mail/{mail_id}/` Alternate route: `/legacy/characters/{character_id}/mail/{mail_id}/` Alternate route: `/v1/characters/{character_id}/mail/{mail_id}/` /// </summary> /// <param name="characterId">An EVE character ID</param> /// <param name="contents">Data used to update the mail</param> /// <param name="mailId">An EVE mail ID</param> /// <param name="datasource">The server name you would like data from</param> /// <param name="token">Access token to use if unable to set a header</param> /// <returns></returns> public void PutCharactersCharacterIdMailMailId(int?characterId, PutCharactersCharacterIdMailMailIdContents contents, int?mailId, string datasource, string token) { // verify the required parameter 'characterId' is set if (characterId == null) { throw new ApiException(400, "Missing required parameter 'characterId' when calling PutCharactersCharacterIdMailMailId"); } // verify the required parameter 'contents' is set if (contents == null) { throw new ApiException(400, "Missing required parameter 'contents' when calling PutCharactersCharacterIdMailMailId"); } // verify the required parameter 'mailId' is set if (mailId == null) { throw new ApiException(400, "Missing required parameter 'mailId' when calling PutCharactersCharacterIdMailMailId"); } var path = "/characters/{character_id}/mail/{mail_id}/"; path = path.Replace("{format}", "json"); path = path.Replace("{" + "character_id" + "}", ApiClient.ParameterToString(characterId)); path = path.Replace("{" + "mail_id" + "}", ApiClient.ParameterToString(mailId)); var queryParams = new Dictionary <String, String>(); var headerParams = new Dictionary <String, String>(); var formParams = new Dictionary <String, String>(); var fileParams = new Dictionary <String, FileParameter>(); String postBody = null; if (datasource != null) { queryParams.Add("datasource", ApiClient.ParameterToString(datasource)); // query parameter } if (token != null) { queryParams.Add("token", ApiClient.ParameterToString(token)); // query parameter } postBody = ApiClient.Serialize(contents); // http body (model) parameter // authentication setting, if any String[] authSettings = new String[] { "evesso" }; // make the HTTP request IRestResponse response = (IRestResponse)ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings); if (((int)response.StatusCode) >= 400) { throw new ApiException((int)response.StatusCode, "Error calling PutCharactersCharacterIdMailMailId: " + response.Content, response.Content); } else if (((int)response.StatusCode) == 0) { throw new ApiException((int)response.StatusCode, "Error calling PutCharactersCharacterIdMailMailId: " + response.ErrorMessage, response.ErrorMessage); } return; }
public async Task <bool> SaveMailMetaData(ViewMailItem item) { if (!await RefreshToken()) { return(false); } MailApi api = new MailApi(); PutCharactersCharacterIdMailMailIdContents content = new PutCharactersCharacterIdMailMailIdContents(); content.Read = item.IsItemRead; content.Labels = new List <int?>(); foreach (var i in item.Labels) { if (i.Subscribed) { content.Labels.Add(i.Label.Id); } } try { int id = (int)DBAccount.CharacterId; int mailid = (int)item.MailId; await api.PutCharactersCharacterIdMailMailIdAsync( characterId : id, contents : content, mailId : mailid, datasource : ESIConfiguration.DataSource, token : DBAccount.AccessToken); return(true); } catch (Eve.Api.Client.ApiException e) { ExceptionHandler.HandleApiException(null, e); mReadFailed = true; mViewAccount.AccountState = AccountState; return(false); } }