internal/stubs/store.go   A
last analyzed

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
dl 0
loc 75
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A stubs.StoreGetResponse 0 2 1
A stubs.StoresListResponse 0 2 1
1
package stubs
2
3
// StoreGetResponse returns the response for the GET /v1/stores/:id endpoint
4
func StoreGetResponse() []byte {
5
	return []byte(`
6
{
7
  "jsonapi": {
8
    "version": "1.0"
9
  },
10
  "links": {
11
    "self": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1"
12
  },
13
  "data": {
14
    "type": "stores",
15
    "id": "1",
16
    "attributes": {
17
      "name": "My Store",
18
      "slug": "my-store",
19
      "domain": "my-store.lemonsqueezy.com",
20
      "url": "https:\/\/my-store.lemonsqueezy.com",
21
      "avatar_url": "https:\/\/app.lemonsqueezy.com\/storage\/avatars\/stores\/1\/czTkMkDm4Vfb8PZehb5c29XFCm9JZyJx0AjEZP7s.png",
22
      "plan": "fresh",
23
      "country": "US",
24
      "country_nicename": "United States",
25
      "currency": "USD",
26
      "total_sales": 1,
27
      "total_revenue": 999,
28
      "thirty_day_sales": 0,
29
      "thirty_day_revenue": 0,
30
      "created_at": "2021-05-24T14:15:06.000000Z",
31
      "updated_at": "2021-06-15T10:03:14.000000Z"
32
    },
33
    "relationships": {
34
      "products": {
35
        "links": {
36
          "related": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/products",
37
          "self": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/relationships\/products"
38
        }
39
      },
40
      "orders": {
41
        "links": {
42
          "related": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/orders",
43
          "self": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/relationships\/orders"
44
        }
45
      },
46
      "subscriptions": {
47
        "links": {
48
          "related": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/subscriptions",
49
          "self": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/relationships\/subscriptions"
50
        }
51
      },
52
      "discounts": {
53
        "links": {
54
          "related": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/discounts",
55
          "self": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/relationships\/discounts"
56
        }
57
      },
58
      "license-keys": {
59
        "links": {
60
          "related": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/license-keys",
61
          "self": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/relationships\/license-keys"
62
        }
63
      }
64
    },
65
    "links": {
66
      "self": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1"
67
    }
68
  }
69
}
70
`)
71
}
72
73
// StoresListResponse is a dummy response for the GET /v1/stores endpoint
74
func StoresListResponse() []byte {
75
	return []byte(`
76
{
77
  "meta": {
78
    "page": {
79
      "currentPage": 1,
80
      "from": 1,
81
      "lastPage": 1,
82
      "perPage": 10,
83
      "to": 10,
84
      "total": 10
85
    }
86
  },
87
  "jsonapi": {
88
    "version": "1.0"
89
  },
90
  "links": {
91
    "first": "https:\/\/api.lemonsqueezy.com\/v1\/stores?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=name",
92
    "last": "https:\/\/api.lemonsqueezy.com\/v1\/stores?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=name"
93
  },
94
  "data": [
95
    {
96
      "type": "stores",
97
      "id": "1",
98
      "attributes": {
99
        "name": "My Store",
100
        "slug": "my-store",
101
        "domain": "my-store.lemonsqueezy.com",
102
        "url": "https:\/\/my-store.lemonsqueezy.com",
103
        "avatar_url": "https:\/\/app.lemonsqueezy.com\/storage\/avatars\/stores\/1\/czTkMkDm4Vfb8PZehb5c29XFCm9JZyJx0AjEZP7s.png",
104
        "plan": "fresh",
105
        "country": "US",
106
        "country_nicename": "United States",
107
        "currency": "USD",
108
        "total_sales": 1,
109
        "total_revenue": 999,
110
        "thirty_day_sales": 0,
111
        "thirty_day_revenue": 0,
112
        "created_at": "2021-05-24T14:15:06.000000Z",
113
        "updated_at": "2021-06-15T10:03:14.000000Z"
114
      },
115
      "relationships": {
116
        "products": {
117
          "links": {
118
            "related": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/products",
119
            "self": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/relationships\/products"
120
          }
121
        },
122
        "orders": {
123
          "links": {
124
            "related": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/orders",
125
            "self": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/relationships\/orders"
126
          }
127
        },
128
        "subscriptions": {
129
          "links": {
130
            "related": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/subscriptions",
131
            "self": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/relationships\/subscriptions"
132
          }
133
        },
134
        "discounts": {
135
          "links": {
136
            "related": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/discounts",
137
            "self": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/relationships\/discounts"
138
          }
139
        },
140
        "license-keys": {
141
          "links": {
142
            "related": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/license-keys",
143
            "self": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/relationships\/license-keys"
144
          }
145
        }
146
      },
147
      "links": {
148
        "self": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1"
149
      }
150
    },
151
	{
152
      "type": "stores",
153
      "id": "2",
154
      "attributes": {
155
        "name": "My Store 2",
156
        "slug": "my-store-2",
157
        "domain": "my-store2.lemonsqueezy.com",
158
        "url": "https:\/\/my-store2.lemonsqueezy.com",
159
        "avatar_url": "https:\/\/app.lemonsqueezy.com\/storage\/avatars\/stores\/1\/czTkMkDm4Vfb8PZehb5c29XFCm9JZyJx0AjEZP7s.png",
160
        "plan": "fresh 2",
161
        "country": "US",
162
        "country_nicename": "United States",
163
        "currency": "USD",
164
        "total_sales": 2,
165
        "total_revenue": 99,
166
        "thirty_day_sales": 0,
167
        "thirty_day_revenue": 0,
168
        "created_at": "2021-05-24T14:15:06.000000Z",
169
        "updated_at": "2021-06-15T10:03:14.000000Z"
170
      },
171
      "relationships": {
172
        "products": {
173
          "links": {
174
            "related": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/products",
175
            "self": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/relationships\/products"
176
          }
177
        },
178
        "orders": {
179
          "links": {
180
            "related": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/orders",
181
            "self": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/relationships\/orders"
182
          }
183
        },
184
        "subscriptions": {
185
          "links": {
186
            "related": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/subscriptions",
187
            "self": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/relationships\/subscriptions"
188
          }
189
        },
190
        "discounts": {
191
          "links": {
192
            "related": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/discounts",
193
            "self": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/relationships\/discounts"
194
          }
195
        },
196
        "license-keys": {
197
          "links": {
198
            "related": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/license-keys",
199
            "self": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1\/relationships\/license-keys"
200
          }
201
        }
202
      },
203
      "links": {
204
        "self": "https:\/\/api.lemonsqueezy.com\/v1\/stores\/1"
205
      }
206
    }
207
  ]
208
}
209
210
`)
211
}
212