Passed
Push — main ( 40456e...6e8bbe )
by Acho
01:02
created

stubs.ProductGetResponse   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
// ProductGetResponse is a dummy response to the GET /v1/products/:id endpoint
4
func ProductGetResponse() []byte {
5
	return []byte(`
6
{
7
  "jsonapi": {
8
    "version": "1.0"
9
  },
10
  "links": {
11
    "self": "https://api.lemonsqueezy.com/v1/products/1"
12
  },
13
  "data": {
14
    "type": "products",
15
    "id": "1",
16
    "attributes": {
17
      "store_id": 1,
18
      "name": "Example Product",
19
      "slug": "example-product",
20
      "description": "<p>Lorem ipsum...</p>",
21
      "status": "published",
22
      "status_formatted": "Published",
23
      "thumb_url": "https://app.lemonsqueezy.com/storage/media/1/1c40f227-aed5-4321-9ffc-62f37a06c9a0.jpg",
24
      "large_thumb_url": "https://app.lemonsqueezy.com/storage/media/1/1c40f227-aed5-4321-9ffc-62f37a06c9a0.jpg",
25
      "price": 999,
26
      "pay_what_you_want": false,
27
      "from_price": null,
28
      "to_price": null,
29
      "buy_now_url": "https://my-store.lemonsqueezy.com/checkout/buy/0a841cf5-4cc2-4bbb-ae5d-9529d97deec6",
30
      "price_formatted": "$9.99",
31
      "created_at": "2021-05-27T12:54:47.000000Z",
32
      "updated_at": "2021-07-14T11:25:24.000000Z"
33
    },
34
    "relationships": {
35
      "store": {
36
        "links": {
37
          "related": "https://api.lemonsqueezy.com/v1/products/1/store",
38
          "self": "https://api.lemonsqueezy.com/v1/products/1/relationships/store"
39
        }
40
      },
41
      "variants": {
42
        "links": {
43
          "related": "https://api.lemonsqueezy.com/v1/products/1/variants",
44
          "self": "https://api.lemonsqueezy.com/v1/products/1/relationships/variants"
45
        }
46
      }
47
    },
48
    "links": {
49
      "self": "https://api.lemonsqueezy.com/v1/products/1"
50
    }
51
  }
52
}
53
`)
54
}
55
56
// ProductsListResponse is a dummy response to GET /v1/products
57
func ProductsListResponse() []byte {
58
	return []byte(`
59
{
60
  "meta": {
61
    "page": {
62
      "currentPage": 1,
63
      "from": 1,
64
      "lastPage": 1,
65
      "perPage": 10,
66
      "to": 10,
67
      "total": 10
68
    }
69
  },
70
  "jsonapi": {
71
    "version": "1.0"
72
  },
73
  "links": {
74
    "first": "https://api.lemonsqueezy.com/v1/products?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=name",
75
    "last": "https://api.lemonsqueezy.com/v1/products?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=name"
76
  },
77
  "data": [
78
    {
79
      "type": "products",
80
      "id": "1",
81
      "attributes": {
82
        "store_id": 1,
83
        "name": "Example Product",
84
        "slug": "example-product",
85
        "description": "<p>Lorem ipsum...</p>",
86
        "status": "published",
87
        "status_formatted": "Published",
88
        "thumb_url": "https://app.lemonsqueezy.com/storage/media/1/1c40f227-aed5-4321-9ffc-62f37a06c9a0.jpg",
89
        "large_thumb_url": "https://app.lemonsqueezy.com/storage/media/1/1c40f227-aed5-4321-9ffc-62f37a06c9a0.jpg",
90
        "price": 999,
91
        "pay_what_you_want": false,
92
        "from_price": null,
93
        "to_price": null,
94
        "buy_now_url": "https://my-store.lemonsqueezy.com/checkout/buy/0a841cf5-4cc2-4bbb-ae5d-9529d97deec6",
95
        "price_formatted": "$9.99",
96
        "created_at": "2021-05-27T12:54:47.000000Z",
97
        "updated_at": "2021-07-14T11:25:24.000000Z"
98
      },
99
      "relationships": {
100
        "store": {
101
          "links": {
102
            "related": "https://api.lemonsqueezy.com/v1/products/1/store",
103
            "self": "https://api.lemonsqueezy.com/v1/products/1/relationships/store"
104
          }
105
        },
106
        "variants": {
107
          "links": {
108
            "related": "https://api.lemonsqueezy.com/v1/products/1/variants",
109
            "self": "https://api.lemonsqueezy.com/v1/products/1/relationships/variants"
110
          }
111
        }
112
      },
113
      "links": {
114
        "self": "https://api.lemonsqueezy.com/v1/products/1"
115
      }
116
    },
117
	{
118
      "type": "products",
119
      "id": "2",
120
      "attributes": {
121
        "store_id": 2,
122
        "name": "Example Product",
123
        "slug": "example-product",
124
        "description": "<p>Lorem ipsum...</p>",
125
        "status": "published",
126
        "status_formatted": "Published",
127
        "thumb_url": "https://app.lemonsqueezy.com/storage/media/1/1c40f227-aed5-4321-9ffc-62f37a06c9a0.jpg",
128
        "large_thumb_url": "https://app.lemonsqueezy.com/storage/media/1/1c40f227-aed5-4321-9ffc-62f37a06c9a0.jpg",
129
        "price": 999,
130
        "pay_what_you_want": false,
131
        "from_price": null,
132
        "to_price": null,
133
        "buy_now_url": "https://my-store.lemonsqueezy.com/checkout/buy/0a841cf5-4cc2-4bbb-ae5d-9529d97deec6",
134
        "price_formatted": "$9.99",
135
        "created_at": "2021-05-27T12:54:47.000000Z",
136
        "updated_at": "2021-07-14T11:25:24.000000Z"
137
      },
138
      "relationships": {
139
        "store": {
140
          "links": {
141
            "related": "https://api.lemonsqueezy.com/v1/products/1/store",
142
            "self": "https://api.lemonsqueezy.com/v1/products/1/relationships/store"
143
          }
144
        },
145
        "variants": {
146
          "links": {
147
            "related": "https://api.lemonsqueezy.com/v1/products/1/variants",
148
            "self": "https://api.lemonsqueezy.com/v1/products/1/relationships/variants"
149
          }
150
        }
151
      },
152
      "links": {
153
        "self": "https://api.lemonsqueezy.com/v1/products/1"
154
      }
155
    }
156
  ]
157
}
158
`)
159
}
160