recap

package
v0.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2020 License: MIT Imports: 13 Imported by: 5

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 the following:
	- create a photoScene
	- upload images to photoScene
	- start photoScene processing
	- get the result

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Code    string `json:"code"`
	Message string `json:"msg"`
}

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 ReCapAPI added in v0.2.0

type ReCapAPI struct {
	Authenticator oauth.ForgeAuthenticator
	ReCapPath     string
}

API struct holds all paths necessary to access ReCap API

func NewAPI added in v0.2.0

func NewAPI(authenticator oauth.ForgeAuthenticator) ReCapAPI

NewAPI returns a ReCap API client with default configurations

func (ReCapAPI) AddFileToSceneUsingData added in v0.2.0

func (api ReCapAPI) 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 ReCapAPI) 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 (ReCapAPI) CancelSceneProcessing added in v0.2.0

func (api ReCapAPI) CancelSceneProcessing(sceneID string) (ID string, err error)

CancelSceneProcessing stops the scene processing, without affecting the already uploaded resources

func (ReCapAPI) CreatePhotoScene added in v0.2.0

func (api ReCapAPI) 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"

func (ReCapAPI) DeleteScene added in v0.2.0

func (api ReCapAPI) DeleteScene(sceneID string) (ID string, err error)

DeleteScene removes all the resources associated with given scene.

func (ReCapAPI) GetSceneProgress added in v0.2.0

func (api ReCapAPI) 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 (ReCapAPI) GetSceneResults added in v0.2.0

func (api ReCapAPI) 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 (ReCapAPI) StartSceneProcessing added in v0.2.0

func (api ReCapAPI) StartSceneProcessing(sceneID string) (result SceneStartProcessingReply, err error)

StartSceneProcessing will trigger the processing of a specified scene that can be canceled any time

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 a wrong link: POST request is successful, but internally it failed to download the file because of the wrongly provided link)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL