u
This commit is contained in:
		
							
								
								
									
										38
									
								
								endpoint/base.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								endpoint/base.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | ||||
| package endpoint | ||||
|  | ||||
| import ( | ||||
| 	"github.com/go-resty/resty/v2" | ||||
| ) | ||||
|  | ||||
| type BaseEndpoint struct { | ||||
| 	request      func(URL string, dataBody any) (*resty.Response, error) | ||||
| 	endpointName EndpointName | ||||
| } | ||||
|  | ||||
| func NewBaseEndpoint(request func(URL string, dataBody any) (*resty.Response, error), endpointName EndpointName) *BaseEndpoint { | ||||
| 	return &BaseEndpoint{ | ||||
| 		request:      request, | ||||
| 		endpointName: endpointName, | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (b *BaseEndpoint) GetEndpointName() EndpointName { | ||||
| 	return b.endpointName | ||||
| } | ||||
|  | ||||
| func (b *BaseEndpoint) Query(query string) (any, error) { | ||||
| 	return nil, nil | ||||
| } | ||||
|  | ||||
| func (b *BaseEndpoint) QueryAny(query string) (any, error) { | ||||
| 	return b.Query(query) | ||||
| } | ||||
|  | ||||
| type Endpoint interface { | ||||
| 	GetEndpointName() EndpointName | ||||
| } | ||||
|  | ||||
| type EntityEndpoint interface { | ||||
| 	QueryAny(query string) (any, error) | ||||
| 	GetEndpointName() EndpointName | ||||
| } | ||||
		Reference in New Issue
	
	Block a user