api

package
v0.9.159 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package api defines all APIs supported by the DOC service of BCE.

Index

Constants

View Source
const (
	DOC_TARGET_H5    = "h5"
	DOC_TARGET_IMAGE = "image"

	DOC_PUBLIC  = "PUBLIC"
	DOC_PRIVATE = "PRIVATE"

	DOC_STATUS_UPLOADING  StatusType = "UPLOADING"
	DOC_STATUS_PROCESSING StatusType = "PROCESSING"
	DOC_STATUS_PUBLISHED  StatusType = "PUBLISHED"
	DOC_STATUS_FAILED     StatusType = "FAILED"
)

Variables

This section is empty.

Functions

func DeleteDocument

func DeleteDocument(cli bce.Client, documentId string) error

DeleteDocument - delete document in doc service

PARAMS:

  • cli: the client agent which can perform sending request
  • documentId: id of document in doc service

RETURNS:

  • error: the return error if any occurs

func PublishDocument

func PublishDocument(cli bce.Client, documentId string) error

PublishDocument - publish document

PARAMS:

  • cli: the client agent which can perform sending request
  • documentId: id of document in doc service

RETURNS:

  • error: the return error if any occurs

Types

type DocumentErrorResp

type DocumentErrorResp struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type DocumentResp

type DocumentResp struct {
	DocumentId   string            `json:"documentId"`
	Title        string            `json:"title"`
	Format       string            `json:"format"`
	TargetType   string            `json:"targetType"`
	Status       string            `json:"status"`
	Notification string            `json:"notification"`
	Access       string            `json:"access"`
	CreateTime   string            `json:"createTime"`
	Error        DocumentErrorResp `json:"error"`
}

type GetImagesResp

type GetImagesResp struct {
	Images []ImageResp `json:"images"`
}

func GetImages

func GetImages(cli bce.Client, documentId string) (*GetImagesResp, error)

GetImages - Get the list of images generated by the document conversion

PARAMS:

  • cli: the client agent which can perform sending request
  • documentId: id of document in doc service

RETURNS:

  • *ImagesListResp
  • error: the return error if any occurs

type ImageResp

type ImageResp struct {
	PageIndex int64  `json:"pageIndex"`
	Url       string `json:"url"`
}

type ListDocumentsParam

type ListDocumentsParam struct {
	Status  StatusType
	Marker  string
	MaxSize int64
}

func (*ListDocumentsParam) Check

func (l *ListDocumentsParam) Check() error

type ListDocumentsResp

type ListDocumentsResp struct {
	Marker      string         `json:"marker"`
	IsTruncated bool           `json:"isTruncated"`
	NextMarker  string         `json:"nextMarker,omitempty"`
	Docs        []DocumentResp `json:"documents"`
}

func ListDocuments

func ListDocuments(cli bce.Client, listParam *ListDocumentsParam) (*ListDocumentsResp, error)

ListDocuments - list all documents

PARAMS:

  • cli: the client agent which can perform sending request
  • param: the optional arguments to list documents

RETURNS:

  • *ListDocumentsResp: the result docments list structure
  • error: nil if ok otherwise the specific error

type PublishInfoResp

type PublishInfoResp struct {
	PageCount   int    `json:"pageCount"`
	SizeInBytes int    `json:"sizeInBytes"`
	CoverUrl    string `json:"coverUrl"`
	PublishTime string `json:"publishTime"`
}

type QueryDocumentParam

type QueryDocumentParam struct {
	Https bool
}

type QueryDocumentResp

type QueryDocumentResp struct {
	DocumentId   string            `json:"documentId"`
	Title        string            `json:"title"`
	Format       string            `json:"format"`
	TargetType   string            `json:"targetType"`
	Status       string            `json:"status"`
	UploadInfo   UploadInfoResp    `json:"uploadInfo"`
	PublishInfo  PublishInfoResp   `json:"publishInfo"`
	Notification string            `json:"notification"`
	Access       string            `json:"access"`
	CreateTime   string            `json:"createTime"`
	Error        DocumentErrorResp `json:"error"`
}

func QueryDocument

func QueryDocument(cli bce.Client, documentId string, queryParam *QueryDocumentParam) (*QueryDocumentResp, error)

QueryDocument - query document's status

PARAMS:

  • cli: the client agent which can perform sending request
  • documentId: id of document in doc service
  • queryParam: enable/disable https of coverl url

RETURNS:

  • *QueryDocumentResp
  • error: the return error if any occurs

type ReadDocumentParam

type ReadDocumentParam struct {
	ExpireInSeconds int64
}

type ReadDocumentResp

type ReadDocumentResp struct {
	DocumentId string `json:"documentId"`
	DocId      string `json:"docId"`
	Host       string `json:"host"`
	Token      string `json:"token"`
	CreateTime string `json:"createTime"`
	ExpireTime string `json:"expireTime"`
}

func ReadDocument

func ReadDocument(cli bce.Client, documentId string, readParam *ReadDocumentParam) (*ReadDocumentResp, error)

ReadDocument - get document token for client sdk

PARAMS:

  • cli: the client agent which can perform sending request
  • documentId: id of document in doc service
  • readParam: expiration time of the doc's html

RETURNS:

  • *ReadDocumentResp
  • error: the return error if any occurs

type RegDocumentParam

type RegDocumentParam struct {
	Title        string `json:"title"`        // must
	Format       string `json:"format"`       // must,doc, docx, ppt, pptx, xls, xlsx, vsd, pot, pps, rtf, wps, et, dps, pdf, txt, epub
	TargetType   string `json:"targetType"`   // h5|image, default: h5
	Notification string `json:"notification"` // notification
	Access       string `json:"access"`       // PUBLIC|PRIVATE, default: PUBLIC
}

func (*RegDocumentParam) String

func (d *RegDocumentParam) String() (string, error)

String - 格式化为json格式

type RegDocumentResp

type RegDocumentResp struct {
	DocumentId  string `json:"documentId"`
	Bucket      string `json:"bucket"`
	Object      string `json:"object"`
	BosEndpoint string `json:"bosEndpoint"`
}

RegDocumentResp - 注册文档请求响应

func RegisterDocument

func RegisterDocument(cli bce.Client, regParam *RegDocumentParam) (*RegDocumentResp, error)

RegisterDocument - register document in doc service

PARAMS:

  • cli: the client agent which can perform sending request
  • regParam title and format of the document being registered

RETURNS:

  • *RegDocumentResp: id and document location in bos
  • error: the return error if any occurs

type StatusType

type StatusType string

type UploadInfoResp

type UploadInfoResp struct {
	Bucket      string `json:"bucket"`
	Object      string `json:"object"`
	BosEndpoint string `json:"bosEndpoint"`
}

Jump to

Keyboard shortcuts

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