Home
Author Manual
Builder Manual
Development

sync API
sync API is called by the fpm cli to sync the local content of fpm package with the remote server. It is available only in FPM remote feature.

URL And Parameters
The URL is /-/sync/

Input
The input to this API is:

#[derive(serde::Deserialize, serde::Serialize)]
#[serde(tag = "action")]
pub enum SyncRequestFile {
    Add { path: String, content: Vec<u8> },
    Update { path: String, content: Vec<u8> },
    Delete { path: String },
}

#[derive(serde::Deserialize, serde::Serialize)]
pub struct SyncRequest {
    pub package_name: String,
    pub files: Vec<SyncRequestFile>,
    pub latest_ftd: String,
}

Response
The output of this API is:

#[derive(serde::Serialize, serde::Deserialize, PartialEq)]
pub enum SyncStatus {
    Conflict,
    NoConflict,
    ClientEditedServerDeleted,
    ClientDeletedServerEdited,
}

#[derive(serde::Serialize, serde::Deserialize)]
#[serde(tag = "action")]
pub enum SyncResponseFile {
    Add {
        path: String,
        status: SyncStatus,
        content: Vec<u8>,
    },
    Update {
        path: String,
        status: SyncStatus,
        content: Vec<u8>,
    },
    Delete {
        path: String,
        status: SyncStatus,
        content: Vec<u8>,
    },
}

#[derive(serde::Serialize, serde::Deserialize)]
pub struct File {
    pub path: String,
    pub content: Vec<u8>,
}