utils

package
v0.0.0-...-b69bfab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2014 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OrgUtils

type OrgUtils struct {
	*Utils
}

OrgUtils handles activities around GitHub organizations. This code is basically just a wrapper around the library that google has graciously put together.

TODO: Methods implemented on this struct should provide generic return values (Not, the go-github structs)

func (*OrgUtils) ConcealMembership

func (ot *OrgUtils) ConcealMembership(org, user string) (*github.Response, error)

ConcealMembership conceals a user's membership in an organization.

func (*OrgUtils) Edit

Edit an organization.

func (*OrgUtils) EditOrgMembership

func (ot *OrgUtils) EditOrgMembership(org string, membership *github.Membership) (*github.Membership, *github.Response, error)

EditOrgMembership edits the membership for the authenticated user for the specified organization.

func (*OrgUtils) Get

func (ot *OrgUtils) Get(org string) (*github.Organization, *github.Response, error)

Get fetches an organization by name.

func (*OrgUtils) GetOrgMembership

func (ot *OrgUtils) GetOrgMembership(org string) (*github.Membership, *github.Response, error)

GetOrgMembership gets the membership for the authenticated user for the specified organization.

func (*OrgUtils) IsMember

func (ot *OrgUtils) IsMember(org, user string) (bool, *github.Response, error)

IsMember checks if a user is a member of an organization.

func (*OrgUtils) IsPublicMember

func (ot *OrgUtils) IsPublicMember(org, user string) (bool, *github.Response, error)

IsPublicMember checks if a user is a public member of an organization.

func (*OrgUtils) List

List the organizations for a user. Passing the empty string will list organizations for the authenticated user.

func (*OrgUtils) ListMembers

func (ot *OrgUtils) ListMembers(org string, opt *github.ListMembersOptions) ([]github.User, *github.Response, error)

ListMembers lists the members for an organization. If the authenticated user is an owner of the organization, this will return both concealed and public members, otherwise it will only return public members.

func (*OrgUtils) ListOrgMemberships

func (ot *OrgUtils) ListOrgMemberships(opt *github.ListOrgMembershipsOptions) ([]github.Membership, *github.Response, error)

ListOrgMemberships lists the organization memberships for the authenticated user.

func (*OrgUtils) PublicizeMembership

func (ot *OrgUtils) PublicizeMembership(org, user string) (*github.Response, error)

PublicizeMembership publicizes a user's membership in an organization.

func (*OrgUtils) RemoveMember

func (ot *OrgUtils) RemoveMember(org, user string) (*github.Response, error)

RemoveMember removes a user from all teams of an organization.

type RepoUtils

type RepoUtils struct {
	*Utils
}

RepoUtils handles activities around GitHub repositories. This code is basically just a wrapper around the library that google has graciously put together.

TODO: Methods implemented on this struct should provide generic return values (Not, the go-github structs)

func (*RepoUtils) AddCollaborator

func (rt *RepoUtils) AddCollaborator(owner, repo, user string) (*Response, error)

AddCollaborator adds the specified Github user as collaborator to the given repo.

func (*RepoUtils) CompareCommits

func (rt *RepoUtils) CompareCommits(owner, repo string, base, head string) (*github.CommitsComparison, *Response, error)

CompareCommits compares a range of commits with each other. todo: support media formats - https://github.com/google/go-github/issues/6

func (*RepoUtils) Create

func (rt *RepoUtils) Create(org string, repo *github.Repository) (*github.Repository, *Response, error)

Create a new repository. If an organization is specified, the new repository will be created under that org. If the empty string is specified, it will be created for the authenticated user.

func (*RepoUtils) CreateComment

func (rt *RepoUtils) CreateComment(owner, repo, sha string, comment *github.RepositoryComment) (*github.RepositoryComment, *Response, error)

CreateComment creates a comment for the given commit. Note: GitHub allows for comments to be created for non-existing files and positions.

func (*RepoUtils) CreateFile

func (rt *RepoUtils) CreateFile(owner, repo, path string, opt *github.RepositoryContentFileOptions) (*github.RepositoryContentResponse, *Response, error)

