Repository: PrefectHQ/prefect
Issue category: Feature Request

Issue:
`client/orchestration.py/update_deployment_schedule` should be update with `active` and `schedule` at once
### First check

- [X] I added a descriptive title to this issue.
- [X] I used the GitHub search to find a similar request and didn't find it.
- [X] I searched the Prefect documentation for this feature.

### Prefect Version

2.x

### Describe the current behavior

I am trying to change the schedule of a deployment from an external service (a client service I am creating). I am trying to update the cron using this function, but the behavior is different from what I expected, so I would like to confirm.
In this function, lines 1953 to 1956 are written as follows:
https://github.com/PrefectHQ/prefect/blob/1d1499a900fb4a68029a0c206b43140b0703a1b6/src/prefect/client/orchestration.py#L1953-L1956

### Describe the proposed behavior

It's should be following:

```python
if active is not None:
    kwargs["active"] = active

if schedule is not None:
    kwargs["schedule"] = schedule
```

### Example Use


```python
import asyncio
from prefect.client.orchestration import PrefectClient
from prefect.client.schemas.schedules import construct_schedule

async def updateDeploymentSchedule():
    client = PrefectClient(api="http://127.0.0.1:4200/api")
    target_deployment = await client.read_deployment_by_name("foo/bar")
    schedule_id = target_deployment.schedules[0].id
    cron =construct_schedule(cron="0 5 * * *",timezone="Asia/Tokyo") 
    _ = await client.update_deployment_schedule(deployment_id=target_deployment.id, schedule_id=schedule_id, schedule=cron, active=True)

if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    loop.run_until_complete(updateDeploymentSchedule())
```

### Additional context

I mentioned about this issue in [slack channnel](https://prefect-community.slack.com/archives/CL09KU1K7/p1714642952657639)


Hints:

Patch:
diff --git a/src/prefect/client/orchestration.py b/src/prefect/client/orchestration.py
index 2e4334ba4bfe..53aa8bc5bf9a 100644
--- a/src/prefect/client/orchestration.py
+++ b/src/prefect/client/orchestration.py
@@ -1958,7 +1958,7 @@ async def update_deployment_schedule(
         kwargs = {}
         if active is not None:
             kwargs["active"] = active
-        elif schedule is not None:
+        if schedule is not None:
             kwargs["schedule"] = schedule
 
         deployment_schedule_update = DeploymentScheduleUpdate(**kwargs)


Test patch:
diff --git a/tests/client/test_prefect_client.py b/tests/client/test_prefect_client.py
index 4d13d6de0e12..203ec7a19216 100644
--- a/tests/client/test_prefect_client.py
+++ b/tests/client/test_prefect_client.py
@@ -2416,7 +2416,12 @@ async def test_read_deployment_schedules_success(self, prefect_client, deploymen
         )
         assert result[0].active is True
 
-    async def test_update_deployment_schedule_success(self, deployment, prefect_client):
+    async def test_update_deployment_schedule_only_active(
+        self, deployment, prefect_client
+    ):
+        result = await prefect_client.read_deployment_schedules(deployment.id)
+        assert result[0].active is True
+
         await prefect_client.update_deployment_schedule(
             deployment.id, deployment.schedules[0].id, active=False
         )
@@ -2425,6 +2430,48 @@ async def test_update_deployment_schedule_success(self, deployment, prefect_clie
         assert len(result) == 1
         assert result[0].active is False
 
+    async def test_update_deployment_schedule_only_schedule(
+        self, deployment, prefect_client
+    ):
+        result = await prefect_client.read_deployment_schedules(deployment.id)
+        assert result[0].schedule == IntervalSchedule(
+            interval=timedelta(days=1), anchor_date=pendulum.datetime(2020, 1, 1)
+        )
+
+        await prefect_client.update_deployment_schedule(
+            deployment.id,
+            deployment.schedules[0].id,
+            schedule=IntervalSchedule(interval=timedelta(minutes=15)),
+        )
+
+        result = await prefect_client.read_deployment_schedules(deployment.id)
+        assert len(result) == 1
+        assert result[0].schedule.interval == timedelta(minutes=15)
+
+    async def test_update_deployment_schedule_all_fields(
+        self, deployment, prefect_client
+    ):
+        """
+        A regression test for #13243
+        """
+        result = await prefect_client.read_deployment_schedules(deployment.id)
+        assert result[0].schedule == IntervalSchedule(
+            interval=timedelta(days=1), anchor_date=pendulum.datetime(2020, 1, 1)
+        )
+        assert result[0].active is True
+
+        await prefect_client.update_deployment_schedule(
+            deployment.id,
+            deployment.schedules[0].id,
+            schedule=IntervalSchedule(interval=timedelta(minutes=15)),
+            active=False,
+        )
+
+        result = await prefect_client.read_deployment_schedules(deployment.id)
+        assert len(result) == 1
+        assert result[0].schedule.interval == timedelta(minutes=15)
+        assert result[0].active is False
+
     async def test_delete_deployment_schedule_success(self, deployment, prefect_client):
         await prefect_client.delete_deployment_schedule(
             deployment.id, deployment.schedules[0].id