Class CreateProfileFieldApiRequest
java.lang.Object
com.github.jamesnetherton.zulip.client.api.core.ZulipApiRequest
com.github.jamesnetherton.zulip.client.api.server.request.CreateProfileFieldApiRequest
- All Implemented Interfaces:
ExecutableApiRequest<Long>
public class CreateProfileFieldApiRequest
extends ZulipApiRequest
implements ExecutableApiRequest<Long>
Zulip API request builder for creating a custom profile field.
This endpoint is only available to organization administrators.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexecute()
Executes the Zulip API request for creating a custom profile field.withDisplayInProfileSummary
(boolean isDisplayInProfileSummary) Sets whether clients should display this profile field in a summary section of a users profile.withEditableByUser
(boolean editableByUser) Sets whether regular users can edit the profile field on their own account.Creates a external account filed type.Creates a list of options profile field.withRequired
(boolean required) Sets whether the profile field is required.withSimpleFieldType
(ProfileFieldType type, String name, String hint) Creates a simple profile field determined by the providedProfileFieldType
.Methods inherited from class com.github.jamesnetherton.zulip.client.api.core.ZulipApiRequest
client, getParam, getParams, putParam, putParamAsJsonString, putParamAsWrappedObject
-
Field Details
-
NAME
- See Also:
-
HINT
- See Also:
-
FIELD_TYPE
- See Also:
-
FIELD_DATA
- See Also:
-
DISPLAY_IN_PROFILE_SUMMARY
- See Also:
-
REQUIRED
- See Also:
-
EDITABLE_BY_USER
- See Also:
-
-
Constructor Details
-
CreateProfileFieldApiRequest
Constructs aCreateProfileFieldApiRequest
.- Parameters:
client
- The Zulip HTTP client
-
-
Method Details
-
withSimpleFieldType
public CreateProfileFieldApiRequest withSimpleFieldType(ProfileFieldType type, String name, String hint) Creates a simple profile field determined by the providedProfileFieldType
.- Parameters:
type
- The field type to createname
- The name of the profile fieldhint
- The help text displayed against the custom field in the Zulip UI- Returns:
- This
CreateProfileFieldApiRequest
instance
-
withListOfOptionsFieldType
public CreateProfileFieldApiRequest withListOfOptionsFieldType(String name, String hint, Map<String, Map<String, String>> data) Creates a list of options profile field.- Parameters:
name
- The name of the profile fieldhint
- The help text displayed against the custom field in the Zulip UIdata
- The map that determines the available list options and their orderMap<String, Map<String, String>> options = new LinkedHashMap<>(); Map<String, String> option = new LinkedHashMap<>(); option.put("text", "Test Field"); option.put("order", "1"); options.put("test", option);
- Returns:
- This
CreateProfileFieldApiRequest
instance
-
withExternalAccountFieldType
Creates a external account filed type. Zulip labels this field structure for this field type as not being stable, so this API is best avoided unless you know what you are doing.- Parameters:
data
- The mao that determines the external account type configurationMap<String, String> externalData = new LinkedHashMap<>(); externalData.put("subtype", "github");
- Returns:
- This
CreateProfileFieldApiRequest
instance
-
withDisplayInProfileSummary
Sets whether clients should display this profile field in a summary section of a users profile.- Parameters:
isDisplayInProfileSummary
- Whether clients should display this profile field in a summary section of a users profile- Returns:
- This
CreateProfileFieldApiRequest
instance
-
withRequired
Sets whether the profile field is required.- Parameters:
required
- Whether the profile field is required- Returns:
- This
CreateProfileFieldApiRequest
instance
-
withEditableByUser
Sets whether regular users can edit the profile field on their own account.- Parameters:
editableByUser
- Whether regular users can edit the profile field on their own account- Returns:
- This
CreateProfileFieldApiRequest
instance
-
execute
Executes the Zulip API request for creating a custom profile field.- Specified by:
execute
in interfaceExecutableApiRequest<Long>
- Returns:
- The id of the created profile field
- Throws:
ZulipClientException
- if the request was not successful
-