getUserPrivateDesigns method

Future<PrintifyProductListModel> getUserPrivateDesigns({
  1. required String baseUrl,
  2. required String userId,
})

Publishes productId to the store.

Implementation

Future<PrintifyProductListModel> getUserPrivateDesigns({
  required String baseUrl,
  required String userId,
}) async {
  Response? response;

  try {
    final dio = Dio(
      BaseOptions(
        contentType: 'application/json',
        responseType: ResponseType.json,
        baseUrl: 'https://$baseUrl/app',
      ),
    );
    response = await dio.post(
      '/getUserDesigns',
      queryParameters: {
        'userId': userId,
      },
    );

    if (response.statusCode == 200) {
      return PrintifyProductListModel.fromJson(response.data);
    } else {
      throw Exception(
          'Non 200 code for user private designs with user ID $userId. Response: ${response.statusCode}');
    }
  } catch (e) {
    throw Exception(
        'Non 200 code for getting user private designs with user ID $userId. Response: ${response?.statusCode}');
  }
}