/// <summary> /// Create a mail label Create a mail label - -- Alternate route: `/dev/characters/{character_id}/mail/labels/` Alternate route: `/legacy/characters/{character_id}/mail/labels/` Alternate route: `/v2/characters/{character_id}/mail/labels/` /// </summary> /// <param name="characterId">An EVE character ID</param> /// <param name="label">Label to create</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>int?</returns> public int?PostCharactersCharacterIdMailLabels(int?characterId, PostCharactersCharacterIdMailLabelsLabel label, string datasource, string token) { // verify the required parameter 'characterId' is set if (characterId == null) { throw new ApiException(400, "Missing required parameter 'characterId' when calling PostCharactersCharacterIdMailLabels"); } // verify the required parameter 'label' is set if (label == null) { throw new ApiException(400, "Missing required parameter 'label' when calling PostCharactersCharacterIdMailLabels"); } var path = "/characters/{character_id}/mail/labels/"; path = path.Replace("{format}", "json"); path = path.Replace("{" + "character_id" + "}", ApiClient.ParameterToString(characterId)); 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(label); // http body (model) parameter // authentication setting, if any String[] authSettings = new String[] { "evesso" }; // make the HTTP request IRestResponse response = (IRestResponse)ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); if (((int)response.StatusCode) >= 400) { throw new ApiException((int)response.StatusCode, "Error calling PostCharactersCharacterIdMailLabels: " + response.Content, response.Content); } else if (((int)response.StatusCode) == 0) { throw new ApiException((int)response.StatusCode, "Error calling PostCharactersCharacterIdMailLabels: " + response.ErrorMessage, response.ErrorMessage); } return((int?)ApiClient.Deserialize(response.Content, typeof(int?), response.Headers)); }
internal async Task <bool> AddLabel(string label_name) { if (!await RefreshToken()) { return(false); } MailApi api = new MailApi(); int?charid = (int?)mDBAccount.CharacterId; PostCharactersCharacterIdMailLabelsLabel label = new PostCharactersCharacterIdMailLabelsLabel( PostCharactersCharacterIdMailLabelsLabel.ColorEnum.Ffffff, label_name); try { int?labelid = await api.PostCharactersCharacterIdMailLabelsAsync( characterId : charid, label : label, datasource : ESIConfiguration.DataSource, token : DBAccount.AccessToken); if (!labelid.HasValue) { return(false); } mLabels.Add(new Label(mClient, this, labelid ?? -1, label_name, LabelType.Label)); ViewAccount.Sync(this); return(true); } catch (Eve.Api.Client.ApiException e) { ExceptionHandler.HandleApiException(null, e); return(false); } }