Skip to content

incident_io_client.api.schedules_v2.schedules_v2_create

asyncio async

asyncio(
    *,
    client: Union[AuthenticatedClient, Client],
    body: SchedulesV2CreateRequestBody
) -> Optional[SchedulesV2CreateResponseBody]

Create Schedules V2

Create a new schedule.

Parameters:

Name Type Description Default
body SchedulesV2CreateRequestBody

Example: {'schedule': {'annotations': {'incident.io/terraform/version': 'version-of-terraform'}, 'config': {'rotations': [{'effective_from': '2021-08-17T13:28:57.801578Z', 'handover_start_at': '2021-08-17T13:28:57.801578Z', 'handovers': [{'interval': 1, 'interval_type': 'daily'}], 'id': '01G0J1EXE7AXZ2C93K61WBPYEH', 'layers': [{'id': '01G0J1EXE7AXZ2C93K61WBPYEH', 'name': 'Layer 1'}], 'name': 'My Rotation', 'users': [{'email': 'bob@example.com', 'id': '01G0J1EXE7AXZ2C93K61WBPYEH', 'slack_user_id': 'USER123'}], 'working_interval': [{'end_time': '17:00', 'start_time': '09:00', 'weekday': 'tuesday'}]}]}, 'holidays_public_config': {'country_codes': ['abc123']}, 'name': 'My Schedule', 'timezone': 'America/Los_Angeles'}}.

required

Raises:

Type Description
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:

Type Description
Optional[SchedulesV2CreateResponseBody]

SchedulesV2CreateResponseBody

Source code in incident_io_client/api/schedules_v2/schedules_v2_create.py
async def asyncio(
    *,
    client: Union[AuthenticatedClient, Client],
    body: SchedulesV2CreateRequestBody,
) -> Optional[SchedulesV2CreateResponseBody]:
    """Create Schedules V2

     Create a new schedule.

    Args:
        body (SchedulesV2CreateRequestBody):  Example: {'schedule': {'annotations':
            {'incident.io/terraform/version': 'version-of-terraform'}, 'config': {'rotations':
            [{'effective_from': '2021-08-17T13:28:57.801578Z', 'handover_start_at':
            '2021-08-17T13:28:57.801578Z', 'handovers': [{'interval': 1, 'interval_type': 'daily'}],
            'id': '01G0J1EXE7AXZ2C93K61WBPYEH', 'layers': [{'id': '01G0J1EXE7AXZ2C93K61WBPYEH',
            'name': 'Layer 1'}], 'name': 'My Rotation', 'users': [{'email': 'bob@example.com', 'id':
            '01G0J1EXE7AXZ2C93K61WBPYEH', 'slack_user_id': 'USER123'}], 'working_interval':
            [{'end_time': '17:00', 'start_time': '09:00', 'weekday': 'tuesday'}]}]},
            'holidays_public_config': {'country_codes': ['abc123']}, 'name': 'My Schedule',
            'timezone': 'America/Los_Angeles'}}.

    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:
        SchedulesV2CreateResponseBody
    """

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

asyncio_detailed async

asyncio_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
    body: SchedulesV2CreateRequestBody
) -> Response[SchedulesV2CreateResponseBody]

Create Schedules V2

Create a new schedule.

Parameters:

Name Type Description Default
body SchedulesV2CreateRequestBody

Example: {'schedule': {'annotations': {'incident.io/terraform/version': 'version-of-terraform'}, 'config': {'rotations': [{'effective_from': '2021-08-17T13:28:57.801578Z', 'handover_start_at': '2021-08-17T13:28:57.801578Z', 'handovers': [{'interval': 1, 'interval_type': 'daily'}], 'id': '01G0J1EXE7AXZ2C93K61WBPYEH', 'layers': [{'id': '01G0J1EXE7AXZ2C93K61WBPYEH', 'name': 'Layer 1'}], 'name': 'My Rotation', 'users': [{'email': 'bob@example.com', 'id': '01G0J1EXE7AXZ2C93K61WBPYEH', 'slack_user_id': 'USER123'}], 'working_interval': [{'end_time': '17:00', 'start_time': '09:00', 'weekday': 'tuesday'}]}]}, 'holidays_public_config': {'country_codes': ['abc123']}, 'name': 'My Schedule', 'timezone': 'America/Los_Angeles'}}.

