refactor: clean up the getAccountID function sig
The getAccountID function no longer needs the path to the credentials file.
This commit is contained in:
parent
878a898d4c
commit
a0eab3b6ae
12 changed files with 12 additions and 13 deletions
|
@ -25,7 +25,7 @@ func (a *AcceptExecutor) Execute() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AcceptExecutor) acceptFollowRequest(gtsClient *client.Client) error {
|
func (a *AcceptExecutor) acceptFollowRequest(gtsClient *client.Client) error {
|
||||||
accountID, err := getAccountID(gtsClient, false, a.accountName, a.config.CredentialsFile)
|
accountID, err := getAccountID(gtsClient, false, a.accountName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ func getAccountID(
|
||||||
gtsClient *client.Client,
|
gtsClient *client.Client,
|
||||||
myAccount bool,
|
myAccount bool,
|
||||||
accountNames internalFlag.StringSliceValue,
|
accountNames internalFlag.StringSliceValue,
|
||||||
credentialsFile string,
|
|
||||||
) (string, error) {
|
) (string, error) {
|
||||||
account, err := getAccount(gtsClient, myAccount, accountNames)
|
account, err := getAccount(gtsClient, myAccount, accountNames)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -104,7 +104,7 @@ func (a *AddExecutor) addToAccount(gtsClient *client.Client) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AddExecutor) addNoteToAccount(gtsClient *client.Client) error {
|
func (a *AddExecutor) addNoteToAccount(gtsClient *client.Client) error {
|
||||||
accountID, err := getAccountID(gtsClient, false, a.accountNames, a.config.CredentialsFile)
|
accountID, err := getAccountID(gtsClient, false, a.accountNames)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ func (b *BlockExecutor) Execute() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *BlockExecutor) blockAccount(gtsClient *client.Client) error {
|
func (b *BlockExecutor) blockAccount(gtsClient *client.Client) error {
|
||||||
accountID, err := getAccountID(gtsClient, false, b.accountName, b.config.CredentialsFile)
|
accountID, err := getAccountID(gtsClient, false, b.accountName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ func (f *FollowExecutor) Execute() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *FollowExecutor) followAccount(gtsClient *client.Client) error {
|
func (f *FollowExecutor) followAccount(gtsClient *client.Client) error {
|
||||||
accountID, err := getAccountID(gtsClient, false, f.accountName, f.config.CredentialsFile)
|
accountID, err := getAccountID(gtsClient, false, f.accountName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ func (m *MuteExecutor) Execute() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MuteExecutor) muteAccount(gtsClient *client.Client) error {
|
func (m *MuteExecutor) muteAccount(gtsClient *client.Client) error {
|
||||||
accountID, err := getAccountID(gtsClient, false, m.accountName, m.config.CredentialsFile)
|
accountID, err := getAccountID(gtsClient, false, m.accountName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ func (r *RejectExecutor) Execute() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *RejectExecutor) rejectFollowRequest(gtsClient *client.Client) error {
|
func (r *RejectExecutor) rejectFollowRequest(gtsClient *client.Client) error {
|
||||||
accountID, err := getAccountID(gtsClient, false, r.accountName, r.config.CredentialsFile)
|
accountID, err := getAccountID(gtsClient, false, r.accountName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ func (r *RemoveExecutor) removeFromAccount(gtsClient *client.Client) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *RemoveExecutor) removeNoteFromAccount(gtsClient *client.Client) error {
|
func (r *RemoveExecutor) removeNoteFromAccount(gtsClient *client.Client) error {
|
||||||
accountID, err := getAccountID(gtsClient, false, r.accountNames, r.config.CredentialsFile)
|
accountID, err := getAccountID(gtsClient, false, r.accountNames)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,7 +253,7 @@ func (s *ShowExecutor) showFollowers(gtsClient *client.Client) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ShowExecutor) showFollowersFromAccount(gtsClient *client.Client) error {
|
func (s *ShowExecutor) showFollowersFromAccount(gtsClient *client.Client) error {
|
||||||
accountID, err := getAccountID(gtsClient, s.myAccount, s.accountName, s.config.CredentialsFile)
|
accountID, err := getAccountID(gtsClient, s.myAccount, s.accountName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -293,7 +293,7 @@ func (s *ShowExecutor) showFollowing(gtsClient *client.Client) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ShowExecutor) showFollowingFromAccount(gtsClient *client.Client) error {
|
func (s *ShowExecutor) showFollowingFromAccount(gtsClient *client.Client) error {
|
||||||
accountID, err := getAccountID(gtsClient, s.myAccount, s.accountName, s.config.CredentialsFile)
|
accountID, err := getAccountID(gtsClient, s.myAccount, s.accountName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ func (b *UnblockExecutor) Execute() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *UnblockExecutor) unblockAccount(gtsClient *client.Client) error {
|
func (b *UnblockExecutor) unblockAccount(gtsClient *client.Client) error {
|
||||||
accountID, err := getAccountID(gtsClient, false, b.accountName, b.config.CredentialsFile)
|
accountID, err := getAccountID(gtsClient, false, b.accountName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ func (f *UnfollowExecutor) Execute() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *UnfollowExecutor) unfollowAccount(gtsClient *client.Client) error {
|
func (f *UnfollowExecutor) unfollowAccount(gtsClient *client.Client) error {
|
||||||
accountID, err := getAccountID(gtsClient, false, f.accountName, f.config.CredentialsFile)
|
accountID, err := getAccountID(gtsClient, false, f.accountName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ func (m *UnmuteExecutor) Execute() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *UnmuteExecutor) unmuteAccount(gtsClient *client.Client) error {
|
func (m *UnmuteExecutor) unmuteAccount(gtsClient *client.Client) error {
|
||||||
accountID, err := getAccountID(gtsClient, false, m.accountName, m.config.CredentialsFile)
|
accountID, err := getAccountID(gtsClient, false, m.accountName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue