Skip to content

Commit 80c0094

Browse files
committed
misc
1 parent 4fcade8 commit 80c0094

File tree

10 files changed

+9
-108
lines changed

10 files changed

+9
-108
lines changed

Diff for: TODO.md

-50
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,6 @@
99
- [ ] get personal objekt/grid ranking
1010
- [ ] get top 10 ranking
1111

12-
## Artist
13-
14-
- [x] get artist list
15-
- [x] get artist & members
16-
- [x] get artist (backend for frontend)
17-
18-
## Auth
19-
20-
- [x] sign in
21-
- [x] refresh token
22-
2312
## Gravity
2413

2514
- [ ] total como spent per artist
@@ -28,31 +17,9 @@
2817
- [ ] get user status of a gravity
2918
- [ ] get polls for a gravity
3019

31-
## Grid
32-
33-
- [x] artist status/counts
34-
- [x] list of editions
35-
- [x] list of grid for an edition
36-
- [x] grid status
37-
- [x] complete a grid
38-
- [x] claim a grid reward
39-
40-
## News
41-
42-
- [x] home page
43-
- [x] feed
44-
- [x] exclusive feed
45-
- [x] feed (backend for frontend)
46-
4720
## Objekt
4821

49-
- [x] filters
50-
- [x] get by serial
51-
- [ ] claim by serial
5222
- [ ] objekt collection by address
53-
- [x] get token
54-
- [x] apply lenticular
55-
- [x] remove lenticular
5623
- [ ] gas station
5724

5825
## Rekord
@@ -66,24 +33,7 @@
6633
- [ ] unlike post
6734
- [ ] get post by id
6835

69-
## Rewards
70-
71-
- [x] list pending rewards
72-
- [x] check if claimable
73-
- [x] claim rewards
74-
75-
## Season
76-
77-
- [x] list seasons
78-
7936
## Shop
8037

8138
- [ ] get products
8239
- [ ] get banner
83-
84-
## User
85-
86-
- [x] get current user
87-
- [x] search users
88-
- [x] get user by nickname
89-
- [x] update device profile

Diff for: src/api/auth.ts

