github.com/go-playground/webhooks/v6@v6.3.0/gitlab/payload.go (about) 1 package gitlab 2 3 import ( 4 "strings" 5 "time" 6 ) 7 8 type customTime struct { 9 time.Time 10 } 11 12 func (t *customTime) UnmarshalJSON(b []byte) (err error) { 13 layout := []string{ 14 "2006-01-02 15:04:05 MST", 15 "2006-01-02 15:04:05 Z07:00", 16 "2006-01-02 15:04:05 Z0700", 17 time.RFC3339, 18 } 19 s := strings.Trim(string(b), "\"") 20 if s == "null" { 21 t.Time = time.Time{} 22 return 23 } 24 for _, l := range layout { 25 t.Time, err = time.Parse(l, s) 26 if err == nil { 27 break 28 } 29 } 30 return 31 } 32 33 // IssueEventPayload contains the information for GitLab's issue event 34 type IssueEventPayload struct { 35 ObjectKind string `json:"object_kind"` 36 User User `json:"user"` 37 Project Project `json:"project"` 38 Repository Repository `json:"repository"` 39 ObjectAttributes ObjectAttributes `json:"object_attributes"` 40 Assignee Assignee `json:"assignee"` 41 Assignees []Assignee `json:"assignees"` 42 Changes Changes `json:"changes"` 43 } 44 45 // ConfidentialIssueEventPayload contains the information for GitLab's confidential issue event 46 type ConfidentialIssueEventPayload struct { 47 // The data for confidential issues is currently the same as normal issues, 48 // so we can just embed the normal issue payload type here. 49 IssueEventPayload 50 } 51 52 // MergeRequestEventPayload contains the information for GitLab's merge request event 53 type MergeRequestEventPayload struct { 54 ObjectKind string `json:"object_kind"` 55 User User `json:"user"` 56 ObjectAttributes ObjectAttributes `json:"object_attributes"` 57 Changes Changes `json:"changes"` 58 Project Project `json:"project"` 59 Repository Repository `json:"repository"` 60 Labels []Label `json:"labels"` 61 Assignees []Assignee `json:"assignees"` 62 } 63 64 // PushEventPayload contains the information for GitLab's push event 65 type PushEventPayload struct { 66 ObjectKind string `json:"object_kind"` 67 Before string `json:"before"` 68 After string `json:"after"` 69 Ref string `json:"ref"` 70 CheckoutSHA string `json:"checkout_sha"` 71 UserID int64 `json:"user_id"` 72 UserName string `json:"user_name"` 73 UserUsername string `json:"user_username"` 74 UserEmail string `json:"user_email"` 75 UserAvatar string `json:"user_avatar"` 76 ProjectID int64 `json:"project_id"` 77 Project Project `json:"project"` 78 Repository Repository `json:"repository"` 79 Commits []Commit `json:"commits"` 80 TotalCommitsCount int64 `json:"total_commits_count"` 81 } 82 83 // TagEventPayload contains the information for GitLab's tag push event 84 type TagEventPayload struct { 85 ObjectKind string `json:"object_kind"` 86 Before string `json:"before"` 87 After string `json:"after"` 88 Ref string `json:"ref"` 89 CheckoutSHA string `json:"checkout_sha"` 90 UserID int64 `json:"user_id"` 91 UserName string `json:"user_name"` 92 UserUsername string `json:"user_username"` 93 UserAvatar string `json:"user_avatar"` 94 ProjectID int64 `json:"project_id"` 95 Project Project `json:"project"` 96 Repository Repository `json:"repository"` 97 Commits []Commit `json:"commits"` 98 TotalCommitsCount int64 `json:"total_commits_count"` 99 } 100 101 // WikiPageEventPayload contains the information for GitLab's wiki created/updated event 102 type WikiPageEventPayload struct { 103 ObjectKind string `json:"object_kind"` 104 User User `json:"user"` 105 Project Project `json:"project"` 106 Wiki Wiki `json:"wiki"` 107 ObjectAttributes ObjectAttributes `json:"object_attributes"` 108 } 109 110 // PipelineEventPayload contains the information for GitLab's pipeline status change event 111 type PipelineEventPayload struct { 112 ObjectKind string `json:"object_kind"` 113 User User `json:"user"` 114 Project Project `json:"project"` 115 Commit Commit `json:"commit"` 116 ObjectAttributes PipelineObjectAttributes `json:"object_attributes"` 117 MergeRequest MergeRequest `json:"merge_request"` 118 Builds []Build `json:"builds"` 119 } 120 121 // CommentEventPayload contains the information for GitLab's comment event 122 type CommentEventPayload struct { 123 ObjectKind string `json:"object_kind"` 124 EventType string `json:"event_type"` 125 User User `json:"user"` 126 ProjectID int64 `json:"project_id"` 127 Project Project `json:"project"` 128 Repository Repository `json:"repository"` 129 ObjectAttributes ObjectAttributes `json:"object_attributes"` 130 MergeRequest MergeRequest `json:"merge_request"` 131 Commit Commit `json:"commit"` 132 Issue Issue `json:"issue"` 133 Snippet Snippet `json:"snippet"` 134 } 135 136 // ConfidentialCommentEventPayload contains the information for GitLab's confidential issue event 137 type ConfidentialCommentEventPayload struct { 138 // The data for confidential issues is currently the same as normal issues, 139 // so we can just embed the normal issue payload type here. 140 CommentEventPayload 141 } 142 143 // BuildEventPayload contains the information for GitLab's build status change event 144 type BuildEventPayload struct { 145 ObjectKind string `json:"object_kind"` 146 Ref string `json:"ref"` 147 Tag bool `json:"tag"` 148 BeforeSHA string `json:"before_sha"` 149 SHA string `json:"sha"` 150 BuildID int64 `json:"build_id"` 151 BuildName string `json:"build_name"` 152 BuildStage string `json:"build_stage"` 153 BuildStatus string `json:"build_status"` 154 BuildStartedAt customTime `json:"build_started_at"` 155 BuildFinishedAt customTime `json:"build_finished_at"` 156 BuildQueuedDuration float64 `json:"build_queued_duration"` 157 BuildDuration float64 `json:"build_duration"` 158 BuildAllowFailure bool `json:"build_allow_failure"` 159 ProjectID int64 `json:"project_id"` 160 ProjectName string `json:"project_name"` 161 User User `json:"user"` 162 Commit BuildCommit `json:"commit"` 163 Repository Repository `json:"repository"` 164 Runner Runner `json:"runner"` 165 } 166 167 // JobEventPayload contains the information for GitLab's Job status change 168 type JobEventPayload struct { 169 ObjectKind string `json:"object_kind"` 170 Ref string `json:"ref"` 171 Tag bool `json:"tag"` 172 BeforeSHA string `json:"before_sha"` 173 SHA string `json:"sha"` 174 BuildID int64 `json:"build_id"` 175 BuildName string `json:"build_name"` 176 BuildStage string `json:"build_stage"` 177 BuildStatus string `json:"build_status"` 178 BuildStartedAt customTime `json:"build_started_at"` 179 BuildFinishedAt customTime `json:"build_finished_at"` 180 BuildQueuedDuration float64 `json:"build_queued_duration"` 181 BuildDuration float64 `json:"build_duration"` 182 BuildAllowFailure bool `json:"build_allow_failure"` 183 BuildFailureReason string `json:"build_failure_reason"` 184 PipelineID int64 `json:"pipeline_id"` 185 ProjectID int64 `json:"project_id"` 186 ProjectName string `json:"project_name"` 187 User User `json:"user"` 188 Commit BuildCommit `json:"commit"` 189 Repository Repository `json:"repository"` 190 Runner Runner `json:"runner"` 191 } 192 193 // DeploymentEventPayload contains the information for GitLab's triggered when a deployment 194 type DeploymentEventPayload struct { 195 ObjectKind string `json:"object_kind"` 196 Status string `json:"status"` 197 StatusChangeAt string `json:"status_changed_at"` 198 DeploymentId int64 `json:"deployment_id"` 199 DeployableId int64 `json:"deployable_id"` 200 DeployableUrl string `json:"deployable_url"` 201 Environment string `json:"environment"` 202 Project Project `json:"project"` 203 ShortSha string `json:"short_sha"` 204 User User `json:"user"` 205 UserUrl string `json:"user_url"` 206 CommitUrl string `json:"commit_url"` 207 CommitTitle string `json:"commit_title"` 208 } 209 210 // SystemHookPayload contains the ObjectKind to match with real hook events 211 type SystemHookPayload struct { 212 ObjectKind string `json:"object_kind"` 213 EventName string `json:"event_name"` 214 } 215 216 // ProjectCreatedEventPayload contains the information about GitLab's project created event 217 type ProjectCreatedEventPayload struct { 218 CreatedAt customTime `json:"created_at"` 219 UpdatedAt customTime `json:"updated_at"` 220 EventName string `json:"event_name"` 221 Name string `json:"name"` 222 OwnerEmail string `json:"owner_email"` 223 OwnerName string `json:"owner_name"` 224 Owners []Author `json:"owners"` 225 Path string `json:"path"` 226 PathWithNamespace string `json:"path_with_namespace"` 227 ProjectID int64 `json:"project_id"` 228 ProjectVisibility string `json:"project_visibility"` 229 } 230 231 // ProjectDestroyedEventPayload contains the information about GitLab's project destroyed event 232 type ProjectDestroyedEventPayload struct { 233 CreatedAt customTime `json:"created_at"` 234 UpdatedAt customTime `json:"updated_at"` 235 EventName string `json:"event_name"` 236 Name string `json:"name"` 237 OwnerEmail string `json:"owner_email"` 238 OwnerName string `json:"owner_name"` 239 Owners []Author `json:"owners"` 240 Path string `json:"path"` 241 PathWithNamespace string `json:"path_with_namespace"` 242 ProjectID int64 `json:"project_id"` 243 ProjectVisibility string `json:"project_visibility"` 244 } 245 246 // ProjectRenamedEventPayload contains the information about GitLab's project renamed event 247 type ProjectRenamedEventPayload struct { 248 CreatedAt customTime `json:"created_at"` 249 UpdatedAt customTime `json:"updated_at"` 250 EventName string `json:"event_name"` 251 Name string `json:"name"` 252 Path string `json:"path"` 253 PathWithNamespace string `json:"path_with_namespace"` 254 ProjectID int64 `json:"project_id"` 255 OwnerName string `json:"owner_name"` 256 OwnerEmail string `json:"owner_email"` 257 Owners []Author `json:"owners"` 258 ProjectVisibility string `json:"project_visibility"` 259 OldPathWithNamespace string `json:"old_path_with_namespace"` 260 } 261 262 // ProjectTransferredEventPayload contains the information about GitLab's project transferred event 263 type ProjectTransferredEventPayload struct { 264 CreatedAt customTime `json:"created_at"` 265 UpdatedAt customTime `json:"updated_at"` 266 EventName string `json:"event_name"` 267 Name string `json:"name"` 268 Path string `json:"path"` 269 PathWithNamespace string `json:"path_with_namespace"` 270 ProjectID int64 `json:"project_id"` 271 OwnerName string `json:"owner_name"` 272 OwnerEmail string `json:"owner_email"` 273 Owners []Author `json:"owners"` 274 ProjectVisibility string `json:"project_visibility"` 275 OldPathWithNamespace string `json:"old_path_with_namespace"` 276 } 277 278 // ProjectUpdatedEventPayload contains the information about GitLab's project updated event 279 type ProjectUpdatedEventPayload struct { 280 CreatedAt customTime `json:"created_at"` 281 UpdatedAt customTime `json:"updated_at"` 282 EventName string `json:"event_name"` 283 Name string `json:"name"` 284 OwnerEmail string `json:"owner_email"` 285 OwnerName string `json:"owner_name"` 286 Owners []Author `json:"owners"` 287 Path string `json:"path"` 288 PathWithNamespace string `json:"path_with_namespace"` 289 ProjectID int64 `json:"project_id"` 290 ProjectVisibility string `json:"project_visibility"` 291 } 292 293 // TeamMemberAddedEventPayload contains the information about GitLab's new team member event 294 type TeamMemberAddedEventPayload struct { 295 CreatedAt customTime `json:"created_at"` 296 UpdatedAt customTime `json:"updated_at"` 297 EventName string `json:"event_name"` 298 AccessLevel string `json:"access_level"` 299 ProjectID int64 `json:"project_id"` 300 ProjectName string `json:"project_name"` 301 ProjectPath string `json:"project_path"` 302 ProjectPathWithNamespace string `json:"project_path_with_namespace"` 303 UserEmail string `json:"user_email"` 304 UserName string `json:"user_name"` 305 UserUsername string `json:"user_username"` 306 UserID int64 `json:"user_id"` 307 ProjectVisibility string `json:"project_visibility"` 308 } 309 310 // TeamMemberRemovedEventPayload contains the information about GitLab's team member removed event 311 type TeamMemberRemovedEventPayload struct { 312 CreatedAt customTime `json:"created_at"` 313 UpdatedAt customTime `json:"updated_at"` 314 EventName string `json:"event_name"` 315 AccessLevel string `json:"access_level"` 316 ProjectID int `json:"project_id"` 317 ProjectName string `json:"project_name"` 318 ProjectPath string `json:"project_path"` 319 ProjectPathWithNamespace string `json:"project_path_with_namespace"` 320 UserEmail string `json:"user_email"` 321 UserName string `json:"user_name"` 322 UserUsername string `json:"user_username"` 323 UserID int64 `json:"user_id"` 324 ProjectVisibility string `json:"project_visibility"` 325 } 326 327 // TeamMemberUpdatedEventPayload contains the information about GitLab's team member updated event 328 type TeamMemberUpdatedEventPayload struct { 329 CreatedAt customTime `json:"created_at"` 330 UpdatedAt customTime `json:"updated_at"` 331 EventName string `json:"event_name"` 332 AccessLevel string `json:"access_level"` 333 ProjectID int64 `json:"project_id"` 334 ProjectName string `json:"project_name"` 335 ProjectPath string `json:"project_path"` 336 ProjectPathWithNamespace string `json:"project_path_with_namespace"` 337 UserEmail string `json:"user_email"` 338 UserName string `json:"user_name"` 339 UserUsername string `json:"user_username"` 340 UserID int64 `json:"user_id"` 341 ProjectVisibility string `json:"project_visibility"` 342 } 343 344 // UserCreatedEventPayload contains the information about GitLab's user created event 345 type UserCreatedEventPayload struct { 346 CreatedAt customTime `json:"created_at"` 347 UpdatedAt customTime `json:"updated_at"` 348 Email string `json:"email"` 349 EventName string `json:"event_name"` 350 Name string `json:"name"` 351 Username string `json:"username"` 352 UserID int64 `json:"user_id"` 353 } 354 355 // UserRemovedEventPayload contains the information about GitLab's user removed event 356 type UserRemovedEventPayload struct { 357 CreatedAt customTime `json:"created_at"` 358 UpdatedAt customTime `json:"updated_at"` 359 Email string `json:"email"` 360 EventName string `json:"event_name"` 361 Name string `json:"name"` 362 Username string `json:"username"` 363 UserID int64 `json:"user_id"` 364 } 365 366 // UserFailedLoginEventPayload contains the information about GitLab's user login failed event 367 type UserFailedLoginEventPayload struct { 368 EventName string `json:"event_name"` 369 CreatedAt customTime `json:"created_at"` 370 UpdatedAt customTime `json:"updated_at"` 371 Name string `json:"name"` 372 Email string `json:"email"` 373 UserID int64 `json:"user_id"` 374 Username string `json:"username"` 375 State string `json:"state"` 376 } 377 378 // UserRenamedEventPayload contains the information about GitLab's user renamed event 379 type UserRenamedEventPayload struct { 380 EventName string `json:"event_name"` 381 CreatedAt customTime `json:"created_at"` 382 UpdatedAt customTime `json:"updated_at"` 383 Name string `json:"name"` 384 Email string `json:"email"` 385 UserID int64 `json:"user_id"` 386 Username string `json:"username"` 387 OldUsername string `json:"old_username"` 388 } 389 390 // KeyAddedEventPayload contains the information about GitLab's key added event 391 type KeyAddedEventPayload struct { 392 EventName string `json:"event_name"` 393 CreatedAt string `json:"created_at"` 394 UpdatedAt customTime `json:"updated_at"` 395 Username string `json:"username"` 396 Key string `json:"key"` 397 Id int64 `json:"id"` 398 } 399 400 // KeyRemovedEventPayload contains the information about GitLab's key removed event 401 type KeyRemovedEventPayload struct { 402 EventName string `json:"event_name"` 403 CreatedAt string `json:"created_at"` 404 UpdatedAt customTime `json:"updated_at"` 405 Username string `json:"username"` 406 Key string `json:"key"` 407 Id int64 `json:"id"` 408 } 409 410 // GroupCreatedEventPayload contains the information about GitLab's group created event 411 type GroupCreatedEventPayload struct { 412 CreatedAt customTime `json:"created_at"` 413 UpdatedAt customTime `json:"updated_at"` 414 EventName string `json:"event_name"` 415 Name string `json:"name"` 416 Path string `json:"path"` 417 GroupID int64 `json:"group_id"` 418 } 419 420 // GroupRemovedEventPayload contains the information about GitLab's group removed event 421 type GroupRemovedEventPayload struct { 422 CreatedAt customTime `json:"created_at"` 423 UpdatedAt customTime `json:"updated_at"` 424 EventName string `json:"event_name"` 425 Name string `json:"name"` 426 Path string `json:"path"` 427 GroupID int64 `json:"group_id"` 428 } 429 430 // GroupRenamedEventPayload contains the information about GitLab's group renamed event 431 type GroupRenamedEventPayload struct { 432 EventName string `json:"event_name"` 433 CreatedAt customTime `json:"created_at"` 434 UpdatedAt customTime `json:"updated_at"` 435 Name string `json:"name"` 436 Path string `json:"path"` 437 FullPath string `json:"full_path"` 438 GroupID int64 `json:"group_id"` 439 OldPath string `json:"old_path"` 440 OldFullPath string `json:"old_full_path"` 441 } 442 443 // GroupMemberAddedEventPayload contains the information about GitLab's new group member event 444 type GroupMemberAddedEventPayload struct { 445 CreatedAt customTime `json:"created_at"` 446 UpdatedAt customTime `json:"updated_at"` 447 EventName string `json:"event_name"` 448 GroupAccess string `json:"group_access"` 449 GroupID int64 `json:"group_id"` 450 GroupName string `json:"group_name"` 451 GroupPath string `json:"group_path"` 452 UserEmail string `json:"user_email"` 453 UserName string `json:"user_name"` 454 UserUsername string `json:"user_username"` 455 UserID int64 `json:"user_id"` 456 } 457 458 // GroupMemberRemovedEventPayload contains the information about GitLab's group member removed event 459 type GroupMemberRemovedEventPayload struct { 460 CreatedAt customTime `json:"created_at"` 461 UpdatedAt customTime `json:"updated_at"` 462 EventName string `json:"event_name"` 463 GroupAccess string `json:"group_access"` 464 GroupID int64 `json:"group_id"` 465 GroupName string `json:"group_name"` 466 GroupPath string `json:"group_path"` 467 UserEmail string `json:"user_email"` 468 UserName string `json:"user_name"` 469 UserUsername string `json:"user_username"` 470 UserID int64 `json:"user_id"` 471 } 472 473 // GroupMemberUpdatedEventPayload contains the information about GitLab's group member updated event 474 type GroupMemberUpdatedEventPayload struct { 475 CreatedAt customTime `json:"created_at"` 476 UpdatedAt customTime `json:"updated_at"` 477 EventName string `json:"event_name"` 478 GroupAccess string `json:"group_access"` 479 GroupID int64 `json:"group_id"` 480 GroupName string `json:"group_name"` 481 GroupPath string `json:"group_path"` 482 UserEmail string `json:"user_email"` 483 UserName string `json:"user_name"` 484 UserUsername string `json:"user_username"` 485 UserID int64 `json:"user_id"` 486 } 487 488 // Issue contains all of the GitLab issue information 489 type Issue struct { 490 ID int64 `json:"id"` 491 Title string `json:"title"` 492 AssigneeID int64 `json:"assignee_id"` 493 AuthorID int64 `json:"author_id"` 494 ProjectID int64 `json:"project_id"` 495 CreatedAt customTime `json:"created_at"` 496 UpdatedAt customTime `json:"updated_at"` 497 Position int64 `json:"position"` 498 BranchName string `json:"branch_name"` 499 Description string `json:"description"` 500 MilestoneID int64 `json:"milestone_id"` 501 State string `json:"state"` 502 IID int64 `json:"iid"` 503 } 504 505 // Build contains all of the GitLab Build information 506 type Build struct { 507 ID int64 `json:"id"` 508 Stage string `json:"stage"` 509 Name string `json:"name"` 510 Status string `json:"status"` 511 CreatedAt customTime `json:"created_at"` 512 StartedAt customTime `json:"started_at"` 513 FinishedAt customTime `json:"finished_at"` 514 FailureReason string `json:"failure_reason"` 515 When string `json:"when"` 516 Manual bool `json:"manual"` 517 User User `json:"user"` 518 Runner Runner `json:"runner"` 519 ArtifactsFile ArtifactsFile `json:"artifactsfile"` 520 } 521 522 // Runner represents a runner agent 523 type Runner struct { 524 ID int64 `json:"id"` 525 Description string `json:"description"` 526 Active bool `json:"active"` 527 IsShared bool `json:"is_shared"` 528 } 529 530 // ArtifactsFile contains all of the GitLab artifact information 531 type ArtifactsFile struct { 532 Filename string `json:"filename"` 533 Size string `json:"size"` 534 } 535 536 // Wiki contains all of the GitLab wiki information 537 type Wiki struct { 538 WebURL string `json:"web_url"` 539 GitSSHURL string `json:"git_ssh_url"` 540 GitHTTPURL string `json:"git_http_url"` 541 PathWithNamespace string `json:"path_with_namespace"` 542 DefaultBranch string `json:"default_branch"` 543 } 544 545 // Commit contains all of the GitLab commit information 546 type Commit struct { 547 ID string `json:"id"` 548 Message string `json:"message"` 549 Title string `json:"title"` 550 Timestamp customTime `json:"timestamp"` 551 URL string `json:"url"` 552 Author Author `json:"author"` 553 Added []string `json:"added"` 554 Modified []string `json:"modified"` 555 Removed []string `json:"removed"` 556 } 557 558 // BuildCommit contains all of the GitLab build commit information 559 type BuildCommit struct { 560 ID int64 `json:"id"` 561 SHA string `json:"sha"` 562 Message string `json:"message"` 563 AuthorName string `json:"author_name"` 564 AuthorEmail string `json:"author_email"` 565 Status string `json:"status"` 566 Duration float64 `json:"duration"` 567 StartedAt customTime `json:"started_at"` 568 FinishedAt customTime `json:"finished_at"` 569 } 570 571 // Snippet contains all of the GitLab snippet information 572 type Snippet struct { 573 ID int64 `json:"id"` 574 Title string `json:"title"` 575 Content string `json:"content"` 576 AuthorID int64 `json:"author_id"` 577 ProjectID int64 `json:"project_id"` 578 CreatedAt customTime `json:"created_at"` 579 UpdatedAt customTime `json:"updated_at"` 580 FileName string `json:"file_name"` 581 ExpiresAt customTime `json:"expires_at"` 582 Type string `json:"type"` 583 VisibilityLevel int64 `json:"visibility_level"` 584 } 585 586 // User contains all of the GitLab user information 587 type User struct { 588 ID int64 `json:"id"` 589 Name string `json:"name"` 590 UserName string `json:"username"` 591 AvatarURL string `json:"avatar_url"` 592 Email string `json:"email"` 593 } 594 595 // Project contains all of the GitLab project information 596 type Project struct { 597 ID int64 `json:"id"` 598 Name string `json:"name"` 599 Description string `json:"description"` 600 WebURL string `json:"web_url"` 601 AvatarURL string `json:"avatar_url"` 602 GitSSHURL string `json:"git_ssh_url"` 603 GitHTTPURL string `json:"git_http_url"` 604 Namespace string `json:"namespace"` 605 VisibilityLevel int64 `json:"visibility_level"` 606 PathWithNamespace string `json:"path_with_namespace"` 607 DefaultBranch string `json:"default_branch"` 608 Homepage string `json:"homepage"` 609 URL string `json:"url"` 610 SSHURL string `json:"ssh_url"` 611 HTTPURL string `json:"http_url"` 612 } 613 614 // Repository contains all of the GitLab repository information 615 type Repository struct { 616 Name string `json:"name"` 617 URL string `json:"url"` 618 Description string `json:"description"` 619 Homepage string `json:"homepage"` 620 GitSSHURL string `json:"git_ssh_url"` 621 GitHTTPURL string `json:"git_http_url"` 622 VisibilityLevel int64 `json:"visibility_level"` 623 } 624 625 // ObjectAttributes contains all of the GitLab object attributes information 626 type ObjectAttributes struct { 627 ID int64 `json:"id"` 628 Title string `json:"title"` 629 AssigneeIDS []int64 `json:"assignee_ids"` 630 AssigneeID int64 `json:"assignee_id"` 631 AuthorID int64 `json:"author_id"` 632 ProjectID int64 `json:"project_id"` 633 CreatedAt customTime `json:"created_at"` 634 UpdatedAt customTime `json:"updated_at"` 635 UpdatedByID int64 `json:"updated_by_id"` 636 LastEditedAt customTime `json:"last_edited_at"` 637 LastEditedByID int64 `json:"last_edited_by_id"` 638 RelativePosition int64 `json:"relative_position"` 639 Position Position `json:"position"` 640 BranchName string `json:"branch_name"` 641 Description string `json:"description"` 642 MilestoneID int64 `json:"milestone_id"` 643 State string `json:"state"` 644 StateID int64 `json:"state_id"` 645 Confidential bool `json:"confidential"` 646 DiscussionLocked bool `json:"discussion_locked"` 647 DueDate customTime `json:"due_date"` 648 TimeEstimate int64 `json:"time_estimate"` 649 TotalTimeSpent int64 `json:"total_time_spent"` 650 IID int64 `json:"iid"` 651 URL string `json:"url"` 652 Action string `json:"action"` 653 TargetBranch string `json:"target_branch"` 654 SourceBranch string `json:"source_branch"` 655 SourceProjectID int64 `json:"source_project_id"` 656 TargetProjectID int64 `json:"target_project_id"` 657 StCommits string `json:"st_commits"` 658 MergeStatus string `json:"merge_status"` 659 Content string `json:"content"` 660 Format string `json:"format"` 661 Message string `json:"message"` 662 Slug string `json:"slug"` 663 Ref string `json:"ref"` 664 Tag bool `json:"tag"` 665 SHA string `json:"sha"` 666 BeforeSHA string `json:"before_sha"` 667 Status string `json:"status"` 668 Stages []string `json:"stages"` 669 Duration int64 `json:"duration"` 670 Note string `json:"note"` 671 NotebookType string `json:"noteable_type"` // nolint:misspell 672 At customTime `json:"attachment"` 673 LineCode string `json:"line_code"` 674 CommitID string `json:"commit_id"` 675 NoteableID int64 `json:"noteable_id"` // nolint: misspell 676 System bool `json:"system"` 677 WorkInProgress bool `json:"work_in_progress"` 678 StDiffs []StDiff `json:"st_diffs"` 679 Source Source `json:"source"` 680 Target Target `json:"target"` 681 LastCommit LastCommit `json:"last_commit"` 682 Assignee Assignee `json:"assignee"` 683 } 684 685 // PipelineObjectAttributes contains pipeline specific GitLab object attributes information 686 type PipelineObjectAttributes struct { 687 ID int64 `json:"id"` 688 IID int64 `json:"iid"` 689 Name string `json:"name"` 690 Ref string `json:"ref"` 691 Tag bool `json:"tag"` 692 SHA string `json:"sha"` 693 BeforeSHA string `json:"before_sha"` 694 Source string `json:"source"` 695 Status string `json:"status"` 696 Stages []string `json:"stages"` 697 CreatedAt customTime `json:"created_at"` 698 FinishedAt customTime `json:"finished_at"` 699 Duration int64 `json:"duration"` 700 Variables []Variable `json:"variables"` 701 Url string `json:"url"` 702 } 703 704 // Variable contains pipeline variables 705 type Variable struct { 706 Key string `json:"key"` 707 Value string `json:"value"` 708 } 709 710 // Position defines a specific location, identified by paths line numbers and 711 // image coordinates, within a specific diff, identified by start, head and 712 // base commit ids. 713 // 714 // Text position will have: new_line and old_line 715 // Image position will have: width, height, x, y 716 type Position struct { 717 BaseSHA string `json:"base_sha"` 718 StartSHA string `json:"start_sha"` 719 HeadSHA string `json:"head_sha"` 720 OldPath string `json:"old_path"` 721 NewPath string `json:"new_path"` 722 PositionType string `json:"position_type"` 723 OldLine int64 `json:"old_line"` 724 NewLine int64 `json:"new_line"` 725 Width int64 `json:"width"` 726 Height int64 `json:"height"` 727 X int64 `json:"x"` 728 Y int64 `json:"y"` 729 } 730 731 // MergeRequest contains all of the GitLab merge request information 732 type MergeRequest struct { 733 ID int64 `json:"id"` 734 TargetBranch string `json:"target_branch"` 735 SourceBranch string `json:"source_branch"` 736 SourceProjectID int64 `json:"source_project_id"` 737 AssigneeID int64 `json:"assignee_id"` 738 AuthorID int64 `json:"author_id"` 739 Title string `json:"title"` 740 CreatedAt customTime `json:"created_at"` 741 UpdatedAt customTime `json:"updated_at"` 742 MilestoneID int64 `json:"milestone_id"` 743 State string `json:"state"` 744 MergeStatus string `json:"merge_status"` 745 TargetProjectID int64 `json:"target_project_id"` 746 IID int64 `json:"iid"` 747 Description string `json:"description"` 748 Position int64 `json:"position"` 749 LockedAt customTime `json:"locked_at"` 750 Source Source `json:"source"` 751 Target Target `json:"target"` 752 LastCommit LastCommit `json:"last_commit"` 753 WorkInProgress bool `json:"work_in_progress"` 754 Assignee Assignee `json:"assignee"` 755 URL string `json:"url"` 756 } 757 758 // Assignee contains all of the GitLab assignee information 759 type Assignee struct { 760 ID int64 `json:"id"` 761 Name string `json:"name"` 762 Username string `json:"username"` 763 AvatarURL string `json:"avatar_url"` 764 Email string `json:"email"` 765 } 766 767 // StDiff contains all of the GitLab diff information 768 type StDiff struct { 769 Diff string `json:"diff"` 770 NewPath string `json:"new_path"` 771 OldPath string `json:"old_path"` 772 AMode string `json:"a_mode"` 773 BMode string `json:"b_mode"` 774 NewFile bool `json:"new_file"` 775 RenamedFile bool `json:"renamed_file"` 776 DeletedFile bool `json:"deleted_file"` 777 } 778 779 // Source contains all of the GitLab source information 780 type Source struct { 781 Name string `json:"name"` 782 Description string `json:"description"` 783 WebURL string `json:"web_url"` 784 AvatarURL string `json:"avatar_url"` 785 GitSSHURL string `json:"git_ssh_url"` 786 GitHTTPURL string `json:"git_http_url"` 787 Namespace string `json:"namespace"` 788 VisibilityLevel int64 `json:"visibility_level"` 789 PathWithNamespace string `json:"path_with_namespace"` 790 DefaultBranch string `json:"default_branch"` 791 Homepage string `json:"homepage"` 792 URL string `json:"url"` 793 SSHURL string `json:"ssh_url"` 794 HTTPURL string `json:"http_url"` 795 } 796 797 // Target contains all of the GitLab target information 798 type Target struct { 799 Name string `json:"name"` 800 Description string `json:"description"` 801 WebURL string `json:"web_url"` 802 AvatarURL string `json:"avatar_url"` 803 GitSSHURL string `json:"git_ssh_url"` 804 GitHTTPURL string `json:"git_http_url"` 805 Namespace string `json:"namespace"` 806 VisibilityLevel int64 `json:"visibility_level"` 807 PathWithNamespace string `json:"path_with_namespace"` 808 DefaultBranch string `json:"default_branch"` 809 Homepage string `json:"homepage"` 810 URL string `json:"url"` 811 SSHURL string `json:"ssh_url"` 812 HTTPURL string `json:"http_url"` 813 } 814 815 // LastCommit contains all of the GitLab last commit information 816 type LastCommit struct { 817 ID string `json:"id"` 818 Message string `json:"message"` 819 Timestamp customTime `json:"timestamp"` 820 URL string `json:"url"` 821 Author Author `json:"author"` 822 } 823 824 // Author contains all of the GitLab author information 825 type Author struct { 826 Name string `json:"name"` 827 Email string `json:"email"` 828 } 829 830 // Changes contains all changes associated with a GitLab issue or MR 831 type Changes struct { 832 LabelChanges LabelChanges `json:"labels"` 833 } 834 835 // LabelChanges contains changes in labels assocatiated with a GitLab issue or MR 836 type LabelChanges struct { 837 Previous []Label `json:"previous"` 838 Current []Label `json:"current"` 839 } 840 841 // Label contains all of the GitLab label information 842 type Label struct { 843 ID int64 `json:"id"` 844 Title string `json:"title"` 845 Color string `json:"color"` 846 ProjectID int64 `json:"project_id"` 847 CreatedAt customTime `json:"created_at"` 848 UpdatedAt customTime `json:"updated_at"` 849 Template bool `json:"template"` 850 Description string `json:"description"` 851 Type string `json:"type"` 852 GroupID int64 `json:"group_id"` 853 }