sbrcsr 3.2.0
ATOMAS sbrcsr

The CSR API for a CSR Business Document object. More...

Typedefs

typedef struct _sbr_Doc sbr_Doc
 The CSR Business Document object. More...
 

Functions

SBR_CSR_EXPORT const char * sbr_doc_iid (sbr_Doc *doc)
 Return the unique id for the Document - this is a memory only value. More...
 
SBR_CSR_EXPORT const char * sbr_doc_content (sbr_Doc *doc)
 Return the document content. More...
 
SBR_CSR_EXPORT const char * sbr_doc_governmentid (sbr_Doc *doc)
 Return the government id. More...
 
SBR_CSR_EXPORT const char * sbr_doc_businessid (sbr_Doc *doc)
 Return the business id. More...
 
SBR_CSR_EXPORT const char * sbr_doc_createtime (sbr_Doc *doc)
 Return the document create time. More...
 
SBR_CSR_EXPORT const char * sbr_doc_validationuri (sbr_Doc *doc)
 Return the validation uri. More...
 
SBR_CSR_EXPORT size_t sbr_doc_sequencenr (sbr_Doc *doc)
 Return the sequence number (starting at 1) of the document within the sbr_Sbdm object. More...
 
SBR_CSR_EXPORT sbr_eMsgSourceType sbr_doc_msgsourcetype (sbr_Doc *doc)
 Return whether the document is within a sbr_Request or sbr_Response. More...
 
SBR_CSR_EXPORT int sbr_doc_setcontent (ato_Ctx *ctx, sbr_Doc *doc, const char *content, ato_eParamAction contentaction)
 Set the content of a document in a Request document - see also sbr_doc_setcontentref(). More...
 
SBR_CSR_EXPORT int sbr_doc_setcontentref (ato_Ctx *ctx, sbr_Doc *doc, char *content, ato_eParamAction contentaction)
 Set the content of a document in a Request document where content is a non-const parameter - see also sbr_doc_setcontent(). More...
 
SBR_CSR_EXPORT int sbr_doc_setvalidationuri (ato_Ctx *ctx, sbr_Doc *doc, const char *validationuri)
 Set the validationuri of a document in a Request document. More...
 
SBR_CSR_EXPORT int sbr_doc_setgovernmentid (ato_Ctx *ctx, sbr_Doc *doc, const char *governmentid)
 Set the governmentid of a document in a Request document. More...
 
SBR_CSR_EXPORT int sbr_doc_setbusinessid (ato_Ctx *ctx, sbr_Doc *doc, const char *businessid)
 Set the businessid of a document in a Request document. More...
 
SBR_CSR_EXPORT int sbr_doc_setcreatetime (ato_Ctx *ctx, sbr_Doc *doc, time_t createtime)
 Set the createtime of a document in a Request document. More...
 
SBR_CSR_EXPORT size_t sbr_doc_attachment_count (sbr_Doc *doc)
 Return the number of attachments this document has. More...
 
SBR_CSR_EXPORT void sbr_doc_attachment_iterator (sbr_Doc *doc, ato_Iterator **iter)
 Create an iterator for the collection of attachments - caller must free. More...
 
SBR_CSR_EXPORT sbr_DocAsbr_doc_attachment_firstv (sbr_Doc *doc)
 Get the first attachment of the collection. More...
 
SBR_CSR_EXPORT sbr_DocAsbr_doc_attachment_nextv (sbr_Doc *doc)
 Get the next attachment of the collection. More...
 
SBR_CSR_EXPORT int sbr_doc_attachment_add (ato_Ctx *ctx, sbr_Doc *doc, sbr_DocA **attachment, const char *description, const char *filename, const char *contenttype)
 Add an attachment to a Request document - use sbr_doca_setcontent() to set the content. More...
 
SBR_CSR_EXPORT int sbr_doc_attachment_remove (ato_Ctx *ctx, sbr_Doc *doc, sbr_DocA *attachment)
 Remove an attachment from a Request document - not currently implemented. More...
 

Detailed Description

The CSR API for a CSR Business Document object.

Typedef Documentation

◆ sbr_Doc

typedef struct _sbr_Doc sbr_Doc

The CSR Business Document object.

Used when adding business documents to a request for submission to CSR - see also sbr_Request. Used when extracting business documents from a response - see also sbr_Response.

Function Documentation

◆ sbr_doc_iid()

