Skip to content

Conversation

@AnssiAhola
Copy link
Contributor

@AnssiAhola AnssiAhola commented Jan 17, 2026

Added support for the following endpoints:

Tasklist:

  • Implement listing custom fields
  • Implement editing custom field in a collection item
  • Write basic tests for new stuff
  • Write tests to confirm no backwards incompatibility with CollectionItemInstance.notes

Usage:

Finding the matching field and its information for each assigned note/field in a collection item.

collection_folder = me.collection_folders[0]
instances = collection_folder.releases
instance = instances[0]
for note in instance.notes or []:
    field = custom_fields.get(note.field_id)
    if field:
        print("--------------------------------")
        print(f"Field ID: {field.id}")
        print(f"Field Name: {field.name}")
        print(f"Value: {note.value}")
        print(f"Options: {(', '.join(field.options))}")

Editing/Adding custom fields / notes in a collection item

#TODO

@JOJ0 I'll be working on this for the weekend at least. If you can give some feedback on this (improvements, bugs, documentation), it would be much appreciated 😃

@AnssiAhola AnssiAhola linked an issue Jan 17, 2026 that may be closed by this pull request
@JOJ0
Copy link
Contributor

JOJ0 commented Jan 17, 2026

Great news! Please go ahead and tell me when it's ready for a first review. No comments so far!

release_id = release.id if isinstance(release, Release) else release
return PaginatedList(self.client,self.fetch('resource_url') + "/collection/releases/{}".format(release_id) , "releases", CollectionItemInstance)

def update_collection_item_field(self, instance, field_id, value):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a bit difficult to find a place for as the endpoint needs the users username, so this method cannot be in CollectionItemInstance directly.


resp = self.client._get(self.fetch('resource_url') + "/collection/fields")
# CollectionField's are keyed by their ID so they can be queried with field IDs from CollectionItemInstance's notes
return {int(field["id"]): CollectionField(self.client, field) for field in resp.get("fields", [])}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about using a simple dict {folder_id, CollectionField}.
Should this be a class that holds the collection of CollectionFields and maybe has a find_by_id() method for searching by field_id?

rating = SimpleField() #:
folder_id = SimpleField() #:
notes = SimpleField() #:
notes = ListField('Note') #:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs proper testing as this could potentially be a breaking change if we are not careful.

Returns:
list: The list of available options for the collection field.
"""
return self.fetch('options', [])
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this should be a SimpleField instead...
A getter would provide a better dev experience to not have to check for None.

print(", ".join(field.options)) 
# VS.
print(", ".join(field.options or [])

Thoughts?

def __repr__(self):
return '<CollectionField {0!r} {1!r}>'.format(self.id, self.name)

class Note(SecondaryAPIObject, dict):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this so the client api would be a bit cleaner and not need dict.get('value', '') or such.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support the "List/Edit Custom Fields" endpoints

3 participants