...

Source file src/github.com/xanzy/go-gitlab/event_systemhook_types.go

Documentation: github.com/xanzy/go-gitlab

     1  //
     2  // Copyright 2021, Sander van Harmelen
     3  //
     4  // Licensed under the Apache License, Version 2.0 (the "License");
     5  // you may not use this file except in compliance with the License.
     6  // You may obtain a copy of the License at
     7  //
     8  //     http://www.apache.org/licenses/LICENSE-2.0
     9  //
    10  // Unless required by applicable law or agreed to in writing, software
    11  // distributed under the License is distributed on an "AS IS" BASIS,
    12  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  // See the License for the specific language governing permissions and
    14  // limitations under the License.
    15  //
    16  
    17  package gitlab
    18  
    19  import "time"
    20  
    21  // systemHookEvent is used to pre-process events to determine the
    22  // system hook event type.
    23  type systemHookEvent struct {
    24  	BaseSystemEvent
    25  	ObjectKind string `json:"object_kind"`
    26  }
    27  
    28  // BaseSystemEvent contains system hook's common properties.
    29  //
    30  // GitLab API docs:
    31  // https://docs.gitlab.com/ee/administration/system_hooks.html
    32  type BaseSystemEvent struct {
    33  	EventName string `json:"event_name"`
    34  	CreatedAt string `json:"created_at"`
    35  	UpdatedAt string `json:"updated_at"`
    36  }
    37  
    38  // ProjectSystemEvent represents a project system event.
    39  //
    40  // GitLab API docs:
    41  // https://docs.gitlab.com/ee/administration/system_hooks.html
    42  type ProjectSystemEvent struct {
    43  	BaseSystemEvent
    44  	Name                 string `json:"name"`
    45  	Path                 string `json:"path"`
    46  	PathWithNamespace    string `json:"path_with_namespace"`
    47  	ProjectID            int    `json:"project_id"`
    48  	OwnerName            string `json:"owner_name"`
    49  	OwnerEmail           string `json:"owner_email"`
    50  	ProjectVisibility    string `json:"project_visibility"`
    51  	OldPathWithNamespace string `json:"old_path_with_namespace,omitempty"`
    52  }
    53  
    54  // GroupSystemEvent represents a group system event.
    55  //
    56  // GitLab API docs:
    57  // https://docs.gitlab.com/ee/administration/system_hooks.html
    58  type GroupSystemEvent struct {
    59  	BaseSystemEvent
    60  	Name                 string `json:"name"`
    61  	Path                 string `json:"path"`
    62  	PathWithNamespace    string `json:"full_path"`
    63  	GroupID              int    `json:"group_id"`
    64  	OwnerName            string `json:"owner_name"`
    65  	OwnerEmail           string `json:"owner_email"`
    66  	ProjectVisibility    string `json:"project_visibility"`
    67  	OldPath              string `json:"old_path,omitempty"`
    68  	OldPathWithNamespace string `json:"old_full_path,omitempty"`
    69  }
    70  
    71  // KeySystemEvent represents a key system event.
    72  //
    73  // GitLab API docs:
    74  // https://docs.gitlab.com/ee/administration/system_hooks.html
    75  type KeySystemEvent struct {
    76  	BaseSystemEvent
    77  	ID       int    `json:"id"`
    78  	Username string `json:"username"`
    79  	Key      string `json:"key"`
    80  }
    81  
    82  // UserSystemEvent represents a user system event.
    83  //
    84  // GitLab API docs:
    85  // https://docs.gitlab.com/ee/administration/system_hooks.html
    86  type UserSystemEvent struct {
    87  	BaseSystemEvent
    88  	ID          int    `json:"user_id"`
    89  	Name        string `json:"name"`
    90  	Username    string `json:"username"`
    91  	OldUsername string `json:"old_username,omitempty"`
    92  	Email       string `json:"email"`
    93  	State       string `json:"state,omitempty"`
    94  }
    95  
    96  // UserGroupSystemEvent represents a user group system event.
    97  //
    98  // GitLab API docs:
    99  // https://docs.gitlab.com/ee/administration/system_hooks.html
   100  type UserGroupSystemEvent struct {
   101  	BaseSystemEvent
   102  	ID          int    `json:"user_id"`
   103  	Name        string `json:"user_name"`
   104  	Username    string `json:"user_username"`
   105  	Email       string `json:"user_email"`
   106  	GroupID     int    `json:"group_id"`
   107  	GroupName   string `json:"group_name"`
   108  	GroupPath   string `json:"group_path"`
   109  	GroupAccess string `json:"group_access"`
   110  }
   111  
   112  // UserTeamSystemEvent represents a user team system event.
   113  //
   114  // GitLab API docs:
   115  // https://docs.gitlab.com/ee/administration/system_hooks.html
   116  type UserTeamSystemEvent struct {
   117  	BaseSystemEvent
   118  	ID                       int    `json:"user_id"`
   119  	Name                     string `json:"user_name"`
   120  	Username                 string `json:"user_username"`
   121  	Email                    string `json:"user_email"`
   122  	ProjectID                int    `json:"project_id"`
   123  	ProjectName              string `json:"project_name"`
   124  	ProjectPath              string `json:"project_path"`
   125  	ProjectPathWithNamespace string `json:"project_path_with_namespace"`
   126  	ProjectVisibility        string `json:"project_visibility"`
   127  	AccessLevel              string `json:"access_level"`
   128  }
   129  
   130  // PushSystemEvent represents a push system event.
   131  //
   132  // GitLab API docs:
   133  // https://docs.gitlab.com/ee/administration/system_hooks.html#push-events
   134  type PushSystemEvent struct {
   135  	BaseSystemEvent
   136  	Before       string `json:"before"`
   137  	After        string `json:"after"`
   138  	Ref          string `json:"ref"`
   139  	CheckoutSHA  string `json:"checkout_sha"`
   140  	UserID       int    `json:"user_id"`
   141  	UserName     string `json:"user_name"`
   142  	UserUsername string `json:"user_username"`
   143  	UserEmail    string `json:"user_email"`
   144  	UserAvatar   string `json:"user_avatar"`
   145  	ProjectID    int    `json:"project_id"`
   146  	Project      struct {
   147  		Name              string `json:"name"`
   148  		Description       string `json:"description"`
   149  		WebURL            string `json:"web_url"`
   150  		AvatarURL         string `json:"avatar_url"`
   151  		GitHTTPURL        string `json:"git_http_url"`
   152  		GitSSHURL         string `json:"git_ssh_url"`
   153  		Namespace         string `json:"namespace"`
   154  		VisibilityLevel   int    `json:"visibility_level"`
   155  		PathWithNamespace string `json:"path_with_namespace"`
   156  		DefaultBranch     string `json:"default_branch"`
   157  		Homepage          string `json:"homepage"`
   158  		URL               string `json:"url"`
   159  	} `json:"project"`
   160  	Commits []struct {
   161  		ID        string    `json:"id"`
   162  		Message   string    `json:"message"`
   163  		Timestamp time.Time `json:"timestamp"`
   164  		URL       string    `json:"url"`
   165  		Author    struct {
   166  			Name  string `json:"name"`
   167  			Email string `json:"email"`
   168  		} `json:"author"`
   169  	} `json:"commits"`
   170  	TotalCommitsCount int `json:"total_commits_count"`
   171  }
   172  
   173  // TagPushSystemEvent represents a tag push system event.
   174  //
   175  // GitLab API docs:
   176  // https://docs.gitlab.com/ee/administration/system_hooks.html#tag-events
   177  type TagPushSystemEvent struct {
   178  	BaseSystemEvent
   179  	Before       string `json:"before"`
   180  	After        string `json:"after"`
   181  	Ref          string `json:"ref"`
   182  	CheckoutSHA  string `json:"checkout_sha"`
   183  	UserID       int    `json:"user_id"`
   184  	UserName     string `json:"user_name"`
   185  	UserUsername string `json:"user_username"`
   186  	UserEmail    string `json:"user_email"`
   187  	UserAvatar   string `json:"user_avatar"`
   188  	ProjectID    int    `json:"project_id"`
   189  	Project      struct {
   190  		Name              string `json:"name"`
   191  		Description       string `json:"description"`
   192  		WebURL            string `json:"web_url"`
   193  		AvatarURL         string `json:"avatar_url"`
   194  		GitHTTPURL        string `json:"git_http_url"`
   195  		GitSSHURL         string `json:"git_ssh_url"`
   196  		Namespace         string `json:"namespace"`
   197  		VisibilityLevel   int    `json:"visibility_level"`
   198  		PathWithNamespace string `json:"path_with_namespace"`
   199  		DefaultBranch     string `json:"default_branch"`
   200  		Homepage          string `json:"homepage"`
   201  		URL               string `json:"url"`
   202  	} `json:"project"`
   203  	Commits []struct {
   204  		ID        string    `json:"id"`
   205  		Message   string    `json:"message"`
   206  		Timestamp time.Time `json:"timestamp"`
   207  		URL       string    `json:"url"`
   208  		Author    struct {
   209  			Name  string `json:"name"`
   210  			Email string `json:"email"`
   211  		} `json:"author"`
   212  	} `json:"commits"`
   213  	TotalCommitsCount int `json:"total_commits_count"`
   214  }
   215  
   216  // RepositoryUpdateSystemEvent represents a repository updated system event.
   217  //
   218  // GitLab API docs:
   219  // https://docs.gitlab.com/ee/administration/system_hooks.html#repository-update-events
   220  type RepositoryUpdateSystemEvent struct {
   221  	BaseSystemEvent
   222  	UserID     int    `json:"user_id"`
   223  	UserName   string `json:"user_name"`
   224  	UserEmail  string `json:"user_email"`
   225  	UserAvatar string `json:"user_avatar"`
   226  	ProjectID  int    `json:"project_id"`
   227  	Project    struct {
   228  		ID                int    `json:"id"`
   229  		Name              string `json:"name"`
   230  		Description       string `json:"description"`
   231  		WebURL            string `json:"web_url"`
   232  		AvatarURL         string `json:"avatar_url"`
   233  		GitHTTPURL        string `json:"git_http_url"`
   234  		GitSSHURL         string `json:"git_ssh_url"`
   235  		Namespace         string `json:"namespace"`
   236  		VisibilityLevel   int    `json:"visibility_level"`
   237  		PathWithNamespace string `json:"path_with_namespace"`
   238  		DefaultBranch     string `json:"default_branch"`
   239  		CiConfigPath      string `json:"ci_config_path"`
   240  		Homepage          string `json:"homepage"`
   241  		URL               string `json:"url"`
   242  	} `json:"project"`
   243  	Changes []struct {
   244  		Before string `json:"before"`
   245  		After  string `json:"after"`
   246  		Ref    string `json:"ref"`
   247  	} `json:"changes"`
   248  	Refs []string `json:"refs"`
   249  }
   250  

View as plain text