AppMage

Checkpoint

This endpoint group provides methods for managing versioned data scopes, allowing users to list scopes, check Git status, view checkpoint history, create new checkpoints, tag releases, and restore or roll back to previous states. It relies on the VersionedDataStore service.

Endpoints

POST /api/rpc (Method: CheckpointRpc.listScopes)

  • Description: Lists all available versioned scopes for the current subscription.

  • Request Body:

    {
      "method": "CheckpointRpc.listScopes",
      "params": {}
    }
  • Parameters:

    Name Type Required Description
  • Response:

    {
      "success": true,
      "data": [
        "scope1",
        "scope2"
      ]
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "CheckpointRpc.listScopes",
        "params": {}
      }'

POST /api/rpc (Method: CheckpointRpc.getStatus)

  • Description: Gets the Git status for a specific scope. Delegates to VersionedDataStore.getStatus.

  • Request Body:

    {
      "method": "CheckpointRpc.getStatus",
      "params": {
        "scope": "my-project-scope"
      }
    }
  • Parameters:

    Name Type Required Description
    scope String Yes The name of the versioned data scope.
  • Response:

    {
      "success": true,
      "data": {
        "isClean": true,
        "files": []
      }
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "CheckpointRpc.getStatus",
        "params": {
          "scope": "my-project-scope"
        }
      }'

POST /api/rpc (Method: CheckpointRpc.listCheckpoints)

  • Description: Lists the checkpoint (commit) history for a scope. Delegates to VersionedDataStore.listCheckpoints.

  • Request Body:

    {
      "method": "CheckpointRpc.listCheckpoints",
      "params": {
        "scope": "my-project-scope",
        "limit": 50
      }
    }
  • Parameters:

    Name Type Required Description
    scope String Yes The name of the versioned data scope.
    limit Number No The maximum number of checkpoints to return. Defaults to 50.
  • Response:

    {
      "success": true,
      "data": [
        {
          "hash": "a1b2c3d4e5f6...",
          "author": "User Name ",
          "date": "2023-10-27T10:00:00Z",
          "message": "Initial commit",
          "tags": ["v1.0"]
        }
      ]
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "CheckpointRpc.listCheckpoints",
        "params": {
          "scope": "my-project-scope",
          "limit": 20
        }
      }'

POST /api/rpc (Method: CheckpointRpc.createCheckpoint)

  • Description: Creates a new checkpoint (commit) and optionally tags it. Delegates to VersionedDataStore.createCheckpoint.

  • Request Body:

    {
      "method": "CheckpointRpc.createCheckpoint",
      "params": {
        "scope": "my-project-scope",
        "message": "Added new feature X",
        "tagName": "feature-x-ready"
      }
    }
  • Parameters:

    Name Type Required Description
    scope String Yes The name of the versioned data scope.
    message String Yes A descriptive message for the checkpoint.
    tagName String No An optional tag name to apply to this checkpoint.
  • Response:

    {
      "success": true,
      "data": {
        "commitHash": "f7e8d9c0b1a2..."
      }
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "CheckpointRpc.createCheckpoint",
        "params": {
          "scope": "my-project-scope",
          "message": "Implemented user authentication",
          "tagName": "auth-v1"
        }
      }'

POST /api/rpc (Method: CheckpointRpc.tagRelease)

  • Description: Applies an annotated tag to an existing checkpoint. Delegates to VersionedDataStore.tagRelease.

  • Request Body:

    {
      "method": "CheckpointRpc.tagRelease",
      "params": {
        "scope": "my-project-scope",
        "commitHash": "a1b2c3d4e5f6...",
        "tagName": "production-release-v1.1",
        "message": "Release candidate for v1.1 with bug fixes."
      }
    }
  • Parameters:

    Name Type Required Description
    scope String Yes The name of the versioned data scope.
    commitHash String Yes The hash of the commit to tag.
    tagName String Yes The name of the tag to apply.
    message String Yes An annotated message for the tag.
  • Response:

    {
      "success": true,
      "data": {
        "tagName": "production-release-v1.1"
      }
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "CheckpointRpc.tagRelease",
        "params": {
          "scope": "my-project-scope",
          "commitHash": "a1b2c3d4e5f6...",
          "tagName": "stable-v2.0",
          "message": "Marking stable release 2.0"
        }
      }'

POST /api/rpc (Method: CheckpointRpc.restore)

  • Description: Restores the files from a checkpoint into the working directory and creates a new commit. This operation also emits a dataScopeRefreshed Socket.IO event to the user if successful. Delegates to VersionedDataStore.restoreFromCheckpoint.

  • Request Body:

    {
      "method": "CheckpointRpc.restore",
      "params": {
        "scope": "my-project-scope",
        "hash": "a1b2c3d4e5f6..."
      }
    }
  • Parameters:

    Name Type Required Description
    scope String Yes The name of the versioned data scope.
    hash String Yes The commit hash of the checkpoint to restore from.
  • Response:

    {
      "success": true,
      "data": {
        "message": "Successfully restored from checkpoint."
      }
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "CheckpointRpc.restore",
        "params": {
          "scope": "my-project-scope",
          "hash": "a1b2c3d4e5f6..."
        }
      }'

POST /api/rpc (Method: CheckpointRpc.rollback)

  • Description: Performs a hard reset to a specific checkpoint, discarding all subsequent history. This is a DANGEROUS operation. This operation also emits a dataScopeRefreshed Socket.IO event to the user if successful. Delegates to VersionedDataStore.rollbackToCheckpoint.

  • Request Body:

    {
      "method": "CheckpointRpc.rollback",
      "params": {
        "scope": "my-project-scope",
        "hash": "a1b2c3d4e5f6..."
      }
    }
  • Parameters:

    Name Type Required Description
    scope String Yes The name of the versioned data scope.
    hash String Yes The commit hash of the checkpoint to roll back to.
  • Response:

    {
      "success": true,
      "data": {
        "message": "Successfully rolled back to checkpoint."
      }
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "CheckpointRpc.rollback",
        "params": {
          "scope": "my-project-scope",
          "hash": "a1b2c3d4e5f6..."
        }
      }'