SBR_CSR_EXPORT const char * sbr_doc_iid ( sbr_Doc doc)

Return the unique id for the Document - this is a memory only value.

Parameters
docthe Business Document
Returns
unique id.

◆ sbr_doc_content()

SBR_CSR_EXPORT const char * sbr_doc_content ( sbr_Doc doc)

Return the document content.

Parameters
docthe Business Document.
Returns
document content.

◆ sbr_doc_governmentid()

SBR_CSR_EXPORT const char * sbr_doc_governmentid ( sbr_Doc doc)

Return the government id.

Parameters
docthe Business Document.
Returns
the government id or NULL if none.

◆ sbr_doc_businessid()

SBR_CSR_EXPORT const char * sbr_doc_businessid ( sbr_Doc doc)

Return the business id.

Parameters
docthe Business Document.
Returns
the business id or NULL if none.

◆ sbr_doc_createtime()

SBR_CSR_EXPORT const char * sbr_doc_createtime ( sbr_Doc doc)

Return the document create time.

Parameters
docthe Business Document.
Returns
document create time or NULL if none.

◆ sbr_doc_validationuri()

SBR_CSR_EXPORT const char * sbr_doc_validationuri ( sbr_Doc doc)

Return the validation uri.

Parameters
docthe Business Document.
Returns
the validation uri or NULL if none.

◆ sbr_doc_sequencenr()

SBR_CSR_EXPORT size_t sbr_doc_sequencenr ( sbr_Doc doc)

Return the sequence number (starting at 1) of the document within the sbr_Sbdm object.

Parameters
docthe Business Document.
Returns
the sequence number.

◆ sbr_doc_msgsourcetype()

SBR_CSR_EXPORT sbr_eMsgSourceType sbr_doc_msgsourcetype ( sbr_Doc doc)

Return whether the document is within a sbr_Request or sbr_Response.

Parameters
docthe Business Document.
Returns
SBR_MSG_RESPONSE or SBR_MSG_REQUEST.

◆ sbr_doc_setcontent()

SBR_CSR_EXPORT int sbr_doc_setcontent ( ato_Ctx ctx,
sbr_Doc doc,
const char *  content,
ato_eParamAction  contentaction 
)

Set the content of a document in a Request document - see also sbr_doc_setcontentref().

Parameters
ctxthe current thread local Context.
docthe Business Document.
contentthe content of the document (e.g. the xbrl) This is inserted at StandardBusinessDocumentBody:BusinessDocumentInstances:BusinessDocument.Instance.Text
contentactiontells the attachment object what to do with the content. ATO_PARAMACTION_DEFAULT or ATO_PARAMACTION_COPY will cause a copy to be taken. ATO_PARAMACTION_CONST will cause content to be referenced directly and not touched in any way - the caller must maintain until the attachment is freed. ATO_PARAMACTION_FREE is not valid as content is a const - use sbr_doc_setcontentref() for this.
Returns
ATO_ERR_OK if successful or an errorcode OR -1 if the call is ignored (SBR_RESPONSE sbdm).

◆ sbr_doc_setcontentref()

SBR_CSR_EXPORT int sbr_doc_setcontentref ( ato_Ctx ctx,
sbr_Doc doc,
char *  content,
ato_eParamAction  contentaction 
)

Set the content of a document in a Request document where content is a non-const parameter - see also sbr_doc_setcontent().

Parameters
ctxthe current thread local Context.
docthe Business Document.
contentthe content of the document (e.g. the xbrl) This is inserted at StandardBusinessDocumentBody:BusinessDocumentInstances:BusinessDocument.Instance.Text
contentactiontells the attachment object what to do with the content. ATO_PARAMACTION_DEFAULT or ATO_PARAMACTION_COPY will cause a copy to be taken. ATO_PARAMACTION_CONST will cause content to be referenced directly and not touched in any way - the caller must maintain until the attachment is freed. ATO_PARAMACTION_FREE will cause content to be referenced directly and will be freed when the attachment is freed (i.e. the attachment object takes "ownership" of the content).
Returns
ATO_ERR_OK if successful or an errorcode OR -1 if the call is ignored (SBR_RESPONSE sbdm).

◆ sbr_doc_setvalidationuri()

SBR_CSR_EXPORT int sbr_doc_setvalidationuri ( ato_Ctx ctx,
sbr_Doc doc,
const char *  validationuri 
)

