canonicalwebteam.store-api 4.10.0__py3-none-any.whl → 4.11.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -81,7 +81,7 @@ class Publisher:
81
81
  )
82
82
 
83
83
  return {
84
- "Authorization": f"Macaroon root={root}, discharge={bound}"
84
+ "Authorization": f"macaroon root={root}, discharge={bound}"
85
85
  }
86
86
  # With Candid the header is Macaroons
87
87
  elif "macaroons" in session:
@@ -216,6 +216,35 @@ class SnapPublisher(Publisher):
216
216
  )
217
217
  return self.process_response(response)
218
218
 
219
+ def create_track(self, session, snap_name, track_name):
220
+ """
221
+ Create a track for a snap base on the snap's guardrail pattern.
222
+ """
223
+ response = self.session.post(
224
+ url=self.get_publisherwg_endpoint_url(f"snap/{snap_name}/tracks"),
225
+ headers=self._get_publisherwg_authorization_header(session),
226
+ json=[{"name": track_name}],
227
+ )
228
+ return response
229
+
230
+ def unregister_package_name(self, publisher_auth, snap_name):
231
+ """
232
+ Unregister a package name.
233
+
234
+ Args:
235
+ publisher_auth: Serialized macaroon to consume the API.
236
+ name: Name of the package to unregister
237
+ Returns:
238
+ The package name ID if successful
239
+ Otherwise, returns an error list
240
+ """
241
+ url = self.get_publisherwg_endpoint_url(f"snap/{snap_name}")
242
+ response = self.session.delete(
243
+ url=url,
244
+ headers=self._get_authorization_header(publisher_auth),
245
+ )
246
+ return response
247
+
219
248
 
220
249
  class SnapStoreAdmin(SnapPublisher):
221
250
  def get_endpoint_url(self, endpoint, api_version=2):
@@ -464,3 +493,40 @@ class SnapStoreAdmin(SnapPublisher):
464
493
  )
465
494
 
466
495
  return self.process_response(response)
496
+
497
+ # FEATURED SNAPS AUTOMATION
498
+ def delete_featured_snaps(self, session, snaps):
499
+ headers = self._get_publisherwg_authorization_header(session)
500
+ url = self.get_publisherwg_endpoint_url("snap/featured")
501
+ response = self.session.delete(
502
+ url=url,
503
+ headers=headers,
504
+ json=snaps,
505
+ )
506
+ return response
507
+
508
+ def update_featured_snaps(self, session, snaps):
509
+ headers = self._get_publisherwg_authorization_header(session)
510
+ url = self.get_publisherwg_endpoint_url("snap/featured")
511
+ response = self.session.put(
512
+ url=url,
513
+ headers=headers,
514
+ json=snaps,
515
+ )
516
+ return response
517
+
518
+ def get_featured_snaps(self, session, api_version=1):
519
+ url = "https://api.staging.snapcraft.io/api/v1/snaps/search"
520
+ headers = self.config[api_version].get("headers")
521
+
522
+ params = {
523
+ "scope": "wide",
524
+ "arch": "wide",
525
+ "confinement": "strict,classic,devmode",
526
+ "fields": "snap_id",
527
+ "section": "featured",
528
+ }
529
+
530
+ return self.process_response(
531
+ self.session.get(url, params=params, headers=headers)
532
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: canonicalwebteam.store-api
3
- Version: 4.10.0
3
+ Version: 4.11.1
4
4
  Summary:
5
5
  License: LGPL-3.0
6
6
  Author: Canonical Web Team
@@ -1,12 +1,12 @@
1
1
  canonicalwebteam/__init__.py,sha256=ED6jHcYiuYpr_0vjGz0zx2lrrmJT9sDJCzIljoDfmlM,65
2
2
  canonicalwebteam/store_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  canonicalwebteam/store_api/exceptions.py,sha256=A49LRhiEIfXNB2zC-zNcZEcdh0ugw6G7fBbXbs-BWxA,1517
4
- canonicalwebteam/store_api/publisher.py,sha256=c3zvfp8tbplsju5MLb2Zc5uCldj8fiHcbX1ZD0o9Cfo,10632
4
+ canonicalwebteam/store_api/publisher.py,sha256=9Ru9Lkrb5BlTAIzQnGv8zQTAi-6PUqxFeo__ocug1C0,10632
5
5
  canonicalwebteam/store_api/store.py,sha256=dyz3afMF_mTr3k6oAx5pBU0U8zRLIFYYgO-BUa62mj4,6249
6
6
  canonicalwebteam/store_api/stores/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  canonicalwebteam/store_api/stores/charmstore.py,sha256=ffAaL9WkTkwG1S1DypU2pzqTME_u7bU78UUJwEiDI6A,11533
8
- canonicalwebteam/store_api/stores/snapstore.py,sha256=WQ8PgwrnLAq3MSlNklNDXqPAZy3PCHVoiF55kEKKOoo,14824
9
- canonicalwebteam_store_api-4.10.0.dist-info/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
10
- canonicalwebteam_store_api-4.10.0.dist-info/METADATA,sha256=hl2UB2hIizBzaOo8NUyiRg5CWpwdJTOApWS8nToTOMw,2265
11
- canonicalwebteam_store_api-4.10.0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
12
- canonicalwebteam_store_api-4.10.0.dist-info/RECORD,,
8
+ canonicalwebteam/store_api/stores/snapstore.py,sha256=ry5XYZAXtm4JwwZcQNfrfWTFGGt_BgpH3u9lpR0fyxQ,17059
9
+ canonicalwebteam_store_api-4.11.1.dist-info/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
10
+ canonicalwebteam_store_api-4.11.1.dist-info/METADATA,sha256=ZfffE3XtAuf7G8-l7z3tQOpxgaHqr001DrTIJIONmbE,2265
11
+ canonicalwebteam_store_api-4.11.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
12
+ canonicalwebteam_store_api-4.11.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.8.1
2
+ Generator: poetry-core 1.9.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any