Skip to content

katana_public_api_client.api.variant.create_variant

katana_public_api_client.api.variant.create_variant

Classes

Functions

asyncio(*, client, body) async

Create a variant

Creates a new variant object. Note that you can create variants for both products and materials. In order for Katana to know which one you are creating, you have to specify either product_id or material_id, not both.

Parameters:

  • body (CreateVariantRequest) –

    Request payload for creating a new product or material variant with specific SKU and configuration attributes Example: {'sku': 'KNF-PRO-12PC-WD', 'sales_price': 399.99, 'purchase_price': 200.0, 'product_id': 101, 'material_id': None, 'supplier_item_codes': ['SUP-KNF-12PC-002'], 'internal_barcode': 'INT-KNF-002', 'registered_barcode': '789123456790', 'lead_time': 10, 'minimum_order_quantity': 1, 'config_attributes': [{'config_name': 'Piece Count', 'config_value': '12-piece'}, {'config_name': 'Handle Material', 'config_value': 'Wood'}], 'custom_fields': [{'field_name': 'Warranty Period', 'field_value': '5 years'}, {'field_name': 'Care Instructions', 'field_value': 'Hand wash only'}]}.

Raises:

  • UnexpectedStatus

    If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

  • TimeoutException

    If the request takes longer than Client.timeout.

Returns:

Source code in katana_public_api_client/api/variant/create_variant.py
async def asyncio(
    *,
    client: AuthenticatedClient | Client,
    body: CreateVariantRequest,
) -> DetailedErrorResponse | ErrorResponse | Variant | None:
    """Create a variant

     Creates a new variant object. Note that you can create variants for both products and materials.
        In order for Katana to know which one you are creating,
        you have to specify either product_id or material_id, not both.

    Args:
        body (CreateVariantRequest): Request payload for creating a new product or material
            variant with specific SKU and configuration attributes
             Example: {'sku': 'KNF-PRO-12PC-WD', 'sales_price': 399.99, 'purchase_price': 200.0,
            'product_id': 101, 'material_id': None, 'supplier_item_codes': ['SUP-KNF-12PC-002'],
            'internal_barcode': 'INT-KNF-002', 'registered_barcode': '789123456790', 'lead_time': 10,
            'minimum_order_quantity': 1, 'config_attributes': [{'config_name': 'Piece Count',
            'config_value': '12-piece'}, {'config_name': 'Handle Material', 'config_value': 'Wood'}],
            'custom_fields': [{'field_name': 'Warranty Period', 'field_value': '5 years'},
            {'field_name': 'Care Instructions', 'field_value': 'Hand wash only'}]}.

    Raises:
        errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
        httpx.TimeoutException: If the request takes longer than Client.timeout.


    Returns:
        Union[DetailedErrorResponse, ErrorResponse, Variant]
    """

    return (
        await asyncio_detailed(
            client=client,
            body=body,
        )
    ).parsed

asyncio_detailed(*, client, body) async

Create a variant

Creates a new variant object. Note that you can create variants for both products and materials. In order for Katana to know which one you are creating, you have to specify either product_id or material_id, not both.

Parameters:

  • body (CreateVariantRequest) –

    Request payload for creating a new product or material variant with specific SKU and configuration attributes Example: {'sku': 'KNF-PRO-12PC-WD', 'sales_price': 399.99, 'purchase_price': 200.0, 'product_id': 101, 'material_id': None, 'supplier_item_codes': ['SUP-KNF-12PC-002'], 'internal_barcode': 'INT-KNF-002', 'registered_barcode': '789123456790', 'lead_time': 10, 'minimum_order_quantity': 1, 'config_attributes': [{'config_name': 'Piece Count', 'config_value': '12-piece'}, {'config_name': 'Handle Material', 'config_value': 'Wood'}], 'custom_fields': [{'field_name': 'Warranty Period', 'field_value': '5 years'}, {'field_name': 'Care Instructions', 'field_value': 'Hand wash only'}]}.

Raises:

  • UnexpectedStatus

    If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

  • TimeoutException

    If the request takes longer than Client.timeout.

Returns:

Source code in katana_public_api_client/api/variant/create_variant.py
async def asyncio_detailed(
    *,
    client: AuthenticatedClient | Client,
    body: CreateVariantRequest,
) -> Response[DetailedErrorResponse | ErrorResponse | Variant]:
    """Create a variant

     Creates a new variant object. Note that you can create variants for both products and materials.
        In order for Katana to know which one you are creating,
        you have to specify either product_id or material_id, not both.

    Args:
        body (CreateVariantRequest): Request payload for creating a new product or material
            variant with specific SKU and configuration attributes
             Example: {'sku': 'KNF-PRO-12PC-WD', 'sales_price': 399.99, 'purchase_price': 200.0,
            'product_id': 101, 'material_id': None, 'supplier_item_codes': ['SUP-KNF-12PC-002'],
            'internal_barcode': 'INT-KNF-002', 'registered_barcode': '789123456790', 'lead_time': 10,
            'minimum_order_quantity': 1, 'config_attributes': [{'config_name': 'Piece Count',
            'config_value': '12-piece'}, {'config_name': 'Handle Material', 'config_value': 'Wood'}],
            'custom_fields': [{'field_name': 'Warranty Period', 'field_value': '5 years'},
            {'field_name': 'Care Instructions', 'field_value': 'Hand wash only'}]}.

    Raises:
        errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
        httpx.TimeoutException: If the request takes longer than Client.timeout.


    Returns:
        Response[Union[DetailedErrorResponse, ErrorResponse, Variant]]
    """

    kwargs = _get_kwargs(
        body=body,
    )

    response = await client.get_async_httpx_client().request(**kwargs)

    return _build_response(client=client, response=response)

