getContextsForField method

Future<PageBeanCustomFieldContext> getContextsForField({
  1. required String fieldId,
  2. bool? isAnyIssueType,
  3. bool? isGlobalContext,
  4. List<int>? contextId,
  5. int? startAt,
  6. int? maxResults,
})

Returns a paginated list of contexts for a custom field. Contexts can be returned as follows:

  • With no other parameters set, all contexts.
  • By defining id only, all contexts from the list of IDs.
  • By defining isAnyIssueType, limit the list of contexts returned to either those that apply to all issue types (true) or those that apply to only a subset of issue types (false)
  • By defining isGlobalContext, limit the list of contexts return to either those that apply to all projects (global contexts) (true) or those that apply to only a subset of projects (false).

Permissions required: Administer Jira global permission.

Implementation

Future<PageBeanCustomFieldContext> getContextsForField(
    {required String fieldId,
    bool? isAnyIssueType,
    bool? isGlobalContext,
    List<int>? contextId,
    int? startAt,
    int? maxResults}) async {
  return PageBeanCustomFieldContext.fromJson(await _client.send(
    'get',
    'rest/api/3/field/{fieldId}/context',
    pathParameters: {
      'fieldId': fieldId,
    },
    queryParameters: {
      if (isAnyIssueType != null) 'isAnyIssueType': '$isAnyIssueType',
      if (isGlobalContext != null) 'isGlobalContext': '$isGlobalContext',
      if (contextId != null)
        'contextId': contextId.map((e) => '$e').join(','),
      if (startAt != null) 'startAt': '$startAt',
      if (maxResults != null) 'maxResults': '$maxResults',
    },
  ));
}