The RedmineBase
class serves as the base class for various other classes used in a Redmine integration. It provides a static method toCreateFormat(objIns)
and an instance method toCreate()
.
The toCreateFormat(objIns)
method is a static method that transforms an object instance or an array of object instances into a specific format suitable for creating or updating objects in the Redmine system. It recursively traverses the object instances and their prototypes to retrieve data to be sent to the Redmine API.
-
objIns
: The object instance or an array of object instances to be transformed.
The method returns an object in a format suitable for creating or updating objects in Redmine.
The toCreate()
method is an instance method that should be implemented in the derived classes. It is used to provide data for creating or updating objects in the Redmine system. The method should return an object or a value that represents the data to be sent to Redmine.
The following classes extend the RedmineBase
class and provide specific functionality for creating or updating various Redmine entities.
The RedmineValue
class represents a basic Redmine entity with an id
and name
.
-
RedmineValue(id, name)
: Creates aRedmineValue
instance with the givenid
andname
.
-
toJSON()
: Returns an object representing theRedmineValue
instance in JSON format.
RedmineProject, RedmineTracker, RedmineStatus, RedmineUser, RedmineAuthor, RedmineAssignedTo, RedmineWatcher Classes
These classes represent specific types of Redmine entities and inherit from the RedmineValue
class. They have similar functionality to the RedmineValue
class.
The RedmineCustomField
class represents a custom field in Redmine with an additional value
property.
-
RedmineCustomField(id, name)
: Creates aRedmineCustomField
instance with the givenid
andname
.
-
setValue(value)
: Sets thevalue
property of theRedmineCustomField
instance. -
toJSON()
: Returns an object representing theRedmineCustomField
instance in JSON format.
The RedmineCheckList
class represents a checklist in Redmine.
-
RedmineCheckList()
: Creates aRedmineCheckList
instance.
The RedmineCustomFieldMultiple
class represents a custom field in Redmine that can hold multiple values.
-
RedmineCustomFieldMultiple(id, name)
: Creates aRedmineCustomFieldMultiple
instance with the givenid
andname
.
-
addValue(value)
: Adds a value to thevalue
array of theRedmineCustomFieldMultiple
instance. -
setValue(list)
: Sets thevalue
array of theRedmineCustomFieldMultiple
instance with the given list of values. -
toJSON()
: Returns an object representing theRedmineCustomFieldMultiple
instance in JSON format.
The RedmineIssue
class represents an issue in Redmine and extends the RedmineBase
class.
-
RedmineIssue()
: Creates aRedmineIssue
instance.
-
setProject(project)
: Sets the project of the issue. -
setTracker(tracker)
: Sets the tracker of the issue. -
setStatus(status)
: Sets the status of the issue. -
setAuthor(author)
: Sets the author of the issue. -
setAssignedTo(assigned_to)
: Sets the assigned-to user of the issue. -
setSubject(subject)
: Sets the subject of the issue. -
setDescription(description)
: Sets the description of the issue. -
addCustomFields(custom_field)
: Adds a custom field to the issue. -
addWatchers(watcher)
: Adds a watcher to the issue. -
setWatchers(...watchers)
: Sets the watchers of the issue with multiple watcher objects. -
setDueDate(due_date)
: Sets the due date of the issue. -
setEstimatedHours(estimated_hours)
: Sets the estimated hours of the issue. -
addCheckList(subject, is_done)
: Adds a checklist item to the issue. -
setCheckList(...list)
: Sets the checklist of the issue with multiple checklist items.
Note: The RedmineIssue
class does not have a toCreate()
method. It relies on the toCreate()
method defined in its parent classes (RedmineBase
and RedmineValue
) to generate the necessary data for creating or updating the issue in Redmine.