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

org.kohsuke.github.GHMemberChanges Maven / Gradle / Ivy

There is a newer version: 2.0.0-alpha-2
Show newest version
package org.kohsuke.github;

import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.kohsuke.github.internal.EnumUtils;

/**
 * Changes made to a team.
 */
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_FIELD" }, justification = "JSON API")
public class GHMemberChanges {

    /**
     * Create default GHMemberChanges instance
     */
    public GHMemberChanges() {
    }

    private FromToPermission permission;

    private FromRoleName roleName;

    /**
     * Get changes to permission.
     *
     * @return changes to permission
     */
    public FromToPermission getPermission() {
        return permission;
    }

    /**
     * Get changes to the role name.
     * 

* Apparently, it is recommended to use this rather than permission if defined. But it will only be defined when * adding and not when editing. * * @return changes to role name */ public FromRoleName getRoleName() { return roleName; } /** * Changes to permission. */ public static class FromToPermission { /** * Create default FromToPermission instance */ public FromToPermission() { } private String from; private String to; /** * Gets the from. * * @return the from */ @WithBridgeMethods(value = GHOrganization.Permission.class, adapterMethod = "stringToOrgPermission") public String getFrom() { return from; } /** * Gets the to. * * @return the to */ @WithBridgeMethods(value = GHOrganization.Permission.class, adapterMethod = "stringToOrgPermission") public String getTo() { return to; } @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD", justification = "Bridge method of getFrom and getTo") private Object stringToOrgPermission(String permissionType, Class type) { switch (permissionType) { case "admin" : return GHOrganization.Permission.ADMIN; case "none" : return GHOrganization.Permission.UNKNOWN; case "read" : return GHOrganization.Permission.PULL; case "write" : return GHOrganization.Permission.PUSH; default : return EnumUtils.getNullableEnumOrDefault(GHPermissionType.class, to, GHPermissionType.UNKNOWN); } } } /** * Changes to role name. */ public static class FromRoleName { /** * Create default FromRoleName instance */ public FromRoleName() { } private String to; /** * Gets the to. * * @return the to */ public String getTo() { return to; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy