From db02b2dfd3ee041e6c3e6c2bfe9b2f8260a18b6c Mon Sep 17 00:00:00 2001 From: Kristof Daja Date: Tue, 19 May 2020 03:15:29 +0200 Subject: [PATCH] RequestService refactored Removed the redundant "Request" suffix from function names --- auth.go | 4 ++-- common.functions.go | 4 ++-- epics.go | 16 ++++++++-------- issues.go | 2 +- milestones.go | 10 +++++----- projects.go | 12 ++++++------ requests.go | 36 ++++++++++++++++++------------------ resolver.go | 2 +- stats.go | 4 ++-- tasks.go | 8 ++++---- user_stories.go | 12 ++++++------ users.go | 16 ++++++++-------- webhooks.go | 18 +++++++++--------- 13 files changed, 72 insertions(+), 72 deletions(-) diff --git a/auth.go b/auth.go index 91be505..5e26ede 100644 --- a/auth.go +++ b/auth.go @@ -18,7 +18,7 @@ func (s *AuthService) PublicRegistry(credentials *Credentials) (*UserAuthenticat credentials.Type = "public" credentials.AcceptedTerms = true // Hardcoded for simplicity; otherwise this func would be useless - err := s.client.Request.PostRequest(url, &credentials, &response) + err := s.client.Request.Post(url, &credentials, &response) if err != nil { return nil, err } @@ -35,7 +35,7 @@ func (s *AuthService) login(credentials *Credentials) (*UserAuthenticationDetail url := s.client.APIURL + endpointAuth response := UserAuthenticationDetail{} - err := s.client.Request.PostRequest(url, &credentials, &response) + err := s.client.Request.Post(url, &credentials, &response) if err != nil { log.Println("Failed to authenticate to Taiga.") return nil, err diff --git a/common.functions.go b/common.functions.go index 1fd17a1..7af01d9 100644 --- a/common.functions.go +++ b/common.functions.go @@ -19,7 +19,7 @@ func listAttachmentsForEndpoint(c *Client, queryParams *attachmentsQueryParams) url := c.APIURL + queryParams.endpointURI + "/attachments?" + paramValues.Encode() var attachmentsList []Attachment - err := c.Request.GetRequest(url, &attachmentsList) + err := c.Request.Get(url, &attachmentsList) if err != nil { return nil, err } @@ -31,7 +31,7 @@ func getAttachmentForEndpoint(c *Client, attachment *Attachment, endpointURI str url := c.APIURL + endpointURI + fmt.Sprintf("/attachments/%d", attachment.ID) var a Attachment - err := c.Request.GetRequest(url, &a) + err := c.Request.Get(url, &a) if err != nil { return nil, err } diff --git a/epics.go b/epics.go index 984af83..a3d972f 100644 --- a/epics.go +++ b/epics.go @@ -28,7 +28,7 @@ func (s *EpicService) List(queryParams *EpicsQueryParams) ([]Epic, error) { url = url + s.client.GetDefaultProjectAsQueryParam() } var epics EpicDetailLIST - err := s.client.Request.GetRequest(url, &epics) + err := s.client.Request.Get(url, &epics) if err != nil { return nil, err } @@ -49,7 +49,7 @@ func (s *EpicService) Create(epic *Epic) (*Epic, error) { return nil, errors.New("A mandatory field(Project, Subject) is missing. See API documentataion") } - err := s.client.Request.PostRequest(url, &epic, &responseEpic) + err := s.client.Request.Post(url, &epic, &responseEpic) if err != nil { return nil, err } @@ -63,7 +63,7 @@ func (s *EpicService) Create(epic *Epic) (*Epic, error) { func (s *EpicService) Get(epicID int) (*Epic, error) { url := s.client.APIURL + fmt.Sprintf("%s/%d", endpointEpics, epicID) var e EpicDetailGET - err := s.client.Request.GetRequest(url, &e) + err := s.client.Request.Get(url, &e) if err != nil { return nil, err } @@ -95,7 +95,7 @@ func (s *EpicService) GetByRef(epicRef int, project *Project) (*Epic, error) { return nil, errors.New("No ID or Ref defined in passed project struct") } - err := s.client.Request.GetRequest(url, &e) + err := s.client.Request.Get(url, &e) if err != nil { return nil, err } @@ -118,7 +118,7 @@ func (s *EpicService) Edit(epic *Epic) (*Epic, error) { return nil, err } epic.Version = remoteEpic.Version - err = s.client.Request.PatchRequest(url, &epic, &responseEpic) + err = s.client.Request.Patch(url, &epic, &responseEpic) if err != nil { return nil, err } @@ -128,7 +128,7 @@ func (s *EpicService) Edit(epic *Epic) (*Epic, error) { // Delete => https://taigaio.github.io/taiga-doc/dist/api.html#epics-delete func (s *EpicService) Delete(epicID int) error { url := s.client.APIURL + fmt.Sprintf("%s/%d", endpointEpics, epicID) - return s.client.Request.DeleteRequest(url) + return s.client.Request.Delete(url) } // BulkCreation => https://taigaio.github.io/taiga-doc/dist/api.html#epics-bulk-create @@ -149,7 +149,7 @@ It seems to be pointless to implement this operation here. A for loop around `Cr func (s *EpicService) ListRelatedUserStories(epicID int) ([]EpicRelatedUserStoryDetail, error) { url := s.client.APIURL + fmt.Sprintf("%s/%d/related_userstories", endpointEpics, epicID) var responseEpic []EpicRelatedUserStoryDetail - err := s.client.Request.GetRequest(url, &responseEpic) + err := s.client.Request.Get(url, &responseEpic) if err != nil { return nil, err } @@ -165,7 +165,7 @@ func (s *EpicService) CreateRelatedUserStory(EpicID int, UserStoryID int) (*Epic e := EpicRelatedUserStoryDetail{EpicID: EpicID, UserStoryID: UserStoryID} - err := s.client.Request.PostRequest(url, &e, &e) + err := s.client.Request.Post(url, &e, &e) if err != nil { return nil, err } diff --git a/issues.go b/issues.go index 0e8db09..1ba4128 100644 --- a/issues.go +++ b/issues.go @@ -25,7 +25,7 @@ func (s *IssueService) List(queryParams *IssueQueryParams) ([]Issue, error) { } // execute requests var issues IssueDetailLIST - err := s.client.Request.GetRequest(url, &issues) + err := s.client.Request.Get(url, &issues) if err != nil { return nil, err } diff --git a/milestones.go b/milestones.go index 8ac0693..092eea4 100644 --- a/milestones.go +++ b/milestones.go @@ -28,7 +28,7 @@ func (s *MilestoneService) List(queryParams *MilestonesQueryParams) ([]Milestone } // execute requests var Milestones []Milestone - err := s.client.Request.GetRequest(url, &Milestones) + err := s.client.Request.Get(url, &Milestones) if err != nil { return nil, err } @@ -52,7 +52,7 @@ func (s *MilestoneService) Create(milestone *Milestone) (*Milestone, error) { return nil, errors.New("A mandatory field is missing. See API documentataion") } - err := s.client.Request.PostRequest(url, &milestone, &respMilestone) + err := s.client.Request.Post(url, &milestone, &respMilestone) if err != nil { return nil, err } @@ -64,7 +64,7 @@ func (s *MilestoneService) Create(milestone *Milestone) (*Milestone, error) { func (s *MilestoneService) Get(milestoneID int) (*Milestone, error) { url := s.client.APIURL + fmt.Sprintf("%s/%d", endpointMilestones, milestoneID) var m Milestone - err := s.client.Request.GetRequest(url, &m) + err := s.client.Request.Get(url, &m) if err != nil { return nil, err } @@ -81,7 +81,7 @@ func (s *MilestoneService) Edit(milestone *Milestone) (*Milestone, error) { return nil, errors.New("Passed Milestone does not have an ID yet. Does it exist?") } - err := s.client.Request.PatchRequest(url, &milestone, &M) + err := s.client.Request.Patch(url, &milestone, &M) if err != nil { return nil, err } @@ -91,7 +91,7 @@ func (s *MilestoneService) Edit(milestone *Milestone) (*Milestone, error) { // Delete => https://taigaio.github.io/taiga-doc/dist/api.html#milestones-delete func (s *MilestoneService) Delete(milestoneID int) error { url := s.client.APIURL + fmt.Sprintf("%s/%d", endpointMilestones, milestoneID) - return s.client.Request.DeleteRequest(url) + return s.client.Request.Delete(url) } // Stats diff --git a/projects.go b/projects.go index 3794112..dc1eb5d 100644 --- a/projects.go +++ b/projects.go @@ -48,7 +48,7 @@ func (s *ProjectService) List(queryParameters *ProjectsQueryParameters) (*Projec } var projects ProjectsList - err := s.client.Request.GetRequest(url, &projects) + err := s.client.Request.Get(url, &projects) if err != nil { return nil, err } @@ -66,7 +66,7 @@ func (s *ProjectService) Create(project *Project) (*Project, error) { return nil, errors.New("A mandatory field is missing. See API documentataion") } - err := s.client.Request.PostRequest(url, &project, &responseProject) + err := s.client.Request.Post(url, &project, &responseProject) if err != nil { return nil, err } @@ -78,7 +78,7 @@ func (s *ProjectService) Get(projectID int) (*Project, error) { url := s.client.APIURL + fmt.Sprintf("/%s/%d", endpointProjects, projectID) var responseProject ProjectDetail - err := s.client.Request.GetRequest(url, &responseProject) + err := s.client.Request.Get(url, &responseProject) if err != nil { return nil, err } @@ -90,7 +90,7 @@ func (s *ProjectService) GetBySlug(slug string) (*Project, error) { url := s.client.APIURL + fmt.Sprintf("/%s/by_slug?slug=%s", endpointProjects, slug) var p ProjectDetail - err := s.client.Request.GetRequest(url, &p) + err := s.client.Request.Get(url, &p) if err != nil { return nil, err } @@ -107,7 +107,7 @@ func (s *ProjectService) Edit(project *Project) (*Project, error) { return nil, errors.New("Passed Project does not have an ID yet. Does it exist?") } - err := s.client.Request.PatchRequest(url, &project, &projectDetail) + err := s.client.Request.Patch(url, &project, &projectDetail) if err != nil { return nil, err } @@ -117,5 +117,5 @@ func (s *ProjectService) Edit(project *Project) (*Project, error) { // Delete => https://taigaio.github.io/taiga-doc/dist/api.html#projects-delete func (s *ProjectService) Delete(projectID int) error { url := s.client.APIURL + fmt.Sprintf("%s/%d", endpointProjects, projectID) - return s.client.Request.DeleteRequest(url) + return s.client.Request.Delete(url) } diff --git a/requests.go b/requests.go index 2534171..110e923 100644 --- a/requests.go +++ b/requests.go @@ -47,47 +47,47 @@ func SuccessfulHTTPRequest(Response *http.Response) bool { return false } -// GetRequest a handler for composing a new HTTP GET request +// Get a handler for composing a new HTTP GET request // // * URL must be an absolute (full) URL to the desired endpoint // * ResponseBody must be a pointer to a struct representing the fields returned by Taiga -func (s *RequestService) GetRequest(URL string, ResponseBody interface{}) error { +func (s *RequestService) Get(URL string, ResponseBody interface{}) error { return newRawRequest("GET", s.client, ResponseBody, URL, nil) } -// HeadRequest a handler for composing a new HTTP HEAD request -func (s *RequestService) HeadRequest() { +// Head a handler for composing a new HTTP HEAD request +func (s *RequestService) Head() { panic("HEAD requests are not implemented") } -// PostRequest a handler for composing a new HTTP POST request +// Post a handler for composing a new HTTP POST request // // * URL must be an absolute (full) URL to the desired endpoint // * Payload must be a pointer to a complete struct which will be sent to Taiga // * ResponseBody must be a pointer to a struct representing the fields returned by Taiga -func (s *RequestService) PostRequest(URL string, Payload interface{}, ResponseBody interface{}) error { +func (s *RequestService) Post(URL string, Payload interface{}, ResponseBody interface{}) error { // NOTE: responseBody must always be a pointer otherwise we lose the response data! // New POST request return newRawRequest("POST", s.client, ResponseBody, URL, Payload) } -// PutRequest a handler for composing a new HTTP PUT request +// Put a handler for composing a new HTTP PUT request // // * URL must be an absolute (full) URL to the desired endpoint // * Payload must be a pointer to a complete struct which will be sent to Taiga // * ResponseBody must be a pointer to a struct representing the fields returned by Taiga -func (s *RequestService) PutRequest(URL string, Payload interface{}, ResponseBody interface{}) error { +func (s *RequestService) Put(URL string, Payload interface{}, ResponseBody interface{}) error { // NOTE: responseBody must always be a pointer otherwise we lose the response data! // New PUT request return newRawRequest("PUT", s.client, ResponseBody, URL, Payload) } -// PatchRequest a handler for composing a new HTTP PATCH request +// Patch a handler for composing a new HTTP PATCH request // // * URL must be an absolute (full) URL to the desired endpoint // * Payload must be a pointer to a complete struct which will be sent to Taiga // * ResponseBody must be a pointer to a struct representing the fields returned by Taiga -func (s *RequestService) PatchRequest(URL string, Payload interface{}, ResponseBody interface{}) error { +func (s *RequestService) Patch(URL string, Payload interface{}, ResponseBody interface{}) error { /* patchRequest is proto-function to keep the code DRY and write things only once patchRequest takes the following arguments: @@ -100,26 +100,26 @@ func (s *RequestService) PatchRequest(URL string, Payload interface{}, ResponseB return newRawRequest("PATCH", s.client, ResponseBody, URL, Payload) } -// DeleteRequest a handler for composing a new HTTP DELETE request +// Delete a handler for composing a new HTTP DELETE request // // * URL must be an absolute (full) URL to the desired endpoint -func (s *RequestService) DeleteRequest(URL string) error { +func (s *RequestService) Delete(URL string) error { // New DELETE request return newRawRequest("DELETE", s.client, nil, URL, nil) } -// ConnectRequest a handler for composing a new HTTP CONNECT request -func (s *RequestService) ConnectRequest() { +// Connect a handler for composing a new HTTP CONNECT request +func (s *RequestService) Connect() { panic("CONNECT requests are not implemented") } -// OptionsRequest a handler for composing a new HTTP OPTIONS request -func (s *RequestService) OptionsRequest() { +// Options a handler for composing a new HTTP OPTIONS request +func (s *RequestService) Options() { panic("OPTIONS requests are not implemented") } -// TraceRequest a handler for composing a new HTTP TRACE request -func (s *RequestService) TraceRequest() { +// Trace a handler for composing a new HTTP TRACE request +func (s *RequestService) Trace() { panic("TRACE requests are not implemented") } diff --git a/resolver.go b/resolver.go index a58be55..841eaca 100644 --- a/resolver.go +++ b/resolver.go @@ -78,7 +78,7 @@ func genericResolver(c *Client, queryParameters *ResolverQueryParams) (*Resolver paramValues, _ := query.Values(queryParameters) url := c.APIURL + resolverURI + "?" + paramValues.Encode() var respResolver Resolver - err := c.Request.GetRequest(url, &respResolver) + err := c.Request.Get(url, &respResolver) if err != nil { return nil, err } diff --git a/stats.go b/stats.go index 387f1b2..5a39fb7 100644 --- a/stats.go +++ b/stats.go @@ -12,7 +12,7 @@ type StatsService struct { func (s *StatsService) GetDiscoverStats() (*DiscoverStats, error) { url := s.client.Request.MakeURL(statsURI, "discover") var respDiscoverStats DiscoverStats - err := s.client.Request.GetRequest(url, &respDiscoverStats) + err := s.client.Request.Get(url, &respDiscoverStats) if err != nil { return nil, err } @@ -23,7 +23,7 @@ func (s *StatsService) GetDiscoverStats() (*DiscoverStats, error) { func (s *StatsService) GetSystemStats() (*SystemStats, error) { url := s.client.Request.MakeURL(statsURI, "system") var respSystemStats SystemStats - err := s.client.Request.GetRequest(url, &respSystemStats) + err := s.client.Request.Get(url, &respSystemStats) if err != nil { return nil, err } diff --git a/tasks.go b/tasks.go index 60e1e07..8869d75 100644 --- a/tasks.go +++ b/tasks.go @@ -28,7 +28,7 @@ func (s *TaskService) List(queryParameters *TasksQueryParams) ([]Task, error) { var taskDetailList TaskDetailLIST - err := s.client.Request.GetRequest(url, &taskDetailList) + err := s.client.Request.Get(url, &taskDetailList) if err != nil { return nil, err } @@ -47,7 +47,7 @@ func (s *TaskService) Create(task *Task) (*Task, error) { return nil, errors.New("A mandatory field is missing. See API documentataion") } - err := s.client.Request.PostRequest(url, &task, &responseTask) + err := s.client.Request.Post(url, &task, &responseTask) if err != nil { return nil, err } @@ -58,7 +58,7 @@ func (s *TaskService) Create(task *Task) (*Task, error) { func (s *TaskService) Get(task *Task) (*Task, error) { url := s.client.APIURL + fmt.Sprintf("%s/%d", endpointTasks, task.ID) var responseTask TaskDetailGET - err := s.client.Request.GetRequest(url, &responseTask) + err := s.client.Request.Get(url, &responseTask) if err != nil { return nil, err } @@ -77,7 +77,7 @@ func (s *TaskService) GetByRef(task *Task, project *Project) (*Task, error) { return nil, errors.New("No ID or Ref defined in passed project struct") } - err := s.client.Request.GetRequest(url, &respTask) + err := s.client.Request.Get(url, &respTask) if err != nil { return nil, err } diff --git a/user_stories.go b/user_stories.go index 6fd98b5..550e902 100644 --- a/user_stories.go +++ b/user_stories.go @@ -27,7 +27,7 @@ func (s *UserStoryService) List(queryParameters *UserStoryQueryParams) ([]UserSt url = url + s.client.GetDefaultProjectAsQueryParam() } var UserStoryDetailList UserStoryDetailLIST - err := s.client.Request.GetRequest(url, &UserStoryDetailList) + err := s.client.Request.Get(url, &UserStoryDetailList) if err != nil { return nil, err } @@ -47,7 +47,7 @@ func (s *UserStoryService) Create(userStory *UserStory) (*UserStory, error) { return nil, errors.New("A mandatory field is missing. See API documentataion") } - err := s.client.Request.PostRequest(url, &userStory, &newUserStory) + err := s.client.Request.Post(url, &userStory, &newUserStory) if err != nil { return nil, err } @@ -61,7 +61,7 @@ func (s *UserStoryService) Create(userStory *UserStory) (*UserStory, error) { func (s *UserStoryService) Get(userStoryID int) (*UserStory, error) { url := s.client.APIURL + fmt.Sprintf("%s/%d", endpointUserStories, userStoryID) var us UserStoryDetailGET - err := s.client.Request.GetRequest(url, &us) + err := s.client.Request.Get(url, &us) if err != nil { return nil, err } @@ -93,7 +93,7 @@ func (s *UserStoryService) GetByRef(userStoryRef int, project *Project) (*UserSt return nil, errors.New("No ID or Ref defined in passed project struct") } - err := s.client.Request.GetRequest(url, &us) + err := s.client.Request.Get(url, &us) if err != nil { return nil, err } @@ -116,7 +116,7 @@ func (s *UserStoryService) Edit(userStory *UserStory) (*UserStory, error) { return nil, err } userStory.Version = remoteUS.Version - err = s.client.Request.PatchRequest(url, &userStory, &responseUS) + err = s.client.Request.Patch(url, &userStory, &responseUS) if err != nil { return nil, err } @@ -126,7 +126,7 @@ func (s *UserStoryService) Edit(userStory *UserStory) (*UserStory, error) { // Delete -> https://taigaio.github.io/taiga-doc/dist/api.html#user-stories-delete func (s *UserStoryService) Delete(userStoryID int) error { url := s.client.APIURL + fmt.Sprintf("%s/%d", endpointUserStories, userStoryID) - return s.client.Request.DeleteRequest(url) + return s.client.Request.Delete(url) } // CreateAttachment creates a new UserStory attachment => https://taigaio.github.io/taiga-doc/dist/api.html#user-stories-create-attachment diff --git a/users.go b/users.go index f7c63dd..d9d1d93 100644 --- a/users.go +++ b/users.go @@ -18,7 +18,7 @@ func (s *UserService) List() ([]User, error) { url := s.client.APIURL + endpointUsers var users []User - err := s.client.Request.GetRequest(url, &users) + err := s.client.Request.Get(url, &users) if err != nil { return nil, err } @@ -29,7 +29,7 @@ func (s *UserService) List() ([]User, error) { func (s *UserService) Get(user User) (*User, error) { url := s.client.APIURL + fmt.Sprintf("%s/%d", endpointUsers, user.ID) var respUser User - err := s.client.Request.GetRequest(url, &respUser) + err := s.client.Request.Get(url, &respUser) if err != nil { return nil, err } @@ -41,7 +41,7 @@ func (s *UserService) Me() (*User, error) { var user User url := s.client.APIURL + endpointUsers + "/me" - err := s.client.Request.GetRequest(url, &user) + err := s.client.Request.Get(url, &user) if err != nil { return nil, err } @@ -53,7 +53,7 @@ func (s *UserService) GetStats(user *User) (*UserStatsDetail, error) { url := s.client.APIURL + endpointUsers + fmt.Sprintf("/%d/stats", user.ID) var userStatsDetail UserStatsDetail - err := s.client.Request.GetRequest(url, &userStatsDetail) + err := s.client.Request.Get(url, &userStatsDetail) if err != nil { return nil, err } @@ -68,7 +68,7 @@ func (s *UserService) GetWatchedContent(user *User) (*UserWatched, error) { url := s.client.APIURL + endpointUsers + fmt.Sprintf("/%d/watched", user.ID) var userWatched UserWatched - err := s.client.Request.GetRequest(url, &userWatched) + err := s.client.Request.Get(url, &userWatched) if err != nil { return nil, err } @@ -83,7 +83,7 @@ func (s *UserService) GetLikedContent(user *User) (*UserLiked, error) { url := s.client.APIURL + endpointUsers + fmt.Sprintf("/%d/liked", user.ID) var userLiked UserLiked - err := s.client.Request.GetRequest(url, &userLiked) + err := s.client.Request.Get(url, &userLiked) if err != nil { return nil, err } @@ -100,7 +100,7 @@ func (s *UserService) Edit(userID int, patchedUser *User) (*User, error) { url := s.client.APIURL + endpointUsers + fmt.Sprintf("/%d", userID) var responseUser User - err := s.client.Request.PatchRequest(url, &patchedUser, &responseUser) + err := s.client.Request.Patch(url, &patchedUser, &responseUser) if err != nil { return nil, err } @@ -110,7 +110,7 @@ func (s *UserService) Edit(userID int, patchedUser *User) (*User, error) { // Delete => https://taigaio.github.io/taiga-doc/dist/api.html#users-delete func (s *UserService) Delete(user *User) error { url := s.client.APIURL + fmt.Sprintf("%s/%d", endpointUsers, user.ID) - err := s.client.Request.DeleteRequest(url) + err := s.client.Request.Delete(url) if err != nil { return err } diff --git a/webhooks.go b/webhooks.go index 1720229..982035d 100644 --- a/webhooks.go +++ b/webhooks.go @@ -26,7 +26,7 @@ func (s *WebhookService) ListWebhooks(queryParameters *WebhookQueryParameters) ( } var webhooks []Webhook - err := s.client.Request.GetRequest(url, &webhooks) + err := s.client.Request.Get(url, &webhooks) if err != nil { return nil, err } @@ -39,7 +39,7 @@ func (s *WebhookService) CreateWebhook(webhook *Webhook) (*Webhook, error) { url := s.client.APIURL + endpointWebhooksURI var responseWebhook Webhook - err := s.client.Request.PostRequest(url, &webhook, &responseWebhook) + err := s.client.Request.Post(url, &webhook, &responseWebhook) if err != nil { return nil, err } @@ -51,7 +51,7 @@ func (s *WebhookService) CreateWebhook(webhook *Webhook) (*Webhook, error) { func (s *WebhookService) GetWebhook(webhook *Webhook) (*Webhook, error) { url := s.client.APIURL + fmt.Sprintf("%s/%d", endpointWebhooksURI, webhook.ID) var respWebhook Webhook - err := s.client.Request.GetRequest(url, &respWebhook) + err := s.client.Request.Get(url, &respWebhook) if err != nil { return nil, err } @@ -64,7 +64,7 @@ func (s *WebhookService) EditWebhook(webhook *Webhook) (*Webhook, error) { var responseWebhook Webhook url := s.client.APIURL + fmt.Sprintf("%s/%d", endpointWebhooksURI, webhook.ID) - err := s.client.Request.PatchRequest(url, &webhook, &responseWebhook) + err := s.client.Request.Patch(url, &webhook, &responseWebhook) if err != nil { return nil, err } @@ -75,7 +75,7 @@ func (s *WebhookService) EditWebhook(webhook *Webhook) (*Webhook, error) { // https://taigaio.github.io/taiga-doc/dist/api.html#webhooks-delete func (s *WebhookService) DeleteWebhook(webhook *Webhook) error { url := s.client.APIURL + fmt.Sprintf("%s/%d", endpointWebhooksURI, webhook.ID) - err := s.client.Request.DeleteRequest(url) + err := s.client.Request.Delete(url) if err != nil { return err } @@ -87,7 +87,7 @@ func (s *WebhookService) DeleteWebhook(webhook *Webhook) error { func (s *WebhookService) TestWebhook(webhook *Webhook) (*WebhookLog, error) { url := s.client.APIURL + fmt.Sprintf("%s/%d", endpointWebhooksURI, webhook.ID) var responseWebhookLog WebhookLog - err := s.client.Request.PostRequest(url, &webhook, &responseWebhookLog) + err := s.client.Request.Post(url, &webhook, &responseWebhookLog) if err != nil { return nil, err } @@ -105,7 +105,7 @@ func (s *WebhookService) ListWebhookLogs(queryParameters *WebhookQueryParameters } var webhookLogs []WebhookLog - err := s.client.Request.GetRequest(url, &webhookLogs) + err := s.client.Request.Get(url, &webhookLogs) if err != nil { return nil, err } @@ -117,7 +117,7 @@ func (s *WebhookService) ListWebhookLogs(queryParameters *WebhookQueryParameters func (s *WebhookService) GetWebhookLog(webhook *Webhook) (*WebhookLog, error) { url := s.client.APIURL + fmt.Sprintf("%s/%d", endpointWebhookLogs, webhook.ID) var respWebhookLog WebhookLog - err := s.client.Request.GetRequest(url, &respWebhookLog) + err := s.client.Request.Get(url, &respWebhookLog) if err != nil { return nil, err } @@ -129,7 +129,7 @@ func (s *WebhookService) GetWebhookLog(webhook *Webhook) (*WebhookLog, error) { func (s *WebhookService) ResendWebhookRequest(webhookLog *WebhookLog) (*WebhookLog, error) { url := s.client.APIURL + fmt.Sprintf("%s/%d/resend", endpointWebhookLogs, webhookLog.ID) var respWebhookLog WebhookLog - err := s.client.Request.PostRequest(url, &webhookLog, &respWebhookLog) + err := s.client.Request.Post(url, &webhookLog, &respWebhookLog) if err != nil { return nil, err }