@@ -713,6 +713,60 @@ def get_custom_field_option(self, option_id: T_id) -> T_resp_json:
713713 url = f"{ base_url } /{ option_id } "
714714 return self .get (url )
715715
716+ def get_custom_field_options (
717+ self ,
718+ field_id : T_id ,
719+ project_id : T_id ,
720+ issue_type_id : Union [T_id , list [str ], None ] = None ,
721+ query : Optional [str ] = None ,
722+ page : Optional [int ] = None ,
723+ limit : Optional [int ] = None ,
724+ sort : Optional [bool ] = None ,
725+ use_all_contexts : Optional [bool ] = None ,
726+ ) -> T_resp_json :
727+ """
728+ Get list of all options available for a custom field in a specified project.
729+ Numeric field ID and numeric project ID must be used.
730+
731+ This is Experimental API available to Jira data Center.
732+ At the time of testing, providing multiple project IDs results in 404 response.
733+
734+ Reference: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-customfields/#api-api-2-customfields-customfieldid-options-get
735+
736+ :param field_id: str - The ID of the custom field.
737+ :param project_id: str - The project ID in a context.
738+ :param issue_type_id: str, Optional - A list of issue type IDs in a context.
739+ :param query: str, Optional - A string used to filter options.
740+ :param page: int, Optional - The page of options to return, starting from 1.
741+ :param limit: int, Optional - The maximum number of results to return. If empty, return all results.
742+ :param sort: bool, Optional - Flag to sort options by their names.
743+ :param use_all_contexts: bool, Optional - Flag to fetch all options regardless of context, project IDs, or issue type IDs.
744+ """
745+ url = self .resource_url (
746+ f"customFields/{ field_id } /options" ,
747+ api_version = 2 ,
748+ )
749+ params : dict = {}
750+ if project_id :
751+ if isinstance (project_id , (list , tuple , set )):
752+ project_id = "," .join (project_id )
753+ params ["projectIds" ] = project_id
754+ if issue_type_id :
755+ if isinstance (issue_type_id , (list , tuple , set )):
756+ issue_type_id = "," .join (issue_type_id )
757+ params ["issueTypeIds" ] = issue_type_id
758+ if query :
759+ params ["query" ] = query
760+ if page is not None :
761+ params ["page" ] = page
762+ if limit is not None :
763+ params ["maxResults" ] = limit
764+ if sort is not None :
765+ params ["sortByOptionName" ] = sort
766+ if use_all_contexts is not None :
767+ params ["useAllContexts" ] = use_all_contexts
768+ return self .get (url , params = params )
769+
716770 def get_custom_fields (self , search : Optional [str ] = None , start : int = 1 , limit : int = 50 ) -> T_resp_json :
717771 """
718772 Get custom fields. Evaluated on 7.12
@@ -3910,6 +3964,60 @@ def get_priority_by_id(self, priority_id: T_id) -> T_resp_json:
39103964 url = f"{ base_url } /{ priority_id } "
39113965 return self .get (url )
39123966
3967+ def get_autocomplete_data (self ) -> T_resp_json :
3968+ """
3969+ Returns full information about visible fields that can be autocompleted in JQL.
3970+
3971+ Available in Jira Data Center, Jira Cloud v2, Jira Cloud v3.
3972+
3973+ Reference: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-jql/#api-api-2-jql-autocompletedata-get
3974+ https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-jql/#api-rest-api-2-jql-autocompletedata-get
3975+ :return:
3976+ """
3977+ url = self .resource_url ("jql/autocompletedata" )
3978+ return self .get (url )
3979+
3980+ def get_autocomplete_suggestion (
3981+ self ,
3982+ field_name : Optional [str ] = None ,
3983+ field_value : Optional [str ] = None ,
3984+ predicate_name : Optional [str ] = None ,
3985+ predicate_value : Optional [str ] = None ,
3986+ ) -> T_resp_json :
3987+ """
3988+ Returns auto complete suggestions for JQL search.
3989+
3990+ Suggestions can be obtained by providing:
3991+
3992+ `fieldName` to get a list of all values for the field.
3993+ `fieldName` and `fieldValue` to get a list of values containing the text in `fieldValue`.
3994+ `fieldName` and `predicateName` to get a list of all predicate values for the field.
3995+ `fieldName`, `predicateName`, and `predicateValue` to get a list of predicate values containing the text in `predicateValue`.
3996+
3997+ Although auto complete suggestion can be used to retrieve possible option for a field,
3998+ it may be more appropriate to use `get_custom_field_options()` method to get project-specific options for a field.
3999+
4000+ Reference: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-jql/#api-api-2-jql-autocompletedata-suggestions-get
4001+ https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-jql/#api-rest-api-2-jql-autocompletedata-suggestions-get
4002+
4003+ :param field_name: str, Optional - The field name for which the suggestions are generated.
4004+ :param field_value: str, Optional - The portion of the field value that has already been provided by the user.
4005+ :param predicate_name: str, Optional - The predicate for which the suggestions are generated. Suggestions are generated only for: "by", "from" and "to".
4006+ :param predicate_value: str, Optional - The portion of the predicate value that has already been provided by the user.
4007+ :return:
4008+ """
4009+ url = self .resource_url ("jql/autocompletedata/suggestions" )
4010+ params : dict = {}
4011+ if field_name :
4012+ params ["fieldName" ] = field_name
4013+ if field_value :
4014+ params ["fieldValue" ] = field_value
4015+ if predicate_name :
4016+ params ["predicateName" ] = predicate_name
4017+ if predicate_value :
4018+ params ["predicateValue" ] = predicate_value
4019+ return self .get (url , params = params )
4020+
39134021 """
39144022 Workflow
39154023 Reference: https://docs.atlassian.com/software/jira/docs/api/REST/8.5.0/#api/2/workflow
0 commit comments