required

Raises:

Type Description
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:

Type Description
Response[SchedulesV2CreateResponseBody]

Response[SchedulesV2CreateResponseBody]

Source code in incident_io_client/api/schedules_v2/schedules_v2_create.py
async def asyncio_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
    body: SchedulesV2CreateRequestBody,
) -> Response[SchedulesV2CreateResponseBody]:
    """Create Schedules V2

     Create a new schedule.

    Args:
        body (SchedulesV2CreateRequestBody):  Example: {'schedule': {'annotations':
            {'incident.io/terraform/version': 'version-of-terraform'}, 'config': {'rotations':
            [{'effective_from': '2021-08-17T13:28:57.801578Z', 'handover_start_at':
            '2021-08-17T13:28:57.801578Z', 'handovers': [{'interval': 1, 'interval_type': 'daily'}],
            'id': '01G0J1EXE7AXZ2C93K61WBPYEH', 'layers': [{'id': '01G0J1EXE7AXZ2C93K61WBPYEH',
            'name': 'Layer 1'}], 'name': 'My Rotation', 'users': [{'email': 'bob@example.com', 'id':
            '01G0J1EXE7AXZ2C93K61WBPYEH', 'slack_user_id': 'USER123'}], 'working_interval':
            [{'end_time': '17:00', 'start_time': '09:00', 'weekday': 'tuesday'}]}]},
            'holidays_public_config': {'country_codes': ['abc123']}, 'name': 'My Schedule',
            'timezone': 'America/Los_Angeles'}}.

    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[SchedulesV2CreateResponseBody]
    """

    kwargs = _get_kwargs(
        body=body,
    )

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

    return _build_response(client=client, response=response)

sync

sync(
    *,
    client: Union[AuthenticatedClient, Client],
    body: SchedulesV2CreateRequestBody
) -> Optional[SchedulesV2CreateResponseBody]

Create Schedules V2

Create a new schedule.

Parameters:

Name Type Description Default
body SchedulesV2CreateRequestBody

Example: {'schedule': {'annotations': {'incident.io/terraform/version': 'version-of-terraform'}, 'config': {'rotations': [{'effective_from': '2021-08-17T13:28:57.801578Z', 'handover_start_at': '2021-08-17T13:28:57.801578Z', 'handovers': [{'interval': 1, 'interval_type': 'daily'}], 'id': '01G0J1EXE7AXZ2C93K61WBPYEH', 'layers': [{'id': '01G0J1EXE7AXZ2C93K61WBPYEH', 'name': 'Layer 1'}], 'name': 'My Rotation', 'users': [{'email': 'bob@example.com', 'id': '01G0J1EXE7AXZ2C93K61WBPYEH', 'slack_user_id': 'USER123'}], 'working_interval': [{'end_time': '17:00', 'start_time': '09:00', 'weekday': 'tuesday'}]}]}, 'holidays_public_config': {'country_codes': ['abc123']}, 'name': 'My Schedule', 'timezone': 'America/Los_Angeles'}}.

required

Raises:

Type Description
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:

Type Description
Optional[SchedulesV2CreateResponseBody]

SchedulesV2CreateResponseBody