sync(*, client, body)

Create a variant

Creates a new variant object. Note that you can create variants for both products and materials. In order for Katana to know which one you are creating, you have to specify either product_id or material_id, not both.

Parameters:

  • body (CreateVariantRequest) –

    Request payload for creating a new product or material variant with specific SKU and configuration attributes Example: {'sku': 'KNF-PRO-12PC-WD', 'sales_price': 399.99, 'purchase_price': 200.0, 'product_id': 101, 'material_id': None, 'supplier_item_codes': ['SUP-KNF-12PC-002'], 'internal_barcode': 'INT-KNF-002', 'registered_barcode': '789123456790', 'lead_time': 10, 'minimum_order_quantity': 1, 'config_attributes': [{'config_name': 'Piece Count', 'config_value': '12-piece'}, {'config_name': 'Handle Material', 'config_value': 'Wood'}], 'custom_fields': [{'field_name': 'Warranty Period', 'field_value': '5 years'}, {'field_name': 'Care Instructions', 'field_value': 'Hand wash only'}]}.

Raises:

  • UnexpectedStatus

    If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

  • TimeoutException

    If the request takes longer than Client.timeout.

Returns:

Source code in katana_public_api_client/api/variant/create_variant.py
def sync(
    *,
    client: AuthenticatedClient | Client,
    body: CreateVariantRequest,
) -> DetailedErrorResponse | ErrorResponse | Variant | None:
    """Create a variant

     Creates a new variant object. Note that you can create variants for both products and materials.
        In order for Katana to know which one you are creating,
        you have to specify either product_id or material_id, not both.

    Args:
        body (CreateVariantRequest): Request payload for creating a new product or material
            variant with specific SKU and configuration attributes
             Example: {'sku': 'KNF-PRO-12PC-WD', 'sales_price': 399.99, 'purchase_price': 200.0,
            'product_id': 101, 'material_id': None, 'supplier_item_codes': ['SUP-KNF-12PC-002'],
            'internal_barcode': 'INT-KNF-002', 'registered_barcode': '789123456790', 'lead_time': 10,
            'minimum_order_quantity': 1, 'config_attributes': [{'config_name': 'Piece Count',
            'config_value': '12-piece'}, {'config_name': 'Handle Material', 'config_value': 'Wood'}],
            'custom_fields': [{'field_name': 'Warranty Period', 'field_value': '5 years'},
            {'field_name': 'Care Instructions', 'field_value': 'Hand wash only'}]}.

    Raises:
        errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
        httpx.TimeoutException: If the request takes longer than Client.timeout.


    Returns:
        Union[DetailedErrorResponse, ErrorResponse, Variant]
    """

    return sync_detailed(
        client=client,
        body=body,
    ).parsed

sync_detailed(*, client, body)

Create a variant

Creates a new variant object. Note that you can create variants for both products and materials. In order for Katana to know which one you are creating, you have to specify either product_id or material_id, not both.

Parameters:

  • body (CreateVariantRequest) –

    Request payload for creating a new product or material variant with specific SKU and configuration attributes Example: {'sku': 'KNF-PRO-12PC-WD', 'sales_price': 399.99, 'purchase_price': 200.0, 'product_id': 101, 'material_id': None, 'supplier_item_codes': ['SUP-KNF-12PC-002'], 'internal_barcode': 'INT-KNF-002', 'registered_barcode': '789123456790', 'lead_time': 10, 'minimum_order_quantity': 1, 'config_attributes': [{'config_name': 'Piece Count', 'config_value': '12-piece'}, {'config_name': 'Handle Material', 'config_value': 'Wood'}], 'custom_fields': [{'field_name': 'Warranty Period', 'field_value': '5 years'}, {'field_name': 'Care Instructions', 'field_value': 'Hand wash only'}]}.

Raises:

  • UnexpectedStatus

    If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

  • TimeoutException

    If the request takes longer than Client.timeout.

Returns:

Source code in katana_public_api_client/api/variant/create_variant.py
def sync_detailed(
    *,
    client: AuthenticatedClient | Client,
    body: CreateVariantRequest,
) -> Response[DetailedErrorResponse | ErrorResponse | Variant]:
    """Create a variant

     Creates a new variant object. Note that you can create variants for both products and materials.
        In order for Katana to know which one you are creating,
        you have to specify either product_id or material_id, not both.

    Args:
        body (CreateVariantRequest): Request payload for creating a new product or material
            variant with specific SKU and configuration attributes
             Example: {'sku': 'KNF-PRO-12PC-WD', 'sales_price': 399.99, 'purchase_price': 200.0,
            'product_id': 101, 'material_id': None, 'supplier_item_codes': ['SUP-KNF-12PC-002'],
            'internal_barcode': 'INT-KNF-002', 'registered_barcode': '789123456790', 'lead_time': 10,
            'minimum_order_quantity': 1, 'config_attributes': [{'config_name': 'Piece Count',
            'config_value': '12-piece'}, {'config_name': 'Handle Material', 'config_value': 'Wood'}],
            'custom_fields': [{'field_name': 'Warranty Period', 'field_value': '5 years'},
            {'field_name': 'Care Instructions', 'field_value': 'Hand wash only'}]}.

    Raises:
        errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
        httpx.TimeoutException: If the request takes longer than Client.timeout.


    Returns:
        Response[Union[DetailedErrorResponse, ErrorResponse, Variant]]
    """

    kwargs = _get_kwargs(
        body=body,
    )

    response = client.get_httpx_client().request(
        **kwargs,
    )

    return _build_response(client=client, response=response)