CreateFile creates a new file in a repository at the given path and returns the commit and file metadata.

func (*RepoUtils) CreateFork

func (rt *RepoUtils) CreateFork(owner, repo string, opt *github.RepositoryCreateForkOptions) (*github.Repository, *Response, error)

CreateFork creates a fork of the specified repository.

func (*RepoUtils) Delete

func (rt *RepoUtils) Delete(owner, repo string) (*Response, error)

Delete a repository.

func (*RepoUtils) DeleteComment

func (rt *RepoUtils) DeleteComment(owner, repo string, id int) (*Response, error)

func (*RepoUtils) DeleteFile

func (rt *RepoUtils) DeleteFile(owner, repo, path string, opt *github.RepositoryContentFileOptions) (*github.RepositoryContentResponse, *Response, error)

DeleteFile deletes a file from a repository and returns the commit. Requires the blob SHA of the file to be deleted.

func (*RepoUtils) Edit

func (rt *RepoUtils) Edit(owner, repo string, repository *github.Repository) (*github.Repository, *Response, error)

Edit updates a repository.

func (*RepoUtils) Get

func (rt *RepoUtils) Get(owner, repo string) (*github.Repository, *Response, error)

Get fetches a repository.

func (*RepoUtils) GetBranch

func (rt *RepoUtils) GetBranch(owner, repo, branch string) (*github.Branch, *Response, error)

GetBranch gets the specified branch for a repository.

func (*RepoUtils) GetComment

func (rt *RepoUtils) GetComment(owner, repo string, id int) (*github.RepositoryComment, *Response, error)

GetComment gets a single comment from a repository.

func (*RepoUtils) GetCommit

func (rt *RepoUtils) GetCommit(owner, repo, sha string) (*github.RepositoryCommit, *Response, error)

GetCommit fetches the specified commit, including all details about it. todo: support media formats - https://github.com/google/go-github/issues/6

func (*RepoUtils) GetContents

func (rt *RepoUtils) GetContents(owner, repo, path string, opt *github.RepositoryContentGetOptions) (fileContent *github.RepositoryContent,
	directoryContent []*github.RepositoryContent, resp *Response, err error)

GetContents can return either the metadata and content of a single file (when path references a file) or the metadata of all the files and/or subdirectories of a directory (when path references a directory). To make it easy to distinguish between both result types and to mimic the API as much as possible, both result types will be returned but only one will contain a value and the other will be nil.

func (*RepoUtils) GetReadme

GetReadme gets the Readme file for the repository.

func (*RepoUtils) IsCollaborator

func (rt *RepoUtils) IsCollaborator(owner, repo, user string) (bool, *Response, error)

IsCollaborator checks whether the specified Github user has collaborator access to the given repo. Note: This will return false if the user is not a collaborator OR the user is not a GitHub user.

func (*RepoUtils) List

List the repositories for a user. Passing the empty string will list repositories for the authenticated user.

func (*RepoUtils) ListAll

ListAll lists all GitHub repositories in the order that they were created.

func (*RepoUtils) ListBranches

func (rt *RepoUtils) ListBranches(owner string, repo string, opt *github.ListOptions) ([]github.Branch, *Response, error)

ListBranches lists branches for the specified repository.

func (*RepoUtils) ListByOrg

ListByOrg lists the repositories for an organization.

func (*RepoUtils) ListCollaborators

func (rt *RepoUtils) ListCollaborators(owner, repo string, opt *github.ListOptions) ([]github.User, *Response, error)

ListCollaborators lists the Github users that have access to the repository.

func (*RepoUtils) ListComments

func (rt *RepoUtils) ListComments(owner, repo string, opt *github.ListOptions) ([]github.RepositoryComment, *Response, error)

ListComments lists all the comments for the repository.

func (*RepoUtils) ListCommitComments

func (rt *RepoUtils) ListCommitComments(owner, repo, sha string, opt *github.ListOptions) ([]github.RepositoryComment, *Response, error)

