api_deprecated.go 764 B

123456789101112131415161718192021
  1. package api
  2. import (
  3. "fmt"
  4. "github.com/OliveTin/OliveTin/internal/configissues"
  5. )
  6. // reportDeprecatedAPICall raises a warning on the Diagnostics page (once per
  7. // method, until OliveTin restarts) when a deprecated API method is called, so
  8. // admins can find and update the integrations still using it.
  9. func reportDeprecatedAPICall(method, replacement string) {
  10. configissues.ReportRuntime(configissues.Issue{
  11. Severity: configissues.SeverityWarning,
  12. Code: configissues.CodeDeprecatedAPICall,
  13. Message: fmt.Sprintf(
  14. "The deprecated API method %s was called. Use %s instead, as %s will be removed in a future version. See https://docs.olivetin.app/api/start_action.html#api-deprecated-byget",
  15. method, replacement, method),
  16. Source: method,
  17. })
  18. }