@@ -775,6 +775,60 @@ def get_custom_field_option(self, option_id: T_id) -> T_resp_json:
775775 url = f"{ base_url } /{ option_id } "
776776 return self .get (url )
777777
778+ def get_custom_field_options (
779+ self ,
780+ field_id : T_id ,
781+ project_id : T_id ,
782+ issue_type_id : Union [T_id , list [str ], None ] = None ,
783+ query : Optional [str ] = None ,
784+ page : Optional [int ] = None ,
785+ limit : Optional [int ] = None ,
786+ sort : Optional [bool ] = None ,
787+ use_all_contexts : Optional [bool ] = None ,
788+ ) -> T_resp_json :
789+ """
790+ Get list of all options available for a custom field in a specified project.
791+ Numeric field ID and numeric project ID must be used.
792+
793+ This is Experimental API available to Jira data Center.
794+ At the time of testing, providing multiple project IDs results in 404 response.
795+
796+ Reference: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-customfields/#api-api-2-customfields-customfieldid-options-get
797+
798+ :param field_id: str - The ID of the custom field.
799+ :param project_id: str - The project ID in a context.
800+ :param issue_type_id: str, Optional - A list of issue type IDs in a context.
801+ :param query: str, Optional - A string used to filter options.
802+ :param page: int, Optional - The page of options to return, starting from 1.
803+ :param limit: int, Optional - The maximum number of results to return. If empty, return all results.
804+ :param sort: bool, Optional - Flag to sort options by their names.
805+ :param use_all_contexts: bool, Optional - Flag to fetch all options regardless of context, project IDs, or issue type IDs.
806+ """
807+ url = self .resource_url (
808+ f"customFields/{ field_id } /options" ,
809+ api_version = 2 ,
810+ )
811+ params : dict = {}
812+ if project_id :
813+ if isinstance (project_id , (list , tuple , set )):
814+ project_id = "," .join (project_id )
815+ params ["projectIds" ] = project_id
816+ if issue_type_id :
817+ if isinstance (issue_type_id , (list , tuple , set )):
818+ issue_type_id = "," .join (issue_type_id )
819+ params ["issueTypeIds" ] = issue_type_id
820+ if query :
821+ params ["query" ] = query
822+ if page is not None :
823+ params ["page" ] = page
824+ if limit is not None :
825+ params ["maxResults" ] = limit
826+ if sort is not None :
827+ params ["sortByOptionName" ] = sort
828+ if use_all_contexts is not None :
829+ params ["useAllContexts" ] = use_all_contexts
830+ return self .get (url , params = params )
831+
778832 def get_custom_fields (self , search : Optional [str ] = None , start : int = 1 , limit : int = 50 ) -> T_resp_json :
779833 """
780834 Get custom fields. Evaluated on 7.12
@@ -3972,6 +4026,60 @@ def get_priority_by_id(self, priority_id: T_id) -> T_resp_json:
39724026 url = f"{ base_url } /{ priority_id } "
39734027 return self .get (url )
39744028
4029+ def get_autocomplete_data (self ) -> T_resp_json :
4030+ """
4031+ Returns full information about visible fields that can be autocompleted in JQL.
4032+
4033+ Available in Jira Data Center, Jira Cloud v2, Jira Cloud v3.
4034+
4035+ Reference: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-jql/#api-api-2-jql-autocompletedata-get
4036+ https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-jql/#api-rest-api-2-jql-autocompletedata-get
4037+ :return:
4038+ """
4039+ url = self .resource_url ("jql/autocompletedata" )
4040+ return self .get (url )
4041+
4042+ def get_autocomplete_suggestion (
4043+ self ,
4044+ field_name : Optional [str ] = None ,
4045+ field_value : Optional [str ] = None ,
4046+ predicate_name : Optional [str ] = None ,
4047+ predicate_value : Optional [str ] = None ,
4048+ ) -> T_resp_json :
4049+ """
4050+ Returns auto complete suggestions for JQL search.
4051+
4052+ Suggestions can be obtained by providing:
4053+
4054+ `fieldName` to get a list of all values for the field.
4055+ `fieldName` and `fieldValue` to get a list of values containing the text in `fieldValue`.
4056+ `fieldName` and `predicateName` to get a list of all predicate values for the field.
4057+ `fieldName`, `predicateName`, and `predicateValue` to get a list of predicate values containing the text in `predicateValue`.
4058+
4059+ Although auto complete suggestion can be used to retrieve possible option for a field,
4060+ it may be more appropriate to use `get_custom_field_options()` method to get project-specific options for a field.
4061+
4062+ Reference: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-jql/#api-api-2-jql-autocompletedata-suggestions-get
4063+ https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-jql/#api-rest-api-2-jql-autocompletedata-suggestions-get
4064+
4065+ :param field_name: str, Optional - The field name for which the suggestions are generated.
4066+ :param field_value: str, Optional - The portion of the field value that has already been provided by the user.
4067+ :param predicate_name: str, Optional - The predicate for which the suggestions are generated. Suggestions are generated only for: "by", "from" and "to".
4068+ :param predicate_value: str, Optional - The portion of the predicate value that has already been provided by the user.
4069+ :return:
4070+ """
4071+ url = self .resource_url ("jql/autocompletedata/suggestions" )
4072+ params : dict = {}
4073+ if field_name :
4074+ params ["fieldName" ] = field_name
4075+ if field_value :
4076+ params ["fieldValue" ] = field_value
4077+ if predicate_name :
4078+ params ["predicateName" ] = predicate_name
4079+ if predicate_value :
4080+ params ["predicateValue" ] = predicate_value
4081+ return self .get (url , params = params )
4082+
39754083 """
39764084 Workflow
39774085 Reference: https://docs.atlassian.com/software/jira/docs/api/REST/8.5.0/#api/2/workflow
0 commit comments