Truxton artifact set object id

From truxwiki.com
Revision as of 11:13, 10 February 2021 by Sam (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This sets the source object of the artifact. Artifacts can come from any Truxton object, file, media, URL, etc.

Syntax

void truxton_artifact_set_object_id( uint64_t artifact_handle, char const * id );

Parameters

artifact_handle

The handle to an artifact created by the truxton_artifact_create call.

id

The string representation of a GUID. It corresponds to the [ID] column of a table in the database.

Sample

void create_artifact( char const * file_id, char const * media_id )
{
   uint64_t truxton = truxton_create();

   uint64_t artifact= truxton_artifact_create( truxton );

   truxton_artifact_set_file_id( artifact, file_id );
   truxton_artifact_set_media_id( artifact, media_id );
   truxton_artifact_set_object_id( artifact, file_id );
   truxton_artifact_set_object_type( artifact, OBJECT_TYPE_FILE );
   truxton_artifact_set_name( artifact, "Ducky Momo Server" );
   truxton_artifact_save( artifact );
   truxton_artifact_tag( artifact, "Too Young", "Yes, yes I am", 1 );

   char id[ 65 ];

   truxton_artifact_get_id( artifact, id, sizeof( id ) );

   printf( "Artifact ID is %s\n", id );

   truxton_artifact_destroy( artifact );
   truxton_destroy( truxton );
}