Skip to content

Commit 8deffb3

Browse files
committed
Added createVariable() and updateVariable() methods without the environmentScope param (#330).
1 parent 04561b0 commit 8deffb3

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

src/main/java/org/gitlab4j/api/ProjectApi.java

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2494,6 +2494,24 @@ public Optional<Variable> getOptionalVariable(Object projectIdOrPath, String key
24942494
* @param key the key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed, required
24952495
* @param value the value for the variable, required
24962496
* @param isProtected whether the variable is protected, optional
2497+
* @return a Variable instance with the newly created variable
2498+
* @throws GitLabApiException if any exception occurs during execution
2499+
*/
2500+
public Variable createVariable(Object projectIdOrPath, String key, String value, Boolean isProtected) throws GitLabApiException {
2501+
return (createVariable(projectIdOrPath, key, value, isProtected, null));
2502+
}
2503+
2504+
/**
2505+
* Create a new project variable.
2506+
*
2507+
* <p>NOTE: Setting the environmentScope is only available on GitLab EE.</p>
2508+
*
2509+
* <pre><code>GitLab Endpoint: POST /projects/:id/variables</code></pre>
2510+
*
2511+
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
2512+
* @param key the key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed, required
2513+
* @param value the value for the variable, required
2514+
* @param isProtected whether the variable is protected, optional
24972515
* @param environmentScope the environment_scope of the variable, optional
24982516
* @return a Variable instance with the newly created variable
24992517
* @throws GitLabApiException if any exception occurs during execution
@@ -2518,7 +2536,25 @@ public Variable createVariable(Object projectIdOrPath, String key, String value,
25182536
* @param key the key of an existing variable, required
25192537
* @param value the value for the variable, required
25202538
* @param isProtected whether the variable is protected, optional
2521-
* @param environmentScope the environment_scope of the variable, optional
2539+
* @return a Variable instance with the updated variable
2540+
* @throws GitLabApiException if any exception occurs during execution
2541+
*/
2542+
public Variable updateVariable(Object projectIdOrPath, String key, String value, Boolean isProtected) throws GitLabApiException {
2543+
return (updateVariable(projectIdOrPath, key, value, isProtected, null));
2544+
}
2545+
2546+
/**
2547+
* Update a project variable.
2548+
*
2549+
* <p>NOTE: Updating the environmentScope is only available on GitLab EE.</p>
2550+
*
2551+
* <pre><code>GitLab Endpoint: PUT /projects/:id/variables/:key</code></pre>
2552+
*
2553+
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
2554+
* @param key the key of an existing variable, required
2555+
* @param value the value for the variable, required
2556+
* @param isProtected whether the variable is protected, optional
2557+
* @param environmentScope the environment_scope of the variable, optional.
25222558
* @return a Variable instance with the updated variable
25232559
* @throws GitLabApiException if any exception occurs during execution
25242560
*/

0 commit comments

Comments
 (0)