Passed
Push — main ( 6e8bbe...6c1cc7 )
by Acho
01:10
created

internal/stubs/file.go   A

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A stubs.FilesListResponse 0 2 1
A stubs.FileGetResponse 0 2 1
1
package stubs
2
3
// FileGetResponse is a dummy response to the GET /v1/files/:id endpoint
4
func FileGetResponse() []byte {
5
	return []byte(`
6
{
7
  "jsonapi": {
8
    "version": "1.0"
9
  },
10
  "links": {
11
    "self": "https://api.lemonsqueezy.com/v1/files/1"
12
  },
13
  "data": {
14
    "type": "files",
15
    "id": "1",
16
    "attributes": {
17
      "variant_id": 168,
18
      "identifier": "6dce5ba7-76f2-481f-ad1e-9c2bec6eb0e2",
19
      "name": "my_product.zip",
20
      "extension": "zip",
21
      "download_url": "https://app.lemonsqueezy.com/download/6dce5ba7-76f2-481f-ad1e-9c2bec6eb0e2?expires=1636384018&signature=f0a9bdec44ffabf143d4689594491f42a76d773d3cc88ec23ef84d6e903e8f11",
22
      "size": 874694,
23
      "size_formatted": "854 KB",
24
      "version": "1.0.0",
25
      "sort": 1,
26
      "status": "published",
27
      "createdAt": "2021-11-05T10:22:14.000000Z",
28
      "updatedAt": "2021-11-05T16:16:33.000000Z"
29
    },
30
    "relationships": {
31
      "variant": {
32
        "links": {
33
          "related": "https://api.lemonsqueezy.com/v1/files/1/variant",
34
          "self": "https://api.lemonsqueezy.com/v1/files/1/relationships/variant"
35
        }
36
      }
37
    },
38
    "links": {
39
      "self": "https://api.lemonsqueezy.com/v1/files/1"
40
    }
41
  }
42
}
43
`)
44
}
45
46
// FilesListResponse is a dummy response to GET /v1/files
47
func FilesListResponse() []byte {
48
	return []byte(`
49
{
50
  "meta": {
51
    "page": {
52
      "currentPage": 1,
53
      "from": 1,
54
      "lastPage": 1,
55
      "perPage": 10,
56
      "to": 10,
57
      "total": 10
58
    }
59
  },
60
  "jsonapi": {
61
    "version": "1.0"
62
  },
63
  "links": {
64
    "first": "https://api.lemonsqueezy.com/v1/files?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=sort",
65
    "last": "https://api.lemonsqueezy.com/v1/files?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=sort"
66
  },
67
  "data": [
68
    {
69
      "type": "files",
70
      "id": "1",
71
      "attributes": {
72
        "variant_id": 168,
73
        "identifier": "6dce5ba7-76f2-481f-ad1e-9c2bec6eb0e2",
74
        "name": "my_product.zip",
75
        "extension": "zip",
76
        "download_url": "https://app.lemonsqueezy.com/download/6dce5ba7-76f2-481f-ad1e-9c2bec6eb0e2?expires=1636383388&signature=886a63faf7215c54011accfa08578b1b687def66f767092629f263061b3a253a",
77
        "size": 874694,
78
        "size_formatted": "854 KB",
79
        "version": "1.0.0",
80
        "sort": 1,
81
        "status": "published",
82
        "createdAt": "2021-11-05T10:22:14.000000Z",
83
        "updatedAt": "2021-11-05T16:16:33.000000Z"
84
      },
85
      "relationships": {
86
        "variant": {
87
          "links": {
88
            "related": "https://api.lemonsqueezy.com/v1/files/1/variant",
89
            "self": "https://api.lemonsqueezy.com/v1/files/1/relationships/variant"
90
          }
91
        }
92
      },
93
      "links": {
94
        "self": "https://api.lemonsqueezy.com/v1/files/1"
95
      }
96
    },
97
	{
98
      "type": "files",
99
      "id": "2",
100
      "attributes": {
101
        "variant_id": 168,
102
        "identifier": "6dce5ba7-76f2-481f-ad1e-9c2bec6eb0e2",
103
        "name": "my_product.zip",
104
        "extension": "zip",
105
        "download_url": "https://app.lemonsqueezy.com/download/6dce5ba7-76f2-481f-ad1e-9c2bec6eb0e2?expires=1636383388&signature=886a63faf7215c54011accfa08578b1b687def66f767092629f263061b3a253a",
106
        "size": 874694,
107
        "size_formatted": "854 KB",
108
        "version": "1.0.0",
109
        "sort": 1,
110
        "status": "published",
111
        "createdAt": "2021-11-05T10:22:14.000000Z",
112
        "updatedAt": "2021-11-05T16:16:33.000000Z"
113
      },
114
      "relationships": {
115
        "variant": {
116
          "links": {
117
            "related": "https://api.lemonsqueezy.com/v1/files/1/variant",
118
            "self": "https://api.lemonsqueezy.com/v1/files/1/relationships/variant"
119
          }
120
        }
121
      },
122
      "links": {
123
        "self": "https://api.lemonsqueezy.com/v1/files/1"
124
      }
125
    }
126
  ]
127
}
128
`)
129
}
130