Difference between revisions of "Truxton artifact set file id"

From truxwiki.com
Jump to navigation Jump to search
(Created page with "This sets the source file of the artifact. =Syntax= <source lang="C"> void truxton_artifact_set_file_id(uint64_t artifact_handle, char const * id); </source> =Parameters= ==...")
 
 
Line 3: Line 3:
 
=Syntax=
 
=Syntax=
 
<source lang="C">
 
<source lang="C">
void truxton_artifact_set_file_id(uint64_t artifact_handle, char const * id);
+
void truxton_artifact_set_file_id( uint64_t artifact_handle, char const * id );
 
</source>
 
</source>
  
Line 23: Line 23:
 
   uint64_t truxton = truxton_create();
 
   uint64_t truxton = truxton_create();
  
   uint64_t artifact= truxton_artifact_create(truxton);
+
   uint64_t artifact= truxton_artifact_create( truxton );
  
 
   truxton_artifact_set_file_id( artifact, file_id );
 
   truxton_artifact_set_file_id( artifact, file_id );
 
   truxton_artifact_set_name( artifact, "Ducky Momo Server" );
 
   truxton_artifact_set_name( artifact, "Ducky Momo Server" );
   truxton_artifact_save( artifact);
+
   truxton_artifact_save( artifact );
 
   truxton_artifact_tag( artifact, "Too Young", "Yes, yes I am", 1 );
 
   truxton_artifact_tag( artifact, "Too Young", "Yes, yes I am", 1 );
  
Line 36: Line 36:
 
   printf( "Artifact ID is %s\n", id );
 
   printf( "Artifact ID is %s\n", id );
  
   truxton_artifact_destroy(artifact);
+
   truxton_artifact_destroy( artifact );
   truxton_destroy(truxton);
+
   truxton_destroy( truxton );
 
}
 
}
 
</source>
 
</source>

Latest revision as of 11:10, 10 February 2021

This sets the source file of the artifact.

Syntax

void truxton_artifact_set_file_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 [FileID] column of the [Entity] table.

Remarks

This identifier should be a value from the [ID] column of the [File] table in the database.

Sample

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

   uint64_t artifact= truxton_artifact_create( truxton );

   truxton_artifact_set_file_id( artifact, file_id );
   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 );
}