Add Wildberries product fetching and rate limiting functionality
This commit is contained in:
		
							
								
								
									
										22
									
								
								internal/wb/security_handler.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								internal/wb/security_handler.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
package wb
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	wbclient "sipro-mps/pkg/api/wb/client"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type WildberriesSecurityHandler struct {
 | 
			
		||||
	ApiKey string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (sh WildberriesSecurityHandler) HeaderApiKey(ctx context.Context, operationName wbclient.OperationName, client *wbclient.Client) (wbclient.HeaderApiKey, error) {
 | 
			
		||||
	return wbclient.HeaderApiKey{
 | 
			
		||||
		APIKey: sh.ApiKey,
 | 
			
		||||
		Roles:  nil,
 | 
			
		||||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
func NewWildberriesSecurityHandler(apiKey string) WildberriesSecurityHandler {
 | 
			
		||||
	return WildberriesSecurityHandler{
 | 
			
		||||
		ApiKey: apiKey,
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user