Minor fixes and first API test changeover (#243)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2020-08-07 15:01:18 -04:00
1 parent d74e30d94a
commit df4730b1a0
16 files changed
+167 -145

No files matched your search

+8 -8
View File
@@ -23,15 +23,15 @@ type Account struct {
Attributes map[string]interface{} `json:"attributes,omitempty"`
}
type accountClient struct {
type accountsClient struct {
client *api.Client
}
func NewAccountClient(c *api.Client) *accountClient {
return &accountClient{client: c}
func NewAccountsClient(c *api.Client) *accountsClient {
return &accountsClient{client: c}
}
func (c *accountClient) Create(ctx context.Context, authMethodId string, opt ...Option) (*Account, *api.Error, error) {
func (c *accountsClient) Create(ctx context.Context, authMethodId string, opt ...Option) (*Account, *api.Error, error) {
if authMethodId == "" {
return nil, nil, fmt.Errorf("empty authMethodId value passed into Create request")
}
@@ -61,7 +61,7 @@ func (c *accountClient) Create(ctx context.Context, authMethodId string, opt ...
return target, apiErr, nil
}
func (c *accountClient) Read(ctx context.Context, authMethodId string, accountId string, opt ...Option) (*Account, *api.Error, error) {
func (c *accountsClient) Read(ctx context.Context, authMethodId string, accountId string, opt ...Option) (*Account, *api.Error, error) {
if authMethodId == "" {
return nil, nil, fmt.Errorf("empty authMethodId value passed into Read request")
}
@@ -95,7 +95,7 @@ func (c *accountClient) Read(ctx context.Context, authMethodId string, accountId
return target, apiErr, nil
}
func (c *accountClient) Update(ctx context.Context, authMethodId string, accountId string, version uint32, opt ...Option) (*Account, *api.Error, error) {
func (c *accountsClient) Update(ctx context.Context, authMethodId string, accountId string, version uint32, opt ...Option) (*Account, *api.Error, error) {
if authMethodId == "" {
return nil, nil, fmt.Errorf("empty authMethodId value passed into Update request")
}
@@ -127,7 +127,7 @@ func (c *accountClient) Update(ctx context.Context, authMethodId string, account
return target, apiErr, nil
}
func (c *accountClient) Delete(ctx context.Context, authMethodId string, accountId string, opt ...Option) (bool, *api.Error, error) {
func (c *accountsClient) Delete(ctx context.Context, authMethodId string, accountId string, opt ...Option) (bool, *api.Error, error) {
if authMethodId == "" {
return false, nil, fmt.Errorf("empty authMethodId value passed into Delete request")
}
@@ -164,7 +164,7 @@ func (c *accountClient) Delete(ctx context.Context, authMethodId string, account
return target.Existed, apiErr, nil
}
func (c *accountClient) List(ctx context.Context, authMethodId string, opt ...Option) ([]*Account, *api.Error, error) {
func (c *accountsClient) List(ctx context.Context, authMethodId string, opt ...Option) ([]*Account, *api.Error, error) {
if authMethodId == "" {
return nil, nil, fmt.Errorf("empty authMethodId value passed into List request")
}
+8 -8
View File
@@ -21,15 +21,15 @@ type AuthMethod struct {
Attributes map[string]interface{} `json:"attributes,omitempty"`
}
type authmethodClient struct {
type authmethodsClient struct {
client *api.Client
}
func NewAuthMethodClient(c *api.Client) *authmethodClient {
return &authmethodClient{client: c}
func NewAuthMethodsClient(c *api.Client) *authmethodsClient {
return &authmethodsClient{client: c}
}
func (c *authmethodClient) Create(ctx context.Context, opt ...Option) (*AuthMethod, *api.Error, error) {
func (c *authmethodsClient) Create(ctx context.Context, opt ...Option) (*AuthMethod, *api.Error, error) {
if c.client == nil {
return nil, nil, fmt.Errorf("nil client")
}
@@ -55,7 +55,7 @@ func (c *authmethodClient) Create(ctx context.Context, opt ...Option) (*AuthMeth
return target, apiErr, nil
}
func (c *authmethodClient) Read(ctx context.Context, authMethodId string, opt ...Option) (*AuthMethod, *api.Error, error) {
func (c *authmethodsClient) Read(ctx context.Context, authMethodId string, opt ...Option) (*AuthMethod, *api.Error, error) {
if authMethodId == "" {
return nil, nil, fmt.Errorf("empty authMethodId value passed into Read request")
}
@@ -85,7 +85,7 @@ func (c *authmethodClient) Read(ctx context.Context, authMethodId string, opt ..
return target, apiErr, nil
}
func (c *authmethodClient) Update(ctx context.Context, authMethodId string, version uint32, opt ...Option) (*AuthMethod, *api.Error, error) {
func (c *authmethodsClient) Update(ctx context.Context, authMethodId string, version uint32, opt ...Option) (*AuthMethod, *api.Error, error) {
if authMethodId == "" {
return nil, nil, fmt.Errorf("empty authMethodId value passed into Update request")
}
@@ -114,7 +114,7 @@ func (c *authmethodClient) Update(ctx context.Context, authMethodId string, vers
return target, apiErr, nil
}
func (c *authmethodClient) Delete(ctx context.Context, authMethodId string, opt ...Option) (bool, *api.Error, error) {
func (c *authmethodsClient) Delete(ctx context.Context, authMethodId string, opt ...Option) (bool, *api.Error, error) {
if authMethodId == "" {
return false, nil, fmt.Errorf("empty authMethodId value passed into Delete request")
}
@@ -147,7 +147,7 @@ func (c *authmethodClient) Delete(ctx context.Context, authMethodId string, opt
return target.Existed, apiErr, nil
}
func (c *authmethodClient) List(ctx context.Context, opt ...Option) ([]*AuthMethod, *api.Error, error) {
func (c *authmethodsClient) List(ctx context.Context, opt ...Option) ([]*AuthMethod, *api.Error, error) {
if c.client == nil {
return nil, nil, fmt.Errorf("nil client")
}