xanzy / go-gitlab

GitLab Go SDK
Apache License 2.0
2.42k stars 960 forks source link

Fix support for the GitLab Slack App #2039

Closed jgangemi closed 2 weeks ago

jgangemi commented 1 month ago

The current implementation does not support the json data structure returned from the PUT and GET operations.

Sample JSON from a GET call using:

curl -s -X GET --header "PRIVATE-TOKEN: <token>" https://gitlab.com/api/v4/projects/<project-id>/integrations/gitlab-slack-application
{
  "id": 12345,
  "title": "GitLab for Slack app",
  "slug": "gitlab-slack-application",
  "created_at": "2024-10-15T01:57:19.376Z",
  "updated_at": "2024-10-15T13:28:48.228Z",
  "active": true,
  "commit_events": false,
  "push_events": false,
  "issues_events": false,
  "incident_events": false,
  "alert_events": true,
  "confidential_issues_events": false,
  "merge_requests_events": false,
  "tag_push_events": false,
  "deployment_events": false,
  "note_events": false,
  "confidential_note_events": false,
  "pipeline_events": false,
  "wiki_page_events": false,
  "job_events": false,
  "comment_on_event_enabled": true,
  "inherited": false,
  "vulnerability_events": false,
  "properties": {
    "channel": null,
    "notify_only_broken_pipelines": true,
    "branches_to_be_notified": "default",
    "labels_to_be_notified": "",
    "labels_to_be_notified_behavior": "match_any",
    "push_channel": "",
    "issue_channel": "",
    "confidential_issue_channel": "",
    "merge_request_channel": "",
    "note_channel": "",
    "confidential_note_channel": "",
    "tag_push_channel": "",
    "pipeline_channel": "",
    "wiki_page_channel": "",
    "deployment_channel": "",
    "incident_channel": "",
    "vulnerability_channel": "",
    "alert_channel": ""
  }
}

All of the boolean values aside from notify_only_broken_pipelines are already defined on the Service struct. the current SlackApplicationProperties just redeclares all the boolean properties and the SetSlackApplicationOptions doesn't declare almost all of what's in the properties attribute.

svanharmelen commented 1 month ago

I think https://github.com/xanzy/go-gitlab/pull/2042 should fix this issue