Documentation ¶
Overview ¶
Package recap contains the Go wrappers for calls to Forge Reality Capture API https://developer.autodesk.com/api/reality-capture-cover-page/
The workflow is simple: - create a photoScene - upload images to photoScene - start photoScene processing - get the result
Index ¶
- Constants
- type API
- func (api API) AddFileToSceneUsingData(sceneID string, data []byte) (uploads FileUploadingReply, err error)
- func (api API) AddFileToSceneUsingLink(sceneID string, link string) (uploads FileUploadingReply, err error)
- func (api API) CancelSceneProcessing(sceneID string) (ID string, err error)
- func (api API) CreatePhotoScene(name string, formats []string, sceneType string) (scene PhotoScene, err error)
- func (api API) DeleteScene(sceneID string) (ID string, err error)
- func (api API) GetSceneProgress(sceneID string) (progress SceneProgressReply, err error)
- func (api API) GetSceneResults(sceneID string, format string) (result SceneResultReply, err error)
- func (api API) Path(paths ...string) []string
- func (api API) StartSceneProcessing(sceneID string) (result SceneStartProcessingReply, err error)
- type Error
- type ErrorMessage
- type FileUploadingReply
- type PhotoScene
- type SceneCancelReply
- type SceneCreationReply
- type SceneDeletionReply
- type SceneProgressReply
- type SceneResultReply
- type SceneStartProcessingReply
- Bugs
Examples ¶
Constants ¶
const (
DefaultRecapAPIPath = "/photo-to-3d/v1"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { Client *clientapi.Client APIPath string oauth.ForgeAuthenticator }
API struct holds all paths necessary to access ReCap API
func NewAPIWithCredentials ¶
NewAPIWithCredentials returns a ReCap API client with default configurations
func (API) AddFileToSceneUsingData ¶
func (api API) AddFileToSceneUsingData(sceneID string, data []byte) (uploads FileUploadingReply, err error)
AddFileToSceneUsingData can be used when the image is already available as a byte slice, be it read from a local file or as a result/body of a POST request
func (API) AddFileToSceneUsingLink ¶
func (api API) AddFileToSceneUsingLink(sceneID string, link string) (uploads FileUploadingReply, err error)
AddFileToSceneUsingLink can be used when the needed images are already available remotely and can be uploaded just by providing the remote link
func (API) CancelSceneProcessing ¶
CancelSceneProcessing stops the scene processing, without affecting the already uploaded resources
func (API) CreatePhotoScene ¶
func (api API) CreatePhotoScene(name string, formats []string, sceneType string) (scene PhotoScene, err error)
CreatePhotoScene prepares a scene with a given name, expected output formats and sceneType
name - should not be empty formats - should be of type rcm, rcs, obj, ortho or report sceneType - should be either "aerial" or "object"
Example ¶
package main import ( "fmt" "log" "os" "github.com/gdey/forge-api-go-client/recap" ) func main() { clientID := os.Getenv("FORGE_CLIENT_ID") clientSecret := os.Getenv("FORGE_CLIENT_SECRET") if clientID == "" || clientSecret == "" { // Skip example test if we don't have the environmental vars set fmt.Println("Scene was successfully created") return } recap := recap.NewAPIWithCredentials(clientID, clientSecret) photoScene, err := recap.CreatePhotoScene("test_scene", nil, "object") if err != nil { log.Fatal(err.Error()) } if len(photoScene.ID) != 0 { fmt.Println("Scene was successfully created") } }
Output: Scene was successfully created
func (API) DeleteScene ¶
DeleteScene removes all the resources associated with given scene.
func (API) GetSceneProgress ¶
func (api API) GetSceneProgress(sceneID string) (progress SceneProgressReply, err error)
GetSceneProgress polls the scene processing status and progress
Note: instead of polling, consider using the callback parameter that can be specified upon scene creation
func (API) GetSceneResults ¶
func (api API) GetSceneResults(sceneID string, format string) (result SceneResultReply, err error)
GetSceneResults requests result in a specified format
Note: The link specified in SceneResultReplies will be available for the time specified in reply, even if the scene is deleted
func (API) StartSceneProcessing ¶
func (api API) StartSceneProcessing(sceneID string) (result SceneStartProcessingReply, err error)
StartSceneProcessing will trigger the processing of a specified scene that can be canceled any time
type Error ¶
Error is inner struct encountered in cases when the server reported status OK, but still contains details on encountered errors. Check the bug section of this documentation for more info.
This bug was reported to the engineering team
type ErrorMessage ¶
type ErrorMessage struct { Usage string `json:",omitempty"` Resource string `json:",omitempty"` Error *Error `json:"Error"` }
ErrorMessage represents a struct corresponding to successfully received task, but failed due to some reasons. Check the bug section of this documentation for more info.
type FileUploadingReply ¶
type FileUploadingReply struct { Usage string `json:",omitempty"` Resource string `json:",omitempty"` Files *struct { File struct { FileName string `json:"filename"` FileID string `json:"fileid"` FileSize string `json:"filesize"` Message string `json:"msg"` } `json:"file"` } `json:"Files"` Error *Error `json:"Error,omitempty"` }
FileUploadingReply reflects the response content upon uploading a file, be it a link or a local one
type PhotoScene ¶
type PhotoScene struct { ID string `json:"photosceneid"` Name string `json:"name,omitempty"` Files []string `json:",omitempty"` Formats []string `json:",omitempty"` Metadata []struct { Name string Values string } `json:",omitempty"` }
PhotoScene holds data encountered in replies like creation of photoScene
type SceneCancelReply ¶
type SceneCancelReply struct { Usage string `json:",omitempty"` Resource string `json:",omitempty"` Message string `json:"msg"` Error *Error `json:"Error,omitempty"` }
SceneCancelReply reflects the response content upon scene cancel processing
type SceneCreationReply ¶
type SceneCreationReply struct { Usage string `json:",omitempty"` Resource string `json:",omitempty"` PhotoScene PhotoScene `json:"Photoscene,omitempty"` Error *Error `json:"Error,omitempty"` }
SceneCreationReply reflects the response content upon scene creation
type SceneDeletionReply ¶
type SceneDeletionReply struct { Usage string `json:",omitempty"` Resource string `json:",omitempty"` Message string `json:"msg"` Error *Error `json:"Error,omitempty"` }
SceneDeletionReply reflects the response content upon scene deletion
type SceneProgressReply ¶
type SceneProgressReply struct { Usage string `json:",omitempty"` Resource string `json:",omitempty"` PhotoScene struct { ID string `json:"photosceneid"` Message string `json:"progressmsg"` Progress string `json:"progress"` } `json:"Photoscene"` Error *Error `json:"Error,omitempty"` }
SceneProgressReply reflects the response content upon polling for scene status
type SceneResultReply ¶
type SceneResultReply struct { PhotoScene struct { ID string `json:"photosceneid"` Message string `json:"progressmsg"` Progress string `json:"progress"` SceneLink string `json:"scenelink"` FileSize string `json:"filesize"` } `json:"Photoscene"` Error *Error `json:"Error,omitempty"` }
SceneResultReply reflects the response content upon requesting the scene results in a certain format
type SceneStartProcessingReply ¶
type SceneStartProcessingReply struct { Message string `json:"msg"` PhotoScene PhotoScene `json:"Photoscene"` Error *Error `json:"Error,omitempty"` }
SceneStartProcessingReply reflects the response content upon starting scene processing
Notes ¶
Bugs ¶
SceneResultReply has a slightly different schema when getting results from a successfully processed scene and one that failed. In this situation, error of type [JSON DECODING ERROR] should be considered as [SCENE FAILED TO PROCESS]
Frequently the operation succeeded with returning code 200, meaning that the task was received successfully, but failed to execute due to reasons specified in message (g.e. uploading a file by specifying an wrong link: POST request is successful, but internally it failed to download the file because of the wrongly provided link)