Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3ba3a03

Browse files
committed
Add limit-by parameter in every Operator, remove Client*Operator's
1 parent38a4fe8 commit3ba3a03

File tree

32 files changed

+74
-651
lines changed

32 files changed

+74
-651
lines changed

‎src/Domain/V1/Targeting/RemarketingTargeting.php‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ class RemarketingTargeting
1818
*/
1919
private$name;
2020

21+
/**
22+
* @param int $id
23+
* @return RemarketingTargeting
24+
*/
25+
publicstaticfunctionwithId($id)
26+
{
27+
returnnewRemarketingTargeting($id,null);
28+
}
29+
2130
/**
2231
* @param int $id
2332
* @param string $name

‎src/Operator/V1/BannerOperator.php‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function edit(Banner $banner, BannerFields $fields = null, array $context
8888
*/
8989
publicfunctioneditAll(array$banners,BannerFields$fields =null,array$context =null)
9090
{
91-
$context = (array)$context + ["limit-by" =>"banner-create"];
91+
$context = (array)$context + ["limit-by" =>"banner-edit"];
9292
$fields =$fields ?: BannerFields::create();
9393

9494
$banners =array_values($banners);
@@ -98,12 +98,8 @@ public function editAll(array $banners, BannerFields $fields = null, array $cont
9898
$query = ["fields" =>$this->mapFields($fields->getFields())];
9999
$path =sprintf("/api/v1/banners/%s.json",implode(";",$ids));
100100
$json =$this->client->post($path,$query,$rawBanners,$context);
101+
$json =f\objects_array_fixup($json,count($banners));
101102

102-
// MyTarget would return an object instead of array in case there is only one banner in result
103-
if (0 !==count($json) && !is_array(reset($json))) {
104-
$json = [$json];
105-
}
106-
107103
returnarray_map(function ($json) {
108104
return$this->mapper->hydrateNew(Banner::class,$json);
109105
},$json);

‎src/Operator/V1/CampaignOperator.php‎

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,6 @@ public function __construct(Client $client, Mapper $mapper)
2929
$this->mapper =$mapper;
3030
}
3131

32-
/**
33-
* @param string $username
34-
* @return ClientCampaignOperator
35-
*/
36-
publicfunctionforClient($username)
37-
{
38-
returnnewClientCampaignOperator($username,$this->client,$this->mapper);
39-
}
40-
4132
/**
4233
* @param MutateCampaign $campaign
4334
* @param array|null $context
@@ -46,6 +37,7 @@ public function forClient($username)
4637
*/
4738
publicfunctioncreate(MutateCampaign$campaign,array$context =null)
4839
{
40+
$context = (array)$context + ["limit-by" =>"campaign-create"];
4941
$rawCampaign =$this->mapper->snapshot($campaign);
5042

5143
$json =$this->client->post("/api/v1/campaigns.json",null,$rawCampaign,$context);
@@ -57,11 +49,25 @@ public function create(MutateCampaign $campaign, array $context = null)
5749
* @param int $id
5850
* @param MutateCampaign $campaign
5951
* @param array|null $context
52+
* @deprecated Use edit() instead. All editing actions will be consistently named across all Operators as edit*
6053
*
6154
* @return Campaign
6255
*/
6356
publicfunctionupdate($id,MutateCampaign$campaign,array$context =null)
6457
{
58+
return$this->edit($id,$campaign,$context);
59+
}
60+
61+
/**
62+
* @param int $id
63+
* @param MutateCampaign $campaign
64+
* @param array|null $context
65+
*
66+
* @return Campaign
67+
*/
68+
publicfunctionedit($id,MutateCampaign$campaign,array$context =null)
69+
{
70+
$context = (array)$context + ["limit-by" =>"campaign-edit"];
6571
$rawCampaign =$this->mapper->snapshot($campaign);
6672

6773
$json =$this->client->post(sprintf("/api/v1/campaigns/%d.json",$id),null,$rawCampaign,$context);
@@ -80,6 +86,7 @@ public function update($id, MutateCampaign $campaign, array $context = null)
8086
*/
8187
publicfunctionall(CampaignFields$fields =null,array$withStatuses =null,array$context =null)
8288
{
89+
$context = (array)$context + ["limit-by" =>"campaign-find-all"];
8390
$fields =$fields ?: CampaignFields::create();
8491

8592
$query = ["fields" =>$this->mapFields($fields->getFields())];
@@ -92,8 +99,6 @@ public function all(CampaignFields $fields = null, array $withStatuses = null, a
9299
$query["with_banners"] ="1";
93100
}
94101

95-
$context = (array)$context + ["limit-by" =>"campaigns-all"];
96-
97102
$json =$this->client->get("/api/v1/campaigns.json",$query,$context);
98103

99104
$objects =array_map(function ($json) {

‎src/Operator/V1/ClientCampaignOperator.php‎

Lines changed: 0 additions & 70 deletions
This file was deleted.

‎src/Operator/V1/ClientImageOperator.php‎

Lines changed: 0 additions & 34 deletions
This file was deleted.

‎src/Operator/V1/ClientOperator.php‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public function __construct(Client $client, Mapper $mapper)
3131
*/
3232
publicfunctionall(array$context =null)
3333
{
34+
$context = (array)$context + ["limit-by" =>"client-find"];
3435
$json =$this->client->get("/api/v1/clients.json",null,$context);
3536

3637
returnarray_map(function ($json) {
@@ -46,6 +47,7 @@ public function all(array $context = null)
4647
*/
4748
publicfunctioncreate(AdditionalUserInfo$userInfo,array$context =null)
4849
{
50+
$context = (array)$context + ["limit-by" =>"campaign-create"];
4951
$rawUserInfo =$this->mapper->snapshot($userInfo);
5052
$body = ["additional_info" =>$rawUserInfo];
5153

‎src/Operator/V1/ClientProjectionOperator.php‎

Lines changed: 0 additions & 34 deletions
This file was deleted.

‎src/Operator/V1/ClientStatisticOperator.php‎

Lines changed: 0 additions & 43 deletions
This file was deleted.

‎src/Operator/V1/DetailedExactDemographyOperator.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function __construct(Client $client, Mapper $mapper)
4141
*/
4242
publicfunctionfindAll(array$ids,DateRange$dateRange,array$context =null)
4343
{
44+
$context = (array)$context + ["limit-by" =>"detailed-exact-demography-find"];
4445
$query = [
4546
'date_from' =>$dateRange->getFrom()->format(self::DATE_FORMAT),
4647
'date_to' =>$dateRange->getTo()->format(self::DATE_FORMAT),

‎src/Operator/V1/ImageOperator.php‎

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,17 @@ public function __construct(Client $client, Mapper $mapper)
2727
$this->mapper =$mapper;
2828
}
2929

30-
/**
31-
* @param string $username
32-
*
33-
* @return ClientImageOperator
34-
*/
35-
publicfunctionforClient($username)
36-
{
37-
returnnewClientImageOperator($username,$this->client,$this->mapper);
38-
}
39-
4030
/**
4131
* @param resource|string|StreamInterface $file Can be a StreamInterface instance, resource or a file path
4232
* @param UploadImage $image
33+
* @param string|null $filename
4334
* @param array|null $context
44-
* @param str|null $filename
4535
*
4636
* @return Image
4737
*/
48-
publicfunctionupload($file,UploadImage$image,array$context =null,$filename =null)
38+
publicfunctionupload($file,UploadImage$image,$filename =null,array$context =null)
4939
{
40+
$context = (array)$context + ["limit-by" =>"image-upload"];
5041
$file =f\streamOrResource($file);
5142

5243
$imageInfo =$this->mapper->snapshot($image);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp