Skip to content

Commit

Permalink
refact!: change packages to more consistent naming scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-helmich committed Feb 3, 2025
1 parent 670692b commit b89a4c5
Show file tree
Hide file tree
Showing 2,094 changed files with 4,767 additions and 4,765 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ on how to obtain an API token and how to get started with the API.
## Example

```go
req := project.ListProjectsRequest{
CustomerId: pointer.To("2ef23459-beb1-4ac2-9a38-d3a9df62bf93"),
req := projectclientv2.ListProjectsRequest{
CustomerID: pointer.To("2ef23459-beb1-4ac2-9a38-d3a9df62bf93"),
Limit: pointer.To(100),
}

Expand Down
5 changes: 3 additions & 2 deletions mittwaldv2/client_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package mittwaldv2_test
import (
"context"
"fmt"

"github.com/mittwald/api-client-go/mittwaldv2"
"github.com/mittwald/api-client-go/mittwaldv2/generated/clients/user"
"github.com/mittwald/api-client-go/mittwaldv2/generated/clients/userclientv2"
)

func ExampleNew_accessTokenFromEnvironment() {
Expand All @@ -15,7 +16,7 @@ func ExampleNew_accessTokenFromEnvironment() {
panic(err)
}

me, _, err := client.User().GetUser(ctx, user.GetUserRequest{UserID: "self"})
me, _, err := client.User().GetUser(ctx, userclientv2.GetUserRequest{UserID: "self"})
if err != nil {
panic(err)
}
Expand Down
20 changes: 10 additions & 10 deletions mittwaldv2/client_opt_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"time"

generatedv2 "github.com/mittwald/api-client-go/mittwaldv2/generated/clients"
"github.com/mittwald/api-client-go/mittwaldv2/generated/clients/marketplace"
"github.com/mittwald/api-client-go/mittwaldv2/generated/clients/user"
"github.com/mittwald/api-client-go/mittwaldv2/generated/clients/marketplaceclientv2"
"github.com/mittwald/api-client-go/mittwaldv2/generated/clients/userclientv2"
"github.com/mittwald/api-client-go/pkg/httpclient"
)

Expand Down Expand Up @@ -43,8 +43,8 @@ func WithAccessTokenAndRefresh(token, refreshToken string, expiration time.Time)
return func(ctx context.Context, inner httpclient.RequestRunner) (httpclient.RequestRunner, error) {
refreshToken := refreshToken
refreshFunc := func() (string, time.Time, error) {
req := user.RefreshSessionRequest{
Body: user.RefreshSessionRequestBody{
req := userclientv2.RefreshSessionRequest{
Body: userclientv2.RefreshSessionRequestBody{
RefreshToken: refreshToken,
},
}
Expand Down Expand Up @@ -79,8 +79,8 @@ func WithAccessTokenAndRefreshFunc(token string, expiration time.Time, refreshFu
// it is recommended to use API tokens, instead of username+password.
func WithUsernamePassword(email, password string) ClientOption {
return func(ctx context.Context, inner httpclient.RequestRunner) (httpclient.RequestRunner, error) {
req := user.AuthenticateRequest{
Body: user.AuthenticateRequestBody{
req := userclientv2.AuthenticateRequest{
Body: userclientv2.AuthenticateRequestBody{
Email: email,
Password: password,
},
Expand Down Expand Up @@ -110,8 +110,8 @@ func WithUsernamePassword(email, password string) ClientOption {
// [1]: https://developer.mittwald.de/docs/v2/contribution/overview/concepts/authentication/
func WithAccessTokenRetrievalKey(userID string, accessTokenRetrievalKey string) ClientOption {
return func(ctx context.Context, inner httpclient.RequestRunner) (httpclient.RequestRunner, error) {
req := user.AuthenticateWithAccessTokenRetrievalKeyRequest{
Body: user.AuthenticateWithAccessTokenRetrievalKeyRequestBody{
req := userclientv2.AuthenticateWithAccessTokenRetrievalKeyRequest{
Body: userclientv2.AuthenticateWithAccessTokenRetrievalKeyRequestBody{
AccessTokenRetrievalKey: accessTokenRetrievalKey,
UserId: userID,
},
Expand All @@ -133,9 +133,9 @@ func WithAccessTokenRetrievalKey(userID string, accessTokenRetrievalKey string)
func WithExtensionSecret(extensionInstanceID string, extensionSecret string) ClientOption {
return func(ctx context.Context, inner httpclient.RequestRunner) (httpclient.RequestRunner, error) {
refreshFunc := func() (string, time.Time, error) {
req := marketplace.AuthenticateInstanceRequest{
req := marketplaceclientv2.AuthenticateInstanceRequest{
ExtensionInstanceID: extensionInstanceID,
Body: marketplace.AuthenticateInstanceRequestBody{
Body: marketplaceclientv2.AuthenticateInstanceRequestBody{
ExtensionInstanceSecret: extensionSecret,
},
}
Expand Down
13 changes: 7 additions & 6 deletions mittwaldv2/client_opt_auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package mittwaldv2_test

import (
"context"
"net/http"
"os"

"github.com/mittwald/api-client-go/mittwaldv2"
"github.com/mittwald/api-client-go/mittwaldv2/generated/clients/user"
"github.com/mittwald/api-client-go/mittwaldv2/generated/clients/userclientv2"
"github.com/mittwald/api-client-go/pkg/httpclient_mock"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"net/http"
"os"
)

var _ = Describe("Client authentication", func() {
Expand All @@ -23,7 +24,7 @@ var _ = Describe("Client authentication", func() {

Expect(err).NotTo(HaveOccurred())

_, _, err = client.User().GetUser(ctx, user.GetUserRequest{UserID: "self"})
_, _, err = client.User().GetUser(ctx, userclientv2.GetUserRequest{UserID: "self"})

Expect(err).NotTo(HaveOccurred())
Expect(runner.Requests).To(HaveLen(1))
Expand All @@ -44,7 +45,7 @@ var _ = Describe("Client authentication", func() {

Expect(err).NotTo(HaveOccurred())

_, _, err = client.User().GetUser(ctx, user.GetUserRequest{UserID: "self"})
_, _, err = client.User().GetUser(ctx, userclientv2.GetUserRequest{UserID: "self"})

Expect(err).NotTo(HaveOccurred())
Expect(runner.Requests).To(HaveLen(1))
Expand All @@ -64,7 +65,7 @@ var _ = Describe("Client authentication", func() {

Expect(err).NotTo(HaveOccurred())

_, _, err = client.User().GetUser(ctx, user.GetUserRequest{UserID: "self"})
_, _, err = client.User().GetUser(ctx, userclientv2.GetUserRequest{UserID: "self"})

Expect(err).NotTo(HaveOccurred())
Expect(runner.Requests).To(HaveLen(2))
Expand Down
Loading

0 comments on commit b89a4c5

Please sign in to comment.