-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { signInSchema } from "../zod/auth";
55
export class AuthAPI extends BaseAPI {
66
/**
77
* Sign in with Ramper credentials.
8-
*
98
* Authentication is not required.
109
*/
1110
async signIn(payload: Auth.LoginPayload) {
@@ -17,7 +16,6 @@ export class AuthAPI extends BaseAPI {
1716

1817
/**
1918
* Refresh an access token.
20-
*
2119
* Authentication is not required.
2220
*/
2321
async refreshToken(refreshToken: string) {

Diff for: src/api/grid.ts

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import { BaseAPI } from "./base-api";
22
import { AccessTokenMissing, BadRequestError, CosmoError } from "../errors";
3-
import { ValidArtist } from "./legacy-artist";
3+
import { ValidArtist } from "../types/artist-common";
44

55
export class GridAPI extends BaseAPI {
66
/**
77
* Get the grid status/counts for the given artist.
8-
*
98
* Authentication is required.
109
*/
1110
async artistStatus(artist: ValidArtist) {
@@ -18,7 +17,6 @@ export class GridAPI extends BaseAPI {
1817

1918
/**
2019
* Get the list of editions for the given artist.
21-
*
2220
* Authentication is required.
2321
*/
2422
async editions(artist: ValidArtist) {
@@ -33,7 +31,6 @@ export class GridAPI extends BaseAPI {
3331

3432
/**
3533
* Get the required objekts and rewards for the given edition.
36-
*
3734
* Authentication is required.
3835
*/
3936
async editionGrids(edition: string) {
@@ -48,7 +45,6 @@ export class GridAPI extends BaseAPI {
4845

4946
/**
5047
* Get the current state of the given grid.
51-
*
5248
* Authentication is required.
5349
*/
5450
async gridStatus(gridId: string) {
@@ -63,7 +59,6 @@ export class GridAPI extends BaseAPI {
6359

6460
/**
6561
* Complete a grid.
66-
*
6762
* Authentication is required.
6863
*/
6964
async complete(gridId: string, slots: Grid.SlotCompletion[]) {
@@ -97,7 +92,6 @@ export class GridAPI extends BaseAPI {
9792
/**
9893
* Claim a grid reward.
9994
* Must be called after {@link complete}.
100-
*
10195
* Authentication is required.
10296
*/
10397
async claim(gridId: string) {

Diff for: src/api/news.ts

-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { LegacyArtist } from "./legacy-artist";
88
export class NewsAPI extends BaseAPI {
99
/**
1010
* Get home page news sections for the given artist.
11-
*
1211
* Authentication is required.
1312
*/
1413
async home(artist: ValidArtist) {
@@ -23,7 +22,6 @@ export class NewsAPI extends BaseAPI {
2322

2423
/**
2524
* Get the news feed for the given artist.
26-
*
2725
* Authentication is not required.
2826
*/
2927
async feed({ artist, startAfter = 0, limit = 10 }: News.Payload) {
@@ -40,7 +38,6 @@ export class NewsAPI extends BaseAPI {
4038

4139
/**
4240
* Get the exclusive news feed for the given artist.
43-
*
4441
* Authentication is not required.
4542
*/
4643
async exclusive({ artist, startAfter = 0, limit = 10 }: News.Payload) {
@@ -57,7 +54,6 @@ export class NewsAPI extends BaseAPI {
5754

5855
/**
5956
* Get the news feed for the given artist via the backend for frontend endpoint.
60-
*
6157
* Authentication is required.
6258
*/
6359
async feedBff({ artistName, page = 1, size = 10 }: NewsBFF.Payload) {

Diff for: src/api/objekt.ts

+3-11
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ import { z } from "zod";
22
import { BaseAPI } from "./base-api";
33
import { objektFilterSchema } from "../zod/objekt";
44
import { AccessTokenMissing } from "../errors";
5-
import { ValidArtist } from "./legacy-artist";
5+
import { ValidArtist } from "../types/artist-common";
66

77
export class ObjektAPI extends BaseAPI {
88
/**
99
* Get the available objekt filters.
10-
*
1110
* Authentication is required.
1211
*/
1312
async filters(artist?: ValidArtist) {
@@ -25,7 +24,6 @@ export class ObjektAPI extends BaseAPI {
2524

2625
/**
2726
* Get an objekt by its QR/odmq code.
28-
*
2927
* Authentication is required.
3028
*/
3129
async getBySerial(serial: string) {
@@ -41,23 +39,20 @@ export class ObjektAPI extends BaseAPI {
4139

4240
/**
4341
* Claim an objekt by its QR/odmq code.
44-
*
4542
* Authentication is required.
4643
*/
4744
async claimBySerial(serial: string) {
4845
if (!this.config.accessToken) {
4946
throw new AccessTokenMissing();
5047
}
5148

52-
throw new Error("not implemented");
53-
return await this.request<boolean>(`/objekt/v1/by-serial/${serial}/claim`, {
49+
return await this.request(`/objekt/v1/by-serial/${serial}/claim`, {
5450
method: "POST",
55-
});
51+
}).then(() => true);
5652
}
5753

5854
/**
5955
* Get the objekts owned by the given address.
60-
*
6156
* Authentication is not required.
6257
*/
6358
async ownedBy(address: Objekt.OwnedBy, filters?: Objekt.CollectionParams) {
@@ -78,7 +73,6 @@ export class ObjektAPI extends BaseAPI {
7873

7974
/**
8075
* Get a single token by its ID.
81-
*
8276
* Authentication is not required.
8377
*/
8478
async token(tokenId: Objekt.TokenId) {
@@ -87,7 +81,6 @@ export class ObjektAPI extends BaseAPI {
8781

8882
/**
8983
* Put two tokens into a lenticular pair.
90-
*
9184
* Authentication is required.
9285
*/
9386
async applyLenticular(tokenA: Objekt.TokenId, tokenB: Objekt.TokenId) {
@@ -106,7 +99,6 @@ export class ObjektAPI extends BaseAPI {
10699

107100
/**
108101
* Remove a token from a lenticular pair.
109-
*
110102
* Authentication is required.
111103
*/
112104
async removeLenticular(tokenId: Objekt.TokenId) {

Diff for: src/api/rewards.ts

-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { AccessTokenMissing, BadRequestError } from "../errors";
44
export class RewardsAPI extends BaseAPI {
55
/**
66
* Display the list of pending rewards.
7-
*
87
* Authentication is required.
98
*/
109
async list() {
@@ -23,7 +22,6 @@ export class RewardsAPI extends BaseAPI {
2322

2423
/**
2524
* Check if there are any pending rewards.
26-
*
2725
* Authentication is required.
2826
*/
2927
async check() {
@@ -42,7 +40,6 @@ export class RewardsAPI extends BaseAPI {
4240

4341
/**
4442
* Claim all pending rewards.
45-
*
4643
* Authentication is required.
4744
*/
4845
async claim() {

Diff for: src/api/season.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import { ValidArtist } from "./legacy-artist";
1+
import { ValidArtist } from "../types/artist-common";
22
import { BaseAPI } from "./base-api";
33

44
export class SeasonAPI extends BaseAPI {
55
/**
66
* Get the seasons for the given artist.
7-
*
87
* Authentication is not required.
98
*/
109
async list(artist: ValidArtist) {

Diff for: tests/api/objekt.spec.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ describe("ObjektAPI", () => {
2727
});
2828

2929
it("should claim an objekt by its qr code", async () => {
30-
await expect(() => {
31-
return cosmo.objekts.claimBySerial("1234");
32-
}).rejects.toThrowError("not implemented");
30+
const response = await cosmo.objekts.claimBySerial("1234");
31+
expect(response).toEqual(true);
3332
});
3433

3534
it("should apply lenticular to two objekts", async () => {
@@ -95,7 +94,7 @@ describe("ObjektAPI", () => {
9594

9695
it("claiming an objekt by its qr code should handle unauthorized requests", async () => {
9796
await expect(cosmo.objekts.claimBySerial("1234")).rejects.toThrowError(
98-
new Error("not implemented")
97+
new UnauthorizedError("missing Authorization header")
9998
);
10099
});
101100

Diff for: tests/mocks.json

-24
Original file line numberDiff line numberDiff line change
@@ -1081,30 +1081,6 @@
10811081
"isClaimed": true
10821082
},
10831083

1084-
"claimBySerial": {
1085-
"objekt": {
1086-
"collectionId": "Atom01 JiWoo 100Z",
1087-
"season": "Atom01",
1088-
"member": "JiWoo",
1089-
"collectionNo": "100Z",
1090-
"class": "Welcome",
1091-
"artists": ["tripleS"],
1092-
"thumbnailImage": "https://imagedelivery.net/qQuMkbHJ-0s6rwu8vup_5w/bd31d000-fa7b-4518-dd27-58cde1faf200/thumbnail",
1093-
"frontImage": "https://imagedelivery.net/qQuMkbHJ-0s6rwu8vup_5w/bd31d000-fa7b-4518-dd27-58cde1faf200/3x",
1094-
"backImage": "https://imagedelivery.net/qQuMkbHJ-0s6rwu8vup_5w/78f14332-1f28-4745-d49a-06684a8d4f00/3x",
1095-
"accentColor": "#F1F2F2",
1096-
"backgroundColor": "#F1F2F2",
1097-
"textColor": "#000000",
1098-
"comoAmount": 1,
1099-
"transferableByDefault": true,
1100-
"tokenId": "1",
1101-
"tokenAddress": "0xA4B37bE40F7b231Ee9574c4b16b7DDb7EAcDC99B",
1102-
"objektNo": 1,
1103-
"transferable": false
1104-
},
1105-
"isClaimed": true
1106-
},
1107-
11081084
"token": {
11091085
"name": "Atom01 JinSoul 310Z #5",
11101086
"description": "ARTMS\n——————————————————\nObjekt is a NFT photo card of ARTMS.\nUsers can acquire (as a reward or buy), collect, and trade their Objekt in COSMO, our exclusive app.\nYou can also mint your physical Objekt by scanning its QR code by COSMO.",

Diff for: tests/mocks.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const handlers = [
6262
HttpResponse.json(json.getBySerial)
6363
),
6464
http.post(cosmo("/objekt/v1/by-serial/*/claim"), () =>
65-
HttpResponse.json(json.claimBySerial)
65+
HttpResponse.json(undefined, { status: 201 })
6666
),
6767
http.post(cosmo("/lenticular/v1"), () =>
6868
HttpResponse.json(undefined, { status: 201 })

0 commit comments

Comments
 (0)