pub fn init(
name: Option<&str>,
template: Option<&str>,
) -> Result<(), BackendError>
Expand description
initializes a new project in the current or a new directory, optionally from a template
§Errors
§General
-
returns
BackendError::ReadCurrentDirectory
if the current directory could not be read -
returns
BackendError::ProjectDirectoryExists
if a named is passed and a directory with the same name already exists in the current directory -
returns
BackendError::AlreadyAProject
if there’s already a grafbase/schema.graphql in the target -
returns
BackendError::CreateGrafbaseDirectory
if the grafbase directory could not be created -
returns
BackendError::CreateProjectDirectory
if the project directory could not be created -
returns
BackendError::WriteSchema
if the schema file could not be written
§Templates
-
returns
BackendError::UnsupportedTemplateURL
if a template URL is not supported -
returns
BackendError::StartDownloadRepoArchive
if a template URL is not supported (if the request could not be made) -
returns
BackendError::DownloadRepoArchive
if a repo tar could not be downloaded (on a non 200-299 status) -
returns
BackendError::TemplateNotFound
if no files matching the template path were extracted (excluding extraction errors) -
returns
BackendError::MoveExtractedFiles
if the extracted files from the template repository could not be moved -
returns
BackendError::ReadArchiveEntries
if the entries of the template repository archive could not be read -
returns
BackendError::ExtractArchiveEntry
if one of the entries of the template repository archive could not be extracted -
returns
BackendError::CleanExtractedFiles
if the files extracted from the template repository archive could not be cleaned -
returns
BackendError::StartGetRepositoryInformation
if the request to get the information for a repository could not be sent -
returns
BackendError::GetRepositoryInformation
if the request to get the information for a repository returned a non 200-299 status -
returns
BackendError::ReadRepositoryInformation
if the request to get the information for a repository returned a response that could not be parsed