From a0eab3b6aef805df4b5dfd3f4e0654a8dc5d2c3e Mon Sep 17 00:00:00 2001 From: Dan Anglin Date: Tue, 13 Aug 2024 23:51:16 +0100 Subject: [PATCH] refactor: clean up the getAccountID function sig The getAccountID function no longer needs the path to the credentials file. --- internal/executor/accept.go | 2 +- internal/executor/account.go | 1 - internal/executor/add.go | 2 +- internal/executor/block.go | 2 +- internal/executor/follow.go | 2 +- internal/executor/mute.go | 2 +- internal/executor/reject.go | 2 +- internal/executor/remove.go | 2 +- internal/executor/show.go | 4 ++-- internal/executor/unblock.go | 2 +- internal/executor/unfollow.go | 2 +- internal/executor/unmute.go | 2 +- 12 files changed, 12 insertions(+), 13 deletions(-) diff --git a/internal/executor/accept.go b/internal/executor/accept.go index 158927d..cb1f43b 100644 --- a/internal/executor/accept.go +++ b/internal/executor/accept.go @@ -25,7 +25,7 @@ func (a *AcceptExecutor) Execute() 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 { return fmt.Errorf("received an error while getting the account ID: %w", err) } diff --git a/internal/executor/account.go b/internal/executor/account.go index d1086f6..b7d0f0c 100644 --- a/internal/executor/account.go +++ b/internal/executor/account.go @@ -12,7 +12,6 @@ func getAccountID( gtsClient *client.Client, myAccount bool, accountNames internalFlag.StringSliceValue, - credentialsFile string, ) (string, error) { account, err := getAccount(gtsClient, myAccount, accountNames) if err != nil { diff --git a/internal/executor/add.go b/internal/executor/add.go index b46d03b..ab89ebd 100644 --- a/internal/executor/add.go +++ b/internal/executor/add.go @@ -104,7 +104,7 @@ func (a *AddExecutor) addToAccount(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 { return fmt.Errorf("received an error while getting the account ID: %w", err) } diff --git a/internal/executor/block.go b/internal/executor/block.go index 1b0eeae..4598888 100644 --- a/internal/executor/block.go +++ b/internal/executor/block.go @@ -25,7 +25,7 @@ func (b *BlockExecutor) Execute() 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 { return fmt.Errorf("received an error while getting the account ID: %w", err) } diff --git a/internal/executor/follow.go b/internal/executor/follow.go index b76ca09..1384ecc 100644 --- a/internal/executor/follow.go +++ b/internal/executor/follow.go @@ -25,7 +25,7 @@ func (f *FollowExecutor) Execute() 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 { return fmt.Errorf("received an error while getting the account ID: %w", err) } diff --git a/internal/executor/mute.go b/internal/executor/mute.go index 73d8f50..2416f76 100644 --- a/internal/executor/mute.go +++ b/internal/executor/mute.go @@ -25,7 +25,7 @@ func (m *MuteExecutor) Execute() 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 { return fmt.Errorf("received an error while getting the account ID: %w", err) } diff --git a/internal/executor/reject.go b/internal/executor/reject.go index adaf804..f12087f 100644 --- a/internal/executor/reject.go +++ b/internal/executor/reject.go @@ -25,7 +25,7 @@ func (r *RejectExecutor) Execute() 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 { return fmt.Errorf("received an error while getting the account ID: %w", err) } diff --git a/internal/executor/remove.go b/internal/executor/remove.go index 34c770d..69aa841 100644 --- a/internal/executor/remove.go +++ b/internal/executor/remove.go @@ -93,7 +93,7 @@ func (r *RemoveExecutor) removeFromAccount(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 { return fmt.Errorf("received an error while getting the account ID: %w", err) } diff --git a/internal/executor/show.go b/internal/executor/show.go index b9499a6..beecf8b 100644 --- a/internal/executor/show.go +++ b/internal/executor/show.go @@ -253,7 +253,7 @@ func (s *ShowExecutor) showFollowers(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 { 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 { - accountID, err := getAccountID(gtsClient, s.myAccount, s.accountName, s.config.CredentialsFile) + accountID, err := getAccountID(gtsClient, s.myAccount, s.accountName) if err != nil { return fmt.Errorf("received an error while getting the account ID: %w", err) } diff --git a/internal/executor/unblock.go b/internal/executor/unblock.go index 831102f..dc16bf4 100644 --- a/internal/executor/unblock.go +++ b/internal/executor/unblock.go @@ -25,7 +25,7 @@ func (b *UnblockExecutor) Execute() 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 { return fmt.Errorf("received an error while getting the account ID: %w", err) } diff --git a/internal/executor/unfollow.go b/internal/executor/unfollow.go index 102ce3d..e9c5e24 100644 --- a/internal/executor/unfollow.go +++ b/internal/executor/unfollow.go @@ -25,7 +25,7 @@ func (f *UnfollowExecutor) Execute() 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 { return fmt.Errorf("received an error while getting the account ID: %w", err) } diff --git a/internal/executor/unmute.go b/internal/executor/unmute.go index c4f4e83..ae19720 100644 --- a/internal/executor/unmute.go +++ b/internal/executor/unmute.go @@ -25,7 +25,7 @@ func (m *UnmuteExecutor) Execute() 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 { return fmt.Errorf("received an error while getting the account ID: %w", err) }