Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions clients/documents/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
}
}
Expand Down
12 changes: 6 additions & 6 deletions clients/documents/documents.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
11 changes: 0 additions & 11 deletions clients/documents/documents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -251,7 +249,6 @@ func TestDocumentClient_Create(t *testing.T) {
"name": "name",
"type": "notebook",
"isPrivate": false,
"externalId": "externalID",
"description": null,
"version": 2
}`
Expand All @@ -260,7 +257,6 @@ func TestDocumentClient_Create(t *testing.T) {
"name": "name",
"type": "notebook",
"isPrivate": true,
"externalId": "externalID",
"description": null,
"version": 1
}`
Expand Down Expand Up @@ -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
}`
Expand All @@ -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"
Expand Down Expand Up @@ -787,7 +781,6 @@ func TestDocumentClient_List(t *testing.T) {
"id": "id1",
"name": "name1",
"isPrivate": true,
"externalId": "extId1",
"type": "dashboard",
"version": 1,
"owner": "owner1",
Expand Down Expand Up @@ -816,7 +809,6 @@ func TestDocumentClient_List(t *testing.T) {
"id": "id2",
"name": "name2",
"isPrivate": false,
"externalId": "extId2",
"type": "dashboard",
"version": 1,
"owner": "owner2",
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion clients/documents/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down