mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 14:42:26 -05:00 
			
		
		
		
	add api/v1/instance info handler + instance model (#18)
This commit is contained in:
		
					parent
					
						
							
								0cbab627c7
							
						
					
				
			
			
				commit
				
					
						3363e0ebdd
					
				
			
		
					 11 changed files with 222 additions and 22 deletions
				
			
		
							
								
								
									
										22
									
								
								internal/message/instanceprocess.go
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								internal/message/instanceprocess.go
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| package message | ||||
| 
 | ||||
| import ( | ||||
| 	"fmt" | ||||
| 
 | ||||
| 	apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model" | ||||
| 	"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" | ||||
| ) | ||||
| 
 | ||||
| func (p *processor) InstanceGet(domain string) (*apimodel.Instance, ErrorWithCode) { | ||||
| 	i := >smodel.Instance{} | ||||
| 	if err := p.db.GetWhere("domain", domain, i); err != nil { | ||||
| 		return nil, NewErrorInternalError(fmt.Errorf("db error fetching instance %s: %s", p.config.Host, err)) | ||||
| 	} | ||||
| 
 | ||||
| 	ai, err := p.tc.InstanceToMasto(i) | ||||
| 	if err != nil { | ||||
| 		return nil, NewErrorInternalError(fmt.Errorf("error converting instance to api representation: %s", err)) | ||||
| 	} | ||||
| 
 | ||||
| 	return  ai, nil | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue