diff --git a/clients/documents/document.go b/clients/documents/document.go index 944bd1d..aaabcca 100644 --- a/clients/documents/document.go +++ b/clients/documents/document.go @@ -23,11 +23,11 @@ import ( ) type Document struct { - Kind string - Name string - ExternalID string - Public bool - Content []byte + Kind string + Name string + ID string + Public bool + Content []byte } func (d *Document) write(w io.Writer) (*multipart.Writer, error) { @@ -42,8 +42,8 @@ func (d *Document) write(w io.Writer) (*multipart.Writer, error) { if err := writer.WriteField("isPrivate", strconv.FormatBool(!d.Public)); err != nil { return nil, err } - if d.ExternalID != "" { - if err := writer.WriteField("externalId", d.ExternalID); err != nil { + if d.ID != "" { + if err := writer.WriteField("id", d.ID); err != nil { return nil, err } } diff --git a/clients/documents/documents.go b/clients/documents/documents.go index de23375..3bf5b6b 100644 --- a/clients/documents/documents.go +++ b/clients/documents/documents.go @@ -176,13 +176,13 @@ func (c Client) List(ctx context.Context, filter string) (ListResponse, error) { return retVal, nil } -func (c Client) Create(ctx context.Context, name string, isPrivate bool, externalId string, data []byte, documentType DocumentType) (api.Response, error) { +func (c Client) Create(ctx context.Context, name string, isPrivate bool, id string, data []byte, documentType DocumentType) (api.Response, error) { d := Document{ - Kind: documentType, - Name: name, - Public: !isPrivate, - ExternalID: externalId, - Content: data, + Kind: documentType, + Name: name, + Public: !isPrivate, + ID: id, + Content: data, } body := &bytes.Buffer{} diff --git a/clients/documents/documents_test.go b/clients/documents/documents_test.go index 47c9bf8..7c88f05 100644 --- a/clients/documents/documents_test.go +++ b/clients/documents/documents_test.go @@ -53,7 +53,6 @@ Content-Type: application/json "id": "b17ec54b-07ac-4c73-9c4d-232e1b2e2420", "name": "my-test-db", "isPrivate": true, - "externalId": "extId", "type": "dashboard", "version": 1, "owner": "12341234-1234-1234-1234-12341234", @@ -105,7 +104,6 @@ This is the document content` assert.Equal(t, "b17ec54b-07ac-4c73-9c4d-232e1b2e2420", resp.ID) assert.Equal(t, "my-test-db", resp.Name) assert.Equal(t, true, resp.IsPrivate) - assert.Equal(t, "extId", resp.ExternalID) assert.Equal(t, "dashboard", resp.Type) assert.Equal(t, 1, resp.Version) assert.Equal(t, "12341234-1234-1234-1234-12341234", resp.Owner) @@ -251,7 +249,6 @@ func TestDocumentClient_Create(t *testing.T) { "name": "name", "type": "notebook", "isPrivate": false, - "externalId": "externalID", "description": null, "version": 2 }` @@ -260,7 +257,6 @@ func TestDocumentClient_Create(t *testing.T) { "name": "name", "type": "notebook", "isPrivate": true, - "externalId": "externalID", "description": null, "version": 1 }` @@ -522,7 +518,6 @@ func TestDocumentClient_Update(t *testing.T) { "id": "038ab74f-0a3a-4bf8-9068-85e2d633a1e6", "name": "my-test-db", "isPrivate": true, -"externalId": "extId", "type": "dashboard", "version": 1 }` @@ -545,7 +540,6 @@ Content-Type: application/json "id": "b17ec54b-07ac-4c73-9c4d-232e1b2e2420", "name": "my-test-db", "isPrivate": true, - "externalId": "extId", "type": "dashboard", "version": 1, "owner": "12341234-1234-1234-1234-12341234" @@ -787,7 +781,6 @@ func TestDocumentClient_List(t *testing.T) { "id": "id1", "name": "name1", "isPrivate": true, - "externalId": "extId1", "type": "dashboard", "version": 1, "owner": "owner1", @@ -816,7 +809,6 @@ func TestDocumentClient_List(t *testing.T) { "id": "id2", "name": "name2", "isPrivate": false, - "externalId": "extId2", "type": "dashboard", "version": 1, "owner": "owner2", @@ -867,7 +859,6 @@ func TestDocumentClient_List(t *testing.T) { assert.Equal(t, "id1", resp.Responses[0].ID) assert.Equal(t, "name1", resp.Responses[0].Name) assert.Equal(t, true, resp.Responses[0].IsPrivate) - assert.Equal(t, "extId1", resp.Responses[0].ExternalID) assert.Equal(t, "dashboard", resp.Responses[0].Type) assert.Equal(t, 1, resp.Responses[0].Version) assert.Equal(t, "owner1", resp.Responses[0].Owner) @@ -879,7 +870,6 @@ func TestDocumentClient_List(t *testing.T) { assert.Equal(t, "id2", resp.Responses[1].ID) assert.Equal(t, "name2", resp.Responses[1].Name) assert.Equal(t, false, resp.Responses[1].IsPrivate) - assert.Equal(t, "extId2", resp.Responses[1].ExternalID) assert.Equal(t, "dashboard", resp.Responses[1].Type) assert.Equal(t, 1, resp.Responses[1].Version) assert.Equal(t, "owner2", resp.Responses[1].Owner) @@ -981,7 +971,6 @@ Content-Type: application/json "id": "b17ec54b-07ac-4c73-9c4d-232e1b2e2420", "name": "my-test-db", "isPrivate": true, - "externalId": "extId1", "type": "dashboard", "version": 1, "owner": "12341234-1234-1234-1234-12341234" diff --git a/clients/documents/metadata.go b/clients/documents/metadata.go index 80c4fe9..444f12d 100644 --- a/clients/documents/metadata.go +++ b/clients/documents/metadata.go @@ -23,7 +23,6 @@ import ( type Metadata struct { ID string `json:"id"` - ExternalID string `json:"externalId"` Owner string `json:"owner"` Name string `json:"name"` Type string `json:"type"`