ListCommitComments lists all the comments for a given commit SHA.

func (*RepoUtils) ListCommits

func (rt *RepoUtils) ListCommits(owner, repo string, opt *github.CommitsListOptions) ([]github.RepositoryCommit, *Response, error)

ListCommits lists the commits of a repository.

func (*RepoUtils) ListContributors

func (rt *RepoUtils) ListContributors(owner string, repository string, opt *github.ListContributorsOptions) ([]github.Contributor, *Response, error)

ListContributors lists contributors for a repository

func (*RepoUtils) ListForks

func (rt *RepoUtils) ListForks(owner, repo string, opt *github.RepositoryListForksOptions) ([]github.Repository, *Response, error)

ListForks lists the forks of the specified repository.

func (*RepoUtils) ListLanguages

func (rt *RepoUtils) ListLanguages(owner string, repo string) (map[string]int, *Response, error)

ListLanguages lists languages for the specified repository. The returned map specifies the languages and the number of bytes of code written in that language. For example:

{
  "C": 78769,
  "Python": 7769
}

func (*RepoUtils) ListTags

func (rt *RepoUtils) ListTags(owner string, repo string, opt *github.ListOptions) ([]github.RepositoryTag, *Response, error)

ListTags lists tags for the specified repository.

func (*RepoUtils) ListTeams

func (rt *RepoUtils) ListTeams(owner string, repo string, opt *github.ListOptions) ([]github.Team, *Response, error)

ListTeams lists the teams for the specified repository.

func (*RepoUtils) RemoveCollaborator

func (rt *RepoUtils) RemoveCollaborator(owner, repo, user string) (*Response, error)

RemoveCollaborator removes the specified Github user as collaborator from the given repo. Note: Does not return error if a valid user that is not a collaborator is removed.

func (*RepoUtils) UpdateComment

func (rt *RepoUtils) UpdateComment(owner, repo string, id int, comment *github.RepositoryComment) (*github.RepositoryComment, *Response, error)

UpdateComment updates the body of a single comment.

func (*RepoUtils) UpdateFile

func (rt *RepoUtils) UpdateFile(owner, repo, path string, opt *github.RepositoryContentFileOptions) (*github.RepositoryContentResponse, *Response, error)

UpdateFile updates a file in a repository at the given path and returns the commit and file metadata. Requires the blob SHA of the file being updated.

type Response

type Response struct {
	*github.Response
}

Response is a light wrapper around the go-github Response struct

func NewResponse

func NewResponse(r *github.Response) *Response

NewResponse creates a new instance of Response

type Team

type Team struct {
	*github.Team
}

Team represents a team within a GitHub organization. Teams are used to manage access to an organization's repositories.

This is just a thin wrapper around the go-github Team struct

func NewTeam

func NewTeam(t *github.Team) *Team

NewTeam creates a new instance of Team

type TeamUtils

type TeamUtils struct {
	*Utils
}

TeamUtils handles activities around managing teams within a GitHub organization. This code is basically just a wrapper around the library that google has graciously put together.

TODO: Methods implemented on this struct should provide generic return values (Not, the go-github structs)

func (*TeamUtils) AddTeamMember

func (tt *TeamUtils) AddTeamMember(team int, user string) (*github.Response, error)

AddTeamMember adds a user to a team.

func (*TeamUtils) AddTeamMembership

func (tt *TeamUtils) AddTeamMembership(team int, user string) (*github.Membership, *github.Response, error)

AddTeamMembership adds or invites a user to a team.

In order to add a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with.

If the user is already a part of the team's organization (meaning they're on at least one other team in the organization), this endpoint will add the user to the team.

If the user is completely unaffiliated with the team's organization (meaning they're on none of the organization's teams), this endpoint will send an invitation to the user via email. This newly-created membership will be in the "pending" state until the user accepts the invitation, at which point the membership will transition to the "active" state and the user will be added as a member of the team.

func (*TeamUtils) AddTeamRepo

func (tt *TeamUtils) AddTeamRepo(team int, owner string, repo string) (*github.Response, error)

