# Product Lists

## Creates a new product list for a store, optionally including initial line items.

`ProductListCreateProductListResponse ProductLists.CreateProductList(ProductListCreateProductListParamsparameters, CancellationTokencancellationToken = default)`

**post** `/api/v2/public/stores/{store_number}/productlists`

Creates a new product list for a store, optionally including initial line items.

### Parameters

- `ProductListCreateProductListParams parameters`

  - `required string storeNumber`

    Path param: The store number to create the product list under.

  - `required string productListName`

    Body param: Name of the product list. Must contain only letters, numbers, spaces, dots, hyphens, or underscores.

  - `required Int productListType`

    Body param: Numeric product list type identifier. Ignored when `module_id` is supplied; the type is then resolved from the module.

  - `string appUsername`

    Query param: Name of the app user creating the product list. Defaults to "unknown" when omitted.

  - `IReadOnlyList<FreeField>? freeFields`

    Body param: Custom free-field key/value pairs to attach to the product list.

    - `string? Key`

      Free-field key.

    - `string? Value`

      Free-field value.

  - `Boolean? isAllowDuplicateProducts`

    Body param: When true (default), duplicate products may appear on multiple lines. When false, lines for the same product are merged and quantities are summed.

  - `IReadOnlyList<Line>? lines`

    Body param: Initial line items to add to the product list. May be empty; lines may be added later via the line-update endpoint.

    - `required string ProductNumber`

      Product number identifying which product the line refers to. Unknown product numbers are silently skipped.

    - `required Double Quantity`

      Quantity for the line. A value of 0 is treated as 1.

    - `string? Barcode`

      Ignored on input. The barcode stored on the line is sourced from the product master via `product_number`. Field retained for backwards compatibility.

  - `Int? moduleID`

    Body param: Optional module identifier. When set, the product list type is resolved from the module's configured type and `product_list_type` is ignored.

### Returns

- `class ProductListCreateProductListResponse:`

  Response returned after a product list is created. Contains the identifier of the new list.

  - `required Long ProductListID`

    Identifier of the newly created product list.

### Example

```csharp
ProductListCreateProductListParams parameters = new()
{
    StoreNumber = "store_number",
    ProductListName = "Produce",
    ProductListType = 1,
};

var response = await client.ProductLists.CreateProductList(parameters);

Console.WriteLine(response);
```

#### Response

```json
{
  "product_list_id": 0
}
```

## Retrieves a paginated list of product lists for a specific store, optionally including line items.

`ProductListListProductListsResponse ProductLists.ListProductLists(ProductListListProductListsParamsparameters, CancellationTokencancellationToken = default)`

**get** `/api/v2/public/stores/{store_number}/productlists`

Retrieves a paginated list of product lists for a specific store, optionally including line items.

### Parameters

- `ProductListListProductListsParams parameters`

  - `required string storeNumber`

    The store number.

  - `DateTimeOffset lastUpdatedOn`

    Filter product lists modified on or after this date.

  - `string name`

    Optional product list name filter.

  - `Long productListID`

    Optional product list identifier to filter by.

  - `Boolean showLines`

    When true, includes the line items for each product list.

  - `Int type`

    Optional product list type filter.

### Returns

- `class ProductListListProductListsResponse:`

  Generic paginated response wrapper.

  - `required Int PageSize`

    Maximum number of items returned per page.

  - `required Int PageStart`

    Current page number (1-based).

  - `required Long TotalCount`

    Total number of records matching the query across all pages.

  - `IReadOnlyList<List>? List`

    Collection of items for the current page.

    - `required Long ID`

      Unique identifier of the product list.

    - `required Int LineCount`

      Number of line items on the product list.

    - `required Int Type`

      Numeric product list type identifier.

    - `string? AppUsername`

      Name of the app user associated with the product list. Separate from the audit `created_by` / `modified_by` fields; this is the in-store app user the list belongs to.

    - `IReadOnlyList<FreeField>? FreeFields`

      Custom free-field key/value pairs associated with the product list.

      - `string? Key`

        Free-field key.

      - `string? Value`

        Free-field value.

    - `IReadOnlyList<Line>? Lines`

      Line items belonging to the product list. Only populated when `show_lines=true` is passed on the request.

      - `required Double Quantity`

        Quantity on the line.

      - `string? Barcode`

        The product barcode.

      - `string? CategoryCode`

        Category code of the product.

      - `Double? Colli`

        Number of items per colli (case pack).

      - `Boolean? IsDecimal`

        Whether decimal quantities are allowed for the product.

      - `string? ParentCategoryCode`

        Parent category code of the product.

      - `string? ProductName`

        Display name of the product.

      - `string? ProductNumber`

        The product number.

      - `string? StockPool`

        Stock pool the line targets.

      - `Int? StoreWalkingOrder`

        Order in which the product appears in the store walking sequence.

    - `DateTimeOffset? ModifiedOn`

      Date and time the product list was last modified.

    - `string? Name`

      Name of the product list.

    - `string? TypeDescription`

      Human-readable description of the product list type.

  - `IReadOnlyDictionary<string, JsonElement>? ListBody`

    Additional body-level metadata for the list.

  - `IReadOnlyDictionary<string, IReadOnlyList<string>>? ListFilters`

    Active filter criteria applied to the result set, keyed by field name.

  - `Int? NextPage`

    Next page number, or null when on the last page.

  - `Long? PreviousPage`

    Previous page number, or null when on the first page.

  - `string? ProjectLastModifiedDate`

    Last modified date/time of the project.

  - `string? ScrollID`

    Opaque scroll identifier for deep-pagination scenarios.

  - `string? ServerTime`

    Server UTC date/time when the response was generated.

  - `string? SortColumn`

    Column name the results are sorted by.

  - `string? SortOrder`

    Sort direction (asc or desc).

  - `string? TaskLastModifiedDate`

    Last modified date/time of the task.

