FakeStoreDemoProvider

FakeStoreDemoProvider is a demo SDK connector provider that works with the the FakeStore REST API service https://fakestoreapi.com . It demonstrates basic SDK connector features - reading data, looking for records, inserting, updating, and deleting data, including both simple data, like Products and data with nested arrays, like Carts.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Devart.Skyvia.Providers.SDK.Attributes;

namespace Devart.Skyvia.Providers.SDK.Demo {

/// <summary>
/// A demo provider for FakeStoreAPI that manages both simple products
/// and complex shopping carts with nested item collections.
/// </summary>
public class FakeStoreDemoProvider : SDKProvider {

private HttpClient httpClient;
private readonly string baseUrl = "https://fakestoreapi.com/";

/// <summary>
/// Initializes the HTTP client and performs a mock authentication to the FakeStoreAPI.
/// </summary>
public override async Task Init(CancellationToken cancellationToken) {

System.Net.ServicePointManager.SecurityProtocol = (System.Net.SecurityProtocolType)3072;
httpClient = new HttpClient();
httpClient.BaseAddress = new Uri(baseUrl);

var loginData = new { username = "mor_2314", password = "83r5^_" };
var content = new StringContent(JsonConvert.SerializeObject(loginData), Encoding.UTF8, "application/json");

using (var response = await httpClient.PostAsync("auth/login", content, cancellationToken)) {
response.EnsureSuccessStatusCode();
var json = await response.Content.ReadAsStringAsync();
var token = (string)JObject.Parse(json)["token"];
httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);
}
}

/// <summary>
/// Performs a lightweight connectivity check.
/// </summary>
protected override async Task Test(CancellationToken cancellationToken) {

using (var response = await httpClient.GetAsync("/products?limit=1", cancellationToken)) {
response.EnsureSuccessStatusCode();
}
}

/// <summary>
/// Releases the HTTP client and other resources used by the provider.
/// </summary>
public override void Dispose() {

if (httpClient != null) {
httpClient.Dispose();
httpClient = null;
}
}

#region Product Operations

/// <summary>
/// Retrieves the complete list of products from the API.
/// </summary>
/// <remarks>
/// This method is compatible with Source components in DataFlow,
/// as well as Action components in ControlFlow or Automation.
/// </remarks>
[ProviderMethod(ProviderActionType.Source | ProviderActionType.Action)]
public async Task<IEnumerable<Product>> GetAllProducts(CancellationToken cancellationToken) {

using (var response = await httpClient.GetAsync("products", cancellationToken)) {
response.EnsureSuccessStatusCode();
var json = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<List<Product>>(json);
}
}

/// <summary>
/// Searches for products based on flexible criteria.
/// </summary>
/// <remarks>
/// This method is compatible with Source and Lookup components in DataFlow,
/// as well as Action components in ControlFlow or Automation.
/// </remarks>
[ProviderMethod(ProviderActionType.Source | ProviderActionType.Lookup | ProviderActionType.Action)]
public async Task<IEnumerable<Product>> SearchProducts(SearchProductsRequest parameters, CancellationToken cancellationToken) {

// Get all products (FakeStore API doesn't support filter directly)
using (var response = await httpClient.GetAsync("/products", cancellationToken)) {
response.EnsureSuccessStatusCode();

var json = await response.Content.ReadAsStringAsync();
var list = JsonConvert.DeserializeObject<List<Product>>(json);

var filtered = new List<Product>();

foreach (var p in list) {
if (parameters.Id.HasValue && p.Id != parameters.Id.Value)
continue;

if (!string.IsNullOrEmpty(parameters.Title) &&
!p.Title.ToLower().Contains(parameters.Title.ToLower()))
continue;

if (!string.IsNullOrEmpty(parameters.Category) &&
!string.Equals(p.Category, parameters.Category, StringComparison.OrdinalIgnoreCase))
continue;

if (parameters.MinPrice.HasValue && p.Price < parameters.MinPrice.Value)
continue;

if (parameters.MaxPrice.HasValue && p.Price > parameters.MaxPrice.Value)
continue;

filtered.Add(p);
}
return filtered;
}
}

/// <summary>
/// Retrieves a single product by its unique identifier.
/// </summary>
/// <remarks>
/// This method is primarily used by Lookup components in DataFlow for data enrichment
/// and by Action components in ControlFlow or Automation for single-record retrieval.
/// </remarks>
[ProviderMethod(ProviderActionType.Lookup | ProviderActionType.Action)]
public async Task<Product> GetProduct(long parameters, CancellationToken cancellationToken) {

using (var response = await httpClient.GetAsync("products/" + parameters, cancellationToken)) {
if (!response.IsSuccessStatusCode)
return null;

var json = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<Product>(json);
}
}

/// <summary>
/// Performs a batch insertion of products into the data source.
/// </summary>
/// <remarks>
/// This method is designed for Target components in DataFlow.
/// The number and order of results strictly match the input parameters to provide per-row execution logging.
/// If an error occurs during the insertion of a specific row, the corresponding result object
/// will contain the error details in the <c>ErrorMessage</c> field, allowing the pipeline to continue
/// processing subsequent records.
/// </remarks>
[ProviderMethod(ProviderActionType.Target)]
public async Task<IEnumerable<TargetResult>> InsertProducts(IEnumerable<InsertProductParameter> parameters, CancellationToken cancellationToken) {

var results = new List<TargetResult>();
foreach (var param in parameters) {
try {
var content = new StringContent(JsonConvert.SerializeObject(param), Encoding.UTF8, "application/json");
using (var response = await httpClient.PostAsync("products", content, cancellationToken)) {
if (response.IsSuccessStatusCode) {
results.Add(JsonConvert.DeserializeObject<TargetResult>(await response.Content.ReadAsStringAsync()));
}
else {
results.Add(new TargetResult { ErrorMessage = "API Error: " + response.ReasonPhrase });
}
}
}
catch (Exception ex) {
results.Add(new TargetResult { ErrorMessage = ex.Message });
}
}
return results;
}

/// <summary>
/// Performs a batch update of existing products in the data source.
/// </summary>
/// <remarks>
/// This method is designed for Target components in DataFlow.
/// The number and order of results strictly match the input parameters to provide per-row execution logging.
/// If an error occurs during the update of a specific row, the corresponding result object
/// will contain the error details in the <c>ErrorMessage</c> field, allowing the pipeline to continue
/// processing subsequent records.
/// </remarks>
[ProviderMethod(ProviderActionType.Target)]
public async Task<IEnumerable<TargetResult>> UpdateProducts(IEnumerable<ProductUpdateParameter> parameters, CancellationToken cancellationToken) {

var results = new List<TargetResult>();
foreach (var param in parameters) {
try {
var content = new StringContent(JsonConvert.SerializeObject(param), Encoding.UTF8, "application/json");
using (var response = await httpClient.PutAsync("products/" + param.ProductId, content, cancellationToken)) {

if (response.IsSuccessStatusCode) {
results.Add(new TargetResult { Id = param.ProductId });
}
else {
results.Add(new TargetResult { Id = param.ProductId, ErrorMessage = "API Error: " + response.ReasonPhrase });
}
}
}
catch (Exception ex) {
results.Add(new TargetResult { Id = param.ProductId, ErrorMessage = ex.Message });
}
}
return results;
}

/// <summary>
/// Performs a batch deletion of products from the data source using their unique identifiers.
/// </summary>
/// <remarks>
/// This method is designed for Target components in DataFlow.
/// The number and order of results strictly match the input parameters to provide per-row execution logging.
/// If an error occurs during the delete of a specific row, the corresponding result object
/// will contain the error details in the <c>ErrorMessage</c> field, allowing the pipeline to continue
/// processing subsequent records.
/// </remarks>
[ProviderMethod(ProviderActionType.Target)]
public async Task<IEnumerable<TargetResult>> DeleteProducts(IEnumerable<DeleteProductParameter> parameters, CancellationToken cancellationToken) {

var results = new List<TargetResult>();
foreach (var param in parameters) {
try {

using (var response = await httpClient.DeleteAsync("products/" + param.ProductId, cancellationToken)) {
var content = await response.Content.ReadAsStringAsync();
if (response.IsSuccessStatusCode && !string.IsNullOrEmpty(content) && content != "null") {
results.Add(new TargetResult { Id = param.ProductId });
}
else {
results.Add(new TargetResult { Id = param.ProductId, ErrorMessage = "Record not found or delete failed" });
}
}
}
catch (Exception ex) {
results.Add(new TargetResult { Id = param.ProductId, ErrorMessage = ex.Message });
}
}
return results;
}


/// <summary>
/// Inserts a single product into the data source and returns the unique identifier of created record.
/// <remarks>
/// This method is designed for Action components in ControlFlow or Automation.
/// If an error occurs, an exception is thrown, causing the specific task or automation step to fail.
/// </remarks>
[ProviderMethod(ProviderActionType.Action)]
public async Task<InsertResult> InsertProduct(InsertProductParameter parameters, CancellationToken cancellationToken) {

var json = JsonConvert.SerializeObject(parameters);
var content = new StringContent(json, Encoding.UTF8, "application/json");

using (var response = await httpClient.PostAsync("products", content, cancellationToken)) {

if (!response.IsSuccessStatusCode)
throw new Exception("Failed to insert product. API Status: " + response.StatusCode);

var responseJson = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<InsertResult>(responseJson);
}
}

/// <summary>
/// Updates the details of an existing product in the data source.
/// <remarks>
/// This method is designed for Action components in ControlFlow or Automation.
/// If an error occurs, an exception is thrown, causing the specific task or automation step to fail.
/// </remarks>
[ProviderMethod(ProviderActionType.Action)]
public async Task UpdateProduct(ProductUpdateParameter parameters, CancellationToken cancellationToken) {

var json = JsonConvert.SerializeObject(parameters);
var content = new StringContent(json, Encoding.UTF8, "application/json");

using (var response = await httpClient.PutAsync("products/" + parameters.ProductId, content, cancellationToken)) {

if (!response.IsSuccessStatusCode)
throw new Exception("Failed to update product " + parameters.ProductId);

var responseJson = await response.Content.ReadAsStringAsync();
if (string.IsNullOrEmpty(responseJson) || responseJson == "null")
throw new Exception("Product " + parameters.ProductId + " not found.");
}
}

/// <summary>
/// Deletes a specific product from the data source using its unique identifier.
/// <remarks>
/// This method is designed for Action components in ControlFlow or Automation.
/// If an error occurs, an exception is thrown, causing the specific task or automation step to fail.
/// </remarks>
[ProviderMethod(ProviderActionType.Action)]
public async Task DeleteProduct(DeleteProductParameter parameters, CancellationToken cancellationToken) {

using (var response = await httpClient.DeleteAsync("products/" + parameters.ProductId, cancellationToken)) {

var content = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode || string.IsNullOrEmpty(content) || content == "null")
throw new Exception("Failed to delete product " + parameters.ProductId + ". Record not found.");
}
}

