getShippingLabel method
Get shipping label
Implementation
Future<String> getShippingLabel(String shipmentId) async {
try {
final response = await _client.authenticatedRequest<String>(
'/rest/V1/shipments/$shipmentId/labels',
options: Options(responseType: ResponseType.plain),
);
if (response.statusCode == 200) {
return response.data!;
} else {
throw Exception(
'Failed to get shipping label: ${response.statusMessage}',
);
}
} on DioException catch (e) {
throw Exception('Failed to get shipping label: ${e.message}');
} catch (e) {
throw Exception('Failed to get shipping label: $e');
}
}