AddTeamRepo adds a repository to be managed by the specified team. The specified repository must be owned by the organization to which the team belongs, or a direct fork of a repository owned by the organization.

func (*TeamUtils) CreateTeam

func (tt *TeamUtils) CreateTeam(org string, team *github.Team) (*github.Team, *Response, error)

CreateTeam creates a new team within an organization.

func (*TeamUtils) DeleteTeam

func (tt *TeamUtils) DeleteTeam(team int) (*github.Response, error)

DeleteTeam deletes a team.

func (*TeamUtils) EditTeam

func (tt *TeamUtils) EditTeam(id int, team *github.Team) (*github.Team, *github.Response, error)

EditTeam edits a team.

func (*TeamUtils) GetTeam

func (tt *TeamUtils) GetTeam(team int) (*github.Team, *Response, error)

GetTeam fetches a team by ID.

func (*TeamUtils) GetTeamMembership

func (tt *TeamUtils) GetTeamMembership(team int, user string) (*github.Membership, *github.Response, error)

GetTeamMembership returns the membership status for a user in a team.

func (*TeamUtils) IsTeamMember

func (tt *TeamUtils) IsTeamMember(team int, user string) (bool, *github.Response, error)

IsTeamMember checks if a user is a member of the specified team.

func (*TeamUtils) IsTeamRepo

func (tt *TeamUtils) IsTeamRepo(team int, owner string, repo string) (bool, *github.Response, error)

IsTeamRepo checks if a team manages the specified repository.

func (*TeamUtils) ListTeamMembers

func (tt *TeamUtils) ListTeamMembers(team int, opt *github.ListOptions) ([]github.User, *github.Response, error)

ListTeamMembers lists all of the users who are members of the specified team.

func (*TeamUtils) ListTeamRepos

func (tt *TeamUtils) ListTeamRepos(team int, opt *github.ListOptions) ([]github.Repository, *github.Response, error)

ListTeamRepos lists the repositories that the specified team has access to.

func (*TeamUtils) ListTeams

func (tt *TeamUtils) ListTeams(org string, opt *github.ListOptions) ([]github.Team, *Response, error)

ListTeams lists all of the teams for an organization.

func (*TeamUtils) RemoveTeamMember

func (tt *TeamUtils) RemoveTeamMember(team int, user string) (*github.Response, error)

RemoveTeamMember removes a user from a team.

func (*TeamUtils) RemoveTeamMembership

func (tt *TeamUtils) RemoveTeamMembership(team int, user string) (*github.Response, error)

RemoveTeamMembership removes a user from a team.

func (*TeamUtils) RemoveTeamRepo

func (tt *TeamUtils) RemoveTeamRepo(team int, owner string, repo string) (*github.Response, error)

RemoveTeamRepo removes a repository from being managed by the specified team. Note that this does not delete the repository, it just removes it from the team.

type User

type User struct {
	*github.User
}

User is a simple wrapper around the go-github User struct

func NewUser

func NewUser(u *github.User) *User

NewUser creates a new instance of User

type UserUtils

type UserUtils struct {
	*Utils
}

UserUtils handles activities around managing users in a development workflow. This could include things like:

  1. communication with the user related methods of the GitHub API. Note: GitHub API docs: http://developer.github.com/v3/users/

func (*UserUtils) GetGitHubUser

func (ut *UserUtils) GetGitHubUser(user string) (*User, *Response, error)

GetGitHubUser fetches a repository user. Passing the empty string will fetch the authenticated user. TODO: This should provide generic return values (Not, the go-github structs)

func (*UserUtils) IsGitHubUser

func (ut *UserUtils) IsGitHubUser(user string) (bool, error)

IsGitHubUser is a convenience method for determining if any user is a valid GitHub user.

type Utils

type Utils struct {
	Users *UserUtils
	// contains filtered or unexported fields
}

Utils manages interactions with all utilities

func NewUtils

func NewUtils(config *config.Config) *Utils

NewUtils creates an instance of Utils

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL