All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.netflix.spinnaker.echo.jira.JiraService Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2018 Netflix, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.netflix.spinnaker.echo.jira;

import com.netflix.spinnaker.echo.controller.EchoResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import retrofit.client.Response;
import retrofit.http.Body;
import retrofit.http.GET;
import retrofit.http.POST;
import retrofit.http.Path;

public interface JiraService {
  @POST("/rest/api/2/issue/")
  CreateIssueResponse createIssue(@Body CreateIssueRequest createIssueRequest);

  @GET("/rest/api/2/issue/{issueIdOrKey}/transitions")
  IssueTransitions getIssueTransitions(@Path("issueIdOrKey") String issueIdOrKey);

  @POST("/rest/api/2/issue/{issueIdOrKey}/transitions")
  Response transitionIssue(
      @Path("issueIdOrKey") String issueIdOrKey,
      @Body TransitionIssueRequest transitionIssueRequest);

  @POST("/rest/api/2/issue/{issueIdOrKey}/comment")
  Response addComment(
      @Path("issueIdOrKey") String issueIdOrKey, @Body CommentIssueRequest commentIssueRequest);

  class CreateIssueRequest extends HashMap {
    CreateIssueRequest(Map body) {
      super(body);
    }
  }

  class TransitionIssueRequest extends HashMap {
    TransitionIssueRequest(Map body) {
      super(body);
    }
  }

  class CommentIssueRequest {
    private String body;

    CommentIssueRequest(String body) {
      this.body = body;
    }

    public String getBody() {
      return body;
    }

    public void setBody(String body) {
      this.body = body;
    }
  }

  class IssueTransitions {
    private List transitions;

    public List getTransitions() {
      return transitions;
    }

    public void setTransitions(List transitions) {
      this.transitions = transitions;
    }

    public static class Transition {
      private String id;
      private String name;

      public String getId() {
        return id;
      }

      public void setId(String id) {
        this.id = id;
      }

      public String getName() {
        return name;
      }

      public void setName(String name) {
        this.name = name;
      }
    }
  }

  class CreateIssueResponse implements EchoResponse.EchoResult {
    private String id;
    private String key;
    private String self;

    public String getId() {
      return id;
    }

    public void setId(String id) {
      this.id = id;
    }

    public String getKey() {
      return key;
    }

    public void setKey(String key) {
      this.key = key;
    }

    public String getSelf() {
      return self;
    }

    public void setSelf(String self) {
      this.self = self;
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy