This PR introduces some API changes that are breaking and thus constitute bumping the major version to 2.0.0. This PR is best viewed by commits as each changes an individual package.
Changes by package:
repository
Move CurrentRepository function from top level gh package to repository package. This felt like a more natural place for it.
Change name of CurrentRepository function to Current as it is now in the repository package.
Change Repository interface type to concrete type. The interface was not serving any purpose as there was only one implementation of it. Allowed for removing of internal/repository/repository.go.
api
Change all references of GQL to GraphQL.
Move RESTClient function from top level gh package to api package. This made more sense in the api package than at the top level.
Move GQLClient function from top level gh package to api package. This made more sense in the api package than at the top level.
Move HTTPClient function from top level gh package to api package. This made more sense in the api package than at the top level.
Change RESTClient interface type to concrete type. The interface was not serving any purpose as there was only one implementation of it.
Change GQLClient interface type to concrete type. The interface was not serving any purpose as there was only one implementation of it.
Change ClientOptions to be used with value semantics instead of pointer semantics. This allows ClientOptions to be used in multiple clients without having to worry about them being modified.
Change methods on HTTPError and GQLError custom error types to take pointers as method receivers. This is a Go convention which should be followed unless good reason not to.
Added DefaultRESTClient, DefaultHTTPClient, DefaultGQLClient convenience functions. With the change to using value semantics for the options these felt nice to have.
These changes allowed for removing of internal/api folder.
Change GQLClientQuery and Mutate methods to return GQLError instead of shurcooL/graphql.Errors.
browser
Change New factory function to return *Browser instead of Browser. All methods on Browser use *Browser as the receiver so we should be returning a pointer.
config
Change methods on InvalidConfigFileError and KeyNotFoundError custom error types to take pointers as method receivers. This is a Go convention which should be followed unless good reason not to.
template
Change New factory function to return *Template instead of Template. All methods on Template use *Template as the receiver so we should be returning a pointer.
This PR introduces some API changes that are breaking and thus constitute bumping the major version to 2.0.0. This PR is best viewed by commits as each changes an individual package.
Changes by package:
CurrentRepository
function from top levelgh
package torepository
package. This felt like a more natural place for it.CurrentRepository
function toCurrent
as it is now in therepository
package.Repository
interface type to concrete type. The interface was not serving any purpose as there was only one implementation of it. Allowed for removing ofinternal/repository/repository.go
.GQL
toGraphQL
.RESTClient
function from top levelgh
package toapi
package. This made more sense in theapi
package than at the top level.GQLClient
function from top levelgh
package toapi
package. This made more sense in theapi
package than at the top level.HTTPClient
function from top levelgh
package toapi
package. This made more sense in theapi
package than at the top level.RESTClient
interface type to concrete type. The interface was not serving any purpose as there was only one implementation of it.GQLClient
interface type to concrete type. The interface was not serving any purpose as there was only one implementation of it.ClientOptions
to be used with value semantics instead of pointer semantics. This allowsClientOptions
to be used in multiple clients without having to worry about them being modified.HTTPError
andGQLError
custom error types to take pointers as method receivers. This is a Go convention which should be followed unless good reason not to.DefaultRESTClient
,DefaultHTTPClient
,DefaultGQLClient
convenience functions. With the change to using value semantics for the options these felt nice to have.internal/api
folder.GQLClient
Query
andMutate
methods to returnGQLError
instead ofshurcooL/graphql.Errors
.New
factory function to return*Browser
instead ofBrowser
. All methods onBrowser
use*Browser
as the receiver so we should be returning a pointer.InvalidConfigFileError
andKeyNotFoundError
custom error types to take pointers as method receivers. This is a Go convention which should be followed unless good reason not to.New
factory function to return*Template
instead ofTemplate
. All methods onTemplate
use*Template
as the receiver so we should be returning a pointer.Fixes https://github.com/cli/go-gh/issues/97