Documentation
¶
Overview ¶
Package document carries the Document resource's wire types. Document API methods still live on github.com/dmalch/go-geni's root Client during the pre-1.0 reshape and migrate into this package in a later PR; this PR lifts only the types.
Index ¶
- type BulkResponse
- type Client
- func (c *Client) AddComment(ctx context.Context, documentId, text, title string) (*comment.BulkResponse, error)
- func (c *Client) AddToProfile(ctx context.Context, profileId string, request *Request) (*Document, error)
- func (c *Client) AddToProject(ctx context.Context, documentId, projectId string) (*BulkResponse, error)
- func (c *Client) Comments(ctx context.Context, documentId string, page int) (*comment.BulkResponse, error)
- func (c *Client) Create(ctx context.Context, request *Request) (*Document, error)
- func (c *Client) Delete(ctx context.Context, documentId string) error
- func (c *Client) ForProfile(ctx context.Context, profileId string, page int) (*BulkResponse, error)
- func (c *Client) Get(ctx context.Context, documentId string) (*Document, error)
- func (c *Client) GetBulk(ctx context.Context, documentIds []string) (*BulkResponse, error)
- func (c *Client) Projects(ctx context.Context, documentId string, page int) (*project.BulkResponse, error)
- func (c *Client) Tag(ctx context.Context, documentId, profileId string) (*profile.BulkResponse, error)
- func (c *Client) Tags(ctx context.Context, documentId string, page int) (*profile.BulkResponse, error)
- func (c *Client) Untag(ctx context.Context, documentId, profileId string) (*profile.BulkResponse, error)
- func (c *Client) Update(ctx context.Context, documentId string, request *Request) (*Document, error)
- type Document
- type Request
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BulkResponse ¶
type BulkResponse struct {
Results []Document `json:"results,omitempty"`
Page int `json:"page,omitempty"`
TotalCount int `json:"total_count,omitempty"`
NextPage string `json:"next_page,omitempty"`
PrevPage string `json:"prev_page,omitempty"`
}
BulkResponse is the paginated envelope returned by GetDocuments and related bulk endpoints.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps a transport.Client with the document endpoints.
func (*Client) AddComment ¶
func (c *Client) AddComment(ctx context.Context, documentId, text, title string) (*comment.BulkResponse, error)
AddComment posts a new comment on a document. text is the comment body and is required by Geni; title is optional and may be the empty string. The response is a comment.BulkResponse — the updated paginated comment list.
func (*Client) AddToProfile ¶
func (c *Client) AddToProfile(ctx context.Context, profileId string, request *Request) (*Document, error)
AddToProfile attaches a new document to a profile. Accepts the same Request used by Create — text/file/source_url are mutually exclusive content sources.
func (*Client) AddToProject ¶
func (c *Client) AddToProject(ctx context.Context, documentId, projectId string) (*BulkResponse, error)
AddToProject tags a document into a project. Returns the bulk envelope of documents Geni associates with the project after the add. The endpoint is project-scoped (/api/<projectId>/add_documents) but the operation lives here so document and project don't import each other.
func (*Client) Comments ¶
func (c *Client) Comments(ctx context.Context, documentId string, page int) (*comment.BulkResponse, error)
Comments returns the paginated list of comments on a document. page is 1-indexed; values ≤0 omit the parameter (Geni defaults to page 1). Max 50 comments per page.
func (*Client) Create ¶
Create posts a new document. The Request fields describe the upload — title, description, content type, optional Base64-encoded file, etc.
func (*Client) ForProfile ¶
ForProfile returns the paginated list of documents attached to a profile. page is 1-indexed; values ≤0 omit the parameter (Geni defaults to page 1). Max 50 per page.
func (*Client) Get ¶
Get fetches a single document by id. Concurrent Get calls are coalesced into one bulk request via transport.BulkCoalescer.
func (*Client) GetBulk ¶
GetBulk fetches multiple documents in a single bulk request. The single-id fallback (Geni's bulk dispatcher returns empty for len(ids)==1) is preserved verbatim.
func (*Client) Projects ¶
func (c *Client) Projects(ctx context.Context, documentId string, page int) (*project.BulkResponse, error)
Projects returns the paginated list of projects a document belongs to. page is 1-indexed; values ≤0 omit the parameter (Geni defaults to page 1). Max 50 projects per page.
func (*Client) Tag ¶
func (c *Client) Tag(ctx context.Context, documentId, profileId string) (*profile.BulkResponse, error)
Tag associates a profile with a document. Returns the updated paginated profile-tags list.
func (*Client) Tags ¶
func (c *Client) Tags(ctx context.Context, documentId string, page int) (*profile.BulkResponse, error)
Tags returns the paginated list of profiles tagged in a document. page is 1-indexed; values ≤0 omit the parameter (Geni defaults to page 1). Max 50 tags per page. Symmetric with photo.Client.Tags.
type Document ¶
type Document struct {
// ID is the document's id
ID string `json:"id,omitempty"`
// Guid is the document's globally unique identifier
Guid string `json:"guid,omitempty"`
// Title is the document's title
Title string `json:"title,omitempty"`
// Description is the document's description
Description *string `json:"description"`
// SourceUrl is the document's source URL
SourceUrl *string `json:"source_url"`
// ContentType is the document's content type
ContentType *string `json:"content_type"`
// Date is the document's date
Date *profile.DateElement `json:"date"`
// Location is the document's location
Location *profile.LocationElement `json:"location,omitempty"`
// Profiles is the list of profiles tagged in the document
Tags []string `json:"tags"`
// Labels is the list of labels associated with the document
Labels []string `json:"labels"`
// UpdatedAt is the timestamp of when the document was last updated
UpdatedAt string `json:"updated_at"`
// CreatedAt is the timestamp of when the document was created
CreatedAt string `json:"created_at"`
}
Document is Geni's Document resource — uploaded files, text records, or external source URLs attached to profiles.
type Request ¶
type Request struct {
// Title is the document's title
Title string `json:"title,omitempty"`
// Description is the document's description
Description *string `json:"description,omitempty"`
// ContentType is the document's content type
ContentType *string `json:"content_type,omitempty"`
// Date is the document's date
Date *profile.DateElement `json:"date,omitempty"`
// Location is the document's location
Location *profile.LocationElement `json:"location,omitempty"`
// Labels is the document's comma separated labels
Labels *string `json:"labels,omitempty"`
// File is the Base64 encoded file to create a document from
File *string `json:"file,omitempty"`
// FileName is the name of the file, required if the file is provided
FileName *string `json:"file_name,omitempty"`
// SourceUrl is the source URL for the document
SourceUrl *string `json:"source_url,omitempty"`
// Text is the text to create a document from
Text *string `json:"text,omitempty"`
}
Request is the JSON-encoded body for CreateDocument / UpdateDocument.