mirror of
				https://github.com/1Password/onepassword-operator.git
				synced 2025-10-31 11:49:40 +00:00 
			
		
		
		
	 dcb5d5675a
			
		
	
	dcb5d5675a
	
	
	
		
			
			These internal models are introduced to reduce decoupling. The idea is to operate internal model within the project boundaries and convert to appropriate Connect or SDK models in the places where it's necessary.
		
			
				
	
	
		
			28 lines
		
	
	
		
			653 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			653 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package model
 | |
| 
 | |
| import (
 | |
| 	"errors"
 | |
| )
 | |
| 
 | |
| // File represents a file stored in 1Password.
 | |
| type File struct {
 | |
| 	ID          string
 | |
| 	Name        string
 | |
| 	Size        int
 | |
| 	ContentPath string
 | |
| 	content     []byte
 | |
| }
 | |
| 
 | |
| // Content returns the content of the file if they have been loaded and returns an error if they have not been loaded.
 | |
| // Use `client.GetFileContent(file *File)` instead to make sure the content is fetched automatically if not present.
 | |
| func (f *File) Content() ([]byte, error) {
 | |
| 	if f.content == nil {
 | |
| 		return nil, errors.New("file content not loaded")
 | |
| 	}
 | |
| 	return f.content, nil
 | |
| }
 | |
| 
 | |
| func (f *File) SetContent(content []byte) {
 | |
| 	f.content = content
 | |
| }
 |