-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Description Markdown #40
Comments
any news here? |
Hi @cfreak, sorry for the late reply. This library only supports REST API v3, and your code is V2 based code. You can use this sample to create an issue with the Atlassian Document format. <?php
require 'vendor/autoload.php';
use JiraCloud\Issue\IssueService;
use JiraCloud\Issue\IssueField;
use JiraCloud\JiraException;
use DH\Adf\Node\Block\Document;
use JiraCloud\ADF\AtlassianDocumentFormat;
try {
$issueField = new IssueField();
$code =<<<CODE
<?php
\$i = 123;
\$a = ['hello', 'world', ];
var_dump([\$i => \$a]);
CODE;
$doc = (new Document())
->heading(1) // header level 1, can have child blocks (needs to be closed with `->end()`)
->text('h1') // simple unstyled text, cannot have child blocks (no `->end()` needed)
->end() // closes `heading` node
->paragraph() // paragraph, can have child blocks (needs to be closed with `->end()`)
->text('we’re ') // simple unstyled text
->strong('support') // text node embedding a `strong` mark
->text(' ') // simple unstyled text
->em('markdown') // text node embedding a `em` mark
->text('. ') // simple unstyled text
->underline('like') // text node embedding a `underline` mark
->text(' this.') // simple unstyled text
->end() // closes `paragraph` node
->heading(2) // header level 2
->text('h2') // simple unstyled text
->end() // closes `heading` node
->heading(3)
->text('heading 3')
->end()
->paragraph() // paragraph
->text('also support heading.') // simple unstyled text
->end() // closes `paragraph` node
->codeblock('php')
->text($code)
->end()
;
$descV3 = new AtlassianDocumentFormat($doc);
$issueField->setProjectKey('TEST')
->setSummary('something\'s wrong')
->setAssigneeNameAsString('lesstif')
->setPriorityNameAsString('Highest')
->setIssueTypeAsString('Story')
->setDescription($descV3)
->addVersionAsString('1.0.1')
->addVersionAsArray(['1.0.2', '1.0.3'])
->addComponentsAsArray(['Component-1', 'Component-2'])
// set issue security if you need.
->setSecurityId(10001 /* security scheme id */)
->setDueDateAsString('2023-06-19')
// or you can use DateTimeInterface
//->setDueDateAsDateTime(
// (new DateTime('NOW'))->add(DateInterval::createFromDateString('1 month 5 day'))
// )
;
$issueService = new IssueService();
$ret = $issueService->create($issueField);
//If success, Returns a link to the created issue.
var_dump($ret);
} catch (JiraCloud\JiraException $e) {
print('Error Occurred! ' . $e->getMessage());
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey guys,
i have tried to post a markdown as description for a issue.
the example in the docs is not working, because the class DescriptionV3() and the method setDescriptionV3 do not exist.
Can you please correct the docs and help me to get it working?
The text was updated successfully, but these errors were encountered: