github.com/altipla-consulting/ravendb-go-client@v0.1.3/get_server_wide_operation_state_operation.go (about) 1 package ravendb 2 3 import ( 4 "net/http" 5 ) 6 7 type GetServerWideOperationStateOperation struct { 8 id int64 9 } 10 11 func (o *GetServerWideOperationStateOperation) GetCommand(conventions *DocumentConventions) *GetServerWideOperationStateCommand { 12 return NewGetServerWideOperationStateCommand(getDefaultConventions(), o.id) 13 } 14 15 type GetServerWideOperationStateCommand struct { 16 RavenCommandBase 17 18 conventions *DocumentConventions 19 id int64 20 21 Result map[string]interface{} 22 } 23 24 func NewGetServerWideOperationStateCommand(conventions *DocumentConventions, id int64) *GetServerWideOperationStateCommand { 25 cmd := &GetServerWideOperationStateCommand{ 26 RavenCommandBase: NewRavenCommandBase(), 27 28 conventions: conventions, 29 id: id, 30 } 31 cmd.IsReadRequest = true 32 33 return cmd 34 } 35 36 func (c *GetServerWideOperationStateCommand) createRequest(node *ServerNode) (*http.Request, error) { 37 url := node.URL + "/operations/state?id=" + i64toa(c.id) 38 return newHttpGet(url) 39 } 40 41 func (c *GetServerWideOperationStateCommand) setResponse(response []byte, fromCache bool) error { 42 if len(response) == 0 { 43 return nil 44 } 45 46 return jsonUnmarshal(response, &c.Result) 47 }