#endregion

#region Cart Operations

/// <summary>
/// Retrieves the complete list of carts from the data source.
/// </summary>
/// <remarks>
/// This method is compatible with Source components in DataFlow,
/// as well as Action components in ControlFlow or Automation.
/// </remarks>
[ProviderMethod(ProviderActionType.Source | ProviderActionType.Action)]
public async Task<IEnumerable<Cart>> GetAllCarts(CancellationToken cancellationToken) {

using (var response = await httpClient.GetAsync("/carts", cancellationToken)) {

response.EnsureSuccessStatusCode();
var json = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<List<Cart>>(json);
}
}

/// <summary>
/// Searches for carts based on flexible criteria such as cart id or user id.
/// </summary>
/// <remarks>
/// This method is compatible with Source and Lookup components in DataFlow,
/// as well as Action components in ControlFlow or Automation.
/// </remarks>
[ProviderMethod(ProviderActionType.Source | ProviderActionType.Lookup | ProviderActionType.Action)]
public async Task<IEnumerable<Cart>> SearchCarts(SearchCartsRequest parameters, CancellationToken cancellationToken) {

using (var response = await httpClient.GetAsync("/carts", cancellationToken)) {

response.EnsureSuccessStatusCode();
var json = await response.Content.ReadAsStringAsync();
var list = JsonConvert.DeserializeObject<List<Cart>>(json);

var result = new List<Cart>();
foreach (var cart in list) {

if (parameters.CartId.HasValue && cart.Id != parameters.CartId.Value)
continue;

if (parameters.UserId.HasValue && cart.UserId != parameters.UserId.Value)
continue;

result.Add(cart);
}
return result;
}
}

