Passed
Push — main ( b84f1a...40456e )
by Acho
01:32
created

stubs.CustomerGetResponse   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
package stubs
2
3
// CustomerGetResponse is a dummy response to the GET /v1/customers/:id endpoint
4
func CustomerGetResponse() []byte {
5
	return []byte(`
6
{
7
  "jsonapi": {
8
    "version": "1.0"
9
  },
10
  "links": {
11
    "self": "https://api.lemonsqueezy.com/v1/customers/1"
12
  },
13
  "data": {
14
    "type": "customers",
15
    "id": "1",
16
    "attributes": {
17
      "store_id": 1,
18
      "name": "Luke Skywalker",
19
      "email": "[email protected]",
20
      "status": "subscribed",
21
      "city": null,
22
      "region": null,
23
      "country": "US",
24
      "total_revenue_currency": 84332,
25
      "mrr": 1999,
26
      "status_formatted": "Subscribed",
27
      "country_formatted": "United States",
28
      "total_revenue_currency_formatted": "$843.32",
29
      "mrr_formatted": "$19.99",
30
      "created_at": "2022-12-01T13:01:07.000000Z",
31
      "updated_at": "2022-12-09T09:05:21.000000Z",
32
      "test_mode": false
33
    },
34
    "relationships": {
35
      "store": {
36
        "links": {
37
          "related": "https://api.lemonsqueezy.com/v1/customers/1/store",
38
          "self": "https://api.lemonsqueezy.com/v1/customers/1/relationships/store"
39
        }
40
      },
41
      "orders": {
42
        "links": {
43
          "related": "https://api.lemonsqueezy.com/v1/customers/1/orders",
44
          "self": "https://api.lemonsqueezy.com/v1/customers/1/relationships/orders"
45
        }
46
      },
47
      "subscriptions": {
48
        "links": {
49
          "related": "https://api.lemonsqueezy.com/v1/customers/1/subscriptions",
50
          "self": "https://api.lemonsqueezy.com/v1/customers/1/relationships/subscriptions"
51
        }
52
      },
53
      "license-keys": {
54
        "links": {
55
          "related": "https://api.lemonsqueezy.com/v1/customers/1/license-keys",
56
          "self": "https://api.lemonsqueezy.com/v1/customers/1/relationships/license-keys"
57
        }
58
      }
59
    },
60
    "links": {
61
      "self": "https://api.lemonsqueezy.com/v1/customers/1"
62
    }
63
  }
64
}
65
`)
66
}
67
68
// CustomerListResponse is a dummy response to GET /v1/customers
69
func CustomerListResponse() []byte {
70
	return []byte(`
71
{
72
  "meta": {
73
    "page": {
74
      "currentPage": 1,
75
      "from": 1,
76
      "lastPage": 1,
77
      "perPage": 10,
78
      "to": 10,
79
      "total": 10
80
    }
81
  },
82
  "jsonapi": {
83
    "version": "1.0"
84
  },
85
  "links": {
86
    "first": "https://api.lemonsqueezy.com/v1/customers?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=-createdAt",
87
    "last": "https://api.lemonsqueezy.com/v1/customers?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=-createdAt"
88
  },
89
  "data": [
90
    {
91
      "type": "customers",
92
      "id": "1",
93
      "attributes": {
94
        "store_id": 1,
95
        "name": "Luke Skywalker",
96
        "email": "[email protected]",
97
        "status": "subscribed",
98
        "city": null,
99
        "region": null,
100
        "country": "US",
101
        "total_revenue_currency": 84332,
102
        "mrr": 1999,
103
        "status_formatted": "Subscribed",
104
        "country_formatted": "United States",
105
        "total_revenue_currency_formatted": "$843.32",
106
        "mrr_formatted": "$19.99",
107
        "created_at": "2022-12-01T13:01:07.000000Z",
108
        "updated_at": "2022-12-09T09:05:21.000000Z",
109
        "test_mode": false
110
      },
111
      "relationships": {
112
        "store": {
113
          "links": {
114
            "related": "https://api.lemonsqueezy.com/v1/customers/1/store",
115
            "self": "https://api.lemonsqueezy.com/v1/customers/1/relationships/store"
116
          }
117
        },
118
        "orders": {
119
          "links": {
120
            "related": "https://api.lemonsqueezy.com/v1/customers/1/orders",
121
            "self": "https://api.lemonsqueezy.com/v1/customers/1/relationships/orders"
122
          }
123
        },
124
        "subscriptions": {
125
          "links": {
126
            "related": "https://api.lemonsqueezy.com/v1/customers/1/subscriptions",
127
            "self": "https://api.lemonsqueezy.com/v1/customers/1/relationships/subscriptions"
128
          }
129
        },
130
        "license-keys": {
131
          "links": {
132
            "related": "https://api.lemonsqueezy.com/v1/customers/1/license-keys",
133
            "self": "https://api.lemonsqueezy.com/v1/customers/1/relationships/license-keys"
134
          }
135
        }
136
      },
137
      "links": {
138
        "self": "https://api.lemonsqueezy.com/v1/customers/1"
139
      }
140
    },
141
	{
142
      "type": "customers",
143
      "id": "2",
144
      "attributes": {
145
        "store_id": 1,
146
        "name": "Luke Skywalker 1",
147
        "email": "[email protected]",
148
        "status": "subscribed",
149
        "city": null,
150
        "region": null,
151
        "country": "US",
152
        "total_revenue_currency": 84332,
153
        "mrr": 1999,
154
        "status_formatted": "Subscribed",
155
        "country_formatted": "United States",
156
        "total_revenue_currency_formatted": "$843.32",
157
        "mrr_formatted": "$19.99",
158
        "created_at": "2022-12-01T13:01:07.000000Z",
159
        "updated_at": "2022-12-09T09:05:21.000000Z",
160
        "test_mode": false
161
      },
162
      "relationships": {
163
        "store": {
164
          "links": {
165
            "related": "https://api.lemonsqueezy.com/v1/customers/1/store",
166
            "self": "https://api.lemonsqueezy.com/v1/customers/1/relationships/store"
167
          }
168
        },
169
        "orders": {
170
          "links": {
171
            "related": "https://api.lemonsqueezy.com/v1/customers/1/orders",
172
            "self": "https://api.lemonsqueezy.com/v1/customers/1/relationships/orders"
173
          }
174
        },
175
        "subscriptions": {
176
          "links": {
177
            "related": "https://api.lemonsqueezy.com/v1/customers/1/subscriptions",
178
            "self": "https://api.lemonsqueezy.com/v1/customers/1/relationships/subscriptions"
179
          }
180
        },
181
        "license-keys": {
182
          "links": {
183
            "related": "https://api.lemonsqueezy.com/v1/customers/1/license-keys",
184
            "self": "https://api.lemonsqueezy.com/v1/customers/1/relationships/license-keys"
185
          }
186
        }
187
      },
188
      "links": {
189
        "self": "https://api.lemonsqueezy.com/v1/customers/1"
190
      }
191
    }
192
  ]
193
}
194
`)
195
}
196