Set the validationuri of a document in a Request document.

Parameters
ctxthe current thread local Context.
docthe Business Document.
validationurithe validationuri to use in the header
Returns
ATO_ERR_OK if successful or an errorcode OR -1 if the call is ignored (SBR_RESPONSE sbdm).

◆ sbr_doc_setgovernmentid()

SBR_CSR_EXPORT int sbr_doc_setgovernmentid ( ato_Ctx ctx,
sbr_Doc doc,
const char *  governmentid 
)

Set the governmentid of a document in a Request document.

Parameters
ctxthe current thread local Context.
docthe Business Document.
governmentidthe validationuri to use in the header
Returns
ATO_ERR_OK if successful or an errorcode OR -1 if the call is ignored (SBR_RESPONSE sbdm).

◆ sbr_doc_setbusinessid()

SBR_CSR_EXPORT int sbr_doc_setbusinessid ( ato_Ctx ctx,
sbr_Doc doc,
const char *  businessid 
)

Set the businessid of a document in a Request document.

Parameters
ctxthe current thread local Context.
docthe Business Document.
businessidthe businessid to use in the header
Returns
ATO_ERR_OK if successful or an errorcode OR -1 if the call is ignored (SBR_RESPONSE sbdm).

◆ sbr_doc_setcreatetime()

SBR_CSR_EXPORT int sbr_doc_setcreatetime ( ato_Ctx ctx,
sbr_Doc doc,
time_t  createtime 
)

Set the createtime of a document in a Request document.

Parameters
ctxthe current thread local Context.
docthe Business Document.
createtimethe createtime to use in the header.
Returns
ATO_ERR_OK if successful or an errorcode OR -1 if the call is ignored (SBR_RESPONSE sbdm).

◆ sbr_doc_attachment_count()

SBR_CSR_EXPORT size_t sbr_doc_attachment_count ( sbr_Doc doc)

Return the number of attachments this document has.

Parameters
docthe Business Document.
Returns
a count of the number of attachments.

◆ sbr_doc_attachment_iterator()

SBR_CSR_EXPORT void sbr_doc_attachment_iterator ( sbr_Doc doc,
ato_Iterator **  iter 
)

Create an iterator for the collection of attachments - caller must free.

This is useful if a collection is being shared between threads and each thread has its own iterator.

If this is not the case then the sbr_doc_attachment_firstv() and sbr_doc_attachment_nextv() methods are simpler and this method can be ignored.

Parameters
docthe Business Document.
iterthe address of the iterator to create - *iter must be NULL. This will be NULL if there is no collection.

◆ sbr_doc_attachment_firstv()

SBR_CSR_EXPORT sbr_DocA * sbr_doc_attachment_firstv ( sbr_Doc doc)

Get the first attachment of the collection.

This also initialises the iterator associated with the current doc attachments.

Parameters
docthe Business Document.
Returns
an attachment or NULL if none.

◆ sbr_doc_attachment_nextv()

SBR_CSR_EXPORT sbr_DocA * sbr_doc_attachment_nextv ( sbr_Doc doc)

Get the next attachment of the collection.

Parameters
docthe Business Document.
Returns
an attachment or NULL if none.

◆ sbr_doc_attachment_add()

SBR_CSR_EXPORT int sbr_doc_attachment_add ( ato_Ctx ctx,
sbr_Doc doc,
sbr_DocA **  attachment,
const char *  description,
const char *  filename,
const char *  contenttype 
)

Add an attachment to a Request document - use sbr_doca_setcontent() to set the content.

Parameters
ctxthe current thread local Context.
docthe Business Document.
attachmentthe address of the attachment object to allocate - DO NOT free.
descriptiona description to use in the header
filenamethe filename to associate with the attachment
contenttypethe type of the content
Returns
ATO_ERR_OK if successful or an errorcode OR -1 if the call is ignored (if it's a SBR_RESPONSE sbdm).

◆ sbr_doc_attachment_remove()

SBR_CSR_EXPORT int sbr_doc_attachment_remove ( ato_Ctx ctx,
sbr_Doc doc,
sbr_DocA attachment 
)

Remove an attachment from a Request document - not currently implemented.

Parameters
ctxthe current thread local Context.
docthe Business Document.
attachmentthe attachment object.
Returns
ATO_ERR_OK if successful or an errorcode OR -1 if the call is ignored (if it's a SBR_RESPONSE sbdm).