internal static string ParseLabelType(LabelTypeEnum type) { string str; string result = string.Empty; switch (type) { case LabelTypeEnum.Default: { result = "Default"; str = result; return(str); } //case 2: //case 3: //{ // str = result; // return str; //} case LabelTypeEnum.Domestic: { result = "Domestic"; str = result; return(str); } case LabelTypeEnum.International: { result = "International"; str = result; return(str); } default: { str = result; return(str); } } }
internal static string ParseLabelSize(LabelSizeEnum size, LabelTypeEnum type) { string result = string.Empty; if (type == LabelTypeEnum.Default) { result = "4x6"; } else if (type == LabelTypeEnum.Domestic) { switch (size) { case LabelSizeEnum._Default: case LabelSizeEnum.Domestic_4x6: { result = "4x6"; break; } case LabelSizeEnum.InternationalDomestic_6X4: { result = "6x4"; break; } case LabelSizeEnum.International_85X533: { result = string.Empty; break; } default: { goto case LabelSizeEnum.International_85X533; } } } else if (type == LabelTypeEnum.International) { switch (size) { case LabelSizeEnum._Default: { result = string.Empty; break; } case LabelSizeEnum.InternationalDomestic_6X4: { result = "4x6c"; break; } case LabelSizeEnum.Domestic_4x6: case LabelSizeEnum.International_85X533: { result = string.Empty; break; } default: { goto case LabelSizeEnum.International_85X533; } } } return(result); }
public async Task <Result <LabelData> > DownloadShipmentLabelAsync(string shipmentId, LabelFormatEnum format = LabelFormatEnum.Pdf, LabelTypeEnum type = LabelTypeEnum.normal) { RestRequest request = createDownloadShipmentLabel(shipmentId, format, type); IRestResponse response = await RestClient.ExecuteTaskAsync(request); byte[] response2 = RestClient.DownloadData(request); File.WriteAllBytes(@"C:\\test.pdf", response2); return(new Result <LabelData>(response)); }
protected RestRequest createDownloadShipmentLabel(string id, LabelFormatEnum format, LabelTypeEnum type) { RestRequest request = new RestRequest($"/v1/shipments/{id}/label?format={format.ToString()}&type={type.ToString()}", Method.GET); return(request); }
public byte[] DownloadShipmentLabel(string shipmentId, LabelFormatEnum format = LabelFormatEnum.Pdf, LabelTypeEnum type = LabelTypeEnum.normal) { RestRequest request = createDownloadShipmentLabel(shipmentId, format, type); return(RestClient.DownloadData(request)); }