Additional endpoint for themes API for getting file info about a file in a theme
parent
c436331e67
commit
09f020329e
|
|
@ -412,6 +412,44 @@ public class Themes implements Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the {@link ThemeFileInfo} for a file from the theme.
|
||||||
|
*
|
||||||
|
* @param themeName The name of the theme.
|
||||||
|
* @param path The path of the file to retrieve.
|
||||||
|
*
|
||||||
|
* @return The content of the requsted file.
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Path("/themes/{theme}/files/{path:.+}/@info")
|
||||||
|
@AuthorizationRequired
|
||||||
|
@RequiresPrivilege(ThemingPrivileges.EDIT_THEME)
|
||||||
|
public ThemeFileInfo getThemeFileInfo(
|
||||||
|
@PathParam("theme") final String themeName,
|
||||||
|
@PathParam("path") final String path
|
||||||
|
) {
|
||||||
|
final ThemeProvider provider = findProvider(themeName)
|
||||||
|
.orElseThrow(
|
||||||
|
() -> new NotFoundException(
|
||||||
|
String.format(
|
||||||
|
"Theme \"%s\" does not exist.", themeName
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return provider
|
||||||
|
.getThemeFileInfo(themeName, ThemeVersion.DRAFT, path)
|
||||||
|
.orElseThrow(
|
||||||
|
() -> new NotFoundException(
|
||||||
|
String.format(
|
||||||
|
"File \"%s\" does not exist in theme %s.",
|
||||||
|
path,
|
||||||
|
themeName
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates or updates a file in a theme.
|
* Creates or updates a file in a theme.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue