Skip to content

Commit

Permalink
🔥 Removed the Confluence legacy implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
ctreminiom committed Oct 9, 2022
1 parent 6db22a7 commit d3dcd14
Show file tree
Hide file tree
Showing 65 changed files with 13 additions and 20,659 deletions.
16 changes: 8 additions & 8 deletions confluence/api_client_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"strings"
)

func NewV2(httpClient common.HttpClient, site string) (*ClientV2, error) {
func New(httpClient common.HttpClient, site string) (*Client, error) {

if httpClient == nil {
httpClient = http.DefaultClient
Expand All @@ -30,7 +30,7 @@ func NewV2(httpClient common.HttpClient, site string) (*ClientV2, error) {
return nil, err
}

client := &ClientV2{
client := &Client{
HTTP: httpClient,
Site: siteAsURL,
}
Expand Down Expand Up @@ -59,7 +59,7 @@ func NewV2(httpClient common.HttpClient, site string) (*ClientV2, error) {
return client, nil
}

type ClientV2 struct {
type Client struct {
HTTP common.HttpClient
Site *url.URL
Auth common.Authentication
Expand All @@ -70,11 +70,11 @@ type ClientV2 struct {
LongTask *internal.TaskService
}

func (c *ClientV2) NewFormRequest(ctx context.Context, method, apiEndpoint, contentType string, payload io.Reader) (*http.Request, error) {
func (c *Client) NewFormRequest(ctx context.Context, method, apiEndpoint, contentType string, payload io.Reader) (*http.Request, error) {
return nil, nil
}

func (c *ClientV2) NewRequest(ctx context.Context, method, apiEndpoint string, payload io.Reader) (*http.Request, error) {
func (c *Client) NewRequest(ctx context.Context, method, apiEndpoint string, payload io.Reader) (*http.Request, error) {

relativePath, err := url.Parse(apiEndpoint)
if err != nil {
Expand Down Expand Up @@ -105,7 +105,7 @@ func (c *ClientV2) NewRequest(ctx context.Context, method, apiEndpoint string, p
return request, nil
}

func (c *ClientV2) Call(request *http.Request, structure interface{}) (*models.ResponseScheme, error) {
func (c *Client) Call(request *http.Request, structure interface{}) (*models.ResponseScheme, error) {

response, err := c.HTTP.Do(request)
if err != nil {
Expand All @@ -115,7 +115,7 @@ func (c *ClientV2) Call(request *http.Request, structure interface{}) (*models.R
return c.TransformTheHTTPResponse(response, structure)
}

func (c *ClientV2) TransformTheHTTPResponse(response *http.Response, structure interface{}) (*models.ResponseScheme, error) {
func (c *Client) TransformTheHTTPResponse(response *http.Response, structure interface{}) (*models.ResponseScheme, error) {

responseTransformed := &models.ResponseScheme{
Response: response,
Expand Down Expand Up @@ -145,7 +145,7 @@ func (c *ClientV2) TransformTheHTTPResponse(response *http.Response, structure i
return responseTransformed, nil
}

func (c *ClientV2) TransformStructToReader(structure interface{}) (io.Reader, error) {
func (c *Client) TransformStructToReader(structure interface{}) (io.Reader, error) {

if structure == nil {
return nil, models.ErrNilPayloadError
Expand Down
10 changes: 5 additions & 5 deletions confluence/api_client_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func TestClient_Call(t *testing.T) {
testCase.on(&testCase.fields)
}

c := &ClientV2{
c := &Client{
HTTP: testCase.fields.HTTP,
Site: testCase.fields.Site,
Auth: testCase.fields.Authentication,
Expand Down Expand Up @@ -205,7 +205,7 @@ func TestNewV2(t *testing.T) {
for _, testCase := range testCases {
t.Run(testCase.name, func(t *testing.T) {

gotClient, err := NewV2(testCase.args.httpClient, testCase.args.site)
gotClient, err := New(testCase.args.httpClient, testCase.args.site)

if testCase.wantErr {

Expand Down Expand Up @@ -282,7 +282,7 @@ func TestClient_TransformTheHTTPResponse(t *testing.T) {

for _, testCase := range testCases {
t.Run(testCase.name, func(t *testing.T) {
c := &ClientV2{
c := &Client{
HTTP: testCase.fields.HTTP,
Site: testCase.fields.Site,
Auth: testCase.fields.Authentication,
Expand Down Expand Up @@ -375,7 +375,7 @@ func TestClient_TransformStructToReader(t *testing.T) {
for _, testCase := range testCases {

t.Run(testCase.name, func(t *testing.T) {
c := &ClientV2{
c := &Client{
HTTP: testCase.fields.HTTP,
Site: testCase.fields.Site,
Auth: testCase.fields.Authentication,
Expand Down Expand Up @@ -497,7 +497,7 @@ func TestClient_NewRequest(t *testing.T) {
}
for _, testCase := range testCases {
t.Run(testCase.name, func(t *testing.T) {
c := &ClientV2{
c := &Client{
HTTP: testCase.fields.HTTP,
Auth: testCase.fields.Auth,
Site: testCase.fields.Site,
Expand Down
25 changes: 0 additions & 25 deletions confluence/auth.go

This file was deleted.

204 changes: 0 additions & 204 deletions confluence/confluence.go

This file was deleted.

Loading

0 comments on commit d3dcd14

Please sign in to comment.