Add createTickets path and tests#3
Conversation
- JobStatusObject - JobStatusObjectResult - JobStatusResponse feat: add tests for createTickets path.
Jonathan-Zollinger
left a comment
There was a problem hiding this comment.
Great PR! Some changes on testing syntax, naming and docs.
Great Work!
| * @return Create many tickets (status code 200) | ||
| */ | ||
| @Post("/api/v2/tickets/create_many") | ||
| Mono<@Valid JobStatusResponse> createTickets(@Body @Nullable @Valid TicketsCreateRequest ticketsCreateRequest); |
There was a problem hiding this comment.
| Mono<@Valid JobStatusResponse> createTickets(@Body @Nullable @Valid TicketsCreateRequest ticketsCreateRequest); | |
| Mono<@Valid JobStatusResponse> createManyTickets(@Body @Nullable @Valid TicketsCreateRequest ticketsCreateRequest); |
|
|
||
| /** | ||
| * {@summary Create Many Tickets} | ||
| * <p>Accepts an array of up to 100 ticket objects. <strong>Note</strong>: Every ticket created with this endpoint may be affected by your business rules, which can include sending email notifications to your end users. If you are importing historical tickets or creating more than 1000 tickets, consider using the <a href=\"/api-reference/ticketing/tickets/ticket_import/#ticket-bulk-import\">Ticket Bulk Import</a> endpoint.</p> <p>This endpoint returns a <code>job_status</code> <a href=\"/api-reference/ticketing/ticket-management/job_statuses/#json-format\">JSON object</a> and queues a background job to do the work. Use the <a href=\"/api-reference/ticketing/ticket-management/job_statuses/#show-job-status\">Show Job Status</a> endpoint to check for the job's completion. Only a certain number of jobs can be queued or running at the same time. See <a href=\"/api-reference/introduction/rate-limits/#job-limit\">Job limit</a> for more information.</p> <h4 id=\"allowed-for\">Allowed For</h4> <ul> <li>Agents</li> </ul> |
There was a problem hiding this comment.
| * <p>Accepts an array of up to 100 ticket objects. <strong>Note</strong>: Every ticket created with this endpoint may be affected by your business rules, which can include sending email notifications to your end users. If you are importing historical tickets or creating more than 1000 tickets, consider using the <a href=\"/api-reference/ticketing/tickets/ticket_import/#ticket-bulk-import\">Ticket Bulk Import</a> endpoint.</p> <p>This endpoint returns a <code>job_status</code> <a href=\"/api-reference/ticketing/ticket-management/job_statuses/#json-format\">JSON object</a> and queues a background job to do the work. Use the <a href=\"/api-reference/ticketing/ticket-management/job_statuses/#show-job-status\">Show Job Status</a> endpoint to check for the job's completion. Only a certain number of jobs can be queued or running at the same time. See <a href=\"/api-reference/introduction/rate-limits/#job-limit\">Job limit</a> for more information.</p> <h4 id=\"allowed-for\">Allowed For</h4> <ul> <li>Agents</li> </ul> | |
| * <h1>{@summary Create Many Tickets}</h1> | |
| * Accepts an array of up to 100 ticket objects. | |
| * Every ticket created with this endpoint may be affected by your business rules, which can include sending email notifications to your end users. | |
| * <blockquote>NOTE: This endpoint starts a background job on the zendesk server. The returned object reports on this background job's status.</blockquote> | |
| * <h4 id="allowed-for">Allowed For Agents</h4> |
| @Accessors(chain = true) | ||
| @NoArgsConstructor | ||
| @AllArgsConstructor | ||
| @Data |
There was a problem hiding this comment.
good use of @Data instead of the generator's usage of both a getter and setter annotation!
There was a problem hiding this comment.
This should be titled "JobStatus" and not "JobStatusObject"
There was a problem hiding this comment.
should not contain "Object" in the title
| @Nullable | ||
| @JsonProperty(JSON_PROPERTY_STATUS) | ||
| @JsonInclude(JsonInclude.Include.USE_DEFAULTS) | ||
| private String status; |
There was a problem hiding this comment.
Use an enum here for "queued", "working", "failed" and "completed". Update the javadocs to point to the enum options.
you could honestly just copy src/main/java/lol/pbu/z4j/model/SortBy.java and swap out the enum constants.
| List<TicketCreateInput> ticketCreateInputList = new ArrayList<>() | ||
| for (int i = 0; i < 100; i++) { | ||
| TicketComment ticketComment = new TicketComment().setBody(faker.chuckNorris().fact()) | ||
| TicketCreateInput createTicketInput = new TicketCreateInput(ticketComment) | ||
| createTicketInput.setRawSubject(faker.chuckNorris().fact()) | ||
| ticketCreateInputList.add(createTicketInput) | ||
| } | ||
| TicketsCreateRequest createTicketsRequest = new TicketsCreateRequest(ticketCreateInputList) |
There was a problem hiding this comment.
Originally I was thinking to not try to make so many tickets, but I like this. let's keep it, but let's use some groovy syntactic sugar
| List<TicketCreateInput> ticketCreateInputList = new ArrayList<>() | |
| for (int i = 0; i < 100; i++) { | |
| TicketComment ticketComment = new TicketComment().setBody(faker.chuckNorris().fact()) | |
| TicketCreateInput createTicketInput = new TicketCreateInput(ticketComment) | |
| createTicketInput.setRawSubject(faker.chuckNorris().fact()) | |
| ticketCreateInputList.add(createTicketInput) | |
| } | |
| TicketsCreateRequest createTicketsRequest = new TicketsCreateRequest(ticketCreateInputList) | |
| List<TicketCreateInput> inputs = (1..100).collect { | |
| new TicketCreateInput(new TicketComment().setBody(faker.chuckNorris().fact())) | |
| .setRawSubject(faker.book().title()) | |
| } | |
| TicketsCreateRequest createTicketsRequest = new TicketsCreateRequest().setTickets(inputs) |
| [client, clientType, ignored, alsoIgnored] << clientTestMatrix.findAll { !it.shouldSucceed } | ||
| } | ||
|
|
||
| def "calling createTickets() fails when trying to create more than the maximum amount(100) of tickets, even when using the correct client"(TicketClient client, String clientType, Boolean ignored, String alsoIgnored) { |
There was a problem hiding this comment.
great test - see my comment on the last test, otherwise this is great
- JobStatusObject - JobStatusObjectResult - JobStatusResponse feat: add tests for createTickets path.
refactor: change "status" property in JobStatus class from String to JobStatusEnum type.
|



feat: add path for createTickets. As well as associated objects.
feat: add tests for createTickets path.