Skip to content

Commit

Permalink
Omit empty Status.Room on Appointment update (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
willfitze authored Dec 14, 2023
1 parent 0f5c3b8 commit 1bd2b6e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions appointment.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,15 @@ func (s *AppointmentService) Get(ctx context.Context, id int64) (*Appointment, *
}

type AppointmentUpdate struct {
Duration *int `json:"duration,omitempty"`
TelehealthDetails *string `json:"telehealth_details,omitempty"`
Instructions *string `json:"instructions,omitempty"`
Status *AppointmentStatus `json:"status,omitempty"`
Duration *int `json:"duration,omitempty"`
TelehealthDetails *string `json:"telehealth_details,omitempty"`
Instructions *string `json:"instructions,omitempty"`
Status *AppointmentUpdateStatus `json:"status,omitempty"`
}

type AppointmentUpdateStatus struct {
Status string `json:"status"` // Required
Room string `json:"room,omitempty"` // Optional
}

func (s *AppointmentService) Update(ctx context.Context, id int64, update *AppointmentUpdate) (*Appointment, *http.Response, error) {
Expand Down
2 changes: 1 addition & 1 deletion appointment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func TestAppointmentService_Update(t *testing.T) {
Duration: Ptr(30),
TelehealthDetails: Ptr("telehealth details"),
Instructions: Ptr("instructions"),
Status: &AppointmentStatus{
Status: &AppointmentUpdateStatus{
Status: "Confirmed",
Room: "Room 1",
},
Expand Down

0 comments on commit 1bd2b6e

Please sign in to comment.