### Example

```csharp
ProductListListProductListsParams parameters = new()
{
    StoreNumber = "store_number"
};

var response = await client.ProductLists.ListProductLists(parameters);

Console.WriteLine(response);
```

#### Response

```json
{
  "page_size": 0,
  "page_start": 0,
  "total_count": 0,
  "list": [
    {
      "id": 0,
      "line_count": 0,
      "type": 0,
      "app_username": "app_username",
      "free_fields": [
        {
          "key": "key",
          "value": "value"
        }
      ],
      "lines": [
        {
          "quantity": 0,
          "barcode": "barcode",
          "category_code": "category_code",
          "colli": 0,
          "is_decimal": true,
          "parent_category_code": "parent_category_code",
          "product_name": "product_name",
          "product_number": "product_number",
          "stock_pool": "stock_pool",
          "store_walking_order": 0
        }
      ],
      "modified_on": "2019-12-27T18:11:19.117Z",
      "name": "name",
      "type_description": "type_description"
    }
  ],
  "list_body": {
    "foo": "bar"
  },
  "list_filters": {
    "foo": [
      "string"
    ]
  },
  "next_page": 0,
  "previous_page": 0,
  "project_last_modified_date": "project_last_modified_date",
  "scroll_id": "scroll_id",
  "server_time": "server_time",
  "sort_column": "sort_column",
  "sort_order": "sort_order",
  "task_last_modified_date": "task_last_modified_date"
}
```

## Deletes a product list by id, optionally archiving it or removing only its header.

`Boolean ProductLists.DeleteProductList(ProductListDeleteProductListParamsparameters, CancellationTokencancellationToken = default)`

**delete** `/api/v2/public/stores/{store_number}/productlists`

Deletes a product list by id, optionally archiving it or removing only its header.

### Parameters

- `ProductListDeleteProductListParams parameters`

  - `required string storeNumber`

    Path param: The store number.

  - `required Long productListID`

    Query param: The product list identifier to delete.

  - `Boolean isArchived`

    Query param: When true, archives the product list instead of permanently deleting it.

  - `Boolean isDeleteHeader`

    Query param: When true, deletes only the product list header (and its lines).

  - `string acceptLanguage`

    Header param

  - `string apiKey`

    Header param

### Example

```csharp
ProductListDeleteProductListParams parameters = new()
{
    StoreNumber = "store_number",
    ProductListID = 0,
};

var response = await client.ProductLists.DeleteProductList(parameters);

Console.WriteLine(response);
```

#### Response

```json
true
```

## Adds or updates lines on an existing product list.

`ProductListUpdateProductListLinesResponse ProductLists.UpdateProductListLines(ProductListUpdateProductListLinesParamsparameters, CancellationTokencancellationToken = default)`

**post** `/api/v2/public/stores/{store_number}/productlists/{id}`

Adds or updates lines on an existing product list.

### Parameters

- `ProductListUpdateProductListLinesParams parameters`

  - `required string storeNumber`

    Path param: The store number.

  - `required Long id`

    Path param: The product list identifier to update.

  - `IReadOnlyList<Line>? lines`

    Body param: The product list lines to add or update.

    - `required Double Quantity`

      Quantity on the line.

    - `string? ArticleNo`

      Deprecated. Use `product_number` instead. Still accepted on input for backwards compatibility.

    - `string? Barcode`

      The product barcode.

    - `string? ProductNumber`

      Product number identifying the line item.

    - `string? StockPool`

      Stock pool the line targets.

  - `string apiKey`

    Header param

### Returns

- `class ProductListUpdateProductListLinesResponse:`

  - `Int? Code`

  - `string? Data`

  - `string? Message`

  - `string? Status`

### Example

```csharp
ProductListUpdateProductListLinesParams parameters = new()
{
    StoreNumber = "store_number",
    ID = 0,
};

var response = await client.ProductLists.UpdateProductListLines(parameters);

Console.WriteLine(response);
```

#### Response

```json
{
  "code": 0,
  "data": "data",
  "message": "message",
  "status": "status"
}
```
