{"modulePath":"github.com/Coding/drone","version":"v0.3.1","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package model\n\n## Constants\n\n```go\nconst (\n\tRemoteGithub           = \"github.com\"\n\tRemoteGitlab           = \"gitlab.com\"\n\tRemoteGithubEnterprise = \"enterprise.github.com\"\n\tRemoteBitbucket        = \"bitbucket.org\"\n\tRemoteStash            = \"stash.atlassian.com\"\n\tRemoteGogs             = \"gogs\"\n)\n```\n\n```go\nconst (\n\tStatusNone    = \"None\"\n\tStatusEnqueue = \"Pending\"\n\tStatusStarted = \"Started\"\n\tStatusSuccess = \"Success\"\n\tStatusFailure = \"Failure\"\n\tStatusError   = \"Error\"\n\tStatusKilled  = \"Killed\"\n)\n```\n\n## Variables\n\n```go\nvar (\n\tDefaultBranch = \"master\"\n\n\t// default build timeout, in seconds\n\tDefaultTimeout int64 = 7200\n)\n```\n\n```go\nvar DefaultExpires = int64(time.Hour.Seconds() * 72)\n```\nby default, let's expire the user cache after 72 hours\n\n## Functions\n\n```go\nfunc CreateGravatar(email string) string\n```\nhelper function to create a Gravatar Hash for the given Email address.\n\n```go\nfunc GenerateToken() string\n```\nGenerateToken generates random strings good for use in URIs to identify unique objects.\n\n## Types\n\n```go\ntype CCProject struct {\n\tXMLName         xml.Name `xml:\"Project\"`\n\tName            string   `xml:\"name,attr\"`\n\tActivity        string   `xml:\"activity,attr\"`\n\tLastBuildStatus string   `xml:\"lastBuildStatus,attr\"`\n\tLastBuildLabel  string   `xml:\"lastBuildLabel,attr\"`\n\tLastBuildTime   string   `xml:\"lastBuildTime,attr\"`\n\tWebURL          string   `xml:\"webUrl,attr\"`\n}\n```\n\n```go\ntype CCProjects struct {\n\tXMLName xml.Name   `xml:\"Projects\"`\n\tProject *CCProject `xml:\"Project\"`\n}\n```\n\n```go\nfunc NewCC(r *Repo, c *Commit, url string) *CCProjects\n```\n\n```go\ntype Commit struct {\n\tID          int64  `meddler:\"commit_id,pk\"     json:\"id\"`\n\tRepoID      int64  `meddler:\"repo_id\"          json:\"-\"`\n\tStatus      string `meddler:\"commit_status\"    json:\"status\"`\n\tStarted     int64  `meddler:\"commit_started\"   json:\"started_at\"`\n\tFinished    int64  `meddler:\"commit_finished\"  json:\"finished_at\"`\n\tDuration    int64  `meddler:\"commit_duration\"  json:\"duration\"`\n\tSha         string `meddler:\"commit_sha\"       json:\"sha\"`\n\tBranch      string `meddler:\"commit_branch\"    json:\"branch\"`\n\tPullRequest string `meddler:\"commit_pr\"        json:\"pull_request\"`\n\tAuthor      string `meddler:\"commit_author\"    json:\"author\"`\n\tGravatar    string `meddler:\"commit_gravatar\"  json:\"gravatar\"`\n\tTimestamp   string `meddler:\"commit_timestamp\" json:\"timestamp\"`\n\tMessage     string `meddler:\"commit_message\"   json:\"message\"`\n\tConfig      string `meddler:\"commit_yaml\"      json:\"-\"`\n\tCreated     int64  `meddler:\"commit_created\"   json:\"created_at\"`\n\tUpdated     int64  `meddler:\"commit_updated\"   json:\"updated_at\"`\n}\n```\n\n```go\nfunc (c *Commit) FinishedString() string\n```\nReturns the Started Date as an ISO8601 formatted string.\n\n```go\nfunc (c *Commit) SetAuthor(email string)\n```\nSetAuthor sets the author's email address and calculate the Gravatar hash.\n\n```go\nfunc (c *Commit) ShaShort() string\n```\nReturns the Short (--short) Commit Hash.\n\n```go\ntype CommitRepo struct {\n\tRemote string `meddler:\"repo_remote\" json:\"remote\"`\n\tHost   string `meddler:\"repo_host\"   json:\"host\"`\n\tOwner  string `meddler:\"repo_owner\"  json:\"owner\"`\n\tName   string `meddler:\"repo_name\"   json:\"name\"`\n\n\tCommitID    int64  `meddler:\"commit_id,pk\"     json:\"-\"`\n\tRepoID      int64  `meddler:\"repo_id\"          json:\"-\"`\n\tStatus      string `meddler:\"commit_status\"    json:\"status\"`\n\tStarted     int64  `meddler:\"commit_started\"   json:\"started_at\"`\n\tFinished    int64  `meddler:\"commit_finished\"  json:\"finished_at\"`\n\tDuration    int64  `meddler:\"commit_duration\"  json:\"duration\"`\n\tSha         string `meddler:\"commit_sha\"       json:\"sha\"`\n\tBranch      string `meddler:\"commit_branch\"    json:\"branch\"`\n\tPullRequest string `meddler:\"commit_pr\"        json:\"pull_request\"`\n\tAuthor      string `meddler:\"commit_author\"    json:\"author\"`\n\tGravatar    string `meddler:\"commit_gravatar\"  json:\"gravatar\"`\n\tTimestamp   string `meddler:\"commit_timestamp\" json:\"timestamp\"`\n\tMessage     string `meddler:\"commit_message\"   json:\"message\"`\n\tConfig      string `meddler:\"commit_yaml\"      json:\"-\"`\n\tCreated     int64  `meddler:\"commit_created\"   json:\"created_at\"`\n\tUpdated     int64  `meddler:\"commit_updated\"   json:\"updated_at\"`\n}\n```\n\n```go\ntype Hook struct {\n\tOwner       string\n\tRepo        string\n\tSha         string\n\tBranch      string\n\tPullRequest string\n\tAuthor      string\n\tGravatar    string\n\tTimestamp   string\n\tMessage     string\n}\n```\nHook represents a subset of commit meta-data provided by post-commit and pull request hooks.\n\n```go\ntype Login struct {\n\tID     int64\n\tLogin  string\n\tAccess string\n\tSecret string\n\tName   string\n\tEmail  string\n\tExpiry int64\n}\n```\nLogin represents a standard subset of user meta-data provided by OAuth login services.\n\n```go\ntype Perm struct {\n\tID      int64 `meddler:\"perm_id,pk\"   json:\"-\"`\n\tUserID  int64 `meddler:\"user_id\"      json:\"-\"`\n\tRepoID  int64 `meddler:\"repo_id\"      json:\"-\"`\n\tRead    bool  `meddler:\"perm_read\"    json:\"read\"`\n\tWrite   bool  `meddler:\"perm_write\"   json:\"write\"`\n\tAdmin   bool  `meddler:\"perm_admin\"   json:\"admin\"`\n\tGuest   bool  `meddler:\"-\"            json:\"guest\"`\n\tCreated int64 `meddler:\"perm_created\" json:\"-\"`\n\tUpdated int64 `meddler:\"perm_updated\" json:\"-\"`\n}\n```\n\n```go\ntype Remote struct {\n\tID     int64  `meddler:\"remote_id,pk\"  json:\"id\"`\n\tType   string `meddler:\"remote_type\"   json:\"type\"`\n\tHost   string `meddler:\"remote_host\"   json:\"host\"`\n\tURL    string `meddler:\"remote_url\"    json:\"url\"`\n\tAPI    string `meddler:\"remote_api\"    json:\"api\"`\n\tClient string `meddler:\"remote_client\" json:\"client\"`\n\tSecret string `meddler:\"remote_secret\" json:\"secret\"`\n\tOpen   bool   `meddler:\"remote_open\"   json:\"open\"`\n}\n```\n\n```go\ntype Repo struct {\n\tID     int64  `meddler:\"repo_id,pk\"        json:\"-\"`\n\tUserID int64  `meddler:\"user_id\"           json:\"-\"`\n\tToken  string `meddler:\"repo_token\"        json:\"-\"`\n\tRemote string `meddler:\"repo_remote\"       json:\"remote\"`\n\tHost   string `meddler:\"repo_host\"         json:\"host\"`\n\tOwner  string `meddler:\"repo_owner\"        json:\"owner\"`\n\tName   string `meddler:\"repo_name\"         json:\"name\"`\n\n\tURL      string `meddler:\"repo_url\"       json:\"url\"`\n\tCloneURL string `meddler:\"repo_clone_url\" json:\"clone_url\"`\n\tGitURL   string `meddler:\"repo_git_url\"   json:\"git_url\"`\n\tSSHURL   string `meddler:\"repo_ssh_url\"   json:\"ssh_url\"`\n\n\tActive      bool   `meddler:\"repo_active\"       json:\"active\"`\n\tPrivate     bool   `meddler:\"repo_private\"      json:\"private\"`\n\tPrivileged  bool   `meddler:\"repo_privileged\"   json:\"privileged\"`\n\tPostCommit  bool   `meddler:\"repo_post_commit\"  json:\"post_commits\"`\n\tPullRequest bool   `meddler:\"repo_pull_request\" json:\"pull_requests\"`\n\tPublicKey   string `meddler:\"repo_public_key\"   json:\"-\"`\n\tPrivateKey  string `meddler:\"repo_private_key\"  json:\"-\"`\n\tParams      string `meddler:\"repo_params\"       json:\"-\"`\n\tTimeout     int64  `meddler:\"repo_timeout\"      json:\"timeout\"`\n\tCreated     int64  `meddler:\"repo_created\"      json:\"created_at\"`\n\tUpdated     int64  `meddler:\"repo_updated\"      json:\"updated_at\"`\n\n\t// Role defines the user's role relative to this repository.\n\t// Note that this data is stored separately in the datastore,\n\t// and must be joined to populate.\n\tRole *Perm `meddler:\"-\" json:\"role,omitempty\"`\n}\n```\n\n```go\nfunc NewRepo(remote, owner, name string) (*Repo, error)\n```\n\n```go\nfunc (r *Repo) ParamMap() (map[string]string, error)\n```\n\n```go\ntype RepoParams map[string]string\n```\nRepoParams represents a set of private key value parameters for each Repository.\n\n```go\ntype Request struct {\n\tHost   string  `json:\"-\"`\n\tUser   *User   `json:\"-\"`\n\tRepo   *Repo   `json:\"repo\"`\n\tCommit *Commit `json:\"commit\"`\n\tPrior  *Commit `json:\"prior_commit\"`\n}\n```\n\n```go\nfunc (r *Request) URL() string\n```\nURL returns the link to the commit in string format.\n\n```go\ntype Token struct {\n\tAccessToken  string\n\tRefreshToken string\n\tExpiry       int64\n}\n```\n\n```go\ntype User struct {\n\tID          int64  `meddler:\"user_id,pk\"          json:\"-\"`\n\tRemote      string `meddler:\"user_remote\"         json:\"remote\"`\n\tLogin       string `meddler:\"user_login\"          json:\"login\"`\n\tAccess      string `meddler:\"user_access\"         json:\"-\"`\n\tSecret      string `meddler:\"user_secret\"         json:\"-\"`\n\tName        string `meddler:\"user_name\"           json:\"name\"`\n\tEmail       string `meddler:\"user_email\"          json:\"email,omitempty\"`\n\tGravatar    string `meddler:\"user_gravatar\"       json:\"gravatar\"`\n\tToken       string `meddler:\"user_token\"          json:\"-\"`\n\tAdmin       bool   `meddler:\"user_admin\"          json:\"admin\"`\n\tActive      bool   `meddler:\"user_active\"         json:\"active\"`\n\tSyncing     bool   `meddler:\"user_syncing\"        json:\"syncing\"`\n\tCreated     int64  `meddler:\"user_created\"        json:\"created_at\"`\n\tUpdated     int64  `meddler:\"user_updated\"        json:\"updated_at\"`\n\tSynced      int64  `meddler:\"user_synced\"         json:\"synced_at\"`\n\tTokenExpiry int64  `meddler:\"user_access_expires,zeroisnull\" json:\"-\"`\n}\n```\n\n```go\nfunc NewUser(remote, login, email string) *User\n```\n\n```go\nfunc (u *User) IsStale() bool\n```\n\n```go\nfunc (u *User) SetEmail(email string)\n```\nSetEmail sets the email address and calculate the Gravatar hash.\n\n","path":"github.com/Coding/drone/shared/model","name":"model","synopsis":"","isRedistributable":true}