/// <summary>
/// Performs a batch insertion of carts into the data source.
/// </summary>
/// <remarks>
/// This method is designed for Target components in DataFlow.
/// The number and order of results strictly match the input parameters to provide per-row execution logging.
/// If an error occurs during the insertion of a specific row, the corresponding result object
/// will contain the error details in the <c>ErrorMessage</c> field, allowing the pipeline to continue
/// processing subsequent records.
/// </remarks>
[ProviderMethod(ProviderActionType.Target)]
public async Task<IEnumerable<TargetResult>> InsertCarts(IEnumerable<InsertCartParameter> parameters, CancellationToken cancellationToken) {

var results = new List<TargetResult>();
foreach (var param in parameters) {

try {

var content = new StringContent(
JsonConvert.SerializeObject(param),
Encoding.UTF8,
"application/json");

using (var response = await httpClient.PostAsync("/carts", content, cancellationToken)) {
response.EnsureSuccessStatusCode();

var json = await response.Content.ReadAsStringAsync();
results.Add(JsonConvert.DeserializeObject<TargetResult>(json));
}
}
catch (Exception ex) {
results.Add(new TargetResult {
ErrorMessage = ex.Message
});
}
}

return results;
}

/// <summary>
/// Performs a batch update of existing carts in the data source.
/// </summary>
/// <remarks>
/// This method is designed for Target components in DataFlow.
/// The number and order of results strictly match the input parameters to provide per-row execution logging.
/// If an error occurs during the update of a specific row, the corresponding result object
/// will contain the error details in the <c>ErrorMessage</c> field, allowing the pipeline to continue
/// processing subsequent records.
/// </remarks>
[ProviderMethod(ProviderActionType.Target)]
public async Task<IEnumerable<TargetResult>> UpdateCarts(IEnumerable<UpdateCartParameter> parameters, CancellationToken cancellationToken) {

var results = new List<TargetResult>();
foreach (var param in parameters) {

try {

var content = new StringContent(
JsonConvert.SerializeObject(param),
Encoding.UTF8,
"application/json");

using (var response = await httpClient.PutAsync("/carts/" + param.CartId, content, cancellationToken)) {

response.EnsureSuccessStatusCode();
results.Add(new TargetResult {
Id = param.CartId
});
}
}
catch (Exception ex) {
results.Add(new TargetResult {
Id = param.CartId,
ErrorMessage = ex.Message
});
}
}

return results;
}

