from panoptes_client.panoptes import PanoptesObject, LinkResolver
from panoptes_client.subject import Subject

class Workflow(PanoptesObject):
    _api_slug = 'workflows'
    _link_slug = 'workflows'
    _edit_attributes = []

    def retire_subjects(self, subjects, reason='other'):
        if type(subjects) not in (list, tuple):
            subjects = [ subjects ]
        subjects = [ s.id if isinstance(s, Subject) else s for s in subjects ]

        return Workflow.post(
            '{}/retired_subjects'.format(self.id),
            json={
                'subject_ids': subjects,
                'retirement_reason': reason
            }
        )

LinkResolver.register(Workflow)

@@ -103,16 +103,68 @@
 Subject%0A
+from panoptes_client.subject_set import SubjectSet%0A%0A
 %0Aclass W
@@ -703,16 +703,1380 @@
      )%0A%0A
+    def add_subject_sets(self, subject_sets, batch_size=100):%0A        _subject_sets = self._build_subject_set_list(subject_sets)%0A%0A        for _subject_sets_batch in %5B%0A            _subject_sets%5Bi:i+batch_size%5D%0A            for i in xrange(0, len(_subject_sets), batch_size)%0A        %5D:%0A            self.post(%0A                '%7B%7D/links/subject_sets'.format(self.id),%0A                json=%7B'subject_sets': _subject_sets_batch%7D%0A            )%0A%0A    def remove_subject_sets(self, subject_sets):%0A        _subject_sets = self._build_subject_set_list(subject_sets)%0A        _subject_set_ids = %22,%22.join(_subject_sets)%0A%0A        self.delete(%0A            '%7B%7D/links/subject_sets/%7B%7D'.format(self.id, _subject_set_ids)%0A        )%0A%0A    def _build_subject_set_list(self, subject_sets):%0A        if not type(subject_sets) in (tuple, list):%0A            subject_sets = %5Bsubject_sets%5D%0A%0A        _subject_sets = %5B%5D%0A        for subject_set in subject_sets:%0A            if not (%0A                isinstance(subject_set, SubjectSet)%0A                or isinstance(subject_set, (int, str, unicode,))%0A            ):%0A                raise TypeError%0A%0A            if isinstance(subject_set, SubjectSet):%0A                _subject_set_id = subject_set.id%0A            else:%0A                _subject_set_id = str(subject_set)%0A%0A            _subject_sets.append(_subject_set_id)%0A%0A        return _subject_sets%0A%0A
 LinkReso

Add Workflow->SubjectSet linking (#31)