idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
34,700
public String getPreviousPageUrl ( String domain , String region ) { if ( previousPageUrl != null ) { return previousPageUrl ; } return urlFromUri ( domain , region , previousPageUri ) ; }
Generate previous page url for a list result .
34,701
public String getUrl ( String domain , String region ) { if ( url != null ) { return url ; } return urlFromUri ( domain , region , uri ) ; }
Generate page url for a list result .
34,702
public static < T > Page < T > fromJson ( String recordKey , String json , Class < T > recordType , ObjectMapper mapper ) { try { List < T > results = new ArrayList < > ( ) ; JsonNode root = mapper . readTree ( json ) ; JsonNode records = root . get ( recordKey ) ; for ( final JsonNode record : records ) { results . add ( mapper . readValue ( record . toString ( ) , recordType ) ) ; } JsonNode uriNode = root . get ( "uri" ) ; if ( uriNode != null ) { return buildPage ( root , results ) ; } else { return buildNextGenPage ( root , results ) ; } } catch ( final IOException e ) { throw new ApiConnectionException ( "Unable to deserialize response: " + e . getMessage ( ) + "\nJSON: " + json , e ) ; } }
Create a new page of data from a json blob .
34,703
public static SyncListItemFetcher fetcher ( final String pathServiceSid , final String pathListSid , final Integer pathIndex ) { return new SyncListItemFetcher ( pathServiceSid , pathListSid , pathIndex ) ; }
Create a SyncListItemFetcher to execute fetch .
34,704
public static SyncListItemDeleter deleter ( final String pathServiceSid , final String pathListSid , final Integer pathIndex ) { return new SyncListItemDeleter ( pathServiceSid , pathListSid , pathIndex ) ; }
Create a SyncListItemDeleter to execute delete .
34,705
public static SyncListItemCreator creator ( final String pathServiceSid , final String pathListSid , final Map < String , Object > data ) { return new SyncListItemCreator ( pathServiceSid , pathListSid , data ) ; }
Create a SyncListItemCreator to execute create .
34,706
public String getAuthString ( ) { String credentials = this . username + ":" + this . password ; try { String encoded = new Base64 ( ) . encodeAsString ( credentials . getBytes ( "ascii" ) ) ; return "Basic " + encoded ; } catch ( final UnsupportedEncodingException e ) { throw new InvalidRequestException ( "It must be possible to encode credentials as ascii" , credentials , e ) ; } }
Create auth string from username and password .
34,707
@ SuppressWarnings ( "checkstyle:abbreviationaswordinname" ) public URL constructURL ( ) { String params = encodeQueryParams ( ) ; String stringUri = url ; if ( params . length ( ) > 0 ) { stringUri += "?" + params ; } try { URI uri = new URI ( stringUri ) ; return uri . toURL ( ) ; } catch ( final URISyntaxException e ) { throw new ApiException ( "Bad URI: " + stringUri , e ) ; } catch ( final MalformedURLException e ) { throw new ApiException ( "Bad URL: " + stringUri , e ) ; } }
Build the URL for the request .
34,708
public static < T > List < T > listOfOne ( final T one ) { List < T > list = new ArrayList < > ( ) ; list . add ( one ) ; return list ; }
Create a list from a single element .
34,709
public static < T extends Enum < ? > > T enumFromString ( final String value , final T [ ] values ) { if ( value == null ) { return null ; } for ( T v : values ) { if ( v . toString ( ) . equalsIgnoreCase ( value ) ) { return v ; } } return null ; }
Convert a string to a enum type .
34,710
public static ExecutionStepFetcher fetcher ( final String pathFlowSid , final String pathExecutionSid , final String pathSid ) { return new ExecutionStepFetcher ( pathFlowSid , pathExecutionSid , pathSid ) ; }
Create a ExecutionStepFetcher to execute fetch .
34,711
public SessionUpdater setParticipants ( final Map < String , Object > participants ) { return setParticipants ( Promoter . listOfOne ( participants ) ) ; }
The Participant objects to include in the session ..
34,712
public static AuthCallsIpAccessControlListMappingCreator creator ( final String pathAccountSid , final String pathDomainSid , final String ipAccessControlListSid ) { return new AuthCallsIpAccessControlListMappingCreator ( pathAccountSid , pathDomainSid , ipAccessControlListSid ) ; }
Create a AuthCallsIpAccessControlListMappingCreator to execute create .
34,713
public static AuthCallsIpAccessControlListMappingFetcher fetcher ( final String pathAccountSid , final String pathDomainSid , final String pathSid ) { return new AuthCallsIpAccessControlListMappingFetcher ( pathAccountSid , pathDomainSid , pathSid ) ; }
Create a AuthCallsIpAccessControlListMappingFetcher to execute fetch .
34,714
public static AuthCallsIpAccessControlListMappingDeleter deleter ( final String pathAccountSid , final String pathDomainSid , final String pathSid ) { return new AuthCallsIpAccessControlListMappingDeleter ( pathAccountSid , pathDomainSid , pathSid ) ; }
Create a AuthCallsIpAccessControlListMappingDeleter to execute delete .
34,715
public static DocumentPermissionFetcher fetcher ( final String pathServiceSid , final String pathDocumentSid , final String pathIdentity ) { return new DocumentPermissionFetcher ( pathServiceSid , pathDocumentSid , pathIdentity ) ; }
Create a DocumentPermissionFetcher to execute fetch .
34,716
public static DocumentPermissionDeleter deleter ( final String pathServiceSid , final String pathDocumentSid , final String pathIdentity ) { return new DocumentPermissionDeleter ( pathServiceSid , pathDocumentSid , pathIdentity ) ; }
Create a DocumentPermissionDeleter to execute delete .
34,717
public static DocumentPermissionUpdater updater ( final String pathServiceSid , final String pathDocumentSid , final String pathIdentity , final Boolean read , final Boolean write , final Boolean manage ) { return new DocumentPermissionUpdater ( pathServiceSid , pathDocumentSid , pathIdentity , read , write , manage ) ; }
Create a DocumentPermissionUpdater to execute update .
34,718
public static FieldFetcher fetcher ( final String pathAssistantSid , final String pathTaskSid , final String pathSid ) { return new FieldFetcher ( pathAssistantSid , pathTaskSid , pathSid ) ; }
Create a FieldFetcher to execute fetch .
34,719
public static FieldCreator creator ( final String pathAssistantSid , final String pathTaskSid , final String fieldType , final String uniqueName ) { return new FieldCreator ( pathAssistantSid , pathTaskSid , fieldType , uniqueName ) ; }
Create a FieldCreator to execute create .
34,720
public static FieldDeleter deleter ( final String pathAssistantSid , final String pathTaskSid , final String pathSid ) { return new FieldDeleter ( pathAssistantSid , pathTaskSid , pathSid ) ; }
Create a FieldDeleter to execute delete .
34,721
public static AuthRegistrationsCredentialListMappingCreator creator ( final String pathAccountSid , final String pathDomainSid , final String credentialListSid ) { return new AuthRegistrationsCredentialListMappingCreator ( pathAccountSid , pathDomainSid , credentialListSid ) ; }
Create a AuthRegistrationsCredentialListMappingCreator to execute create .
34,722
public static AuthRegistrationsCredentialListMappingFetcher fetcher ( final String pathAccountSid , final String pathDomainSid , final String pathSid ) { return new AuthRegistrationsCredentialListMappingFetcher ( pathAccountSid , pathDomainSid , pathSid ) ; }
Create a AuthRegistrationsCredentialListMappingFetcher to execute fetch .
34,723
public static AuthRegistrationsCredentialListMappingDeleter deleter ( final String pathAccountSid , final String pathDomainSid , final String pathSid ) { return new AuthRegistrationsCredentialListMappingDeleter ( pathAccountSid , pathDomainSid , pathSid ) ; }
Create a AuthRegistrationsCredentialListMappingDeleter to execute delete .
34,724
public static StepFetcher fetcher ( final String pathFlowSid , final String pathEngagementSid , final String pathSid ) { return new StepFetcher ( pathFlowSid , pathEngagementSid , pathSid ) ; }
Create a StepFetcher to execute fetch .
34,725
private String getTransformedAttrName ( final String attrName ) { return attrNameMapper . containsKey ( attrName ) ? attrNameMapper . get ( attrName ) : attrName ; }
Get transformed attribute name for this Twiml element .
34,726
public String toXml ( ) throws TwiMLException { try { Document doc = DocumentBuilderFactory . newInstance ( ) . newDocumentBuilder ( ) . newDocument ( ) ; doc . setXmlStandalone ( true ) ; doc . appendChild ( this . buildXmlElement ( doc ) ) ; Transformer transformer = TransformerFactory . newInstance ( ) . newTransformer ( ) ; transformer . setOutputProperty ( OutputKeys . INDENT , "no" ) ; DOMSource source = new DOMSource ( doc ) ; StreamResult output = new StreamResult ( new StringWriter ( ) ) ; transformer . transform ( source , output ) ; return output . getWriter ( ) . toString ( ) . trim ( ) ; } catch ( TransformerException te ) { throw new TwiMLException ( "Exception serializing TwiML: " + te . getMessage ( ) ) ; } catch ( Exception e ) { throw new TwiMLException ( "Unhandled exception: " + e . getMessage ( ) ) ; } }
Convert TwiML object to XML .
34,727
public String toUrl ( ) throws TwiMLException { try { return URLEncoder . encode ( toXml ( ) , "UTF-8" ) ; } catch ( UnsupportedEncodingException e ) { throw new TwiMLException ( e . getMessage ( ) ) ; } }
Convert TwiML object to URL .
34,728
public static AssignedAddOnFetcher fetcher ( final String pathAccountSid , final String pathResourceSid , final String pathSid ) { return new AssignedAddOnFetcher ( pathAccountSid , pathResourceSid , pathSid ) ; }
Create a AssignedAddOnFetcher to execute fetch .
34,729
public static AssignedAddOnCreator creator ( final String pathAccountSid , final String pathResourceSid , final String installedAddOnSid ) { return new AssignedAddOnCreator ( pathAccountSid , pathResourceSid , installedAddOnSid ) ; }
Create a AssignedAddOnCreator to execute create .
34,730
public static AssignedAddOnDeleter deleter ( final String pathAccountSid , final String pathResourceSid , final String pathSid ) { return new AssignedAddOnDeleter ( pathAccountSid , pathResourceSid , pathSid ) ; }
Create a AssignedAddOnDeleter to execute delete .
34,731
public static AssignedAddOnExtensionFetcher fetcher ( final String pathAccountSid , final String pathResourceSid , final String pathAssignedAddOnSid , final String pathSid ) { return new AssignedAddOnExtensionFetcher ( pathAccountSid , pathResourceSid , pathAssignedAddOnSid , pathSid ) ; }
Create a AssignedAddOnExtensionFetcher to execute fetch .
34,732
public static AssignedAddOnExtensionReader reader ( final String pathAccountSid , final String pathResourceSid , final String pathAssignedAddOnSid ) { return new AssignedAddOnExtensionReader ( pathAccountSid , pathResourceSid , pathAssignedAddOnSid ) ; }
Create a AssignedAddOnExtensionReader to execute read .
34,733
public static PayloadFetcher fetcher ( final String pathAccountSid , final String pathReferenceSid , final String pathAddOnResultSid , final String pathSid ) { return new PayloadFetcher ( pathAccountSid , pathReferenceSid , pathAddOnResultSid , pathSid ) ; }
Create a PayloadFetcher to execute fetch .
34,734
public static PayloadReader reader ( final String pathAccountSid , final String pathReferenceSid , final String pathAddOnResultSid ) { return new PayloadReader ( pathAccountSid , pathReferenceSid , pathAddOnResultSid ) ; }
Create a PayloadReader to execute read .
34,735
public static PayloadDeleter deleter ( final String pathAccountSid , final String pathReferenceSid , final String pathAddOnResultSid , final String pathSid ) { return new PayloadDeleter ( pathAccountSid , pathReferenceSid , pathAddOnResultSid , pathSid ) ; }
Create a PayloadDeleter to execute delete .
34,736
public static FeedbackCreator creator ( final String pathAccountSid , final String pathCallSid , final Integer qualityScore ) { return new FeedbackCreator ( pathAccountSid , pathCallSid , qualityScore ) ; }
Create a FeedbackCreator to execute create .
34,737
public static FeedbackUpdater updater ( final String pathAccountSid , final String pathCallSid , final Integer qualityScore ) { return new FeedbackUpdater ( pathAccountSid , pathCallSid , qualityScore ) ; }
Create a FeedbackUpdater to execute update .
34,738
public static InteractionFetcher fetcher ( final String pathServiceSid , final String pathSessionSid , final String pathSid ) { return new InteractionFetcher ( pathServiceSid , pathSessionSid , pathSid ) ; }
Create a InteractionFetcher to execute fetch .
34,739
public static InteractionDeleter deleter ( final String pathServiceSid , final String pathSessionSid , final String pathSid ) { return new InteractionDeleter ( pathServiceSid , pathSessionSid , pathSid ) ; }
Create a InteractionDeleter to execute delete .
34,740
public static IpAccessControlListUpdater updater ( final String pathAccountSid , final String pathSid , final String friendlyName ) { return new IpAccessControlListUpdater ( pathAccountSid , pathSid , friendlyName ) ; }
Create a IpAccessControlListUpdater to execute update .
34,741
public static VerificationCreator creator ( final String pathServiceSid , final String to , final String channel ) { return new VerificationCreator ( pathServiceSid , to , channel ) ; }
Create a VerificationCreator to execute create .
34,742
public static WorkflowCreator creator ( final String pathWorkspaceSid , final String friendlyName , final String configuration ) { return new WorkflowCreator ( pathWorkspaceSid , friendlyName , configuration ) ; }
Create a WorkflowCreator to execute create .
34,743
public static ParticipantUpdater updater ( final String pathAccountSid , final String pathConferenceSid , final String pathCallSid ) { return new ParticipantUpdater ( pathAccountSid , pathConferenceSid , pathCallSid ) ; }
Create a ParticipantUpdater to execute update .
34,744
public static IpAccessControlListMappingFetcher fetcher ( final String pathAccountSid , final String pathDomainSid , final String pathSid ) { return new IpAccessControlListMappingFetcher ( pathAccountSid , pathDomainSid , pathSid ) ; }
Create a IpAccessControlListMappingFetcher to execute fetch .
34,745
public static IpAccessControlListMappingCreator creator ( final String pathAccountSid , final String pathDomainSid , final String ipAccessControlListSid ) { return new IpAccessControlListMappingCreator ( pathAccountSid , pathDomainSid , ipAccessControlListSid ) ; }
Create a IpAccessControlListMappingCreator to execute create .
34,746
public static IpAccessControlListMappingDeleter deleter ( final String pathAccountSid , final String pathDomainSid , final String pathSid ) { return new IpAccessControlListMappingDeleter ( pathAccountSid , pathDomainSid , pathSid ) ; }
Create a IpAccessControlListMappingDeleter to execute delete .
34,747
public static FunctionVersionFetcher fetcher ( final String pathServiceSid , final String pathFunctionSid , final String pathSid ) { return new FunctionVersionFetcher ( pathServiceSid , pathFunctionSid , pathSid ) ; }
Create a FunctionVersionFetcher to execute fetch .
34,748
public static FunctionVersionCreator creator ( final String pathServiceSid , final String pathFunctionSid , final String path , final FunctionVersion . Visibility visibility ) { return new FunctionVersionCreator ( pathServiceSid , pathFunctionSid , path , visibility ) ; }
Create a FunctionVersionCreator to execute create .
34,749
public static RoleCreator creator ( final String pathServiceSid , final String friendlyName , final Role . RoleType type , final List < String > permission ) { return new RoleCreator ( pathServiceSid , friendlyName , type , permission ) ; }
Create a RoleCreator to execute create .
34,750
public static RoleUpdater updater ( final String pathServiceSid , final String pathSid , final List < String > permission ) { return new RoleUpdater ( pathServiceSid , pathSid , permission ) ; }
Create a RoleUpdater to execute update .
34,751
public static AuthorizationDocumentCreator creator ( final List < String > hostedNumberOrderSids , final String addressSid , final String email , final String contactTitle , final String contactPhoneNumber ) { return new AuthorizationDocumentCreator ( hostedNumberOrderSids , addressSid , email , contactTitle , contactPhoneNumber ) ; }
Create a AuthorizationDocumentCreator to execute create .
34,752
public static ExecutionStepContextFetcher fetcher ( final String pathFlowSid , final String pathExecutionSid , final String pathStepSid ) { return new ExecutionStepContextFetcher ( pathFlowSid , pathExecutionSid , pathStepSid ) ; }
Create a ExecutionStepContextFetcher to execute fetch .
34,753
public static TranscriptionFetcher fetcher ( final String pathAccountSid , final String pathRecordingSid , final String pathSid ) { return new TranscriptionFetcher ( pathAccountSid , pathRecordingSid , pathSid ) ; }
Create a TranscriptionFetcher to execute fetch .
34,754
public static TranscriptionDeleter deleter ( final String pathAccountSid , final String pathRecordingSid , final String pathSid ) { return new TranscriptionDeleter ( pathAccountSid , pathRecordingSid , pathSid ) ; }
Create a TranscriptionDeleter to execute delete .
34,755
public static VerificationUpdater updater ( final String pathServiceSid , final String pathSid , final Verification . Status status ) { return new VerificationUpdater ( pathServiceSid , pathSid , status ) ; }
Create a VerificationUpdater to execute update .
34,756
public static PublishedTrackFetcher fetcher ( final String pathRoomSid , final String pathParticipantSid , final String pathSid ) { return new PublishedTrackFetcher ( pathRoomSid , pathParticipantSid , pathSid ) ; }
Create a PublishedTrackFetcher to execute fetch .
34,757
public static void setUsername ( final String username ) { if ( username == null ) { throw new AuthenticationException ( "Username can not be null" ) ; } if ( ! username . equals ( Twilio . username ) ) { Twilio . invalidate ( ) ; } Twilio . username = username ; }
Set the username .
34,758
public static void setPassword ( final String password ) { if ( password == null ) { throw new AuthenticationException ( "Password can not be null" ) ; } if ( ! password . equals ( Twilio . password ) ) { Twilio . invalidate ( ) ; } Twilio . password = password ; }
Set the auth token .
34,759
public static void setAccountSid ( final String accountSid ) { if ( accountSid == null ) { throw new AuthenticationException ( "AccountSid can not be null" ) ; } if ( ! accountSid . equals ( Twilio . accountSid ) ) { Twilio . invalidate ( ) ; } Twilio . accountSid = accountSid ; }
Set the account sid .
34,760
public static ListeningExecutorService getExecutorService ( ) { if ( Twilio . executorService == null ) { Twilio . executorService = MoreExecutors . listeningDecorator ( Executors . newCachedThreadPool ( ) ) ; } return Twilio . executorService ; }
Returns the Twilio executor service .
34,761
public static TaskQueueStatistics fromJson ( final String json , final ObjectMapper objectMapper ) { try { return objectMapper . readValue ( json , TaskQueueStatistics . class ) ; } catch ( final JsonMappingException | JsonParseException e ) { throw new ApiException ( e . getMessage ( ) , e ) ; } catch ( final IOException e ) { throw new ApiConnectionException ( e . getMessage ( ) , e ) ; } }
Converts a JSON String into a TaskQueueStatistics object using the provided ObjectMapper .
34,762
public static UserChannelFetcher fetcher ( final String pathServiceSid , final String pathUserSid , final String pathChannelSid ) { return new UserChannelFetcher ( pathServiceSid , pathUserSid , pathChannelSid ) ; }
Create a UserChannelFetcher to execute fetch .
34,763
public static UserChannelUpdater updater ( final String pathServiceSid , final String pathUserSid , final String pathChannelSid , final UserChannel . NotificationLevel notificationLevel ) { return new UserChannelUpdater ( pathServiceSid , pathUserSid , pathChannelSid , notificationLevel ) ; }
Create a UserChannelUpdater to execute update .
34,764
public static MessageInteractionFetcher fetcher ( final String pathServiceSid , final String pathSessionSid , final String pathParticipantSid , final String pathSid ) { return new MessageInteractionFetcher ( pathServiceSid , pathSessionSid , pathParticipantSid , pathSid ) ; }
Create a MessageInteractionFetcher to execute fetch .
34,765
public static MessageInteractionReader reader ( final String pathServiceSid , final String pathSessionSid , final String pathParticipantSid ) { return new MessageInteractionReader ( pathServiceSid , pathSessionSid , pathParticipantSid ) ; }
Create a MessageInteractionReader to execute read .
34,766
public String toJson ( ) throws IOException { ObjectMapper mapper = new ObjectMapper ( ) ; ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; mapper . writeValue ( out , this ) ; return out . toString ( ) ; }
Converts a resource to JSON .
34,767
public String toJwt ( ) { Map < String , Object > headers = new HashMap < > ( ) ; headers . put ( "typ" , "JWT" ) ; headers . putAll ( this . getHeaders ( ) ) ; JwtBuilder builder = Jwts . builder ( ) . signWith ( this . algorithm , this . secretKey ) . setHeaderParams ( headers ) . setIssuer ( this . issuer ) . setExpiration ( expiration ) ; if ( this . getClaims ( ) != null ) { for ( Map . Entry < String , Object > entry : this . getClaims ( ) . entrySet ( ) ) { builder . claim ( entry . getKey ( ) , entry . getValue ( ) ) ; } } if ( this . getId ( ) != null ) { builder . setId ( this . getId ( ) ) ; } if ( this . getSubject ( ) != null ) { builder . setSubject ( this . getSubject ( ) ) ; } if ( this . getNbf ( ) != null ) { builder . setNotBefore ( this . getNbf ( ) ) ; } return builder . compact ( ) ; }
Encode a JWT .
34,768
public static RoomUpdater updater ( final String pathSid , final Room . RoomStatus status ) { return new RoomUpdater ( pathSid , status ) ; }
Create a RoomUpdater to execute update .
34,769
public static RecordingUpdater updater ( final String pathAccountSid , final String pathConferenceSid , final String pathSid , final Recording . Status status ) { return new RecordingUpdater ( pathAccountSid , pathConferenceSid , pathSid , status ) ; }
Create a RecordingUpdater to execute update .
34,770
public static VariableFetcher fetcher ( final String pathServiceSid , final String pathEnvironmentSid , final String pathSid ) { return new VariableFetcher ( pathServiceSid , pathEnvironmentSid , pathSid ) ; }
Create a VariableFetcher to execute fetch .
34,771
public static VariableCreator creator ( final String pathServiceSid , final String pathEnvironmentSid , final String key , final String value ) { return new VariableCreator ( pathServiceSid , pathEnvironmentSid , key , value ) ; }
Create a VariableCreator to execute create .
34,772
public static VariableUpdater updater ( final String pathServiceSid , final String pathEnvironmentSid , final String pathSid ) { return new VariableUpdater ( pathServiceSid , pathEnvironmentSid , pathSid ) ; }
Create a VariableUpdater to execute update .
34,773
public static AddressCreator creator ( final String pathAccountSid , final String customerName , final String street , final String city , final String region , final String postalCode , final String isoCountry ) { return new AddressCreator ( pathAccountSid , customerName , street , city , region , postalCode , isoCountry ) ; }
Create a AddressCreator to execute create .
34,774
public static SyncListPermissionFetcher fetcher ( final String pathServiceSid , final String pathListSid , final String pathIdentity ) { return new SyncListPermissionFetcher ( pathServiceSid , pathListSid , pathIdentity ) ; }
Create a SyncListPermissionFetcher to execute fetch .
34,775
public static SyncListPermissionDeleter deleter ( final String pathServiceSid , final String pathListSid , final String pathIdentity ) { return new SyncListPermissionDeleter ( pathServiceSid , pathListSid , pathIdentity ) ; }
Create a SyncListPermissionDeleter to execute delete .
34,776
public static SyncListPermissionUpdater updater ( final String pathServiceSid , final String pathListSid , final String pathIdentity , final Boolean read , final Boolean write , final Boolean manage ) { return new SyncListPermissionUpdater ( pathServiceSid , pathListSid , pathIdentity , read , write , manage ) ; }
Create a SyncListPermissionUpdater to execute update .
34,777
public static AddOnResultFetcher fetcher ( final String pathAccountSid , final String pathReferenceSid , final String pathSid ) { return new AddOnResultFetcher ( pathAccountSid , pathReferenceSid , pathSid ) ; }
Create a AddOnResultFetcher to execute fetch .
34,778
public static AddOnResultDeleter deleter ( final String pathAccountSid , final String pathReferenceSid , final String pathSid ) { return new AddOnResultDeleter ( pathAccountSid , pathReferenceSid , pathSid ) ; }
Create a AddOnResultDeleter to execute delete .
34,779
public static Workflow fromJson ( String json ) throws IOException { ObjectMapper mapper = new ObjectMapper ( ) ; return mapper . readValue ( json , Workflow . class ) ; }
Converts a JSON workflow configuration to a workflow object .
34,780
public static WorkflowRuleTarget fromJson ( String json ) throws IOException { ObjectMapper mapper = new ObjectMapper ( ) ; return mapper . readValue ( json , WorkflowRuleTarget . class ) ; }
Converts a JSON workflow configuration to a workflow configuration object .
34,781
public String getContent ( ) { if ( content != null ) { return content ; } if ( stream != null ) { Scanner scanner = new Scanner ( stream , "UTF-8" ) . useDelimiter ( "\\A" ) ; if ( ! scanner . hasNext ( ) ) { return "" ; } String data = scanner . next ( ) ; scanner . close ( ) ; return data ; } return "" ; }
Get the the content of the response .
34,782
public InputStream getStream ( ) { if ( stream != null ) { return stream ; } try { return new ByteArrayInputStream ( content . getBytes ( "utf-8" ) ) ; } catch ( final UnsupportedEncodingException e ) { throw new ApiException ( "UTF-8 encoding not supported" , e ) ; } }
Get response data as stream .
34,783
public static ValidationRequestCreator creator ( final String pathAccountSid , final com . twilio . type . PhoneNumber phoneNumber ) { return new ValidationRequestCreator ( pathAccountSid , phoneNumber ) ; }
Create a ValidationRequestCreator to execute create .
34,784
public static OriginationUrlCreator creator ( final String pathTrunkSid , final Integer weight , final Integer priority , final Boolean enabled , final String friendlyName , final URI sipUrl ) { return new OriginationUrlCreator ( pathTrunkSid , weight , priority , enabled , friendlyName , sipUrl ) ; }
Create a OriginationUrlCreator to execute create .
34,785
public static List < Policy > defaultWorkerPolicies ( String workspaceSid , String workerSid ) { Policy activities = new Policy . Builder ( ) . url ( UrlUtils . activities ( workspaceSid ) ) . method ( HttpMethod . GET ) . allowed ( true ) . build ( ) ; Policy tasks = new Policy . Builder ( ) . url ( UrlUtils . allTasks ( workspaceSid ) ) . method ( HttpMethod . GET ) . allowed ( true ) . build ( ) ; Policy reservations = new Policy . Builder ( ) . url ( UrlUtils . allReservations ( workspaceSid , workerSid ) ) . method ( HttpMethod . GET ) . allowed ( true ) . build ( ) ; Policy workerFetch = new Policy . Builder ( ) . url ( UrlUtils . worker ( workspaceSid , workerSid ) ) . method ( HttpMethod . GET ) . allowed ( true ) . build ( ) ; return Lists . newArrayList ( activities , tasks , reservations , workerFetch ) ; }
Build the default Polices for a Worker .
34,786
public static List < Policy > defaultEventBridgePolicies ( String accountSid , String channelId ) { String url = Joiner . on ( '/' ) . join ( TASKROUTER_EVENT_URL , accountSid , channelId ) ; Policy get = new Policy . Builder ( ) . url ( url ) . method ( HttpMethod . GET ) . allowed ( true ) . build ( ) ; Policy post = new Policy . Builder ( ) . url ( url ) . method ( HttpMethod . POST ) . allowed ( true ) . build ( ) ; return Lists . newArrayList ( get , post ) ; }
Build the default Event Bridge Policies .
34,787
public static String mapToJson ( final Map < String , Object > map ) { try { return MAPPER . writeValueAsString ( map ) ; } catch ( JsonProcessingException e ) { return null ; } }
Convert a map to a JSON String .
34,788
@ SuppressWarnings ( "checkstyle:linelength" ) public ExecutionStepContext fetch ( final TwilioRestClient client ) { Request request = new Request ( HttpMethod . GET , Domains . STUDIO . toString ( ) , "/v1/Flows/" + this . pathFlowSid + "/Executions/" + this . pathExecutionSid + "/Steps/" + this . pathStepSid + "/Context" , client . getRegion ( ) ) ; Response response = client . request ( request ) ; if ( response == null ) { throw new ApiConnectionException ( "ExecutionStepContext fetch failed: Unable to connect to server" ) ; } else if ( ! TwilioRestClient . SUCCESS . apply ( response . getStatusCode ( ) ) ) { RestException restException = RestException . fromJson ( response . getStream ( ) , client . getObjectMapper ( ) ) ; if ( restException == null ) { throw new ApiException ( "Server Error, no content" ) ; } throw new ApiException ( restException . getMessage ( ) , restException . getCode ( ) , restException . getMoreInfo ( ) , restException . getStatus ( ) , null ) ; } return ExecutionStepContext . fromJson ( response . getStream ( ) , client . getObjectMapper ( ) ) ; }
Make the request to the Twilio API to perform the fetch .
34,789
public static TriggerCreator creator ( final String pathAccountSid , final URI callbackUrl , final String triggerValue , final Trigger . UsageCategory usageCategory ) { return new TriggerCreator ( pathAccountSid , callbackUrl , triggerValue , usageCategory ) ; }
Create a TriggerCreator to execute create .
34,790
public static FunctionUpdater updater ( final String pathServiceSid , final String pathSid , final String friendlyName ) { return new FunctionUpdater ( pathServiceSid , pathSid , friendlyName ) ; }
Create a FunctionUpdater to execute update .
34,791
public SessionCreator setParticipants ( final Map < String , Object > participants ) { return setParticipants ( Promoter . listOfOne ( participants ) ) ; }
The Participant objects to include in the new session ..
34,792
public static FactorCreator creator ( final String pathServiceSid , final String pathIdentity , final String binding , final String friendlyName , final Factor . FactorTypes factorType ) { return new FactorCreator ( pathServiceSid , pathIdentity , binding , friendlyName , factorType ) ; }
Create a FactorCreator to execute create .
34,793
public static FactorDeleter deleter ( final String pathServiceSid , final String pathIdentity , final String pathSid ) { return new FactorDeleter ( pathServiceSid , pathIdentity , pathSid ) ; }
Create a FactorDeleter to execute delete .
34,794
public static FactorFetcher fetcher ( final String pathServiceSid , final String pathIdentity , final String pathSid ) { return new FactorFetcher ( pathServiceSid , pathIdentity , pathSid ) ; }
Create a FactorFetcher to execute fetch .
34,795
public static FactorUpdater updater ( final String pathServiceSid , final String pathIdentity , final String pathSid ) { return new FactorUpdater ( pathServiceSid , pathIdentity , pathSid ) ; }
Create a FactorUpdater to execute update .
34,796
public static SyncMapPermissionFetcher fetcher ( final String pathServiceSid , final String pathMapSid , final String pathIdentity ) { return new SyncMapPermissionFetcher ( pathServiceSid , pathMapSid , pathIdentity ) ; }
Create a SyncMapPermissionFetcher to execute fetch .
34,797
public static SyncMapPermissionDeleter deleter ( final String pathServiceSid , final String pathMapSid , final String pathIdentity ) { return new SyncMapPermissionDeleter ( pathServiceSid , pathMapSid , pathIdentity ) ; }
Create a SyncMapPermissionDeleter to execute delete .
34,798
public static SyncMapPermissionUpdater updater ( final String pathServiceSid , final String pathMapSid , final String pathIdentity , final Boolean read , final Boolean write , final Boolean manage ) { return new SyncMapPermissionUpdater ( pathServiceSid , pathMapSid , pathIdentity , read , write , manage ) ; }
Create a SyncMapPermissionUpdater to execute update .
34,799
public static QueryCreator creator ( final String pathAssistantSid , final String language , final String query ) { return new QueryCreator ( pathAssistantSid , language , query ) ; }
Create a QueryCreator to execute create .