/// <summary>
/// Performs a batch deletion of carts from the data source using their unique identifiers.
/// </summary>
/// <remarks>
/// This method is designed for Target components in DataFlow.
/// The number and order of results strictly match the input parameters to provide per-row execution logging.
/// If an error occurs during the delete of a specific row, the corresponding result object
/// will contain the error details in the <c>ErrorMessage</c> field, allowing the pipeline to continue
/// processing subsequent records.
/// </remarks>
[ProviderMethod(ProviderActionType.Target)]
public async Task<IEnumerable<TargetResult>> DeleteCarts(IEnumerable<DeleteCartParameter> parameters, CancellationToken cancellationToken) {

var results = new List<TargetResult>();
foreach (var param in parameters) {

try {

using (var response = await httpClient.DeleteAsync("/carts/" + param.CartId, cancellationToken)) {

response.EnsureSuccessStatusCode();
results.Add(new TargetResult {
Id = param.CartId
});
}
}
catch (Exception ex) {
results.Add(new TargetResult {
Id = param.CartId,
ErrorMessage = ex.Message
});
}
}

return results;
}

/// <summary>
/// Inserts a single cart into the data source and returns the unique identifier of created record.
/// <remarks>
/// This method is designed for Action components in ControlFlow or Automation.
/// If an error occurs, an exception is thrown, causing the specific task or automation step to fail.
/// </remarks>
[ProviderMethod(ProviderActionType.Action)]
public async Task<InsertResult> InsertCart(InsertCartParameter parameters, CancellationToken cancellationToken) {

var content = new StringContent(
JsonConvert.SerializeObject(parameters),
Encoding.UTF8,
"application/json");

using (var response = await httpClient.PostAsync("/carts", content, cancellationToken)) {
response.EnsureSuccessStatusCode();

var json = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<InsertResult>(json);
}
}

/// <summary>
/// Updates the details of an existing cart in the data source.
/// <remarks>
/// This method is designed for Action components in ControlFlow or Automation.
/// If an error occurs, an exception is thrown, causing the specific task or automation step to fail.
/// </remarks>
[ProviderMethod(ProviderActionType.Action)]
public async Task UpdateCart(UpdateCartParameter parameters, CancellationToken cancellationToken) {

var content = new StringContent(
JsonConvert.SerializeObject(parameters),
Encoding.UTF8,
"application/json");

using (var response = await httpClient.PutAsync("/carts/" + parameters.CartId, content, cancellationToken)) {
response.EnsureSuccessStatusCode();
}
}

