Difference between revisions of "Truxton artifact create"

From truxwiki.com
Jump to navigation Jump to search
(Created page with "This creates an artifact object. Internally, Truxton calls these entities. You can use this to add to the <code>Entity</code> table in the database. =Syntax= <syntaxhighlight...")
 
Line 40: Line 40:
  
 
=Remarks=
 
=Remarks=
By default, when this API is called the identifier for the media will be generated, the created and last updated timestamps will be set to the current time, the expiration date set to 99 years from now, the percent complete set to 100 and the status set to [[Media Status | loaded]].
+
The default behavior of this API is to:
 +
* Generate an identifier for the media
 +
* Set the created date to the current time
 +
* Set the last updated date to the current time
 +
* Set the expiration date set to 99 years from now
 +
* Set the percent complete set 100
 +
* Set the status set to [[Media Status | loaded]]

Revision as of 08:08, 16 October 2020

This creates an artifact object. Internally, Truxton calls these entities. You can use this to add to the Entity table in the database.

Syntax

uint64_t truxton_artifact_create(uint64_t truxton_handle);

Parameters

truxton_handle

The Truxton instance this artifact will belong. This handle comes from calling truxton_create().

Return value

A handle to an artifact object.

Sample

void create_artifact(void)
{
   uint64_t truxton = truxton_create();

   uint64_t artifact= truxton_artifact_create(truxton);

   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(media);
   truxton_destroy(truxton);
}

Remarks

The default behavior of this API is to:

  • Generate an identifier for the media
  • Set the created date to the current time
  • Set the last updated date to the current time
  • Set the expiration date set to 99 years from now
  • Set the percent complete set 100
  • Set the status set to loaded