### Setup Jira OAuth CLI Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-connect-using-oauth.md Initiates the manual setup for Jira OAuth using the CLI tool. Requires Jira URL, user credentials, and a consumer key. ```bash jira-oauth-cli setup --url -u -p -k ``` -------------------------------- ### Install jira-oauth-cli Tool Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-connect-using-oauth.md Installs the jira-oauth-cli global tool using the .NET CLI. ```bash dotnet tool install -g jira-oauth-cli ``` -------------------------------- ### Setup Jira Test Data Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-run-the-integration-tests.md Executes the JiraSetup utility to populate the JIRA instance with test data for a specific version. ```bash dotnet Atlassian.Jira.Test.Integration.Setup/bin/netcoreapp3.1/JiraSetup.dll 8.5.2 ``` -------------------------------- ### Run Docker Compose Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-run-the-integration-tests.md Starts the Docker containers defined in the docker-compose file in detached mode. ```bash docker-compose up -d ``` -------------------------------- ### Writing to Custom Fields Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-use-custom-fields.md Shows how to set values for different types of custom fields. Includes examples for single-value, multi-value (labels), and cascading select fields. Remember to save changes. ```csharp // Set a single value custom field issue["My CustomField"] = "Updated Field"; // Set a multi-value custom field issue.CustomFields.AddArray("Custom Labels Field", "label1", "label2"); // Set a cascading-select custom field. issue.CustomFields.AddCascadingSelectField("Custom Cascading Select Field", "Option3"); // Save all your changes to the server. await issue.SaveChangesAsync(); ``` -------------------------------- ### Configure User-Agent for OAuth Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-configure-user-agent.md Example of setting a custom User-Agent when creating a JiraRestClient for OAuth authentication. Ensure your application is identified. ```csharp var settings = new JiraRestClientSettings("MyApp/1.0"); var jira = JiraClient.CreateOAuthRestClient( url, consumerKey, consumerSecret, accessToken, tokenSecret, settings: settings); ``` -------------------------------- ### Set Jira Version Environment Variable (Windows) Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-run-the-integration-tests.md Sets the JIRA_VERSION environment variable on Windows. This is a prerequisite for automated setup. ```bash SET JIRA_VERSION=8.5.2 ``` -------------------------------- ### Build Warning for Parameterless Constructor Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-configure-user-agent.md This example shows the CS0618 build warning received when using the parameterless JiraRestClientSettings constructor. It prompts you to provide a User-Agent. ```csharp warning CS0618: 'JiraRestClientSettings.JiraRestClientSettings()' is obsolete: 'Use the constructor that accepts a userAgent parameter to identify your application (e.g. new JiraRestClientSettings("MyApp/1.0")).' ``` -------------------------------- ### Manage Issue Attachments Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-use-the-sdk.md Provides examples for retrieving, downloading, and uploading attachments for a specific Jira issue. Ensure the file paths are correct when downloading or uploading. ```csharp var issue = await jira.Issues.GetIssueAsync("TST-5"); // get attachments var attachments = await issue.GetAttachmentsAsync(); Console.WriteLine(attachments.First().FileName); // download an attachment var tempFile = Path.GetTempFileName(); attachments[0].Download(tempFile); // upload an attachment await issue.AddAttachmentsAsync("fileToAdd.txt"); ``` -------------------------------- ### Get Jira Workflows Source: https://github.com/panoramicdata/jira.api/blob/main/README.md Retrieves all available workflows or a specific workflow by its name. ```csharp // Get all workflows var workflows = await jiraClient.Workflows.GetWorkflowsAsync(); // Get a specific workflow by name var workflow = await jiraClient.Workflows.GetWorkflowAsync("My Workflow"); ``` -------------------------------- ### Create Jira OAuth REST Client Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-connect-using-oauth.md Creates a Jira REST client using OAuth tokens and secrets. Ensure all placeholder values are replaced with actual credentials and tokens obtained during the setup process. ```csharp var settings = new JiraRestClientSettings("MyApp/1.0"); var jira = JiraClient.CreateOAuthRestClient( YOUR_JIRA_URL, YOUR_CONSUMER_KEY, // as was decided on step #2 YOUR_CONSUMER_SECRET, // as was printed by the cli tool. YOUR_ACCESS_TOKEN, // as was printed by the cli tool. YOUT_TOKEN_SECRET, // as was printed by the cli tool. settings: settings); ``` -------------------------------- ### Get and Download Jira Attachment by ID Source: https://github.com/panoramicdata/jira.api/blob/main/README.md Fetches attachment metadata by ID and then downloads the attachment content as bytes or saves it to a file. ```csharp // Fetch a single attachment's metadata directly by ID var attachment = await jira.Issues.GetAttachmentAsync("10001", cancellationToken); // Download it as a byte array var bytes = await attachment.DownloadDataAsync(cancellationToken); // Or save to disk await attachment.DownloadAsync("C:\\downloads\\report.pdf", cancellationToken); ``` -------------------------------- ### Workflow Scheme Management Source: https://github.com/panoramicdata/jira.api/blob/main/README.md Full CRUD operations for workflow schemes, including getting, creating, updating, and deleting schemes. ```APIDOC ## Workflow Scheme Management (Full CRUD) ### Description Provides comprehensive Create, Read, Update, and Delete (CRUD) operations for workflow schemes. This includes retrieving schemes by ID or project, creating new schemes, updating existing ones, and deleting schemes. ### Method `GET`, `POST`, `PUT`, `DELETE` (Implied by async method names) ### Endpoint `/workflowschemes` (Implied for listing/creation) `/workflowschemes/{schemeId}` (Implied for retrieval/update/delete) `/projects/{projectId}/workflowscheme` (Implied for getting scheme for a project) ### Parameters #### Path Parameters - **schemeId** (string) - Required - The ID of the workflow scheme. - **projectId** (string) - Required - The ID of the project. #### Query Parameters (for GetWorkflowSchemesAsync) - **startAt** (int) - Optional - The number of schemes to skip. - **maxResults** (int) - Optional - The maximum number of schemes to return. #### Request Body (for CreateWorkflowSchemeAsync and UpdateWorkflowSchemeAsync) - **name** (string) - Required - The name of the workflow scheme. - **description** (string) - Optional - The description of the workflow scheme. - **defaultWorkflow** (string) - Optional - The name of the default workflow for the scheme. ### Request Example ```csharp // Get all workflow schemes (paginated) var schemes = await jiraClient.WorkflowSchemes.GetWorkflowSchemesAsync(startAt: 0, maxResults: 50); // Get a workflow scheme by ID var scheme = await jiraClient.WorkflowSchemes.GetWorkflowSchemeAsync("10001"); // Get the workflow scheme for a project var projectScheme = await jiraClient.WorkflowSchemes.GetWorkflowSchemeForProjectAsync("PROJ"); // Create a new workflow scheme var newScheme = await jiraClient.WorkflowSchemes.CreateWorkflowSchemeAsync( name: "My Workflow Scheme", description: "A custom workflow scheme", defaultWorkflow: "jira"); // Update a workflow scheme var updatedScheme = await jiraClient.WorkflowSchemes.UpdateWorkflowSchemeAsync( schemeId: "10001", name: "Updated Name", description: "Updated description"); // Delete a workflow scheme await jiraClient.WorkflowSchemes.DeleteWorkflowSchemeAsync("10001"); ``` ### Response #### Success Response (200) - **schemes** (List) - A list of workflow schemes. - **scheme** (WorkflowScheme) - Details of a specific workflow scheme. - **projectScheme** (WorkflowScheme) - Details of the workflow scheme for a project. - **newScheme** (WorkflowScheme) - Details of the newly created workflow scheme. - **updatedScheme** (WorkflowScheme) - Details of the updated workflow scheme. #### Response Example ```json { "id": "10001", "name": "My Workflow Scheme", "description": "A custom workflow scheme", "defaultWorkflow": "jira" } ``` ``` -------------------------------- ### Get Attachment by ID Source: https://github.com/panoramicdata/jira.api/blob/main/README.md Fetches a single attachment's metadata by its ID and provides methods to download its data or save it to disk. ```APIDOC ## Get Attachment by ID ### Description Fetches a single attachment's metadata directly by ID. It also provides methods to download the attachment's data as a byte array or save it directly to a file. ### Method `GET` (Implied by `GetAttachmentAsync`) ### Endpoint `/attachment/{id}` (Implied) ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the attachment to retrieve. ### Request Example ```csharp // Fetch a single attachment's metadata directly by ID var attachment = await jira.Issues.GetAttachmentAsync("10001", cancellationToken); // Download it as a byte array var bytes = await attachment.DownloadDataAsync(cancellationToken); // Or save to disk await attachment.DownloadAsync("C:\\downloads\\report.pdf", cancellationToken); ``` ### Response #### Success Response (200) - **attachment** (AttachmentMetadata) - Metadata of the requested attachment. - **bytes** (byte[]) - Downloaded attachment data. #### Response Example ```json { "id": "10001", "filename": "report.pdf", "mimeType": "application/pdf", "size": 102400 } ``` ``` -------------------------------- ### Jira API Search Endpoint Response with Custom Field Source: https://github.com/panoramicdata/jira.api/blob/main/Jira.Api.Test.Integration/Trace_CustomFieldArrayOfObjects.txt Example response from the Jira API search endpoint showing an issue with a custom field 'customfield_10260' which is an array of objects (users). ```json // [POST] Request Url: rest/api/2/search{"expand":"schema,names","issues":[{"expand":"operations,versionedRepresentations,editmeta,changelog,renderedFields","fields":{"aggregateprogress":{"progress":0,"total":0},"aggregatetimeestimate":null,"aggregatetimeoriginalestimate":null,"aggregatetimespent":null,"assignee":{"key":"testUser","name":"testUser"},"components":[],"created":"2018-01-11T14:33:15.000+0100","creator":{"key":"testUser","name":"testUser"},"customfield_10260":[{"key":"testUser","name":"testUser"}],"description":"Test description","duedate":null,"environment":null,"fixVersions":[],"issuelinks":[],"issuetype":{"id":"14700","name":"Promotion"},"labels":[],"lastViewed":null,"priority":{"id":"4","name":"Minor"},"progress":{"progress":0,"total":0},"project":{"id":"21800","key":"TST","name":"TEST Project"},"reporter":{"key":"testUser","name":"testUser"},"resolution":null,"resolutiondate":null,"status":{"id":"3","name":"In Progress"},"subtasks":[],"summary":"Test Summary","timeestimate":null,"timeoriginalestimate":null,"timespent":null,"updated":"2018-01-11T15:26:24.000+0100","versions":[],"votes":{"votes":0},"watches":{"watchCount":1},"workratio":-1},"id":"1111644","key":"TST-1"}],"maxResults":20,"startAt":0,"total":5} ``` -------------------------------- ### Jira API Field Endpoint Response for Custom Field Source: https://github.com/panoramicdata/jira.api/blob/main/Jira.Api.Test.Integration/Trace_CustomFieldArrayOfObjects.txt Example response from the Jira API field endpoint describing the schema for 'customfield_10260' (Watchers), indicating it's an array of user objects. ```json // [GET] Request Url: rest/api/2/field[{"clauseNames":["cf[10260]"],"custom":true,"id":"customfield_10260","name":"Watchers","navigable":true,"orderable":true,"schema":{"custom":"com.burningcode.jira.issue.customfields.impl.jira-watcher-field:watcherfieldtype","customId":10260,"items":"user","type":"array"},"searchable":true}] ``` -------------------------------- ### Connect to Jira and Query Issues Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-use-the-sdk.md Establishes a connection to a Jira server using the Rest client and demonstrates querying issues with LINQ syntax. Ensure you replace placeholders with your actual server URL, username, and password. ```csharp var settings = new JiraRestClientSettings("MyApp/1.0"); var jira = JiraClient.CreateRestClient("http://", "", "", settings); var issues = from i in jira.Issues.Queryable where i.Assignee == "admin" && i.Priority == "Major" orderby i.Created select i; ``` -------------------------------- ### Run Integration Tests from Command Line Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-run-the-integration-tests.md Executes the integration tests using the dotnet CLI. Ensure Docker containers are running. ```bash $ dotnet test Atlassian.Jira.Test.Integration/ ``` -------------------------------- ### Build Project in Release Configuration Source: https://github.com/panoramicdata/jira.api/blob/main/docs/reference-appveyor-build-script.md Builds the project in Release configuration, setting the version from an AppVeyor environment variable. ```powershell dotnet build -c Release -p:Version=$env:APPVEYOR_REPO_TAG_NAME ``` -------------------------------- ### Transition Issue Status using Workflow Actions Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-use-the-sdk.md Demonstrates how to transition an issue's status using predefined workflow actions like 'Resolve' or by specifying the desired status name directly. ```csharp var issue = await jira.Issues.GetIssueAsync("TST-5"); issue.Resolution = "Won't Fix"; await issue.WorkflowTransitionAsync(WorkflowActions.Resolve); ``` ```csharp // Sets the ticket status to Pending issue.WorkflowTransitionAsync("Pending"); // Removes status Pending issue.WorkflowTransitionAsync("Back to open"); ``` -------------------------------- ### Build Signed Project Source: https://github.com/panoramicdata/jira.api/blob/main/docs/reference-appveyor-build-script.md Builds a specific signed project file in Release configuration, setting the version from an AppVeyor environment variable. ```powershell dotnet build -c Release -p:Version=$env:APPVEYOR_REPO_TAG_NAME .\Atlassian.Jira\Atlassian.Jira.Signed.csproj ``` -------------------------------- ### Configure User-Agent for Personal Access Tokens Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-configure-user-agent.md Illustrates how to configure a User-Agent when using a personal access token to create a JiraRestClient. This is crucial for tracking API usage. ```csharp var settings = new JiraRestClientSettings("MyApp/1.0"); var jira = JiraClient.CreateRestClient("http://your-jira-server", personalAccessToken, settings); ``` -------------------------------- ### Fetch All Basic Fields Plus Attachments Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-configure-issue-fields-to-fetch.md Set `FetchBasicFields = true` and include "attachment" in `AdditionalFields` to retrieve all basic issue properties along with attachment information. ```csharp var options = new IssueSearchOptions("key = TST-1") { FetchBasicFields = true, AdditionalFields = new List() { "attachment" } }; var issues = await jira.Issues.GetIssuesFromJqlAsync(options); var attachemnts = issues.First().AdditionalFields.Attachments; ``` -------------------------------- ### Manage Issue Worklogs Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-use-the-sdk.md Shows how to add worklogs to an issue, with options for specifying remaining estimates, and how to retrieve all worklogs associated with an issue. ```csharp var issue = await jira.Issues.GetIssueAsync("TST-5"); // add a worklog await issue.AddWorklogAsync("1h"); // add worklog with new remaining estimate await issue.AddWorklogAsync("1m", WorklogStrategy.NewRemainingEstimate, "4h"); // retrieve worklogs var worklogs = await issue.GetWorklogsAsync(); ``` -------------------------------- ### Sign PFX File Source: https://github.com/panoramicdata/jira.api/blob/main/docs/reference-appveyor-build-script.md Uses a PowerShell script to convert a PFX file to a SNK file, requiring the PFX file path and password from environment variables. ```powershell .\pfx2snk.ps1 -pfxFilePath .\Atlassian.Jira\Atlassian.Jira.pfx -pfxPassword $env:pfxPwd ``` -------------------------------- ### Create a New Jira Issue Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-use-the-sdk.md Shows how to create a new issue in Jira. Set the project, type, priority, and summary before saving the issue. ```csharp var issue = jira.CreateIssue("My Project"); issue.Type = "Bug"; issue.Priority = "Major"; issue.Summary = "Issue Summary"; await issue.SaveChangesAsync(); ``` -------------------------------- ### Fetch Only Basic Fields Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-configure-issue-fields-to-fetch.md Use `FetchBasicFields = false` and specify desired fields in `AdditionalFields` to retrieve a subset of issue data. Only the specified fields will be populated. ```csharp var options = new IssueSearchOptions("key = TST-1") { FetchBasicFields = false, AdditionalFields = new List() { "summary" } }; var issues = await jira.Issues.GetIssuesFromJqlAsync(options); ``` -------------------------------- ### Query and Modify Custom Fields Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-use-the-sdk.md Shows how to query issues based on custom field values and how to update existing custom fields or add new values to array and cascading select fields. Ensure custom field names are accurate. ```csharp var issue = (from i in jira.Issues.Queryable where i["My CustomField"] == "Custom Field Value" select i).First(); issue["My CustomField"] = "Updated Field"; // No need to know the id of the custom field. issue.CustomFields.AddArray("Custom Labels Field", "label1", "label2"); // Adds an array value to a custom field. issue.CustomFields.AddCascadingSelectField("Custom Cascading Select Field", "Option3"); // Adds a value to a cascading select field. await issue.SaveChangesAsync(); var cascadingSelect = issue.CustomFields.GetCascadingSelectField("Custom Cascading Select Field"); // Gets the value of a cascading field. ``` -------------------------------- ### Manage Issue Comments Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-use-the-sdk.md Demonstrates how to retrieve existing comments for an issue and how to add a new comment. Comments are retrieved as a list of comment objects. ```csharp var issue = await jira.Issues.GetIssueAsync("TST-5"); // get comments var comments = await issue.GetCommentsAsync(); Console.WriteLine(comments.First().Body); // add comment await issue.AddCommentAsync("new comment"); ``` -------------------------------- ### Handle Null or Whitespace Argument Exception Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-configure-user-agent.md Shows how ArgumentNullException or ArgumentException are thrown when null or empty strings are provided for the User-Agent. ```csharp // Throws ArgumentNullException var settings = new JiraRestClientSettings(null!); ``` ```csharp // Throws ArgumentException var settings = new JiraRestClientSettings(""); ``` -------------------------------- ### Create a Sub-Task Issue Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-use-the-sdk.md Explains how to create a sub-task for an existing parent issue. You need to specify the parent issue key and the issue type ID for the sub-task. ```csharp var issue = jira.CreateIssue("My Project", "PARENTISSUE-1"); issue.Type = "5"; // the id of the sub-task issue type issue.Summary = "A sub task"; await issue.SaveChangesAsync(); ``` -------------------------------- ### Read and Write Account IDs to User Picker Custom Fields Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-handle-gdpr-changes.md Demonstrates how to set and retrieve user account IDs for 'User Picker' and 'Multi User Picker' custom fields in Jira issues. Ensure user privacy mode is enabled for this functionality. ```csharp issue["Test User Picker"] = myAccountId; issue.CustomFields.AddArray("Test Multi User Picker", myAccountId, testAccountId); issue = await issue.SaveChangesAsync(); var singleAccountId = issue["Test User Picker"]); var multiAccounIds = issue.CustomFields["Test Multi User Picker"].Values; ``` -------------------------------- ### Configure User-Agent for Basic Authentication Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-configure-user-agent.md Use this snippet to set a custom User-Agent when creating a JiraRestClient with basic authentication. This helps Jira administrators identify your application. ```csharp var settings = new JiraRestClientSettings("MyApp/1.0"); var jira = JiraClient.CreateRestClient("http://your-jira-server", "user", "password", settings); ``` -------------------------------- ### Handle Invalid User-Agent Format Exception Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-configure-user-agent.md Demonstrates how a FormatException is thrown when an invalid User-Agent string is provided during JiraRestClientSettings construction. ```csharp // Throws FormatException var settings = new JiraRestClientSettings(".InvalidApp"); ``` -------------------------------- ### Query Project Statuses in Jira Source: https://github.com/panoramicdata/jira.api/blob/main/README.md Retrieves project statuses, grouped by issue type, and iterates through them to display status names. ```csharp // Get all statuses for a project (grouped by issue type) var projectStatuses = await jiraClient.ProjectStatuses.GetProjectStatusesAsync("PROJ"); foreach (var issueTypeStatuses in projectStatuses) { Console.WriteLine($"Issue Type: {issueTypeStatuses.Name}"); foreach (var status in issueTypeStatuses.Statuses) { Console.WriteLine($" - {status.Name}"); } } ``` -------------------------------- ### Project Status Queries Source: https://github.com/panoramicdata/jira.api/blob/main/README.md Retrieves all statuses for a given project, grouped by issue type. ```APIDOC ## Project Status Queries ### Description Retrieves all available statuses for a specific project. The statuses are helpfully grouped by issue type, allowing for a clear overview of the workflow states applicable to different kinds of issues within the project. ### Method `GET` (Implied by `GetProjectStatusesAsync`) ### Endpoint `/projects/{projectId}/statuses` (Implied) ### Parameters #### Path Parameters - **projectId** (string) - Required - The ID of the project for which to retrieve statuses. ### Request Example ```csharp // Get all statuses for a project (grouped by issue type) var projectStatuses = await jiraClient.ProjectStatuses.GetProjectStatusesAsync("PROJ"); foreach (var issueTypeStatuses in projectStatuses) { Console.WriteLine($"Issue Type: {issueTypeStatuses.Name}"); foreach (var status in issueTypeStatuses.Statuses) { Console.WriteLine($" - {status.Name}"); } } ``` ### Response #### Success Response (200) - **projectStatuses** (List) - A list where each item contains an issue type name and a list of statuses associated with that issue type within the project. #### Response Example ```json [ { "name": "Bug", "statuses": [ { "id": "10002", "name": "Open" }, { "id": "10003", "name": "In Progress" }, { "id": "10004", "name": "Resolved" } ] }, { "name": "Task", "statuses": [ { "id": "10002", "name": "Open" }, { "id": "10003", "name": "In Progress" } ] } ] ``` ``` -------------------------------- ### Query Issues with Literal Match Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-use-the-sdk.md Demonstrates how to perform a literal string match for issue properties, overriding the default 'contains' behavior. This is useful when an exact match is required. ```csharp var issues = from i in jira.Issues.Queryable where i.Summary == new LiteralMatch("My Title") select i; ``` -------------------------------- ### Register Custom Serializer with Settings Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-use-custom-fields.md Demonstrates how to register a custom serializer for a specific custom field type. This is done by adding an entry to the CustomFieldSerializers collection in JiraRestClientSettings. ```csharp var settings = new JiraRestClientSettings(); settings.CustomFieldSerializers.Add("com.atlassian.jira.plugin.system.customfieldtypes:url", new MyCustomFieldValueSerializer()); return Jira.CreateRestClient(, , , settings); ``` -------------------------------- ### Fetch Only Specific Non-Basic Fields Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-configure-issue-fields-to-fetch.md Configure to fetch only specific non-basic fields like "comment" and "worklog" by setting `FetchBasicFields = false` and listing them in `AdditionalFields`. ```csharp var options = new IssueSearchOptions($"key = {issue.Key.Value}") { FetchBasicFields = false, AdditionalFields = new List() { "comment", "worklog" } }; var issues = await jira.Issues.GetIssuesFromJqlAsync(options); var worklogs = issues.First().AdditionalFields.Worklogs; var comments = issues.First().AdditionalFields.Comments; ``` -------------------------------- ### Retrieve Fields Source: https://github.com/panoramicdata/jira.api/blob/main/Jira.Api.Test.Integration/Trace_CustomFieldArrayOfObjects.txt Retrieves a list of all available fields in Jira, including custom fields. ```APIDOC ## GET rest/api/2/field ### Description Retrieves a list of all fields available in Jira, including system and custom fields. ### Method GET ### Endpoint rest/api/2/field ### Parameters (No parameters are specified for this endpoint in the source.) ### Request Example (No request body or specific parameters are required for this GET request.) ### Response #### Success Response (200) - An array of field objects, each containing details like `id`, `name`, `custom`, `schema`, etc. #### Response Example ```json [ { "clauseNames": ["cf[10260]"], "custom": true, "id": "customfield_10260", "name": "Watchers", "navigable": true, "orderable": true, "schema": { "custom": "com.burningcode.jira.issue.customfields.impl.jira-watcher-field:watcherfieldtype", "customId": 10260, "items": "user", "type": "array" }, "searchable": true } ] ``` ``` -------------------------------- ### Auto-fetch Field Values for an Issue Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-use-the-sdk.md Illustrates how to access various fields of a Jira issue, including standard fields like Priority and Type, and custom fields by their name. This allows for easy retrieval of issue details. ```csharp var issue = await jira.Issues.GetIssueAsync("TST-5"); Console.WriteLine(issue.Priority.Name); // returns the string of the priority field, for example "Critical" Console.WriteLine(issue.Type.Name); // returns the string of the issue type field, for example "Bug" Console.WriteLine(issue["My CustomField"]); // returns the string of the custom field named "My CustomField" ``` -------------------------------- ### Implement Custom Field Value Serializer Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-use-custom-fields.md Provides the base structure for implementing a custom serializer for Jira custom fields. This involves handling the conversion between JSON and a string array. ```csharp public class MyCustomFieldValueSerializer : ICustomFieldValueSerializer { public string[] FromJson(JToken json) { // your code } public JToken ToJson(string[] values) { // your code } } ``` -------------------------------- ### Reading Custom Fields Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-use-custom-fields.md Demonstrates how to retrieve custom field values from a Jira issue. Supports single value, multi-value, cascading select, and deserializing to specific types like JiraUser. ```csharp // Get a custom field with single value. var singleValue = issue["My Field Name"]; // Get a custom field with multiple values. var multiValue = issue.CustomFields["My Field Name"].Values; // Get a cascading select custom field. var cascadingSelect = issue.CustomFields.GetCascadingSelectField("My Field Name"); // Deserialize the custom field value to a type (ie. user picker) var user = issue.CustomFields.GetAs("User Field"); var users = issue.CustomFields.GetAs("Users Field"); ``` -------------------------------- ### Manage Jira Workflow Schemes (CRUD) Source: https://github.com/panoramicdata/jira.api/blob/main/README.md Provides full CRUD operations for Jira workflow schemes, including retrieval, creation, update, and deletion. ```csharp // Get all workflow schemes (paginated) var schemes = await jiraClient.WorkflowSchemes.GetWorkflowSchemesAsync(startAt: 0, maxResults: 50); // Get a workflow scheme by ID var scheme = await jiraClient.WorkflowSchemes.GetWorkflowSchemeAsync("10001"); // Get the workflow scheme for a project var projectScheme = await jiraClient.WorkflowSchemes.GetWorkflowSchemeForProjectAsync("PROJ"); // Create a new workflow scheme var newScheme = await jiraClient.WorkflowSchemes.CreateWorkflowSchemeAsync( name: "My Workflow Scheme", description: "A custom workflow scheme", defaultWorkflow: "jira"); // Update a workflow scheme var updatedScheme = await jiraClient.WorkflowSchemes.UpdateWorkflowSchemeAsync( schemeId: "10001", name: "Updated Name", description: "Updated description"); // Delete a workflow scheme await jiraClient.WorkflowSchemes.DeleteWorkflowSchemeAsync("10001"); ``` -------------------------------- ### Register Built-in Sprint Serializer Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-use-custom-fields.md Shows how to switch to a different serializer for the sprint custom field if the format has changed in newer Jira versions. This involves assigning a new serializer instance to the specific sprint key. ```csharp var settings = new JiraRestClientSettings(); settings.CustomFieldSerializers["com.pyxis.greenhopper.jira:gh-sprint"] = new new GreenhopperSprintJsonCustomFieldValueSerialiser(); var jira = new Jira("url", "user", "password", settings); ``` -------------------------------- ### Update an Existing Jira Issue Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-use-the-sdk.md Demonstrates how to retrieve an existing issue by its key and update its summary. The changes are persisted by calling SaveChangesAsync. ```csharp var issue = await jira.Issues.GetIssueAsync("TST-5"); issue.Summary = "Updated Summary"; await issue.SaveChangesAsync(); ``` -------------------------------- ### Enable Request Tracing in Jira API SDK Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-debug-problems.md Enable request tracing by setting `EnableRequestTrace` to `true` in `JiraRestClientSettings`. This will log all requests and responses sent to the Jira server. ```csharp var settings = new JiraRestClientSettings("MyApp/1.0") { EnableRequestTrace = true }; var jira = JiraClient.CreateRestClient("", "", "", settings); ``` -------------------------------- ### Clean Docker Containers Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-run-the-integration-tests.md Stops and removes the Docker containers and associated volumes launched for the integration tests. ```bash $ docker-compose down -v ``` -------------------------------- ### Workflow Management Source: https://github.com/panoramicdata/jira.api/blob/main/README.md Provides methods to retrieve all available workflows or a specific workflow by its name. ```APIDOC ## Workflow Management ### Description Manages workflows within Jira. You can retrieve a list of all workflows or fetch a specific workflow by its name. ### Method `GET` (Implied by `GetWorkflowsAsync` and `GetWorkflowAsync`) ### Endpoint `/workflows` (Implied for all workflows) `/workflows/{name}` (Implied for specific workflow) ### Parameters #### Query Parameters (for GetWorkflowsAsync - Implied) - **None explicitly mentioned** #### Path Parameters (for GetWorkflowAsync) - **name** (string) - Required - The name of the workflow to retrieve. ### Request Example ```csharp // Get all workflows var workflows = await jiraClient.Workflows.GetWorkflowsAsync(); // Get a specific workflow by name var workflow = await jiraClient.Workflows.GetWorkflowAsync("My Workflow"); ``` ### Response #### Success Response (200) - **workflows** (List) - A list of all workflows. - **workflow** (Workflow) - The details of the requested workflow. #### Response Example ```json { "id": "12345", "name": "My Workflow", "description": "Default Jira workflow" } ``` ``` -------------------------------- ### Search Issues Source: https://github.com/panoramicdata/jira.api/blob/main/Jira.Api.Test.Integration/Trace_CustomFieldArrayOfObjects.txt Allows searching for issues within Jira based on various criteria. The response includes expanded details for each issue. ```APIDOC ## POST rest/api/2/search ### Description Searches for issues in Jira. The response can be expanded to include schema and names, and detailed issue information. ### Method POST ### Endpoint rest/api/2/search ### Parameters #### Query Parameters - **expand** (string) - Optional - Comma-separated list of fields to expand in the response (e.g., "schema,names"). #### Request Body (The request body is not explicitly defined in the source, but the example shows a JSON object with potential fields for search criteria.) ### Request Example ```json { "expand": "schema,names", "issues": [ { "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields", "fields": { "aggregateprogress": {"progress": 0, "total": 0}, "aggregatetimeestimate": null, "aggregatetimeoriginalestimate": null, "aggregatetimespent": null, "assignee": {"key": "testUser", "name": "testUser"}, "components": [], "created": "2018-01-11T14:33:15.000+0100", "creator": {"key": "testUser", "name": "testUser"}, "customfield_10260": [{"key": "testUser", "name": "testUser"}], "description": "Test description", "duedate": null, "environment": null, "fixVersions": [], "issuelinks": [], "issuetype": {"id": "14700", "name": "Promotion"}, "labels": [], "lastViewed": null, "priority": {"id": "4", "name": "Minor"}, "progress": {"progress": 0, "total": 0}, "project": {"id": "21800", "key": "TST", "name": "TEST Project"}, "reporter": {"key": "testUser", "name": "testUser"}, "resolution": null, "resolutiondate": null, "status": {"id": "3", "name": "In Progress"}, "subtasks": [], "summary": "Test Summary", "timeestimate": null, "timeoriginalestimate": null, "timespent": null, "updated": "2018-01-11T15:26:24.000+0100", "versions": [], "votes": {"votes": 0}, "watches": {"watchCount": 1}, "workratio": -1 }, "id": "1111644", "key": "TST-1" } ], "maxResults": 20, "startAt": 0, "total": 5 } ``` ### Response #### Success Response (200) - **expand** (string) - Indicates which fields were expanded. - **issues** (array) - A list of issues matching the search criteria. - **maxResults** (integer) - The maximum number of issues returned. - **startAt** (integer) - The starting index of the issues returned. - **total** (integer) - The total number of issues found. #### Response Example ```json { "expand": "schema,names", "issues": [ { "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields", "fields": { "aggregateprogress": {"progress": 0, "total": 0}, "aggregatetimeestimate": null, "aggregatetimeoriginalestimate": null, "aggregatetimespent": null, "assignee": {"key": "testUser", "name": "testUser"}, "components": [], "created": "2018-01-11T14:33:15.000+0100", "creator": {"key": "testUser", "name": "testUser"}, "customfield_10260": [{"key": "testUser", "name": "testUser"}], "description": "Test description", "duedate": null, "environment": null, "fixVersions": [], "issuelinks": [], "issuetype": {"id": "14700", "name": "Promotion"}, "labels": [], "lastViewed": null, "priority": {"id": "4", "name": "Minor"}, "progress": {"progress": 0, "total": 0}, "project": {"id": "21800", "key": "TST", "name": "TEST Project"}, "reporter": {"key": "testUser", "name": "testUser"}, "resolution": null, "resolutiondate": null, "status": {"id": "3", "name": "In Progress"}, "subtasks": [], "summary": "Test Summary", "timeestimate": null, "timeoriginalestimate": null, "timespent": null, "updated": "2018-01-11T15:26:24.000+0100", "versions": [], "votes": {"votes": 0}, "watches": {"watchCount": 1}, "workratio": -1 }, "id": "1111644", "key": "TST-1" } ], "maxResults": 20, "startAt": 0, "total": 5 } ``` ``` -------------------------------- ### Fetch Non-Typed Field as JToken Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-configure-issue-fields-to-fetch.md Retrieve a non-typed field directly as a `JToken` by specifying its name in `AdditionalFields` and setting `FetchBasicFields = false`. ```csharp var options = new IssueSearchOptions($"key = {issue.Key.Value}") { FetchBasicFields = false, AdditionalFields = new List() { "some-field" } }; var issues = await jira.Issues.GetIssuesFromJqlAsync(options); issues.First().AdditionalFields.TryGetValue("some-field", out JToken value); ``` -------------------------------- ### Enable User Privacy Mode in Jira Client Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-handle-gdpr-changes.md Configure the Jira REST client to enable user privacy mode. This is necessary for GDPR compliance when interacting with Jira Cloud APIs that have changed their user privacy policies. ```csharp var settings = new JiraRestClientSettings("MyApp/1.0") { EnableUserPrivacyMode = true }; var jira = JiraClient.CreateRestClient("jira-url", "username", "api-token", settings); ``` -------------------------------- ### Discover Custom Field Type from API Response Source: https://github.com/panoramicdata/jira.api/blob/main/docs/how-to-use-custom-fields.md Illustrates how to find the custom field type by inspecting the metadata returned from the Jira API's '/rest/api/2/field' endpoint. The 'schema.custom' property indicates the type. ```json [GET] Response for Url: rest/api/2/field [ ... { "clauseNames": [ "cf[10311]", "Custom Url Field" ], "custom": true, "id": "customfield_10311", "key": "customfield_10311", "name": "Custom Url Field", "navigable": true, "orderable": true, "schema": { "custom": "com.atlassian.jira.plugin.system.customfieldtypes:url", <-- CUSTOM FIELD TYPE "customId": 10311, "type": "string" }, "searchable": true } ... ] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.