Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -1,26 +1,3 @@

# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"


[[constraint]]
name = "github.com/bitrise-io/go-utils"
branch = "master"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package bitriseclient
package bitrise

import (
"math/big"
Expand Down Expand Up @@ -76,7 +76,7 @@ type IdentityResponse struct {
}

// FetchUploadedIdentities ...
func (client *BitriseClient) FetchUploadedIdentities() ([]IdentityListData, error) {
func (client *Client) FetchUploadedIdentities() ([]IdentityListData, error) {
log.Debugf("\nDownloading provisioning profile list from Bitrise...")

requestURL, err := urlutil.Join(baseURL, appsEndPoint, client.selectedAppSlug, certificatesEndPoint)
Expand Down Expand Up @@ -104,7 +104,7 @@ func (client *BitriseClient) FetchUploadedIdentities() ([]IdentityListData, erro
}

// GetUploadedCertificatesSerialby ...
func (client *BitriseClient) GetUploadedCertificatesSerialby(identitySlug string) (certificateSerialList []big.Int, err error) {
func (client *Client) GetUploadedCertificatesSerialby(identitySlug string) (certificateSerialList []big.Int, err error) {
downloadURL, certificatePassword, err := client.getUploadedIdentityDownloadURLBy(identitySlug)
if err != nil {
return nil, err
Expand All @@ -128,7 +128,7 @@ func (client *BitriseClient) GetUploadedCertificatesSerialby(identitySlug string
return serialList, nil
}

func (client *BitriseClient) getUploadedIdentityDownloadURLBy(certificateSlug string) (downloadURL string, password string, err error) {
func (client *Client) getUploadedIdentityDownloadURLBy(certificateSlug string) (downloadURL string, password string, err error) {
log.Debugf("\nGet downloadURL for certificate (slug - %s) from Bitrise...", certificateSlug)

requestURL, err := urlutil.Join(baseURL, appsEndPoint, client.selectedAppSlug, certificatesEndPoint, certificateSlug)
Expand Down Expand Up @@ -157,7 +157,7 @@ func (client *BitriseClient) getUploadedIdentityDownloadURLBy(certificateSlug st
return requestResponse.Data.DownloadURL, requestResponse.Data.CertificatePassword, nil
}

func (client *BitriseClient) downloadUploadedIdentity(downloadURL string) (content string, err error) {
func (client *Client) downloadUploadedIdentity(downloadURL string) (content string, err error) {
log.Debugf("\nDownloading identities from Bitrise...")
log.Debugf("\nRequest URL: %s", downloadURL)

Expand All @@ -182,7 +182,7 @@ func (client *BitriseClient) downloadUploadedIdentity(downloadURL string) (conte
}

// RegisterIdentity ...
func (client *BitriseClient) RegisterIdentity(certificateSize int64) (RegisterIdentityData, error) {
func (client *Client) RegisterIdentity(certificateSize int64) (RegisterIdentityData, error) {
log.Printf("Register %s on Bitrise...", "Identities.p12")

requestURL, err := urlutil.Join(baseURL, appsEndPoint, client.selectedAppSlug, certificatesEndPoint)
Expand Down Expand Up @@ -217,7 +217,7 @@ func (client *BitriseClient) RegisterIdentity(certificateSize int64) (RegisterId
}

// UploadIdentity ...
func (client *BitriseClient) UploadIdentity(uploadURL string, uploadFileName string, outputDirPath string, exportFileName string) error {
func (client *Client) UploadIdentity(uploadURL string, uploadFileName string, outputDirPath string, exportFileName string) error {
log.Printf("Upload %s to Bitrise...", exportFileName)

filePth := filepath.Join(outputDirPath, exportFileName)
Expand All @@ -235,7 +235,7 @@ func (client *BitriseClient) UploadIdentity(uploadURL string, uploadFileName str
}

// ConfirmIdentityUpload ...
func (client *BitriseClient) ConfirmIdentityUpload(certificateSlug string, certificateUploadName string) error {
func (client *Client) ConfirmIdentityUpload(certificateSlug string, certificateUploadName string) error {
log.Printf("Confirm - %s - upload to Bitrise...", certificateUploadName)

requestURL, err := urlutil.Join(baseURL, appsEndPoint, client.selectedAppSlug, "build-certificates", certificateSlug, "uploaded")
Expand Down
18 changes: 9 additions & 9 deletions bitriseclient/bitriseclient.go → bitriseio/bitrise/client.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package bitriseclient
package bitrise

import (
"bytes"
Expand Down Expand Up @@ -58,17 +58,17 @@ type MyAppsResponse struct {
Paging Paging `json:"paging"`
}

// BitriseClient ...
type BitriseClient struct {
// Client ...
type Client struct {
accessToken string
selectedAppSlug string
headers map[string]string
client http.Client
}

// NewBitriseClient ...
func NewBitriseClient(accessToken string) (*BitriseClient, []Application, error) {
client := &BitriseClient{accessToken, "", map[string]string{"Authorization": "token " + accessToken}, http.Client{}}
// NewClient ...
func NewClient(accessToken string) (*Client, []Application, error) {
client := &Client{accessToken, "", map[string]string{"Authorization": "token " + accessToken}, http.Client{}}
var apps []Application

log.Infof("Fetching your application list from Bitrise...")
Expand Down Expand Up @@ -120,12 +120,12 @@ func NewBitriseClient(accessToken string) (*BitriseClient, []Application, error)
}

// SetSelectedAppSlug ...
func (client *BitriseClient) SetSelectedAppSlug(slug string) {
func (client *Client) SetSelectedAppSlug(slug string) {
client.selectedAppSlug = slug
}

// RunRequest ...
func RunRequest(client *BitriseClient, req *http.Request, requestResponse interface{}) (interface{}, []byte, error) {
func RunRequest(client *Client, req *http.Request, requestResponse interface{}) (interface{}, []byte, error) {
var responseBody []byte

if err := retry.Times(1).Wait(5 * time.Second).Try(func(attempt uint) error {
Expand Down Expand Up @@ -201,7 +201,7 @@ func createRequest(requestMethod string, url string, headers map[string]string,
return req, nil
}

func performRequest(bitriseClient *BitriseClient, request *http.Request) (body []byte, statusCode int, err error) {
func performRequest(bitriseClient *Client, request *http.Request) (body []byte, statusCode int, err error) {
response, err := bitriseClient.client.Do(request)
if err != nil {
// On error, any Response can be ignored
Expand Down
16 changes: 8 additions & 8 deletions bitriseclient/profile.go → bitriseio/bitrise/profile.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package bitriseclient
package bitrise

import (
"net/http"
Expand Down Expand Up @@ -72,7 +72,7 @@ type UploadedProvisioningProfileResponse struct {
}

// FetchProvisioningProfiles ...
func (client *BitriseClient) FetchProvisioningProfiles() ([]ProvisioningProfileListData, error) {
func (client *Client) FetchProvisioningProfiles() ([]ProvisioningProfileListData, error) {
log.Debugf("\nDownloading provisioning profile list from Bitrise...")

requestURL, err := urlutil.Join(baseURL, appsEndPoint, client.selectedAppSlug, provisioningProfilesEndPoint)
Expand Down Expand Up @@ -102,7 +102,7 @@ func (client *BitriseClient) FetchProvisioningProfiles() ([]ProvisioningProfileL
}

// GetUploadedProvisioningProfileUUIDby ...
func (client *BitriseClient) GetUploadedProvisioningProfileUUIDby(profileSlug string) (UUID string, err error) {
func (client *Client) GetUploadedProvisioningProfileUUIDby(profileSlug string) (UUID string, err error) {
downloadURL, err := client.getUploadedProvisioningProfileDownloadURLBy(profileSlug)
if err != nil {
return "", err
Expand All @@ -126,7 +126,7 @@ func (client *BitriseClient) GetUploadedProvisioningProfileUUIDby(profileSlug st
return data.UUID, nil
}

func (client *BitriseClient) getUploadedProvisioningProfileDownloadURLBy(profileSlug string) (downloadURL string, err error) {
func (client *Client) getUploadedProvisioningProfileDownloadURLBy(profileSlug string) (downloadURL string, err error) {
log.Debugf("\nGet downloadURL for provisioning profile (slug - %s) from Bitrise...", profileSlug)

requestURL, err := urlutil.Join(baseURL, appsEndPoint, client.selectedAppSlug, provisioningProfilesEndPoint, profileSlug)
Expand Down Expand Up @@ -155,7 +155,7 @@ func (client *BitriseClient) getUploadedProvisioningProfileDownloadURLBy(profile
return requestResponse.Data.DownloadURL, nil
}

func (client *BitriseClient) downloadUploadedProvisioningProfile(downloadURL string) (content string, err error) {
func (client *Client) downloadUploadedProvisioningProfile(downloadURL string) (content string, err error) {
log.Debugf("\nDownloading provisioning profile from Bitrise...")
log.Debugf("\nRequest URL: %s", downloadURL)

Expand All @@ -180,7 +180,7 @@ func (client *BitriseClient) downloadUploadedProvisioningProfile(downloadURL str
}

// RegisterProvisioningProfile ...
func (client *BitriseClient) RegisterProvisioningProfile(provisioningProfSize int64, profile profileutil.ProvisioningProfileInfoModel) (RegisterProvisioningProfileData, error) {
func (client *Client) RegisterProvisioningProfile(provisioningProfSize int64, profile profileutil.ProvisioningProfileInfoModel) (RegisterProvisioningProfileData, error) {
log.Printf("Register %s on Bitrise...", profile.Name)

requestURL, err := urlutil.Join(baseURL, appsEndPoint, client.selectedAppSlug, provisioningProfilesEndPoint)
Expand Down Expand Up @@ -215,7 +215,7 @@ func (client *BitriseClient) RegisterProvisioningProfile(provisioningProfSize in
}

// UploadProvisioningProfile ...
func (client *BitriseClient) UploadProvisioningProfile(uploadURL string, uploadFileName string, outputDirPath string, exportFileName string) error {
func (client *Client) UploadProvisioningProfile(uploadURL string, uploadFileName string, outputDirPath string, exportFileName string) error {
log.Printf("Upload %s to Bitrise...", exportFileName)

filePth := filepath.Join(outputDirPath, exportFileName)
Expand All @@ -236,7 +236,7 @@ func (client *BitriseClient) UploadProvisioningProfile(uploadURL string, uploadF
}

// ConfirmProvisioningProfileUpload ...
func (client *BitriseClient) ConfirmProvisioningProfileUpload(profileSlug string, provUploadName string) error {
func (client *Client) ConfirmProvisioningProfileUpload(profileSlug string, provUploadName string) error {
log.Printf("Confirm - %s - upload to Bitrise...", provUploadName)

requestURL, err := urlutil.Join(baseURL, appsEndPoint, client.selectedAppSlug, provisioningProfilesEndPoint, profileSlug, "uploaded")
Expand Down
Loading