Skip to content

Commit

Permalink
FIX: consistand id type
Browse files Browse the repository at this point in the history
  • Loading branch information
gosticks committed Jan 28, 2019
1 parent 8ab33ab commit e41b152
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
13 changes: 7 additions & 6 deletions time_enties.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"net/http"
"strconv"
"time"
)

Expand Down Expand Up @@ -96,9 +97,9 @@ func (m *Mite) GetTimeEntriesForProjectByService(from, to time.Time, projectID u
return m.GetTimeEntriesGroup(from, to, params)
}

func (m *Mite) GetTimeEntry(id string) (*TimeEntry, error) {
func (m *Mite) GetTimeEntry(id uint64) (*TimeEntry, error) {
var timeResp *GetTimeEntryResponseWrapper
err := m.getAndDecodeFromSuffix("time_entry/"+id+".json", &timeResp, nil)
err := m.getAndDecodeFromSuffix("time_entry/"+strconv.FormatUint(id, 10)+".json", &timeResp, nil)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -133,11 +134,11 @@ func (m *Mite) CreateTimeEntry(entry *TimeEntry) (*TimeEntry, error) {
// -------------------------------------------------------------
// ~ Update
// -------------------------------------------------------------
func (m *Mite) UpdateTimeEntry(id string, update *TimeEntry) error {
func (m *Mite) UpdateTimeEntry(id uint64, update *TimeEntry) error {
// Wrap time entry
wrap := &GetTimeEntryResponseWrapper{TimeEntry: update}

resp, errRequest := m.patchAtMite("/time_entry/"+id+".json", wrap)
resp, errRequest := m.patchAtMite("/time_entry/"+strconv.FormatUint(id, 10)+".json", wrap)
if errRequest != nil {
return errRequest
}
Expand All @@ -151,8 +152,8 @@ func (m *Mite) UpdateTimeEntry(id string, update *TimeEntry) error {
// ~ Delete
// -------------------------------------------------------------

func (m *Mite) DeleteTimeEntry(id string) error {
resp, errRequest := m.deleteFromMite("/time_entry/"+id+".json", nil)
func (m *Mite) DeleteTimeEntry(id uint64) error {
resp, errRequest := m.deleteFromMite("/time_entry/"+strconv.FormatUint(id, 10)+".json", nil)
if errRequest != nil {
return errRequest
}
Expand Down
5 changes: 3 additions & 2 deletions user.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package mite

import (
"fmt"
"strconv"
"time"
)

Expand Down Expand Up @@ -50,9 +51,9 @@ func (m *Mite) GetUsers() ([]*User, error) {
return users, nil
}

func (m *Mite) GetUser(id string) (*User, error) {
func (m *Mite) GetUser(id uint64) (*User, error) {
var resp *GetUsersResponseWrapper
err := m.getAndDecodeFromSuffix("users/"+id+".json", &resp, nil)
err := m.getAndDecodeFromSuffix("users/"+strconv.FormatUint(id, 10)+".json", &resp, nil)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit e41b152

Please sign in to comment.