Source code in incident_io_client/api/schedules_v2/schedules_v2_create.py
def sync(
    *,
    client: Union[AuthenticatedClient, Client],
    body: SchedulesV2CreateRequestBody,
) -> Optional[SchedulesV2CreateResponseBody]:
    """Create Schedules V2

     Create a new schedule.

    Args:
        body (SchedulesV2CreateRequestBody):  Example: {'schedule': {'annotations':
            {'incident.io/terraform/version': 'version-of-terraform'}, 'config': {'rotations':
            [{'effective_from': '2021-08-17T13:28:57.801578Z', 'handover_start_at':
            '2021-08-17T13:28:57.801578Z', 'handovers': [{'interval': 1, 'interval_type': 'daily'}],
            'id': '01G0J1EXE7AXZ2C93K61WBPYEH', 'layers': [{'id': '01G0J1EXE7AXZ2C93K61WBPYEH',
            'name': 'Layer 1'}], 'name': 'My Rotation', 'users': [{'email': 'bob@example.com', 'id':
            '01G0J1EXE7AXZ2C93K61WBPYEH', 'slack_user_id': 'USER123'}], 'working_interval':
            [{'end_time': '17:00', 'start_time': '09:00', 'weekday': 'tuesday'}]}]},
            'holidays_public_config': {'country_codes': ['abc123']}, 'name': 'My Schedule',
            'timezone': 'America/Los_Angeles'}}.

    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:
        SchedulesV2CreateResponseBody
    """

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

sync_detailed

sync_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
    body: SchedulesV2CreateRequestBody
) -> Response[SchedulesV2CreateResponseBody]

Create Schedules V2

Create a new schedule.

Parameters:

Name Type Description Default
body SchedulesV2CreateRequestBody

Example: {'schedule': {'annotations': {'incident.io/terraform/version': 'version-of-terraform'}, 'config': {'rotations': [{'effective_from': '2021-08-17T13:28:57.801578Z', 'handover_start_at': '2021-08-17T13:28:57.801578Z', 'handovers': [{'interval': 1, 'interval_type': 'daily'}], 'id': '01G0J1EXE7AXZ2C93K61WBPYEH', 'layers': [{'id': '01G0J1EXE7AXZ2C93K61WBPYEH', 'name': 'Layer 1'}], 'name': 'My Rotation', 'users': [{'email': 'bob@example.com', 'id': '01G0J1EXE7AXZ2C93K61WBPYEH', 'slack_user_id': 'USER123'}], 'working_interval': [{'end_time': '17:00', 'start_time': '09:00', 'weekday': 'tuesday'}]}]}, 'holidays_public_config': {'country_codes': ['abc123']}, 'name': 'My Schedule', 'timezone': 'America/Los_Angeles'}}.

required

Raises:

Type Description
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:

Type Description
Response[SchedulesV2CreateResponseBody]

Response[SchedulesV2CreateResponseBody]

Source code in incident_io_client/api/schedules_v2/schedules_v2_create.py
def sync_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
    body: SchedulesV2CreateRequestBody,
) -> Response[SchedulesV2CreateResponseBody]:
    """Create Schedules V2

     Create a new schedule.

    Args:
        body (SchedulesV2CreateRequestBody):  Example: {'schedule': {'annotations':
            {'incident.io/terraform/version': 'version-of-terraform'}, 'config': {'rotations':
            [{'effective_from': '2021-08-17T13:28:57.801578Z', 'handover_start_at':
            '2021-08-17T13:28:57.801578Z', 'handovers': [{'interval': 1, 'interval_type': 'daily'}],
            'id': '01G0J1EXE7AXZ2C93K61WBPYEH', 'layers': [{'id': '01G0J1EXE7AXZ2C93K61WBPYEH',
            'name': 'Layer 1'}], 'name': 'My Rotation', 'users': [{'email': 'bob@example.com', 'id':
            '01G0J1EXE7AXZ2C93K61WBPYEH', 'slack_user_id': 'USER123'}], 'working_interval':
            [{'end_time': '17:00', 'start_time': '09:00', 'weekday': 'tuesday'}]}]},
            'holidays_public_config': {'country_codes': ['abc123']}, 'name': 'My Schedule',
            'timezone': 'America/Los_Angeles'}}.

    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[SchedulesV2CreateResponseBody]
    """

    kwargs = _get_kwargs(
        body=body,
    )

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

    return _build_response(client=client, response=response)