/// <summary>
/// Deletes a specific cart from the data source using its unique identifier.
/// <remarks>
/// This method is designed for Action components in ControlFlow or Automation.
/// If an error occurs, an exception is thrown, causing the specific task or automation step to fail.
/// </remarks>
[ProviderMethod(ProviderActionType.Action)]
public async Task DeleteCart(DeleteCartParameter parameters, CancellationToken cancellationToken) {

using (var response = await httpClient.DeleteAsync("/carts/" + parameters.CartId, cancellationToken)) {
response.EnsureSuccessStatusCode();
}
}


#endregion

#region Models

/// <summary>
/// Represents the result of a single row operation within a batch target process.
/// </summary>
/// <remarks>
/// The SDK engine matches these results to the input rows by their index.
/// To support Error Output in Target components in DataFlow, the <see cref="ErrorMessage"/> field is marked with
/// a special display name metadata.
/// </remarks>
public class TargetResult {

/// <summary>
/// Contains the identifier of the record after a successful operation.
/// Could be null if the operation failed.
/// </summary>
public long? Id { get; set; }

/// <summary>
/// Contains the error details if the row processing failed.
/// </summary>
/// <remarks>
/// The <c>[Display("$$error$$")]</c> attribute is mandatory for the Skyvia engine
/// to recognize this field as the official error message and enable Error Output routing.
/// </remarks>
[Display("$$error$$")]
public string ErrorMessage { get; set; }
}


/// <summary>
/// Represents the result of a single insert operation.
/// </summary>
public class InsertResult {

public long Id { get; set; }
}

/// <summary>
/// Represents a product entity within the system.
/// This model is used for data exchange in Source, Lookup, and Action operations.
/// </summary>
public class Product {

public long Id { get; set; }
public string Title { get; set; }
public double Price { get; set; }
public string Category { get; set; }
}

/// <summary>
/// Represents a set of optional filters used for searching products.
/// </summary>
/// <remarks>
/// If a property is null, the corresponding filter is ignored during the search.
/// Combining multiple properties results in a logical AND operation.
/// </remarks>
public class SearchProductsRequest {

public long? Id { get; set; }
public string Title { get; set; }
public string Category { get; set; }
public double? MinPrice { get; set; }
public double? MaxPrice { get; set; }
}

/// <summary>
/// Represents the set of parameters required to create a new product.
/// </summary>
public class InsertProductParameter {

[Required]
public string Title { get; set; }

[Required]
public string Category { get; set; }

[Required]
public double Price { get; set; }
}

/// <summary>
/// Represents the parameters required to update an existing product record.
/// </summary>
public class ProductUpdateParameter {

[Required]
public long ProductId { get; set; }

public string Title { get; set; }
public string Category { get; set; }
public double? Price { get; set; }
}

/// <summary>
/// Represents the parameters required to delete a specific product.
/// </summary>
public class DeleteProductParameter {

[Required]
public long ProductId { get; set; }
}


/// <summary>
/// Represents a cart entity within the system.
/// This model is used for data exchange in Source, Lookup, and Action operations.
/// </summary>
public class Cart {

public long Id { get; set; }
public long UserId { get; set; }
public DateTime Date { get; set; }
public List<CartProduct> Products { get; set; }
}

/// <summary>
/// Represents an individual item entry within a cart.
/// </summary>
public class CartProduct {

public long ProductId { get; set; }
public int Quantity { get; set; }
}


/// <summary>
/// Represents a set of optional filters used for searching carts.
/// </summary>
/// <remarks>
/// If a property is null, the corresponding filter is ignored during the search.
/// Combining multiple properties results in a logical AND operation.
/// </remarks>
public class SearchCartsRequest {

public long? CartId { get; set; }
public long? UserId { get; set; }
}

/// <summary>
/// Represents the set of parameters required to create a new cart.
/// </summary>
public class InsertCartParameter {

[Required]
public long UserId { get; set; }

[Required]
public List<CartProduct> Products { get; set; }
}

/// <summary>
/// Represents the parameters required to update an existing cart record.
/// </summary>
public class UpdateCartParameter {

[Required]
public long CartId { get; set; }

[Required]
public long UserId { get; set; }

[Required]
public List<CartProduct> Products { get; set; }
}

/// <summary>
/// Represents the parameters required to delete a specific cart.
/// </summary>
public class DeleteCartParameter {

[Required]
public long CartId { get; set; }
}
#endregion
}
}