-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace the deprecated use of new JsonParser with the use of its stat…
…ic methods
- Loading branch information
Showing
1,070 changed files
with
11,332 additions
and
5,428 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import com.facebook.ads.sdk.*; | ||
import java.io.File; | ||
import java.util.Arrays; | ||
|
||
public class AdAccountAdCreativesEdge { | ||
public static void main (String args[]) throws APIException { | ||
|
||
String access_token = "<ACCESS_TOKEN>"; | ||
String app_secret = "<APP_SECRET>"; | ||
String app_id = "<APP_ID>"; | ||
String id = "<AD_ACCOUNT_ID>"; | ||
APIContext context = new APIContext(access_token).enableDebug(true); | ||
|
||
new AdAccount(id, context).getAdCreatives() | ||
.requestNameField() | ||
.execute(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import com.facebook.ads.sdk.*; | ||
import java.io.File; | ||
import java.util.Arrays; | ||
|
||
public class AdAccountAdCreativesPost { | ||
public static void main (String args[]) throws APIException { | ||
|
||
String access_token = "<ACCESS_TOKEN>"; | ||
String app_secret = "<APP_SECRET>"; | ||
String app_id = "<APP_ID>"; | ||
String id = "<AD_ACCOUNT_ID>"; | ||
APIContext context = new APIContext(access_token).enableDebug(true); | ||
|
||
new AdAccount(id, context).createAdCreative() | ||
.setName("Sample Promoted Post") | ||
.setObjectStoryId("<pageID>_<postID>") | ||
.execute(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import com.facebook.ads.sdk.*; | ||
import java.io.File; | ||
import java.util.Arrays; | ||
|
||
public class AdAccountAdCreativesPostCreateAdCreative { | ||
public static void main (String args[]) throws APIException { | ||
|
||
String access_token = "<ACCESS_TOKEN>"; | ||
String app_secret = "<APP_SECRET>"; | ||
String app_id = "<APP_ID>"; | ||
String id = "<AD_ACCOUNT_ID>"; | ||
APIContext context = new APIContext(access_token).enableDebug(true); | ||
|
||
new AdAccount(id, context).createAdCreative() | ||
.setObjectStoryId("<pageID>_<postID>") | ||
.execute(); | ||
|
||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
examples/AdAccountAdCreativesPostCreateAdCreativeCanvas.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import com.facebook.ads.sdk.*; | ||
import java.io.File; | ||
import java.util.Arrays; | ||
|
||
public class AdAccountAdCreativesPostCreateAdCreativeCanvas { | ||
public static void main (String args[]) throws APIException { | ||
|
||
String access_token = "<ACCESS_TOKEN>"; | ||
String app_secret = "<APP_SECRET>"; | ||
String app_id = "<APP_ID>"; | ||
String id = "<AD_ACCOUNT_ID>"; | ||
APIContext context = new APIContext(access_token).enableDebug(true); | ||
|
||
new AdAccount(id, context).createAdCreative() | ||
.setImageHash("<imageHash>") | ||
.setObjectStorySpec( | ||
new AdCreativeObjectStorySpec() | ||
.setFieldLinkData( | ||
new AdCreativeLinkData() | ||
.setFieldCallToAction( | ||
new AdCreativeLinkDataCallToAction() | ||
.setFieldType(AdCreativeLinkDataCallToAction.EnumType.VALUE_LEARN_MORE) | ||
) | ||
.setFieldImageHash("<imageHash>") | ||
.setFieldLink("<canvasURI>") | ||
.setFieldName("Creative message") | ||
) | ||
.setFieldPageId("<pageID>") | ||
) | ||
.execute(); | ||
|
||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
examples/AdAccountAdCreativesPostCreateAdCreativeCustomizationCanvasDV.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import com.facebook.ads.sdk.*; | ||
import java.io.File; | ||
import java.util.Arrays; | ||
|
||
public class AdAccountAdCreativesPostCreateAdCreativeCustomizationCanvasDV { | ||
public static void main (String args[]) throws APIException { | ||
|
||
String access_token = "<ACCESS_TOKEN>"; | ||
String app_secret = "<APP_SECRET>"; | ||
String app_id = "<APP_ID>"; | ||
String id = "<AD_ACCOUNT_ID>"; | ||
APIContext context = new APIContext(access_token).enableDebug(true); | ||
|
||
new AdAccount(id, context).createAdCreative() | ||
.setObjectStorySpec( | ||
new AdCreativeObjectStorySpec() | ||
.setFieldPageId("<pageID>") | ||
.setFieldTemplateData( | ||
new AdCreativeLinkData() | ||
.setFieldCallToAction( | ||
new AdCreativeLinkDataCallToAction() | ||
.setFieldType(AdCreativeLinkDataCallToAction.EnumType.VALUE_LEARN_MORE) | ||
) | ||
.setFieldCustomizationRulesSpec(Arrays.asList( | ||
new AdCustomizationRuleSpec() | ||
.setFieldCustomizationSpec("{\"language\":\"en_XX\"}") | ||
, | ||
new AdCustomizationRuleSpec() | ||
.setFieldCustomizationSpec("{\"language\":\"fr_XX\"}") | ||
.setFieldLink("<canvasURIFR>") | ||
.setFieldMessage("French Creative message") | ||
.setFieldName("French Creative title") | ||
)) | ||
.setFieldFormatOption(AdCreativeLinkData.EnumFormatOption.VALUE_COLLECTION_VIDEO) | ||
.setFieldLink("<canvasURI>") | ||
.setFieldMessage("English Creative message") | ||
.setFieldName("English Creative title") | ||
.setFieldRetailerItemIds(Arrays.asList(0L, 0L, 0L, 0L)) | ||
) | ||
) | ||
.setProductSetId("<productSetID>") | ||
.execute(); | ||
|
||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
examples/AdAccountAdCreativesPostCreateAdCreativeCustomizationCanvasImage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import com.facebook.ads.sdk.*; | ||
import java.io.File; | ||
import java.util.Arrays; | ||
|
||
public class AdAccountAdCreativesPostCreateAdCreativeCustomizationCanvasImage { | ||
public static void main (String args[]) throws APIException { | ||
|
||
String access_token = "<ACCESS_TOKEN>"; | ||
String app_secret = "<APP_SECRET>"; | ||
String app_id = "<APP_ID>"; | ||
String id = "<AD_ACCOUNT_ID>"; | ||
APIContext context = new APIContext(access_token).enableDebug(true); | ||
|
||
new AdAccount(id, context).createAdCreative() | ||
.setObjectStorySpec( | ||
new AdCreativeObjectStorySpec() | ||
.setFieldLinkData( | ||
new AdCreativeLinkData() | ||
.setFieldCallToAction( | ||
new AdCreativeLinkDataCallToAction() | ||
.setFieldType(AdCreativeLinkDataCallToAction.EnumType.VALUE_LEARN_MORE) | ||
) | ||
.setFieldCustomizationRulesSpec(Arrays.asList( | ||
new AdCustomizationRuleSpec() | ||
.setFieldCustomizationSpec("{\"language\":\"en_XX\"}") | ||
, | ||
new AdCustomizationRuleSpec() | ||
.setFieldCustomizationSpec("{\"language\":\"fr_XX\"}") | ||
.setFieldLink("<canvasURIFR>") | ||
.setFieldMessage("French Creative message") | ||
.setFieldName("French Creative title") | ||
)) | ||
.setFieldLink("<canvasURI>") | ||
.setFieldMessage("English Creative message") | ||
.setFieldName("English Creative title") | ||
.setFieldPicture("<imageURL>") | ||
.setFieldRetailerItemIds(Arrays.asList(0L, 0L, 0L, 0L)) | ||
) | ||
.setFieldPageId("<pageID>") | ||
) | ||
.setProductSetId("<productSetID>") | ||
.execute(); | ||
|
||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
examples/AdAccountAdCreativesPostCreateAdCreativeCustomizationCanvasVideo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import com.facebook.ads.sdk.*; | ||
import java.io.File; | ||
import java.util.Arrays; | ||
|
||
public class AdAccountAdCreativesPostCreateAdCreativeCustomizationCanvasVideo { | ||
public static void main (String args[]) throws APIException { | ||
|
||
String access_token = "<ACCESS_TOKEN>"; | ||
String app_secret = "<APP_SECRET>"; | ||
String app_id = "<APP_ID>"; | ||
String id = "<AD_ACCOUNT_ID>"; | ||
APIContext context = new APIContext(access_token).enableDebug(true); | ||
|
||
new AdAccount(id, context).createAdCreative() | ||
.setObjectStorySpec( | ||
new AdCreativeObjectStorySpec() | ||
.setFieldPageId("<pageID>") | ||
.setFieldVideoData( | ||
new AdCreativeVideoData() | ||
.setFieldCallToAction( | ||
new AdCreativeLinkDataCallToAction() | ||
.setFieldType(AdCreativeLinkDataCallToAction.EnumType.VALUE_LEARN_MORE) | ||
.setFieldValue( | ||
new AdCreativeLinkDataCallToActionValue() | ||
.setFieldLink("<canvasURI>") | ||
) | ||
) | ||
.setFieldImageUrl("<imageURL>") | ||
.setFieldMessage("English Creative message") | ||
.setFieldRetailerItemIds(Arrays.asList(0L, 0L, 0L, 0L)) | ||
.setFieldTitle("English Creative title") | ||
.setFieldVideoId("<videoID>") | ||
) | ||
) | ||
.setProductSetId("<productSetID>") | ||
.execute(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import com.facebook.ads.sdk.*; | ||
import java.io.File; | ||
import java.util.Arrays; | ||
|
||
public class AdAccountAdCreativesPostEnrollStatus { | ||
public static void main (String args[]) throws APIException { | ||
|
||
String access_token = "<ACCESS_TOKEN>"; | ||
String app_secret = "<APP_SECRET>"; | ||
String app_id = "<APP_ID>"; | ||
String id = "<AD_ACCOUNT_ID>"; | ||
APIContext context = new APIContext(access_token).enableDebug(true); | ||
|
||
new AdAccount(id, context).createAdCreative() | ||
.setName("Sample Promoted") | ||
.setObjectStorySpec( | ||
new AdCreativeObjectStorySpec() | ||
.setFieldLinkData( | ||
new AdCreativeLinkData() | ||
.setFieldImageHash("<imageHash>") | ||
.setFieldLink("<imageURL>") | ||
.setFieldMessage("try it out") | ||
) | ||
.setFieldPageId("<pageID>") | ||
) | ||
.setParam("degrees_of_freedom_spec", "{\"creative_features_spec\":\"{\"standard_enhancements\":\"{\\"enroll_status\\":\\"OPT_IN\\"}\"}\"}") | ||
.setParam("special_ad_categories", "[]") | ||
.execute(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import com.facebook.ads.sdk.*; | ||
import java.io.File; | ||
import java.util.Arrays; | ||
|
||
public class AdAccountAdLabelsPost { | ||
public static void main (String args[]) throws APIException { | ||
|
||
String access_token = "<ACCESS_TOKEN>"; | ||
String app_secret = "<APP_SECRET>"; | ||
String app_id = "<APP_ID>"; | ||
String id = "<AD_ACCOUNT_ID>"; | ||
APIContext context = new APIContext(access_token).enableDebug(true); | ||
|
||
new AdAccount(id, context).createAdLabel() | ||
.setName("My Label") | ||
.execute(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import com.facebook.ads.sdk.*; | ||
import java.io.File; | ||
import java.util.Arrays; | ||
|
||
public class AdAccountAdSetsEdge { | ||
public static void main (String args[]) throws APIException { | ||
|
||
String access_token = "<ACCESS_TOKEN>"; | ||
String app_secret = "<APP_SECRET>"; | ||
String app_id = "<APP_ID>"; | ||
String id = "<AD_ACCOUNT_ID>"; | ||
APIContext context = new APIContext(access_token).enableDebug(true); | ||
|
||
new AdAccount(id, context).getAdSets() | ||
.requestNameField() | ||
.requestIdField() | ||
.requestStatusField() | ||
.execute(); | ||
|
||
} | ||
} |
Oops, something went wrong.