JD2022-TU1/main/extern/dtest/dtcore/inc/dtserviceartefactsource.h

52 lines
1.7 KiB
C++

#pragma once
#include "dtcore/inc/dtservice.h"
#include "dtcore/inc/dtbytebuffer.h"
namespace dt
{
class ServiceArtefactSourceImpl;
class ServiceArtefactSource : public ClientService
{
DT_DECLARE_TYPE(ServiceArtefactSource, ClientService)
public:
DT_CORE_DLL_ENTRY ServiceArtefactSource();
DT_CORE_DLL_ENTRY ~ServiceArtefactSource();
DT_CORE_DLL_ENTRY virtual const char* GetHttpId() const override { return "Artefacts"; }
DT_CORE_DLL_ENTRY void Flush();
// Send a blob artefact of type "file"
// tag: a tag to associate to this artefact
// name: The name of the artefact, will be the filename when you download it
// content: The content of the artefact
// return true if the artefact was queue to be sent, false if rejected
DT_CORE_DLL_ENTRY bool SendArtefact(const String& tag,
const String& name,
const ByteBuffer& content);
// Send a text artefact of type "file"
// tag: a tag to associate to this artefact
// name: The name of the artefact, will be the filename when you download it
// content: The content of the artefact
// return true if the artefact was queue to be sent, false if rejected
DT_CORE_DLL_ENTRY bool SendArtefact(const String& tag,
const String& name,
const String& content);
// Send a blob artefact of type "link"
// tag: a tag to associate to this artefact
// link: A http(s) link or NAS link.
DT_CORE_DLL_ENTRY bool SendArtefactLink(const String& tag,
const String& link);
DT_CORE_DLL_ENTRY virtual void Update() override;
private:
ServiceArtefactSourceImpl* m_Impl;
};
}