# Class PinAction (2.11.0)

2.11.0 (latest) 2.10.0 2.9.0 2.8.0 2.7.0 2.6.0 2.5.0 2.4.0 2.3.0 2.2.0 2.1.0 2.0.0 1.25.0 1.24.0 1.23.1 1.22.0 1.21.2 1.20.1 1.19.1 1.18.0 1.17.0 1.16.3 1.15.1 1.14.1 1.13.0 1.12.0 1.11.0 1.10.2 1.9.0 1.8.1 1.7.0 1.6.1 1.5.0 1.4.1 1.3.0 1.2.1 1.1.0 1.0.2 0.4.2 0.3.1 0.2.0 0.1.0

    PinAction(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Pins one or more specified products to a specific position in the
results.

- Rule Condition: Must specify non-empty
  Condition.query_terms
  (for search only) or
  Condition.page_categories
  (for browse only), but can't specify both.

- Action Input: mapping of `[pin_position, product_id]` pairs (pin
  position uses 1-based indexing).

- Action Result: Will pin products with matching ids to the position
  specified in the final result order.

Example: Suppose the query is `shoes`, the
Condition.query_terms
is `shoes` and the pin_map has `{1, "pid1"}`, then product with
`pid1` will be pinned to the top position in the final results.

If multiple PinActions are matched to a single request the actions
will be processed from most to least recently updated.

Pins to positions larger than the max allowed page size of 120 are
not allowed.

| ## Attribute ||
|---|---|
| **Name** | **Description** |
| `pin_map` | `MutableMapping[int, str]` Required. A map of positions to product_ids. Partial matches per action are allowed, if a certain position in the map is already filled that `[position, product_id]` pair will be ignored but the rest may still be applied. This case will only occur if multiple pin actions are matched to a single request, as the map guarantees that pin positions are unique within the same action. Duplicate product_ids are not permitted within a single pin map. The max size of this map is 120, equivalent to the max \`request page size |

## Classes

### PinMapEntry

    PinMapEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

The abstract base class for a message.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `kwargs` | `dict` Keys and values corresponding to the fields of the message. |
| `mapping` | ``Union[dict, `.Message`]`` A dictionary or message to be used to determine the values for this message. |
| `ignore_unknown_fields` | `Optional(bool)` If True, do not raise errors for unknown fields. Only applied if `mapping` is a mapping type or there are keyword parameters. |