AdsApp.​DraftBuilder

Builder for Draft objects.

Example usage:

 // 
  
 Create 
  
 a 
  
 draft 
  
 builder 
 . 
 var 
  
 draftBuilder 
  
 = 
  
 AdsApp 
 . 
 campaigns 
 () 
 . 
 get 
 () 
 . 
 next 
 () 
 . 
 newDraftBuilder 
 (); 
 // 
  
 Create 
  
 a 
  
 draft 
  
 operation 
 . 
 var 
  
 draftOperation 
  
 = 
  
 draftBuilder 
  
 . 
 withName 
 ( 
 "Sample Draft" 
 ) 
  
 // 
  
 required 
  
 . 
 build 
 (); 
 // 
  
 Optional 
 : 
  
 examine 
  
 the 
  
 outcome 
 . 
  
 The 
  
 call 
  
 to 
  
 isSuccessful 
 () 
 // 
  
 will 
  
 block 
  
 until 
  
 the 
  
 operation 
  
 completes 
 . 
 if 
  
 ( 
 draftOperation 
 . 
 isSuccessful 
 ()) 
  
 { 
  
 // 
  
 Get 
  
 the 
  
 result 
 . 
  
 var 
  
 draft 
  
 = 
  
 draftOperation 
 . 
 getResult 
 (); 
 } 
  
 else 
  
 { 
  
 // 
  
 Handle 
  
 the 
  
 errors 
 . 
  
 var 
  
 errors 
  
 = 
  
 draftOperation 
 . 
 getErrors 
 (); 
 } 

Methods:

Member Type Description
AdsApp.DraftOperation Creates a Draft .
AdsApp.DraftBuilder Sets the name of the new draft to the specified value.

build()

Creates a Draft . Returns a DraftOperation that can be used to get the new Draft (or access any associated errors if creation failed).

Return values:

Type Description
AdsApp.DraftOperation The associated Draft operation.

withName(name)

Sets the name of the new draft to the specified value. Required before building.

Arguments:

Name Type Description
name
String Draft name.

Return values:

Type Description
AdsApp.DraftBuilder Draft builder with the specified name.
Create a Mobile Website
View Site in Mobile | Classic
Share by: