Passed
Push — main ( fec294...1af38c )
by Acho
01:36
created

internal/stubs/license_key.go   A

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A stubs.LicenseKeyGetResponse 0 2 1
A stubs.LicenseKeysListResponse 0 2 1
1
package stubs
2
3
// LicenseKeyGetResponse is a dummy response to the GET /v1/license-key/:id endpoint
4
func LicenseKeyGetResponse() []byte {
5
	return []byte(`
6
{
7
  "jsonapi": {
8
    "version": "1.0"
9
  },
10
  "links": {
11
    "self": "https://api.lemonsqueezy.com/v1/license-keys/1"
12
  },
13
  "data": {
14
    "type": "license-keys",
15
    "id": "1",
16
    "attributes": {
17
      "store_id": 1,
18
      "customer_id": 1,
19
      "order_id": 1,
20
      "order_item_id": 1,
21
      "product_id": 1,
22
      "user_name": "Darlene Daugherty",
23
      "user_email": "[email protected]",
24
      "key": "80e15db5-c796-436b-850c-8f9c98a48abe",
25
      "key_short": "XXXX-8f9c98a48abe",
26
      "activation_limit": 5,
27
      "instances_count": 0,
28
      "disabled": 0,
29
      "status": "inactive",
30
      "status_formatted": "Inactive",
31
      "expires_at": null,
32
      "created_at": "2021-05-24T14:15:07.000000Z",
33
      "updated_at": "2021-05-24T14:15:07.000000Z"
34
    },
35
    "relationships": {
36
      "store": {
37
        "links": {
38
          "related": "https://api.lemonsqueezy.com/v1/license-keys/1/store",
39
          "self": "https://api.lemonsqueezy.com/v1/license-keys/1/relationships/store"
40
        }
41
      },
42
      "customer": {
43
        "links": {
44
          "related": "https://api.lemonsqueezy.com/v1/license-keys/1/customer",
45
          "self": "https://api.lemonsqueezy.com/v1/license-keys/1/relationships/customer"
46
        }
47
      },
48
      "order": {
49
        "links": {
50
          "related": "https://api.lemonsqueezy.com/v1/license-keys/1/order",
51
          "self": "https://api.lemonsqueezy.com/v1/license-keys/1/relationships/order"
52
        }
53
      },
54
      "order-item": {
55
        "links": {
56
          "related": "https://api.lemonsqueezy.com/v1/license-keys/1/order-item",
57
          "self": "https://api.lemonsqueezy.com/v1/license-keys/1/relationships/order-item"
58
        }
59
      },
60
      "product": {
61
        "links": {
62
          "related": "https://api.lemonsqueezy.com/v1/license-keys/1/product",
63
          "self": "https://api.lemonsqueezy.com/v1/license-keys/1/relationships/product"
64
        }
65
      },
66
      "license-key-instances": {
67
        "links": {
68
          "related": "https://api.lemonsqueezy.com/v1/license-keys/1/license-key-instances",
69
          "self": "https://api.lemonsqueezy.com/v1/license-keys/1/relationships/license-key-instances"
70
        }
71
      }
72
    },
73
    "links": {
74
      "self": "https://api.lemonsqueezy.com/v1/license-keys/1"
75
    }
76
  }
77
}
78
`)
79
}
80
81
// LicenseKeysListResponse is a dummy response to GET /v1/license-key
82
func LicenseKeysListResponse() []byte {
83
	return []byte(`
84
{
85
  "meta": {
86
    "page": {
87
      "currentPage": 1,
88
      "from": 1,
89
      "lastPage": 1,
90
      "perPage": 10,
91
      "to": 10,
92
      "total": 10
93
    }
94
  },
95
  "jsonapi": {
96
    "version": "1.0"
97
  },
98
  "links": {
99
    "first": "https://api.lemonsqueezy.com/v1/license-keys?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=id",
100
    "last": "https://api.lemonsqueezy.com/v1/license-keys?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=id"
101
  },
102
  "data": [
103
    {
104
      "type": "license-keys",
105
      "id": "1",
106
      "attributes": {
107
        "store_id": 1,
108
        "customer_id": 1,
109
        "order_id": 1,
110
        "order_item_id": 1,
111
        "product_id": 1,
112
        "user_name": "Darlene Daugherty",
113
        "user_email": "[email protected]",
114
        "key": "80e15db5-c796-436b-850c-8f9c98a48abe",
115
        "key_short": "XXXX-8f9c98a48abe",
116
        "activation_limit": 5,
117
        "instances_count": 0,
118
        "disabled": 0,
119
        "status": "inactive",
120
        "status_formatted": "Inactive",
121
        "expires_at": null,
122
        "created_at": "2021-05-24T14:15:07.000000Z",
123
        "updated_at": "2021-05-24T14:15:07.000000Z"
124
      },
125
      "relationships": {
126
        "store": {
127
          "links": {
128
            "related": "https://api.lemonsqueezy.com/v1/license-keys/1/store",
129
            "self": "https://api.lemonsqueezy.com/v1/license-keys/1/relationships/store"
130
          }
131
        },
132
        "customer": {
133
          "links": {
134
            "related": "https://api.lemonsqueezy.com/v1/license-keys/1/customer",
135
            "self": "https://api.lemonsqueezy.com/v1/license-keys/1/relationships/customer"
136
          }
137
        },
138
        "order": {
139
          "links": {
140
            "related": "https://api.lemonsqueezy.com/v1/license-keys/1/order",
141
            "self": "https://api.lemonsqueezy.com/v1/license-keys/1/relationships/order"
142
          }
143
        },
144
        "order-item": {
145
          "links": {
146
            "related": "https://api.lemonsqueezy.com/v1/license-keys/1/order-item",
147
            "self": "https://api.lemonsqueezy.com/v1/license-keys/1/relationships/order-item"
148
          }
149
        },
150
        "product": {
151
          "links": {
152
            "related": "https://api.lemonsqueezy.com/v1/license-keys/1/product",
153
            "self": "https://api.lemonsqueezy.com/v1/license-keys/1/relationships/product"
154
          }
155
        },
156
        "license-key-instances": {
157
          "links": {
158
            "related": "https://api.lemonsqueezy.com/v1/license-keys/1/license-key-instances",
159
            "self": "https://api.lemonsqueezy.com/v1/license-keys/1/relationships/license-key-instances"
160
          }
161
        }
162
      },
163
      "links": {
164
        "self": "https://api.lemonsqueezy.com/v1/license-keys/1"
165
      }
166
    }
167
  ]
168
}
169
`)
170
}
171